1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl
))
40 ;; (require 'gnus-art)
42 (autoload 'gnus-summary-limit-include-cached
"gnus-cache" nil t
)
43 (autoload 'gnus-cache-write-active
"gnus-cache")
44 (autoload 'mm-uu-dissect
"mm-uu")
46 (defcustom gnus-kill-summary-on-exit t
47 "*If non-nil, kill the summary buffer when you exit from it.
48 If nil, the summary will become a \"*Dead Summary*\" buffer, and
49 it will be killed sometime later."
50 :group
'gnus-summary-exit
53 (defcustom gnus-fetch-old-headers nil
54 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
55 If an unread article in the group refers to an older, already read (or
56 just marked as read) article, the old article will not normally be
57 displayed in the Summary buffer. If this variable is non-nil, Gnus
58 will attempt to grab the headers to the old articles, and thereby
59 build complete threads. If it has the value `some', only enough
60 headers to connect otherwise loose threads will be displayed. This
61 variable can also be a number. In that case, no more than that number
62 of old headers will be fetched. If it has the value `invisible', all
63 old headers will be fetched, but none will be displayed.
65 The server has to support NOV for any of this to work."
67 :type
'(choice (const :tag
"off" nil
)
70 (sexp :menu-tag
"other" t
)))
72 (defcustom gnus-refer-thread-limit
200
73 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
74 If t, fetch all the available old headers."
77 (sexp :menu-tag
"other" t
)))
79 (defcustom gnus-summary-make-false-root
'adopt
80 "*nil means that Gnus won't gather loose threads.
81 If the root of a thread has expired or been read in a previous
82 session, the information necessary to build a complete thread has been
83 lost. Instead of having many small sub-threads from this original thread
84 scattered all over the summary buffer, Gnus can gather them.
86 If non-nil, Gnus will try to gather all loose sub-threads from an
87 original thread into one large thread.
89 If this variable is non-nil, it should be one of `none', `adopt',
92 If this variable is `none', Gnus will not make a false root, but just
93 present the sub-threads after another.
94 If this variable is `dummy', Gnus will create a dummy root that will
95 have all the sub-threads as children.
96 If this variable is `adopt', Gnus will make one of the \"children\"
97 the parent and mark all the step-children as such.
98 If this variable is `empty', the \"children\" are printed with empty
99 subject fields. (Or rather, they will be printed with a string
100 given by the `gnus-summary-same-subject' variable.)"
102 :type
'(choice (const :tag
"off" nil
)
108 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
109 "*A regexp to match subjects to be excluded from loose thread gathering.
110 As loose thread gathering is done on subjects only, that means that
111 there can be many false gatherings performed. By rooting out certain
112 common subjects, gathering might become saner."
116 (defcustom gnus-summary-gather-subject-limit nil
117 "*Maximum length of subject comparisons when gathering loose threads.
118 Use nil to compare full subjects. Setting this variable to a low
119 number will help gather threads that have been corrupted by
120 newsreaders chopping off subject lines, but it might also mean that
121 unrelated articles that have subject that happen to begin with the
122 same few characters will be incorrectly gathered.
124 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
127 :type
'(choice (const :tag
"off" nil
)
129 (sexp :menu-tag
"on" t
)))
131 (defcustom gnus-simplify-subject-functions nil
132 "List of functions taking a string argument that simplify subjects.
133 The functions are applied recursively.
135 Useful functions to put in this list include: `gnus-simplify-subject-re',
136 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
138 :type
'(repeat function
))
140 (defcustom gnus-simplify-ignored-prefixes nil
141 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
143 :type
'(choice (const :tag
"off" nil
)
146 (defcustom gnus-build-sparse-threads nil
147 "*If non-nil, fill in the gaps in threads.
148 If `some', only fill in the gaps that are needed to tie loose threads
149 together. If `more', fill in all leaf nodes that Gnus can find. If
150 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
152 :type
'(choice (const :tag
"off" nil
)
155 (sexp :menu-tag
"all" t
)))
157 (defcustom gnus-summary-thread-gathering-function
158 'gnus-gather-threads-by-subject
159 "*Function used for gathering loose threads.
160 There are two pre-defined functions: `gnus-gather-threads-by-subject',
161 which only takes Subjects into consideration; and
162 `gnus-gather-threads-by-references', which compared the References
163 headers of the articles to find matches."
165 :type
'(radio (function-item gnus-gather-threads-by-subject
)
166 (function-item gnus-gather-threads-by-references
)
167 (function :tag
"other")))
169 (defcustom gnus-summary-same-subject
""
170 "*String indicating that the current article has the same subject as the previous.
171 This variable will only be used if the value of
172 `gnus-summary-make-false-root' is `empty'."
173 :group
'gnus-summary-format
176 (defcustom gnus-summary-goto-unread t
177 "*If t, many commands will go to the next unread article.
178 This applies to marking commands as well as other commands that
179 \"naturally\" select the next article, like, for instance, `SPC' at
180 the end of an article.
182 If nil, the marking commands do NOT go to the next unread article
183 \(they go to the next article instead). If `never', commands that
184 usually go to the next unread article, will go to the next article,
185 whether it is read or not."
186 :group
'gnus-summary-marks
187 :link
'(custom-manual "(gnus)Setting Marks")
188 :type
'(choice (const :tag
"off" nil
)
190 (sexp :menu-tag
"on" t
)))
192 (defcustom gnus-summary-default-score
0
193 "*Default article score level.
194 All scores generated by the score files will be added to this score.
195 If this variable is nil, scoring will be disabled."
196 :group
'gnus-score-default
197 :type
'(choice (const :tag
"disable")
200 (defcustom gnus-summary-zcore-fuzz
0
201 "*Fuzziness factor for the zcore in the summary buffer.
202 Articles with scores closer than this to `gnus-summary-default-score'
204 :group
'gnus-summary-format
207 (defcustom gnus-simplify-subject-fuzzy-regexp nil
208 "*Strings to be removed when doing fuzzy matches.
209 This can either be a regular expression or list of regular expressions
210 that will be removed from subject strings if fuzzy subject
211 simplification is selected."
213 :type
'(repeat regexp
))
215 (defcustom gnus-show-threads t
216 "*If non-nil, display threads in summary mode."
220 (defcustom gnus-thread-hide-subtree nil
221 "*If non-nil, hide all threads initially.
222 If threads are hidden, you have to run the command
223 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
224 to expose hidden threads."
228 (defcustom gnus-thread-hide-killed t
229 "*If non-nil, hide killed threads automatically."
233 (defcustom gnus-thread-ignore-subject t
234 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
235 If nil, articles that have different subjects from their parents will
236 start separate threads."
240 (defcustom gnus-thread-operation-ignore-subject t
241 "*If non-nil, subjects will be ignored when doing thread commands.
242 This affects commands like `gnus-summary-kill-thread' and
243 `gnus-summary-lower-thread'.
245 If this variable is nil, articles in the same thread with different
246 subjects will not be included in the operation in question. If this
247 variable is `fuzzy', only articles that have subjects that are fuzzily
248 equal will be included."
250 :type
'(choice (const :tag
"off" nil
)
254 (defcustom gnus-thread-indent-level
4
255 "*Number that says how much each sub-thread should be indented."
259 (defcustom gnus-auto-extend-newsgroup t
260 "*If non-nil, extend newsgroup forward and backward when requested."
261 :group
'gnus-summary-choose
264 (defcustom gnus-auto-select-first t
265 "*If nil, don't select the first unread article when entering a group.
266 If this variable is `best', select the highest-scored unread article
267 in the group. If t, select the first unread article.
269 This variable can also be a function to place point on a likely
270 subject line. Useful values include `gnus-summary-first-unread-subject',
271 `gnus-summary-first-unread-article' and
272 `gnus-summary-best-unread-article'.
274 If you want to prevent automatic selection of the first unread article
275 in some newsgroups, set the variable to nil in
276 `gnus-select-group-hook'."
277 :group
'gnus-group-select
278 :type
'(choice (const :tag
"none" nil
)
280 (sexp :menu-tag
"first" t
)
281 (function-item gnus-summary-first-unread-subject
)
282 (function-item gnus-summary-first-unread-article
)
283 (function-item gnus-summary-best-unread-article
)))
285 (defcustom gnus-auto-select-next t
286 "*If non-nil, offer to go to the next group from the end of the previous.
287 If the value is t and the next newsgroup is empty, Gnus will exit
288 summary mode and go back to group mode. If the value is neither nil
289 nor t, Gnus will select the following unread newsgroup. In
290 particular, if the value is the symbol `quietly', the next unread
291 newsgroup will be selected without any confirmation, and if it is
292 `almost-quietly', the next group will be selected without any
293 confirmation if you are located on the last article in the group.
294 Finally, if this variable is `slightly-quietly', the `Z n' command
295 will go to the next group without confirmation."
296 :group
'gnus-summary-maneuvering
297 :type
'(choice (const :tag
"off" nil
)
299 (const almost-quietly
)
300 (const slightly-quietly
)
301 (sexp :menu-tag
"on" t
)))
303 (defcustom gnus-auto-select-same nil
304 "*If non-nil, select the next article with the same subject.
305 If there are no more articles with the same subject, go to
306 the first unread article."
307 :group
'gnus-summary-maneuvering
310 (defcustom gnus-summary-check-current nil
311 "*If non-nil, consider the current article when moving.
312 The \"unread\" movement commands will stay on the same line if the
313 current article is unread."
314 :group
'gnus-summary-maneuvering
317 (defcustom gnus-auto-center-summary t
318 "*If non-nil, always center the current summary buffer.
319 In particular, if `vertical' do only vertical recentering. If non-nil
320 and non-`vertical', do both horizontal and vertical recentering."
321 :group
'gnus-summary-maneuvering
322 :type
'(choice (const :tag
"none" nil
)
324 (integer :tag
"height")
325 (sexp :menu-tag
"both" t
)))
327 (defcustom gnus-show-all-headers nil
328 "*If non-nil, don't hide any headers."
329 :group
'gnus-article-hiding
330 :group
'gnus-article-headers
333 (defcustom gnus-summary-ignore-duplicates nil
334 "*If non-nil, ignore articles with identical Message-ID headers."
338 (defcustom gnus-single-article-buffer t
339 "*If non-nil, display all articles in the same buffer.
340 If nil, each group will get its own article buffer."
341 :group
'gnus-article-various
344 (defcustom gnus-break-pages t
345 "*If non-nil, do page breaking on articles.
346 The page delimiter is specified by the `gnus-page-delimiter'
348 :group
'gnus-article-various
351 (defcustom gnus-move-split-methods nil
352 "*Variable used to suggest where articles are to be moved to.
353 It uses the same syntax as the `gnus-split-methods' variable."
354 :group
'gnus-summary-mail
355 :type
'(repeat (choice (list :value
(fun) function
)
356 (cons :value
("" "") regexp
(repeat string
))
359 (defcustom gnus-unread-mark ?
;Whitespace
360 "*Mark used for unread articles."
361 :group
'gnus-summary-marks
364 (defcustom gnus-ticked-mark ?
!
365 "*Mark used for ticked articles."
366 :group
'gnus-summary-marks
369 (defcustom gnus-dormant-mark ??
370 "*Mark used for dormant articles."
371 :group
'gnus-summary-marks
374 (defcustom gnus-del-mark ?r
375 "*Mark used for del'd articles."
376 :group
'gnus-summary-marks
379 (defcustom gnus-read-mark ?R
380 "*Mark used for read articles."
381 :group
'gnus-summary-marks
384 (defcustom gnus-expirable-mark ?E
385 "*Mark used for expirable articles."
386 :group
'gnus-summary-marks
389 (defcustom gnus-killed-mark ?K
390 "*Mark used for killed articles."
391 :group
'gnus-summary-marks
394 (defcustom gnus-souped-mark ?F
395 "*Mark used for killed articles."
396 :group
'gnus-summary-marks
399 (defcustom gnus-kill-file-mark ?X
400 "*Mark used for articles killed by kill files."
401 :group
'gnus-summary-marks
404 (defcustom gnus-low-score-mark ?Y
405 "*Mark used for articles with a low score."
406 :group
'gnus-summary-marks
409 (defcustom gnus-catchup-mark ?C
410 "*Mark used for articles that are caught up."
411 :group
'gnus-summary-marks
414 (defcustom gnus-replied-mark ?A
415 "*Mark used for articles that have been replied to."
416 :group
'gnus-summary-marks
419 (defcustom gnus-cached-mark ?
*
420 "*Mark used for articles that are in the cache."
421 :group
'gnus-summary-marks
424 (defcustom gnus-saved-mark ?S
425 "*Mark used for articles that have been saved to."
426 :group
'gnus-summary-marks
429 (defcustom gnus-ancient-mark ?O
430 "*Mark used for ancient articles."
431 :group
'gnus-summary-marks
434 (defcustom gnus-sparse-mark ?Q
435 "*Mark used for sparsely reffed articles."
436 :group
'gnus-summary-marks
439 (defcustom gnus-canceled-mark ?G
440 "*Mark used for canceled articles."
441 :group
'gnus-summary-marks
444 (defcustom gnus-duplicate-mark ?M
445 "*Mark used for duplicate articles."
446 :group
'gnus-summary-marks
449 (defcustom gnus-undownloaded-mark ?
@
450 "*Mark used for articles that weren't downloaded."
451 :group
'gnus-summary-marks
454 (defcustom gnus-downloadable-mark ?%
455 "*Mark used for articles that are to be downloaded."
456 :group
'gnus-summary-marks
459 (defcustom gnus-unsendable-mark ?
=
460 "*Mark used for articles that won't be sent."
461 :group
'gnus-summary-marks
464 (defcustom gnus-score-over-mark ?
+
465 "*Score mark used for articles with high scores."
466 :group
'gnus-summary-marks
469 (defcustom gnus-score-below-mark ?-
470 "*Score mark used for articles with low scores."
471 :group
'gnus-summary-marks
474 (defcustom gnus-empty-thread-mark ?
;Whitespace
475 "*There is no thread under the article."
476 :group
'gnus-summary-marks
479 (defcustom gnus-not-empty-thread-mark ?
=
480 "*There is a thread under the article."
481 :group
'gnus-summary-marks
484 (defcustom gnus-view-pseudo-asynchronously nil
485 "*If non-nil, Gnus will view pseudo-articles asynchronously."
486 :group
'gnus-extract-view
489 (defcustom gnus-auto-expirable-marks
490 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
491 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
492 gnus-souped-mark gnus-duplicate-mark
)
493 "*The list of marks converted into expiration if a group is auto-expirable."
496 :type
'(repeat character
))
498 (defcustom gnus-inhibit-user-auto-expire t
499 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
504 (defcustom gnus-view-pseudos nil
505 "*If `automatic', pseudo-articles will be viewed automatically.
506 If `not-confirm', pseudos will be viewed automatically, and the user
507 will not be asked to confirm the command."
508 :group
'gnus-extract-view
509 :type
'(choice (const :tag
"off" nil
)
511 (const not-confirm
)))
513 (defcustom gnus-view-pseudos-separately t
514 "*If non-nil, one pseudo-article will be created for each file to be viewed.
515 If nil, all files that use the same viewing command will be given as a
516 list of parameters to that command."
517 :group
'gnus-extract-view
520 (defcustom gnus-insert-pseudo-articles t
521 "*If non-nil, insert pseudo-articles when decoding articles."
522 :group
'gnus-extract-view
525 (defcustom gnus-summary-dummy-line-format
527 "*The format specification for the dummy roots in the summary buffer.
528 It works along the same lines as a normal formatting string,
529 with some simple extensions.
532 :group
'gnus-threading
535 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
536 "*The format specification for the summary mode line.
537 It works along the same lines as a normal formatting string,
538 with some simple extensions:
541 %p Unprefixed group name
542 %A Current article number
543 %z Current article score
545 %U Number of unread articles in the group
546 %e Number of unselected articles in the group
547 %Z A string with unread/unselected article counts
548 %g Shortish group name
549 %S Subject of the current article
551 %s Current score file name
552 %d Number of dormant articles
553 %r Number of articles that have been marked as read in this session
554 %E Number of articles expunged by the score files"
555 :group
'gnus-summary-format
558 (defcustom gnus-list-identifiers nil
559 "Regexp that matches list identifiers to be removed from subject.
560 This can also be a list of regexps."
562 :group
'gnus-summary-format
563 :group
'gnus-article-hiding
564 :type
'(choice (const :tag
"none" nil
)
566 (repeat :value
(".*") regexp
)))
568 (defcustom gnus-summary-mark-below
0
569 "*Mark all articles with a score below this variable as read.
570 This variable is local to each summary buffer and usually set by the
572 :group
'gnus-score-default
575 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
576 "*List of functions used for sorting articles in the summary buffer.
577 This variable is only used when not using a threaded display."
578 :group
'gnus-summary-sort
579 :type
'(repeat (choice (function-item gnus-article-sort-by-number
)
580 (function-item gnus-article-sort-by-author
)
581 (function-item gnus-article-sort-by-subject
)
582 (function-item gnus-article-sort-by-date
)
583 (function-item gnus-article-sort-by-score
)
584 (function :tag
"other"))))
586 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
587 "*List of functions used for sorting threads in the summary buffer.
588 By default, threads are sorted by article number.
590 Each function takes two threads and return non-nil if the first thread
591 should be sorted before the other. If you use more than one function,
592 the primary sort function should be the last. You should probably
593 always include `gnus-thread-sort-by-number' in the list of sorting
594 functions -- preferably first.
596 Ready-made functions include `gnus-thread-sort-by-number',
597 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
598 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
599 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
600 :group
'gnus-summary-sort
601 :type
'(repeat (choice (function-item gnus-thread-sort-by-number
)
602 (function-item gnus-thread-sort-by-author
)
603 (function-item gnus-thread-sort-by-subject
)
604 (function-item gnus-thread-sort-by-date
)
605 (function-item gnus-thread-sort-by-score
)
606 (function-item gnus-thread-sort-by-total-score
)
607 (function :tag
"other"))))
609 (defcustom gnus-thread-score-function
'+
610 "*Function used for calculating the total score of a thread.
612 The function is called with the scores of the article and each
613 subthread and should then return the score of the thread.
615 Some functions you can use are `+', `max', or `min'."
616 :group
'gnus-summary-sort
619 (defcustom gnus-summary-expunge-below nil
620 "All articles that have a score less than this variable will be expunged.
621 This variable is local to the summary buffers."
622 :group
'gnus-score-default
623 :type
'(choice (const :tag
"off" nil
)
626 (defcustom gnus-thread-expunge-below nil
627 "All threads that have a total score less than this variable will be expunged.
628 See `gnus-thread-score-function' for en explanation of what a
631 This variable is local to the summary buffers."
632 :group
'gnus-threading
633 :group
'gnus-score-default
634 :type
'(choice (const :tag
"off" nil
)
637 (defcustom gnus-summary-mode-hook nil
638 "*A hook for Gnus summary mode.
639 This hook is run before any variables are set in the summary buffer."
640 :options
'(turn-on-gnus-mailing-list-mode)
641 :group
'gnus-summary-various
644 (defcustom gnus-summary-menu-hook nil
645 "*Hook run after the creation of the summary mode menu."
646 :group
'gnus-summary-visual
649 (defcustom gnus-summary-exit-hook nil
650 "*A hook called on exit from the summary buffer.
651 It will be called with point in the group buffer."
652 :group
'gnus-summary-exit
655 (defcustom gnus-summary-prepare-hook nil
656 "*A hook called after the summary buffer has been generated.
657 If you want to modify the summary buffer, you can use this hook."
658 :group
'gnus-summary-various
661 (defcustom gnus-summary-prepared-hook nil
662 "*A hook called as the last thing after the summary buffer has been generated."
663 :group
'gnus-summary-various
666 (defcustom gnus-summary-generate-hook nil
667 "*A hook run just before generating the summary buffer.
668 This hook is commonly used to customize threading variables and the
670 :group
'gnus-summary-various
673 (defcustom gnus-select-group-hook nil
674 "*A hook called when a newsgroup is selected.
676 If you'd like to simplify subjects like the
677 `gnus-summary-next-same-subject' command does, you can use the
680 (setq gnus-select-group-hook
683 (mapcar (lambda (header)
684 (mail-header-set-subject
686 (gnus-simplify-subject
687 (mail-header-subject header) 're-only)))
688 gnus-newsgroup-headers))))"
689 :group
'gnus-group-select
692 (defcustom gnus-select-article-hook nil
693 "*A hook called when an article is selected."
694 :group
'gnus-summary-choose
697 (defcustom gnus-visual-mark-article-hook
698 (list 'gnus-highlight-selected-summary
)
699 "*Hook run after selecting an article in the summary buffer.
700 It is meant to be used for highlighting the article in some way. It
701 is not run if `gnus-visual' is nil."
702 :group
'gnus-summary-visual
705 (defcustom gnus-parse-headers-hook nil
706 "*A hook called before parsing the headers."
710 (defcustom gnus-exit-group-hook nil
711 "*A hook called when exiting summary mode.
712 This hook is not called from the non-updating exit commands like `Q'."
716 (defcustom gnus-summary-update-hook
717 (list 'gnus-summary-highlight-line
)
718 "*A hook called when a summary line is changed.
719 The hook will not be called if `gnus-visual' is nil.
721 The default function `gnus-summary-highlight-line' will
722 highlight the line according to the `gnus-summary-highlight'
724 :group
'gnus-summary-visual
727 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
728 "*A hook called when an article is selected for the first time.
729 The hook is intended to mark an article as read (or unread)
730 automatically when it is selected."
731 :group
'gnus-summary-choose
734 (defcustom gnus-group-no-more-groups-hook nil
735 "*A hook run when returning to group mode having no more (unread) groups."
736 :group
'gnus-group-select
739 (defcustom gnus-ps-print-hook nil
740 "*A hook run before ps-printing something from Gnus."
744 (defcustom gnus-summary-selected-face
'gnus-summary-selected-face
745 "Face used for highlighting the current article in the summary buffer."
746 :group
'gnus-summary-visual
749 (defcustom gnus-summary-highlight
750 '(((= mark gnus-canceled-mark
)
751 . gnus-summary-cancelled-face
)
752 ((and (> score default
)
753 (or (= mark gnus-dormant-mark
)
754 (= mark gnus-ticked-mark
)))
755 . gnus-summary-high-ticked-face
)
756 ((and (< score default
)
757 (or (= mark gnus-dormant-mark
)
758 (= mark gnus-ticked-mark
)))
759 . gnus-summary-low-ticked-face
)
760 ((or (= mark gnus-dormant-mark
)
761 (= mark gnus-ticked-mark
))
762 . gnus-summary-normal-ticked-face
)
763 ((and (> score default
) (= mark gnus-ancient-mark
))
764 . gnus-summary-high-ancient-face
)
765 ((and (< score default
) (= mark gnus-ancient-mark
))
766 . gnus-summary-low-ancient-face
)
767 ((= mark gnus-ancient-mark
)
768 . gnus-summary-normal-ancient-face
)
769 ((and (> score default
) (= mark gnus-unread-mark
))
770 . gnus-summary-high-unread-face
)
771 ((and (< score default
) (= mark gnus-unread-mark
))
772 . gnus-summary-low-unread-face
)
773 ((= mark gnus-unread-mark
)
774 . gnus-summary-normal-unread-face
)
775 ((and (> score default
) (memq mark
(list gnus-downloadable-mark
776 gnus-undownloaded-mark
)))
777 . gnus-summary-high-unread-face
)
778 ((and (< score default
) (memq mark
(list gnus-downloadable-mark
779 gnus-undownloaded-mark
)))
780 . gnus-summary-low-unread-face
)
781 ((memq mark
(list gnus-downloadable-mark gnus-undownloaded-mark
))
782 . gnus-summary-normal-unread-face
)
784 . gnus-summary-high-read-face
)
786 . gnus-summary-low-read-face
)
788 . gnus-summary-normal-read-face
))
789 "*Controls the highlighting of summary buffer lines.
791 A list of (FORM . FACE) pairs. When deciding how a particular summary
792 line should be displayed, each form is evaluated. The content of the
793 face field after the first true form is used. You can change how those
794 summary lines are displayed, by editing the face field.
796 You can use the following variables in the FORM field.
798 score: The articles score
799 default: The default article score.
800 below: The score below which articles are automatically marked as read.
801 mark: The articles mark."
802 :group
'gnus-summary-visual
803 :type
'(repeat (cons (sexp :tag
"Form" nil
)
806 (defcustom gnus-alter-header-function nil
807 "Function called to allow alteration of article header structures.
808 The function is called with one parameter, the article header vector,
809 which it may alter in any way."
810 :type
'(choice (const :tag
"None" nil
)
812 :group
'gnus-summary
)
814 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
815 "Variable that says which function should be used to decode a string with encoded words.")
817 (defcustom gnus-extra-headers nil
818 "*Extra headers to parse."
821 :type
'(repeat symbol
))
823 (defcustom gnus-ignored-from-addresses
824 (and user-mail-address
(regexp-quote user-mail-address
))
825 "*Regexp of From headers that may be suppressed in favor of To headers."
830 (defcustom gnus-group-charset-alist
831 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5
)
832 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312
)
833 ("^fj\\>\\|^japan\\>" iso-2022-jp-2
)
834 ("^tnn\\>\\|^pin\\>\\|^sci.lang.japan" iso-2022-7bit
)
835 ("^relcom\\>" koi8-r
)
837 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2
)
838 ("^israel\\>" iso-8859-1
)
840 ("^alt.chinese.text.big5\\>" chinese-big5
)
841 ("^soc.culture.vietnamese\\>" vietnamese-viqr
)
842 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1
)
844 "Alist of regexps (to match group names) and default charsets to be used when reading."
845 :type
'(repeat (list (regexp :tag
"Group")
846 (symbol :tag
"Charset")))
847 :group
'gnus-charset
)
849 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
850 "List of charsets that should be ignored.
851 When these charsets are used in the \"charset\" parameter, the
852 default charset will be used instead."
854 :type
'(repeat symbol
)
855 :group
'gnus-charset
)
857 (defcustom gnus-group-ignored-charsets-alist
858 '(("alt\\.chinese\\.text" iso-8859-1
))
859 "Alist of regexps (to match group names) and charsets that should be ignored.
860 When these charsets are used in the \"charset\" parameter, the
861 default charset will be used instead."
862 :type
'(repeat (cons (regexp :tag
"Group")
864 :group
'gnus-charset
)
866 (defcustom gnus-group-highlight-words-alist nil
867 "Alist of group regexps and highlight regexps.
868 This variable uses the same syntax as `gnus-emphasis-alist'."
870 :type
'(repeat (cons (regexp :tag
"Group")
871 (repeat (list (regexp :tag
"Highlight regexp")
872 (number :tag
"Group for entire word" 0)
873 (number :tag
"Group for displayed part" 0)
875 gnus-emphasis-highlight-words
)))))
876 :group
'gnus-summary-visual
)
878 (defcustom gnus-summary-show-article-charset-alist
880 "Alist of number and charset.
881 The article will be shown with the charset corresponding to the
883 For example: ((1 . cn-gb-2312) (2 . big5))."
885 :type
'(repeat (cons (number :tag
"Argument" 1)
886 (symbol :tag
"Charset")))
887 :group
'gnus-charset
)
889 (defcustom gnus-preserve-marks t
890 "Whether marks are preserved when moving, copying and respooling messages."
893 :group
'gnus-summary-marks
)
895 (defcustom gnus-alter-articles-to-read-function nil
896 "Function to be called to alter the list of articles to be selected."
897 :type
'(choice (const nil
) function
)
898 :group
'gnus-summary
)
900 (defcustom gnus-orphan-score nil
901 "*All orphans get this score added. Set in the score file."
902 :group
'gnus-score-default
903 :type
'(choice (const nil
)
906 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
907 "*A regexp to match MIME parts when saving multiple parts of a message
908 with gnus-summary-save-parts (X m). This regexp will be used by default
909 when prompting the user for which type of files to save."
914 ;;; Internal variables
916 (defvar gnus-article-mime-handles nil
)
917 (defvar gnus-article-decoded-p nil
)
918 (defvar gnus-scores-exclude-files nil
)
919 (defvar gnus-page-broken nil
)
920 (defvar gnus-inhibit-mime-unbuttonizing nil
)
922 (defvar gnus-original-article nil
)
923 (defvar gnus-article-internal-prepare-hook nil
)
924 (defvar gnus-newsgroup-process-stack nil
)
926 (defvar gnus-thread-indent-array nil
)
927 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
928 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
929 "Function called to sort the articles within a thread after it has been gathered together.")
931 (defvar gnus-summary-save-parts-type-history nil
)
932 (defvar gnus-summary-save-parts-last-directory nil
)
934 ;; Avoid highlighting in kill files.
935 (defvar gnus-summary-inhibit-highlight nil
)
936 (defvar gnus-newsgroup-selected-overlay nil
)
937 (defvar gnus-inhibit-limiting nil
)
938 (defvar gnus-newsgroup-adaptive-score-file nil
)
939 (defvar gnus-current-score-file nil
)
940 (defvar gnus-current-move-group nil
)
941 (defvar gnus-current-copy-group nil
)
942 (defvar gnus-current-crosspost-group nil
)
944 (defvar gnus-newsgroup-dependencies nil
)
945 (defvar gnus-newsgroup-adaptive nil
)
946 (defvar gnus-summary-display-article-function nil
)
947 (defvar gnus-summary-highlight-line-function nil
948 "Function called after highlighting a summary line.")
950 (defvar gnus-summary-line-format-alist
951 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
952 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
953 (?s gnus-tmp-subject-or-nil ?s
)
954 (?n gnus-tmp-name ?s
)
955 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
957 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
959 (?F gnus-tmp-from ?s
)
960 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
961 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
962 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
963 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
964 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
965 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
966 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
967 (?L gnus-tmp-lines ?d
)
968 (?I gnus-tmp-indentation ?s
)
969 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
970 (?R gnus-tmp-replied ?c
)
971 (?\
[ gnus-tmp-opening-bracket ?c
)
972 (?\
] gnus-tmp-closing-bracket ?c
)
973 (?\
> (make-string gnus-tmp-level ?
) ?s
)
974 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
975 (?i gnus-tmp-score ?d
)
976 (?z gnus-tmp-score-char ?c
)
977 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
978 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
979 (?U gnus-tmp-unread ?c
)
980 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header
) ?s
)
981 (?t
(gnus-summary-number-of-articles-in-thread
982 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
984 (?e
(gnus-summary-number-of-articles-in-thread
985 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
987 (?u gnus-tmp-user-defined ?s
)
988 (?P
(gnus-pick-line-number) ?d
))
989 "An alist of format specifications that can appear in summary lines.
990 These are paired with what variables they correspond with, along with
991 the type of the variable (string, integer, character, etc).")
993 (defvar gnus-summary-dummy-line-format-alist
994 `((?S gnus-tmp-subject ?s
)
995 (?N gnus-tmp-number ?d
)
996 (?u gnus-tmp-user-defined ?s
)))
998 (defvar gnus-summary-mode-line-format-alist
999 `((?G gnus-tmp-group-name ?s
)
1000 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1001 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1002 (?A gnus-tmp-article-number ?d
)
1003 (?Z gnus-tmp-unread-and-unselected ?s
)
1004 (?V gnus-version ?s
)
1005 (?U gnus-tmp-unread-and-unticked ?d
)
1006 (?S gnus-tmp-subject ?s
)
1007 (?e gnus-tmp-unselected ?d
)
1008 (?u gnus-tmp-user-defined ?s
)
1009 (?d
(length gnus-newsgroup-dormant
) ?d
)
1010 (?t
(length gnus-newsgroup-marked
) ?d
)
1011 (?r
(length gnus-newsgroup-reads
) ?d
)
1012 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1013 (?E gnus-newsgroup-expunged-tally ?d
)
1014 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1016 (defvar gnus-last-search-regexp nil
1017 "Default regexp for article search command.")
1019 (defvar gnus-last-shell-command nil
1020 "Default shell command on article.")
1022 (defvar gnus-newsgroup-begin nil
)
1023 (defvar gnus-newsgroup-end nil
)
1024 (defvar gnus-newsgroup-last-rmail nil
)
1025 (defvar gnus-newsgroup-last-mail nil
)
1026 (defvar gnus-newsgroup-last-folder nil
)
1027 (defvar gnus-newsgroup-last-file nil
)
1028 (defvar gnus-newsgroup-auto-expire nil
)
1029 (defvar gnus-newsgroup-active nil
)
1031 (defvar gnus-newsgroup-data nil
)
1032 (defvar gnus-newsgroup-data-reverse nil
)
1033 (defvar gnus-newsgroup-limit nil
)
1034 (defvar gnus-newsgroup-limits nil
)
1036 (defvar gnus-newsgroup-unreads nil
1037 "List of unread articles in the current newsgroup.")
1039 (defvar gnus-newsgroup-unselected nil
1040 "List of unselected unread articles in the current newsgroup.")
1042 (defvar gnus-newsgroup-reads nil
1043 "Alist of read articles and article marks in the current newsgroup.")
1045 (defvar gnus-newsgroup-expunged-tally nil
)
1047 (defvar gnus-newsgroup-marked nil
1048 "List of ticked articles in the current newsgroup (a subset of unread art).")
1050 (defvar gnus-newsgroup-killed nil
1051 "List of ranges of articles that have been through the scoring process.")
1053 (defvar gnus-newsgroup-cached nil
1054 "List of articles that come from the article cache.")
1056 (defvar gnus-newsgroup-saved nil
1057 "List of articles that have been saved.")
1059 (defvar gnus-newsgroup-kill-headers nil
)
1061 (defvar gnus-newsgroup-replied nil
1062 "List of articles that have been replied to in the current newsgroup.")
1064 (defvar gnus-newsgroup-expirable nil
1065 "List of articles in the current newsgroup that can be expired.")
1067 (defvar gnus-newsgroup-processable nil
1068 "List of articles in the current newsgroup that can be processed.")
1070 (defvar gnus-newsgroup-downloadable nil
1071 "List of articles in the current newsgroup that can be processed.")
1073 (defvar gnus-newsgroup-undownloaded nil
1074 "List of articles in the current newsgroup that haven't been downloaded..")
1076 (defvar gnus-newsgroup-unsendable nil
1077 "List of articles in the current newsgroup that won't be sent.")
1079 (defvar gnus-newsgroup-bookmarks nil
1080 "List of articles in the current newsgroup that have bookmarks.")
1082 (defvar gnus-newsgroup-dormant nil
1083 "List of dormant articles in the current newsgroup.")
1085 (defvar gnus-newsgroup-scored nil
1086 "List of scored articles in the current newsgroup.")
1088 (defvar gnus-newsgroup-headers nil
1089 "List of article headers in the current newsgroup.")
1091 (defvar gnus-newsgroup-threads nil
)
1093 (defvar gnus-newsgroup-prepared nil
1094 "Whether the current group has been prepared properly.")
1096 (defvar gnus-newsgroup-ancient nil
1097 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1099 (defvar gnus-newsgroup-sparse nil
)
1101 (defvar gnus-current-article nil
)
1102 (defvar gnus-article-current nil
)
1103 (defvar gnus-current-headers nil
)
1104 (defvar gnus-have-all-headers nil
)
1105 (defvar gnus-last-article nil
)
1106 (defvar gnus-newsgroup-history nil
)
1107 (defvar gnus-newsgroup-charset nil
)
1108 (defvar gnus-newsgroup-ephemeral-charset nil
)
1109 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1111 (defconst gnus-summary-local-variables
1112 '(gnus-newsgroup-name
1113 gnus-newsgroup-begin gnus-newsgroup-end
1114 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1115 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1116 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1117 gnus-newsgroup-unselected gnus-newsgroup-marked
1118 gnus-newsgroup-reads gnus-newsgroup-saved
1119 gnus-newsgroup-replied gnus-newsgroup-expirable
1120 gnus-newsgroup-processable gnus-newsgroup-killed
1121 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1122 gnus-newsgroup-unsendable
1123 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1124 gnus-newsgroup-headers gnus-newsgroup-threads
1125 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1126 gnus-current-article gnus-current-headers gnus-have-all-headers
1127 gnus-last-article gnus-article-internal-prepare-hook
1128 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1129 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1130 gnus-thread-expunge-below
1131 gnus-score-alist gnus-current-score-file
1132 (gnus-summary-expunge-below . global
)
1133 (gnus-summary-mark-below . global
)
1134 (gnus-orphan-score . global
)
1135 gnus-newsgroup-active gnus-scores-exclude-files
1136 gnus-newsgroup-history gnus-newsgroup-ancient
1137 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1138 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1139 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1140 (gnus-newsgroup-expunged-tally .
0)
1141 gnus-cache-removable-articles gnus-newsgroup-cached
1142 gnus-newsgroup-data gnus-newsgroup-data-reverse
1143 gnus-newsgroup-limit gnus-newsgroup-limits
1144 gnus-newsgroup-charset
)
1145 "Variables that are buffer-local to the summary buffers.")
1147 ;; Byte-compiler warning.
1148 (eval-when-compile (defvar gnus-article-mode-map
))
1152 (defvar gnus-decode-encoded-word-methods
1153 '(mail-decode-encoded-word-string)
1154 "List of methods used to decode encoded words.
1156 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1157 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1158 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1159 whose names match REGEXP.
1162 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1163 mail-decode-encoded-word-string
1164 (\"chinese\" . rfc1843-decode-string))")
1166 (defvar gnus-decode-encoded-word-methods-cache nil
)
1168 (defun gnus-multi-decode-encoded-word-string (string)
1169 "Apply the functions from `gnus-encoded-word-methods' that match."
1170 (unless (and gnus-decode-encoded-word-methods-cache
1171 (eq gnus-newsgroup-name
1172 (car gnus-decode-encoded-word-methods-cache
)))
1173 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1176 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1177 (if (and gnus-newsgroup-name
1178 (string-match (car x
) gnus-newsgroup-name
))
1179 (nconc gnus-decode-encoded-word-methods-cache
1181 gnus-decode-encoded-word-methods
))
1182 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1185 (setq string
(funcall (pop xlist
) string
))))
1188 ;; Subject simplification.
1190 (defun gnus-simplify-whitespace (str)
1191 "Remove excessive whitespace from STR."
1194 (while (string-match "[ \t][ \t]+" mystr
)
1195 (setq mystr
(concat (substring mystr
0 (match-beginning 0))
1197 (substring mystr
(match-end 0)))))
1199 (when (string-match "^[ \t]+" mystr
)
1200 (setq mystr
(substring mystr
(match-end 0))))
1202 (when (string-match "[ \t]+$" mystr
)
1203 (setq mystr
(substring mystr
0 (match-beginning 0))))
1206 (defsubst gnus-simplify-subject-re
(subject)
1207 "Remove \"Re:\" from subject lines."
1208 (if (string-match "^[Rr][Ee]: *" subject
)
1209 (substring subject
(match-end 0))
1212 (defun gnus-simplify-subject (subject &optional re-only
)
1213 "Remove `Re:' and words in parentheses.
1214 If RE-ONLY is non-nil, strip leading `Re:'s only."
1215 (let ((case-fold-search t
)) ;Ignore case.
1216 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1217 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1218 (setq subject
(substring subject
(match-end 0))))
1219 ;; Remove uninteresting prefixes.
1220 (when (and (not re-only
)
1221 gnus-simplify-ignored-prefixes
1222 (string-match gnus-simplify-ignored-prefixes subject
))
1223 (setq subject
(substring subject
(match-end 0))))
1224 ;; Remove words in parentheses from end.
1226 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1227 (setq subject
(substring subject
0 (match-beginning 0)))))
1228 ;; Return subject string.
1231 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1233 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1234 (goto-char (point-min))
1235 (while (re-search-forward regexp nil t
)
1236 (replace-match (or newtext
""))))
1238 (defun gnus-simplify-buffer-fuzzy ()
1239 "Simplify string in the buffer fuzzily.
1240 The string in the accessible portion of the current buffer is simplified.
1241 It is assumed to be a single-line subject.
1242 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1243 matter is removed. Additional things can be deleted by setting
1244 `gnus-simplify-subject-fuzzy-regexp'."
1245 (let ((case-fold-search t
)
1247 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1249 (while (not (eq modified-tick
(buffer-modified-tick)))
1250 (setq modified-tick
(buffer-modified-tick))
1252 ((listp gnus-simplify-subject-fuzzy-regexp
)
1253 (mapcar 'gnus-simplify-buffer-fuzzy-step
1254 gnus-simplify-subject-fuzzy-regexp
))
1255 (gnus-simplify-subject-fuzzy-regexp
1256 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1257 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1258 (gnus-simplify-buffer-fuzzy-step
1259 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1260 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1262 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1263 (gnus-simplify-buffer-fuzzy-step " +" " ")
1264 (gnus-simplify-buffer-fuzzy-step " $")
1265 (gnus-simplify-buffer-fuzzy-step "^ +")))
1267 (defun gnus-simplify-subject-fuzzy (subject)
1268 "Simplify a subject string fuzzily.
1269 See `gnus-simplify-buffer-fuzzy' for details."
1271 (gnus-set-work-buffer)
1272 (let ((case-fold-search t
))
1273 ;; Remove uninteresting prefixes.
1274 (when (and gnus-simplify-ignored-prefixes
1275 (string-match gnus-simplify-ignored-prefixes subject
))
1276 (setq subject
(substring subject
(match-end 0))))
1278 (inline (gnus-simplify-buffer-fuzzy))
1281 (defsubst gnus-simplify-subject-fully
(subject)
1282 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1284 (gnus-simplify-subject-functions
1285 (gnus-map-function gnus-simplify-subject-functions subject
))
1286 ((null gnus-summary-gather-subject-limit
)
1287 (gnus-simplify-subject-re subject
))
1288 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1289 (gnus-simplify-subject-fuzzy subject
))
1290 ((numberp gnus-summary-gather-subject-limit
)
1291 (gnus-limit-string (gnus-simplify-subject-re subject
)
1292 gnus-summary-gather-subject-limit
))
1296 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1297 "Check whether two subjects are equal.
1298 If optional argument simple-first is t, first argument is already
1301 ((null simple-first
)
1302 (equal (gnus-simplify-subject-fully s1
)
1303 (gnus-simplify-subject-fully s2
)))
1306 (gnus-simplify-subject-fully s2
)))))
1308 (defun gnus-summary-bubble-group ()
1309 "Increase the score of the current group.
1310 This is a handy function to add to `gnus-summary-exit-hook' to
1311 increase the score of each group you read."
1312 (gnus-group-add-score gnus-newsgroup-name
))
1316 ;;; Gnus summary mode
1319 (put 'gnus-summary-mode
'mode-class
'special
)
1321 (defvar gnus-article-commands-menu
)
1324 ;; Non-orthogonal keys
1326 (gnus-define-keys gnus-summary-mode-map
1327 " " gnus-summary-next-page
1328 "\177" gnus-summary-prev-page
1329 [delete] gnus-summary-prev-page
1330 [backspace] gnus-summary-prev-page
1331 "\r" gnus-summary-scroll-up
1332 "\M-\r" gnus-summary-scroll-down
1333 "n" gnus-summary-next-unread-article
1334 "p" gnus-summary-prev-unread-article
1335 "N" gnus-summary-next-article
1336 "P" gnus-summary-prev-article
1337 "\M-\C-n" gnus-summary-next-same-subject
1338 "\M-\C-p" gnus-summary-prev-same-subject
1339 "\M-n" gnus-summary-next-unread-subject
1340 "\M-p" gnus-summary-prev-unread-subject
1341 "." gnus-summary-first-unread-article
1342 "," gnus-summary-best-unread-article
1343 "\M-s" gnus-summary-search-article-forward
1344 "\M-r" gnus-summary-search-article-backward
1345 "<" gnus-summary-beginning-of-article
1346 ">" gnus-summary-end-of-article
1347 "j" gnus-summary-goto-article
1348 "^" gnus-summary-refer-parent-article
1349 "\M-^" gnus-summary-refer-article
1350 "u" gnus-summary-tick-article-forward
1351 "!" gnus-summary-tick-article-forward
1352 "U" gnus-summary-tick-article-backward
1353 "d" gnus-summary-mark-as-read-forward
1354 "D" gnus-summary-mark-as-read-backward
1355 "E" gnus-summary-mark-as-expirable
1356 "\M-u" gnus-summary-clear-mark-forward
1357 "\M-U" gnus-summary-clear-mark-backward
1358 "k" gnus-summary-kill-same-subject-and-select
1359 "\C-k" gnus-summary-kill-same-subject
1360 "\M-\C-k" gnus-summary-kill-thread
1361 "\M-\C-l" gnus-summary-lower-thread
1362 "e" gnus-summary-edit-article
1363 "#" gnus-summary-mark-as-processable
1364 "\M-#" gnus-summary-unmark-as-processable
1365 "\M-\C-t" gnus-summary-toggle-threads
1366 "\M-\C-s" gnus-summary-show-thread
1367 "\M-\C-h" gnus-summary-hide-thread
1368 "\M-\C-f" gnus-summary-next-thread
1369 "\M-\C-b" gnus-summary-prev-thread
1370 [(meta down)] gnus-summary-next-thread
1371 [(meta up)] gnus-summary-prev-thread
1372 "\M-\C-u" gnus-summary-up-thread
1373 "\M-\C-d" gnus-summary-down-thread
1374 "&" gnus-summary-execute-command
1375 "c" gnus-summary-catchup-and-exit
1376 "\C-w" gnus-summary-mark-region-as-read
1377 "\C-t" gnus-summary-toggle-truncation
1378 "?" gnus-summary-mark-as-dormant
1379 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1380 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1381 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1382 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1383 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1384 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1385 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1386 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1387 "=" gnus-summary-expand-window
1388 "\C-x\C-s" gnus-summary-reselect-current-group
1389 "\M-g" gnus-summary-rescan-group
1390 "w" gnus-summary-stop-page-breaking
1391 "\C-c\C-r" gnus-summary-caesar-message
1392 "f" gnus-summary-followup
1393 "F" gnus-summary-followup-with-original
1394 "C" gnus-summary-cancel-article
1395 "r" gnus-summary-reply
1396 "R" gnus-summary-reply-with-original
1397 "\C-c\C-f" gnus-summary-mail-forward
1398 "o" gnus-summary-save-article
1399 "\C-o" gnus-summary-save-article-mail
1400 "|" gnus-summary-pipe-output
1401 "\M-k" gnus-summary-edit-local-kill
1402 "\M-K" gnus-summary-edit-global-kill
1404 "\C-c\C-d" gnus-summary-describe-group
1405 "q" gnus-summary-exit
1406 "Q" gnus-summary-exit-no-update
1407 "\C-c\C-i" gnus-info-find-node
1408 gnus-mouse-2 gnus-mouse-pick-article
1409 "m" gnus-summary-mail-other-window
1410 "a" gnus-summary-post-news
1411 "x" gnus-summary-limit-to-unread
1412 "s" gnus-summary-isearch-article
1413 "t" gnus-summary-toggle-header
1414 "g" gnus-summary-show-article
1415 "l" gnus-summary-goto-last-article
1416 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1417 "\C-d" gnus-summary-enter-digest-group
1418 "\M-\C-d" gnus-summary-read-document
1419 "\M-\C-e" gnus-summary-edit-parameters
1420 "\M-\C-a" gnus-summary-customize-parameters
1422 "*" gnus-cache-enter-article
1423 "\M-*" gnus-cache-remove-article
1424 "\M-&" gnus-summary-universal-argument
1425 "\C-l" gnus-recenter
1426 "I" gnus-summary-increase-score
1427 "L" gnus-summary-lower-score
1428 "\M-i" gnus-symbolic-argument
1429 "h" gnus-summary-select-article-buffer
1431 "b" gnus-article-view-part
1432 "\M-t" gnus-summary-toggle-display-buttonized
1434 "V" gnus-summary-score-map
1435 "X" gnus-uu-extract-map
1436 "S" gnus-summary-send-map)
1438 ;; Sort of orthogonal keymap
1439 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1440 "t" gnus-summary-tick-article-forward
1441 "!" gnus-summary-tick-article-forward
1442 "d" gnus-summary-mark-as-read-forward
1443 "r" gnus-summary-mark-as-read-forward
1444 "c" gnus-summary-clear-mark-forward
1445 " " gnus-summary-clear-mark-forward
1446 "e" gnus-summary-mark-as-expirable
1447 "x" gnus-summary-mark-as-expirable
1448 "?" gnus-summary-mark-as-dormant
1449 "b" gnus-summary-set-bookmark
1450 "B" gnus-summary-remove-bookmark
1451 "#" gnus-summary-mark-as-processable
1452 "\M-#" gnus-summary-unmark-as-processable
1453 "S" gnus-summary-limit-include-expunged
1454 "C" gnus-summary-catchup
1455 "H" gnus-summary-catchup-to-here
1456 "\C-c" gnus-summary-catchup-all
1457 "k" gnus-summary-kill-same-subject-and-select
1458 "K" gnus-summary-kill-same-subject
1459 "P" gnus-uu-mark-map)
1461 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1462 "c" gnus-summary-clear-above
1463 "u" gnus-summary-tick-above
1464 "m" gnus-summary-mark-above
1465 "k" gnus-summary-kill-below)
1467 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1468 "/" gnus-summary-limit-to-subject
1469 "n" gnus-summary-limit-to-articles
1470 "w" gnus-summary-pop-limit
1471 "s" gnus-summary-limit-to-subject
1472 "a" gnus-summary-limit-to-author
1473 "u" gnus-summary-limit-to-unread
1474 "m" gnus-summary-limit-to-marks
1475 "M" gnus-summary-limit-exclude-marks
1476 "v" gnus-summary-limit-to-score
1477 "*" gnus-summary-limit-include-cached
1478 "D" gnus-summary-limit-include-dormant
1479 "T" gnus-summary-limit-include-thread
1480 "d" gnus-summary-limit-exclude-dormant
1481 "t" gnus-summary-limit-to-age
1482 "x" gnus-summary-limit-to-extra
1483 "E" gnus-summary-limit-include-expunged
1484 "c" gnus-summary-limit-exclude-childless-dormant
1485 "C" gnus-summary-limit-mark-excluded-as-read)
1487 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1488 "n" gnus-summary-next-unread-article
1489 "p" gnus-summary-prev-unread-article
1490 "N" gnus-summary-next-article
1491 "P" gnus-summary-prev-article
1492 "\C-n" gnus-summary-next-same-subject
1493 "\C-p" gnus-summary-prev-same-subject
1494 "\M-n" gnus-summary-next-unread-subject
1495 "\M-p" gnus-summary-prev-unread-subject
1496 "f" gnus-summary-first-unread-article
1497 "b" gnus-summary-best-unread-article
1498 "j" gnus-summary-goto-article
1499 "g" gnus-summary-goto-subject
1500 "l" gnus-summary-goto-last-article
1501 "o" gnus-summary-pop-article)
1503 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1504 "k" gnus-summary-kill-thread
1505 "l" gnus-summary-lower-thread
1506 "i" gnus-summary-raise-thread
1507 "T" gnus-summary-toggle-threads
1508 "t" gnus-summary-rethread-current
1509 "^" gnus-summary-reparent-thread
1510 "s" gnus-summary-show-thread
1511 "S" gnus-summary-show-all-threads
1512 "h" gnus-summary-hide-thread
1513 "H" gnus-summary-hide-all-threads
1514 "n" gnus-summary-next-thread
1515 "p" gnus-summary-prev-thread
1516 "u" gnus-summary-up-thread
1517 "o" gnus-summary-top-thread
1518 "d" gnus-summary-down-thread
1519 "#" gnus-uu-mark-thread
1520 "\M-#" gnus-uu-unmark-thread)
1522 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1523 "g" gnus-summary-prepare
1524 "c" gnus-summary-insert-cached-articles)
1526 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1527 "c" gnus-summary-catchup-and-exit
1528 "C" gnus-summary-catchup-all-and-exit
1529 "E" gnus-summary-exit-no-update
1530 "Q" gnus-summary-exit
1531 "Z" gnus-summary-exit
1532 "n" gnus-summary-catchup-and-goto-next-group
1533 "R" gnus-summary-reselect-current-group
1534 "G" gnus-summary-rescan-group
1535 "N" gnus-summary-next-group
1536 "s" gnus-summary-save-newsrc
1537 "P" gnus-summary-prev-group)
1539 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1540 " " gnus-summary-next-page
1541 "n" gnus-summary-next-page
1542 "\177" gnus-summary-prev-page
1543 [delete] gnus-summary-prev-page
1544 "p" gnus-summary-prev-page
1545 "\r" gnus-summary-scroll-up
1546 "\M-\r" gnus-summary-scroll-down
1547 "<" gnus-summary-beginning-of-article
1548 ">" gnus-summary-end-of-article
1549 "b" gnus-summary-beginning-of-article
1550 "e" gnus-summary-end-of-article
1551 "^" gnus-summary-refer-parent-article
1552 "r" gnus-summary-refer-parent-article
1553 "D" gnus-summary-enter-digest-group
1554 "R" gnus-summary-refer-references
1555 "T" gnus-summary-refer-thread
1556 "g" gnus-summary-show-article
1557 "s" gnus-summary-isearch-article
1558 "P" gnus-summary-print-article
1559 "t" gnus-article-babel
)
1561 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1562 "b" gnus-article-add-buttons
1563 "B" gnus-article-add-buttons-to-head
1564 "o" gnus-article-treat-overstrike
1565 "e" gnus-article-emphasize
1566 "w" gnus-article-fill-cited-article
1567 "Q" gnus-article-fill-long-lines
1568 "C" gnus-article-capitalize-sentences
1569 "c" gnus-article-remove-cr
1570 "q" gnus-article-de-quoted-unreadable
1571 "6" gnus-article-de-base64-unreadable
1572 "Z" gnus-article-decode-HZ
1573 "h" gnus-article-wash-html
1574 "f" gnus-article-display-x-face
1575 "l" gnus-summary-stop-page-breaking
1576 "r" gnus-summary-caesar-message
1577 "t" gnus-summary-toggle-header
1578 "v" gnus-summary-verbose-headers
1579 "H" gnus-article-strip-headers-in-body
1580 "d" gnus-article-treat-dumbquotes
)
1582 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1583 "a" gnus-article-hide
1584 "h" gnus-article-hide-headers
1585 "b" gnus-article-hide-boring-headers
1586 "s" gnus-article-hide-signature
1587 "c" gnus-article-hide-citation
1588 "C" gnus-article-hide-citation-in-followups
1589 "l" gnus-article-hide-list-identifiers
1590 "p" gnus-article-hide-pgp
1591 "B" gnus-article-strip-banner
1592 "P" gnus-article-hide-pem
1593 "\C-c" gnus-article-hide-citation-maybe
)
1595 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1596 "a" gnus-article-highlight
1597 "h" gnus-article-highlight-headers
1598 "c" gnus-article-highlight-citation
1599 "s" gnus-article-highlight-signature
)
1601 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1602 "w" gnus-article-decode-mime-words
1603 "c" gnus-article-decode-charset
1604 "v" gnus-mime-view-all-parts
1605 "b" gnus-article-view-part
)
1607 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1608 "z" gnus-article-date-ut
1609 "u" gnus-article-date-ut
1610 "l" gnus-article-date-local
1611 "e" gnus-article-date-lapsed
1612 "o" gnus-article-date-original
1613 "i" gnus-article-date-iso8601
1614 "s" gnus-article-date-user
)
1616 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1617 "t" gnus-article-remove-trailing-blank-lines
1618 "l" gnus-article-strip-leading-blank-lines
1619 "m" gnus-article-strip-multiple-blank-lines
1620 "a" gnus-article-strip-blank-lines
1621 "A" gnus-article-strip-all-blank-lines
1622 "s" gnus-article-strip-leading-space
1623 "e" gnus-article-strip-trailing-space
)
1625 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1627 "f" gnus-summary-fetch-faq
1628 "d" gnus-summary-describe-group
1629 "h" gnus-summary-describe-briefly
1630 "i" gnus-info-find-node
)
1632 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1633 "e" gnus-summary-expire-articles
1634 "\M-\C-e" gnus-summary-expire-articles-now
1635 "\177" gnus-summary-delete-article
1636 [delete] gnus-summary-delete-article
1637 [backspace] gnus-summary-delete-article
1638 "m" gnus-summary-move-article
1639 "r" gnus-summary-respool-article
1640 "w" gnus-summary-edit-article
1641 "c" gnus-summary-copy-article
1642 "B" gnus-summary-crosspost-article
1643 "q" gnus-summary-respool-query
1644 "t" gnus-summary-respool-trace
1645 "i" gnus-summary-import-article
1646 "p" gnus-summary-article-posted-p)
1648 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1649 "o" gnus-summary-save-article
1650 "m" gnus-summary-save-article-mail
1651 "F" gnus-summary-write-article-file
1652 "r" gnus-summary-save-article-rmail
1653 "f" gnus-summary-save-article-file
1654 "b" gnus-summary-save-article-body-file
1655 "h" gnus-summary-save-article-folder
1656 "v" gnus-summary-save-article-vm
1657 "p" gnus-summary-pipe-output
1658 "s" gnus-soup-add-article)
1660 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1661 "b" gnus-summary-display-buttonized
1662 "m" gnus-summary-repair-multipart
1663 "v" gnus-article-view-part
1664 "o" gnus-article-save-part
1665 "c" gnus-article-copy-part
1666 "e" gnus-article-externalize-part
1667 "i" gnus-article-inline-part
1668 "|" gnus-article-pipe-part))
1670 (defun gnus-summary-make-menu-bar ()
1671 (gnus-turn-off-edit-menu 'summary)
1673 (unless (boundp 'gnus-summary-misc-menu)
1676 gnus-summary-kill-menu gnus-summary-mode-map ""
1681 ["Enter score..." gnus-summary-score-entry t]
1682 ["Customize" gnus-score-customize t])
1683 (gnus-make-score-map 'increase)
1684 (gnus-make-score-map 'lower)
1686 ["Kill below" gnus-summary-kill-below t]
1687 ["Mark above" gnus-summary-mark-above t]
1688 ["Tick above" gnus-summary-tick-above t]
1689 ["Clear above" gnus-summary-clear-above t])
1690 ["Current score" gnus-summary-current-score t]
1691 ["Set score" gnus-summary-set-score t]
1692 ["Switch current score file..." gnus-score-change-score-file t]
1693 ["Set mark below..." gnus-score-set-mark-below t]
1694 ["Set expunge below..." gnus-score-set-expunge-below t]
1695 ["Edit current score file" gnus-score-edit-current-scores t]
1696 ["Edit score file" gnus-score-edit-file t]
1697 ["Trace score" gnus-score-find-trace t]
1698 ["Find words" gnus-score-find-favourite-words t]
1699 ["Rescore buffer" gnus-summary-rescore t]
1700 ["Increase score..." gnus-summary-increase-score t]
1701 ["Lower score..." gnus-summary-lower-score t]))))
1703 ;; Define both the Article menu in the summary buffer and the equivalent
1704 ;; Commands menu in the article buffer here for consistency.
1707 ["All" gnus-article-hide t]
1708 ["Headers" gnus-article-hide-headers t]
1709 ["Signature" gnus-article-hide-signature t]
1710 ["Citation" gnus-article-hide-citation t]
1711 ["List identifiers" gnus-article-hide-list-identifiers t]
1712 ["PGP" gnus-article-hide-pgp t]
1713 ["Banner" gnus-article-strip-banner t]
1714 ["Boring headers" gnus-article-hide-boring-headers t])
1716 ["All" gnus-article-highlight t]
1717 ["Headers" gnus-article-highlight-headers t]
1718 ["Signature" gnus-article-highlight-signature t]
1719 ["Citation" gnus-article-highlight-citation t])
1721 ["Words" gnus-article-decode-mime-words t]
1722 ["Charset" gnus-article-decode-charset t]
1723 ["QP" gnus-article-de-quoted-unreadable t]
1724 ["Base64" gnus-article-de-base64-unreadable t]
1725 ["View all" gnus-mime-view-all-parts t])
1727 ["Local" gnus-article-date-local t]
1728 ["ISO8601" gnus-article-date-iso8601 t]
1729 ["UT" gnus-article-date-ut t]
1730 ["Original" gnus-article-date-original t]
1731 ["Lapsed" gnus-article-date-lapsed t]
1732 ["User-defined" gnus-article-date-user t])
1735 ["Leading" gnus-article-strip-leading-blank-lines t]
1736 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1737 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1738 ["All of the above" gnus-article-strip-blank-lines t]
1739 ["All" gnus-article-strip-all-blank-lines t]
1740 ["Leading space" gnus-article-strip-leading-space t]
1741 ["Trailing space" gnus-article-strip-trailing-space t])
1742 ["Overstrike" gnus-article-treat-overstrike t]
1743 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1744 ["Emphasis" gnus-article-emphasize t]
1745 ["Word wrap" gnus-article-fill-cited-article t]
1746 ["Fill long lines" gnus-article-fill-long-lines t]
1747 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1748 ["CR" gnus-article-remove-cr t]
1749 ["Show X-Face" gnus-article-display-x-face t]
1750 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1751 ["Base64" gnus-article-de-base64-unreadable t]
1752 ["Rot 13" gnus-summary-caesar-message
1753 :help "\"Caesar rotate\" article by 13"]
1754 ["Unix pipe" gnus-summary-pipe-message t]
1755 ["Add buttons" gnus-article-add-buttons t]
1756 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1757 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1758 ["Verbose header" gnus-summary-verbose-headers t]
1759 ["Toggle header" gnus-summary-toggle-header t]
1760 ["Html" gnus-article-wash-html t]
1761 ["HZ" gnus-article-decode-HZ t])
1763 ["Save in default format" gnus-summary-save-article
1764 :help "Save article using default method"]
1765 ["Save in file" gnus-summary-save-article-file
1766 :help "Save article in file"]
1767 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1768 ["Save in MH folder" gnus-summary-save-article-folder t]
1769 ["Save in VM folder" gnus-summary-save-article-vm t]
1770 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1771 ["Save body in file" gnus-summary-save-article-body-file t]
1772 ["Pipe through a filter" gnus-summary-pipe-output t]
1773 ["Add to SOUP packet" gnus-soup-add-article t]
1774 ["Print" gnus-summary-print-article t])
1776 ["Respool article..." gnus-summary-respool-article t]
1777 ["Move article..." gnus-summary-move-article
1778 (gnus-check-backend-function
1779 'request-move-article gnus-newsgroup-name)]
1780 ["Copy article..." gnus-summary-copy-article t]
1781 ["Crosspost article..." gnus-summary-crosspost-article
1782 (gnus-check-backend-function
1783 'request-replace-article gnus-newsgroup-name)]
1784 ["Import file..." gnus-summary-import-article t]
1785 ["Check if posted" gnus-summary-article-posted-p t]
1786 ["Edit article" gnus-summary-edit-article
1787 (not (gnus-group-read-only-p))]
1788 ["Delete article" gnus-summary-delete-article
1789 (gnus-check-backend-function
1790 'request-expire-articles gnus-newsgroup-name)]
1791 ["Query respool" gnus-summary-respool-query t]
1792 ["Trace respool" gnus-summary-respool-trace t]
1793 ["Delete expirable articles" gnus-summary-expire-articles-now
1794 (gnus-check-backend-function
1795 'request-expire-articles gnus-newsgroup-name)])
1797 ["Uudecode" gnus-uu-decode-uu
1798 :help "Decode uuencoded article(s)"]
1799 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1800 ["Unshar" gnus-uu-decode-unshar t]
1801 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1802 ["Save" gnus-uu-decode-save t]
1803 ["Binhex" gnus-uu-decode-binhex t]
1804 ["Postscript" gnus-uu-decode-postscript t])
1806 ["Enter article" gnus-cache-enter-article t]
1807 ["Remove article" gnus-cache-remove-article t])
1808 ["Translate" gnus-article-babel t]
1809 ["Select article buffer" gnus-summary-select-article-buffer t]
1810 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1811 ["Isearch article..." gnus-summary-isearch-article t]
1812 ["Beginning of the article" gnus-summary-beginning-of-article t]
1813 ["End of the article" gnus-summary-end-of-article t]
1814 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1815 ["Fetch referenced articles" gnus-summary-refer-references t]
1816 ["Fetch current thread" gnus-summary-refer-thread t]
1817 ["Fetch article with id..." gnus-summary-refer-article t]
1818 ["Redisplay" gnus-summary-show-article t])))
1820 gnus-summary-article-menu gnus-summary-mode-map ""
1821 (cons "Article" innards))
1823 (if (not (keymapp gnus-summary-article-menu))
1825 gnus-article-commands-menu gnus-article-mode-map ""
1826 (cons "Commands" innards))
1827 ;; in Emacs, don't share menu.
1828 (setq gnus-article-commands-menu
1829 (copy-keymap gnus-summary-article-menu))
1830 (define-key gnus-article-mode-map [menu-bar commands]
1831 (cons "Commands" gnus-article-commands-menu))))
1834 gnus-summary-thread-menu gnus-summary-mode-map ""
1836 ["Toggle threading" gnus-summary-toggle-threads t]
1837 ["Hide threads" gnus-summary-hide-all-threads t]
1838 ["Show threads" gnus-summary-show-all-threads t]
1839 ["Hide thread" gnus-summary-hide-thread t]
1840 ["Show thread" gnus-summary-show-thread t]
1841 ["Go to next thread" gnus-summary-next-thread t]
1842 ["Go to previous thread" gnus-summary-prev-thread t]
1843 ["Go down thread" gnus-summary-down-thread t]
1844 ["Go up thread" gnus-summary-up-thread t]
1845 ["Top of thread" gnus-summary-top-thread t]
1846 ["Mark thread as read" gnus-summary-kill-thread t]
1847 ["Lower thread score" gnus-summary-lower-thread t]
1848 ["Raise thread score" gnus-summary-raise-thread t]
1849 ["Rethread current" gnus-summary-rethread-current t]))
1852 gnus-summary-post-menu gnus-summary-mode-map ""
1854 ["Post an article" gnus-summary-post-news
1855 :help "Post an article"]
1856 ["Followup" gnus-summary-followup
1857 :help "Post followup to this article"]
1858 ["Followup and yank" gnus-summary-followup-with-original
1859 :help "Post followup to this article, quoting its contents"]
1860 ["Supersede article" gnus-summary-supersede-article t]
1861 ["Cancel article" gnus-summary-cancel-article
1862 :help "Cancel an article you posted"]
1863 ["Reply" gnus-summary-reply t]
1864 ["Reply and yank" gnus-summary-reply-with-original t]
1865 ["Wide reply" gnus-summary-wide-reply t]
1866 ["Wide reply and yank" gnus-summary-wide-reply-with-original
1867 :help "Mail a reply, quoting this article"]
1868 ["Mail forward" gnus-summary-mail-forward t]
1869 ["Post forward" gnus-summary-post-forward t]
1870 ["Digest and mail" gnus-uu-digest-mail-forward t]
1871 ["Digest and post" gnus-uu-digest-post-forward t]
1872 ["Resend message" gnus-summary-resend-message t]
1873 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1874 ["Send a mail" gnus-summary-mail-other-window t]
1875 ["Uuencode and post" gnus-uu-post-news
1876 :help "Post a uuencoded article"]
1877 ["Followup via news" gnus-summary-followup-to-mail t]
1878 ["Followup via news and yank"
1879 gnus-summary-followup-to-mail-with-original t]
1881 ;;["Send" gnus-summary-send-draft t]
1882 ;;["Send bounced" gnus-resend-bounced-mail t])
1886 gnus-summary-misc-menu gnus-summary-mode-map ""
1889 ["Mark as read" gnus-summary-mark-as-read-forward t]
1890 ["Mark same subject and select"
1891 gnus-summary-kill-same-subject-and-select t]
1892 ["Mark same subject" gnus-summary-kill-same-subject t]
1893 ["Catchup" gnus-summary-catchup
1894 :help "Mark unread articles in this group as read"]
1895 ["Catchup all" gnus-summary-catchup-all t]
1896 ["Catchup to here" gnus-summary-catchup-to-here t]
1897 ["Catchup region" gnus-summary-mark-region-as-read t]
1898 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1900 ["Tick" gnus-summary-tick-article-forward t]
1901 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1902 ["Remove marks" gnus-summary-clear-mark-forward t]
1903 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1904 ["Set bookmark" gnus-summary-set-bookmark t]
1905 ["Remove bookmark" gnus-summary-remove-bookmark t])
1907 ["Marks..." gnus-summary-limit-to-marks t]
1908 ["Subject..." gnus-summary-limit-to-subject t]
1909 ["Author..." gnus-summary-limit-to-author t]
1910 ["Age..." gnus-summary-limit-to-age t]
1911 ["Extra..." gnus-summary-limit-to-extra t]
1912 ["Score" gnus-summary-limit-to-score t]
1913 ["Unread" gnus-summary-limit-to-unread t]
1914 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1915 ["Articles" gnus-summary-limit-to-articles t]
1916 ["Pop limit" gnus-summary-pop-limit t]
1917 ["Show dormant" gnus-summary-limit-include-dormant t]
1918 ["Hide childless dormant"
1919 gnus-summary-limit-exclude-childless-dormant t]
1920 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1921 ["Hide marked" gnus-summary-limit-exclude-marks t]
1922 ["Show expunged" gnus-summary-show-all-expunged t])
1924 ["Set mark" gnus-summary-mark-as-processable t]
1925 ["Remove mark" gnus-summary-unmark-as-processable t]
1926 ["Remove all marks" gnus-summary-unmark-all-processable t]
1927 ["Mark above" gnus-uu-mark-over t]
1928 ["Mark series" gnus-uu-mark-series t]
1929 ["Mark region" gnus-uu-mark-region t]
1930 ["Unmark region" gnus-uu-unmark-region t]
1931 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1932 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1933 ["Mark all" gnus-uu-mark-all t]
1934 ["Mark buffer" gnus-uu-mark-buffer t]
1935 ["Mark sparse" gnus-uu-mark-sparse t]
1936 ["Mark thread" gnus-uu-mark-thread t]
1937 ["Unmark thread" gnus-uu-unmark-thread t]
1938 ("Process Mark Sets"
1939 ["Kill" gnus-summary-kill-process-mark t]
1940 ["Yank" gnus-summary-yank-process-mark
1941 gnus-newsgroup-process-stack]
1942 ["Save" gnus-summary-save-process-mark t]))
1944 ["Page forward" gnus-summary-next-page
1945 :help "Show next page of article"]
1946 ["Page backward" gnus-summary-prev-page
1947 :help "Show previous page of article"]
1948 ["Line forward" gnus-summary-scroll-up t])
1950 ["Next unread article" gnus-summary-next-unread-article t]
1951 ["Previous unread article" gnus-summary-prev-unread-article t]
1952 ["Next article" gnus-summary-next-article t]
1953 ["Previous article" gnus-summary-prev-article t]
1954 ["Next unread subject" gnus-summary-next-unread-subject t]
1955 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1956 ["Next article same subject" gnus-summary-next-same-subject t]
1957 ["Previous article same subject" gnus-summary-prev-same-subject t]
1958 ["First unread article" gnus-summary-first-unread-article t]
1959 ["Best unread article" gnus-summary-best-unread-article t]
1960 ["Go to subject number..." gnus-summary-goto-subject t]
1961 ["Go to article number..." gnus-summary-goto-article t]
1962 ["Go to the last article" gnus-summary-goto-last-article t]
1963 ["Pop article off history" gnus-summary-pop-article t])
1965 ["Sort by number" gnus-summary-sort-by-number t]
1966 ["Sort by author" gnus-summary-sort-by-author t]
1967 ["Sort by subject" gnus-summary-sort-by-subject t]
1968 ["Sort by date" gnus-summary-sort-by-date t]
1969 ["Sort by score" gnus-summary-sort-by-score t]
1970 ["Sort by lines" gnus-summary-sort-by-lines t]
1971 ["Sort by characters" gnus-summary-sort-by-chars t])
1973 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1974 ["Describe group" gnus-summary-describe-group t]
1975 ["Read manual" gnus-info-find-node t])
1977 ["Pick and read" gnus-pick-mode t]
1978 ["Binary" gnus-binary-mode t])
1980 ["Regenerate" gnus-summary-prepare t]
1981 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1982 ["Toggle threading" gnus-summary-toggle-threads t])
1983 ["Filter articles..." gnus-summary-execute-command t]
1984 ["Run command on subjects..." gnus-summary-universal-argument t]
1985 ["Search articles forward..." gnus-summary-search-article-forward t]
1986 ["Search articles backward..." gnus-summary-search-article-backward t]
1987 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1988 ["Expand window" gnus-summary-expand-window t]
1989 ["Expire expirable articles" gnus-summary-expire-articles
1990 (gnus-check-backend-function
1991 'request-expire-articles gnus-newsgroup-name)]
1992 ["Edit local kill file" gnus-summary-edit-local-kill t]
1993 ["Edit main kill file" gnus-summary-edit-global-kill t]
1994 ["Edit group parameters" gnus-summary-edit-parameters t]
1995 ["Customize group parameters" gnus-summary-customize-parameters t]
1996 ["Send a bug report" gnus-bug t]
1998 ["Catchup and exit" gnus-summary-catchup-and-exit
1999 :help "Mark unread articles in this group as read, then exit"]
2000 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2001 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2002 ["Exit group" gnus-summary-exit
2003 :help "Exit current group, return to group selection mode"]
2004 ["Exit group without updating" gnus-summary-exit-no-update t]
2005 ["Exit and goto next group" gnus-summary-next-group t]
2006 ["Exit and goto prev group" gnus-summary-prev-group t]
2007 ["Reselect group" gnus-summary-reselect-current-group t]
2008 ["Rescan group" gnus-summary-rescan-group t]
2009 ["Update dribble" gnus-summary-save-newsrc t])))
2011 (gnus-run-hooks 'gnus-summary-menu-hook)))
2013 (defvar gnus-summary-tool-bar-map nil)
2015 ;; Emacs 21 tool bar. Should be no-op otherwise.
2016 ;; NB: A new function tool-bar-local-item-from-menu is added in Emacs
2017 ;; 21.2.50+. Considering many users use Emacs 21, use
2018 ;; tool-bar-add-item-from-menu here.
2019 (defun gnus-summary-make-tool-bar ()
2021 (condition-case nil (require 'tool-bar) (error nil))
2022 (fboundp 'tool-bar-add-item-from-menu)
2023 (default-value 'tool-bar-mode)
2024 (not gnus-summary-tool-bar-map))
2025 (setq gnus-summary-tool-bar-map
2026 (let ((tool-bar-map (make-sparse-keymap)))
2027 (tool-bar-add-item-from-menu
2028 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2029 (tool-bar-add-item-from-menu
2030 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2031 (tool-bar-add-item-from-menu
2032 'gnus-summary-post-news "post" gnus-summary-mode-map)
2033 (tool-bar-add-item-from-menu
2034 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2035 (tool-bar-add-item-from-menu
2036 'gnus-summary-followup "followup" gnus-summary-mode-map)
2037 (tool-bar-add-item-from-menu
2038 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2039 (tool-bar-add-item-from-menu
2040 'gnus-summary-reply "reply" gnus-summary-mode-map)
2041 (tool-bar-add-item-from-menu
2042 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2043 (tool-bar-add-item-from-menu
2044 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2045 (tool-bar-add-item-from-menu
2046 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2047 (tool-bar-add-item-from-menu
2048 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2049 (tool-bar-add-item-from-menu
2050 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2051 (tool-bar-add-item-from-menu
2052 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2053 (tool-bar-add-item-from-menu
2054 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2055 (tool-bar-add-item-from-menu
2056 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2058 (if gnus-summary-tool-bar-map
2059 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2061 (defun gnus-score-set-default (var value)
2062 "A version of set that updates the GNU Emacs menu-bar."
2064 ;; It is the message that forces the active status to be updated.
2067 (defun gnus-make-score-map (type)
2068 "Make a summary score map of type TYPE."
2071 (let ((headers '(("author" "from" string)
2072 ("subject" "subject" string)
2073 ("article body" "body" string)
2074 ("article head" "head" string)
2075 ("xref" "xref" string)
2076 ("extra header" "extra" string)
2077 ("lines" "lines" number)
2078 ("followups to author" "followup" string)))
2079 (types '((number ("less than" <)
2082 (string ("substring" s)
2086 (perms '(("temporary" (current-time-string))
2094 (if (eq type 'lower)
2099 (setq header (car headers))
2105 (let ((ts (cdr (assoc (nth 2 header) types)))
2121 'gnus-summary-score-entry
2123 (if (or (string= (nth 1 header)
2125 (string= (nth 1 header)
2128 (list 'gnus-summary-header
2130 (list 'quote (nth 1 (car ts)))
2131 (list 'gnus-score-delta-default
2138 (list (nreverse outp))))
2141 (list (nreverse outt))))
2143 (setq headers (cdr headers)))
2144 (list (nreverse outh))))))))
2148 (defun gnus-summary-mode (&optional group)
2149 "Major mode for reading articles.
2151 All normal editing commands are switched off.
2152 \\<gnus-summary-mode-map>
2153 Each line in this buffer represents one article. To read an
2154 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2155 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2158 You can also post articles and send mail from this buffer. To
2159 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2160 of an article, type `\\[gnus-summary-reply]'.
2162 There are approx. one gazillion commands you can execute in this
2163 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2165 The following commands are available:
2167 \\{gnus-summary-mode-map}"
2169 (kill-all-local-variables)
2170 (when (gnus-visual-p 'summary-menu 'menu)
2171 (gnus-summary-make-menu-bar)
2172 (gnus-summary-make-tool-bar))
2173 (gnus-summary-make-local-variables)
2174 (gnus-make-thread-indent-array)
2175 (gnus-simplify-mode-line)
2176 (setq major-mode 'gnus-summary-mode)
2177 (setq mode-name "Summary")
2178 (make-local-variable 'minor-mode-alist)
2179 (use-local-map gnus-summary-mode-map)
2180 (buffer-disable-undo)
2181 (setq buffer-read-only t) ;Disable modification
2182 (setq truncate-lines t)
2183 (setq selective-display t)
2184 (setq selective-display-ellipses t) ;Display `...'
2185 (gnus-summary-set-display-table)
2186 (gnus-set-default-directory)
2187 (setq gnus-newsgroup-name group)
2188 (make-local-variable 'gnus-summary-line-format)
2189 (make-local-variable 'gnus-summary-line-format-spec)
2190 (make-local-variable 'gnus-summary-dummy-line-format)
2191 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2192 (make-local-variable 'gnus-summary-mark-positions)
2193 (make-local-hook 'pre-command-hook)
2194 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2195 (gnus-run-hooks 'gnus-summary-mode-hook)
2196 (mm-enable-multibyte)
2197 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2198 (gnus-update-summary-mark-positions))
2200 (defun gnus-summary-make-local-variables ()
2201 "Make all the local summary buffer variables."
2203 (dolist (local gnus-summary-local-variables)
2206 (if (eq (cdr local) 'global)
2207 ;; Copy the global value of the variable.
2208 (setq global (symbol-value (car local)))
2209 ;; Use the value from the list.
2210 (setq global (eval (cdr local))))
2211 (set (make-local-variable (car local)) global))
2212 ;; Simple nil-valued local variable.
2213 (set (make-local-variable local) nil)))))
2215 (defun gnus-summary-clear-local-variables ()
2216 (let ((locals gnus-summary-local-variables))
2218 (if (consp (car locals))
2219 (and (vectorp (caar locals))
2220 (set (caar locals) nil))
2221 (and (vectorp (car locals))
2222 (set (car locals) nil)))
2223 (setq locals (cdr locals)))))
2225 ;; Summary data functions.
2227 (defmacro gnus-data-number (data)
2230 (defmacro gnus-data-set-number (data number)
2231 `(setcar ,data ,number))
2233 (defmacro gnus-data-mark (data)
2236 (defmacro gnus-data-set-mark (data mark)
2237 `(setcar (nthcdr 1 ,data) ,mark))
2239 (defmacro gnus-data-pos (data)
2242 (defmacro gnus-data-set-pos (data pos)
2243 `(setcar (nthcdr 2 ,data) ,pos))
2245 (defmacro gnus-data-header (data)
2248 (defmacro gnus-data-set-header (data header)
2249 `(setf (nth 3 ,data) ,header))
2251 (defmacro gnus-data-level (data)
2254 (defmacro gnus-data-unread-p (data)
2255 `(= (nth 1 ,data) gnus-unread-mark))
2257 (defmacro gnus-data-read-p (data)
2258 `(/= (nth 1 ,data) gnus-unread-mark))
2260 (defmacro gnus-data-pseudo-p (data)
2261 `(consp (nth 3 ,data)))
2263 (defmacro gnus-data-find (number)
2264 `(assq ,number gnus-newsgroup-data))
2266 (defmacro gnus-data-find-list (number &optional data)
2267 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2268 (memq (assq ,number bdata)
2271 (defmacro gnus-data-make (number mark pos header level)
2272 `(list ,number ,mark ,pos ,header ,level))
2274 (defun gnus-data-enter (after-article number mark pos header level offset)
2275 (let ((data (gnus-data-find-list after-article)))
2277 (error "No such article: %d" after-article))
2278 (setcdr data (cons (gnus-data-make number mark pos header level)
2280 (setq gnus-newsgroup-data-reverse nil)
2281 (gnus-data-update-list (cddr data) offset)))
2283 (defun gnus-data-enter-list (after-article list &optional offset)
2285 (let ((data (and after-article (gnus-data-find-list after-article)))
2289 (let ((odata gnus-newsgroup-data))
2290 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2292 (gnus-data-update-list odata offset)))
2293 ;; Find the last element in the list to be spliced into the main
2296 (setq list (cdr list)))
2299 (setcdr list gnus-newsgroup-data)
2300 (setq gnus-newsgroup-data ilist)
2302 (gnus-data-update-list (cdr list) offset)))
2303 (setcdr list (cdr data))
2306 (gnus-data-update-list (cdr list) offset))))
2307 (setq gnus-newsgroup-data-reverse nil))))
2309 (defun gnus-data-remove (article &optional offset)
2310 (let ((data gnus-newsgroup-data))
2311 (if (= (gnus-data-number (car data)) article)
2313 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2314 gnus-newsgroup-data-reverse nil)
2316 (gnus-data-update-list gnus-newsgroup-data offset)))
2318 (when (= (gnus-data-number (cadr data)) article)
2319 (setcdr data (cddr data))
2321 (gnus-data-update-list (cdr data) offset))
2323 gnus-newsgroup-data-reverse nil))
2324 (setq data (cdr data))))))
2326 (defmacro gnus-data-list (backward)
2328 (or gnus-newsgroup-data-reverse
2329 (setq gnus-newsgroup-data-reverse
2330 (reverse gnus-newsgroup-data)))
2331 gnus-newsgroup-data))
2333 (defun gnus-data-update-list (data offset)
2334 "Add OFFSET to the POS of all data entries in DATA."
2335 (setq gnus-newsgroup-data-reverse nil)
2337 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2338 (setq data (cdr data))))
2340 (defun gnus-summary-article-pseudo-p (article)
2341 "Say whether this article is a pseudo article or not."
2342 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2344 (defmacro gnus-summary-article-sparse-p (article)
2345 "Say whether this article is a sparse article or not."
2346 `(memq ,article gnus-newsgroup-sparse))
2348 (defmacro gnus-summary-article-ancient-p (article)
2349 "Say whether this article is a sparse article or not."
2350 `(memq ,article gnus-newsgroup-ancient))
2352 (defun gnus-article-parent-p (number)
2353 "Say whether this article is a parent or not."
2354 (let ((data (gnus-data-find-list number)))
2355 (and (cdr data) ; There has to be an article after...
2356 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2357 (gnus-data-level (nth 1 data))))))
2359 (defun gnus-article-children (number)
2360 "Return a list of all children to NUMBER."
2361 (let* ((data (gnus-data-find-list number))
2362 (level (gnus-data-level (car data)))
2364 (setq data (cdr data))
2366 (= (gnus-data-level (car data)) (1+ level)))
2367 (push (gnus-data-number (car data)) children)
2368 (setq data (cdr data)))
2371 (defmacro gnus-summary-skip-intangible ()
2372 "If the current article is intangible, then jump to a different article."
2373 '(let ((to (get-text-property (point) 'gnus-intangible)))
2374 (and to (gnus-summary-goto-subject to))))
2376 (defmacro gnus-summary-article-intangible-p ()
2377 "Say whether this article is intangible or not."
2378 '(get-text-property (point) 'gnus-intangible))
2380 (defun gnus-article-read-p (article)
2381 "Say whether ARTICLE is read or not."
2382 (not (or (memq article gnus-newsgroup-marked)
2383 (memq article gnus-newsgroup-unreads)
2384 (memq article gnus-newsgroup-unselected)
2385 (memq article gnus-newsgroup-dormant))))
2387 ;; Some summary mode macros.
2389 (defmacro gnus-summary-article-number ()
2390 "The article number of the article on the current line.
2391 If there isn't an article number here, then we return the current
2394 (gnus-summary-skip-intangible)
2395 (or (get-text-property (point) 'gnus-number)
2396 (gnus-summary-last-subject))))
2398 (defmacro gnus-summary-article-header (&optional number)
2399 "Return the header of article NUMBER."
2400 `(gnus-data-header (gnus-data-find
2401 ,(or number '(gnus-summary-article-number)))))
2403 (defmacro gnus-summary-thread-level (&optional number)
2404 "Return the level of thread that starts with article NUMBER."
2405 `(if (and (eq gnus-summary-make-false-root 'dummy)
2406 (get-text-property (point) 'gnus-intangible))
2408 (gnus-data-level (gnus-data-find
2409 ,(or number '(gnus-summary-article-number))))))
2411 (defmacro gnus-summary-article-mark (&optional number)
2412 "Return the mark of article NUMBER."
2413 `(gnus-data-mark (gnus-data-find
2414 ,(or number '(gnus-summary-article-number)))))
2416 (defmacro gnus-summary-article-pos (&optional number)
2417 "Return the position of the line of article NUMBER."
2418 `(gnus-data-pos (gnus-data-find
2419 ,(or number '(gnus-summary-article-number)))))
2421 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2422 (defmacro gnus-summary-article-subject (&optional number)
2423 "Return current subject string or nil if nothing."
2426 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2427 '(gnus-data-header (assq (gnus-summary-article-number)
2428 gnus-newsgroup-data)))))
2431 (mail-header-subject headers))))
2433 (defmacro gnus-summary-article-score (&optional number)
2434 "Return current article score."
2435 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2436 gnus-newsgroup-scored))
2437 gnus-summary-default-score 0))
2439 (defun gnus-summary-article-children (&optional number)
2440 "Return a list of article numbers that are children of article NUMBER."
2441 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2442 (level (gnus-data-level (car data)))
2444 (while (and (setq data (cdr data))
2445 (> (setq l (gnus-data-level (car data))) level))
2446 (and (= (1+ level) l)
2447 (push (gnus-data-number (car data))
2449 (nreverse children)))
2451 (defun gnus-summary-article-parent (&optional number)
2452 "Return the article number of the parent of article NUMBER."
2453 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2454 (gnus-data-list t)))
2455 (level (gnus-data-level (car data))))
2457 () ; This is a root.
2458 ;; We search until we find an article with a level less than
2459 ;; this one. That function has to be the parent.
2460 (while (and (setq data (cdr data))
2461 (not (< (gnus-data-level (car data)) level))))
2462 (and data (gnus-data-number (car data))))))
2464 (defun gnus-unread-mark-p (mark)
2465 "Say whether MARK is the unread mark."
2466 (= mark gnus-unread-mark))
2468 (defun gnus-read-mark-p (mark)
2469 "Say whether MARK is one of the marks that mark as read.
2470 This is all marks except unread, ticked, dormant, and expirable."
2471 (not (or (= mark gnus-unread-mark)
2472 (= mark gnus-ticked-mark)
2473 (= mark gnus-dormant-mark)
2474 (= mark gnus-expirable-mark))))
2476 (defmacro gnus-article-mark (number)
2477 "Return the MARK of article NUMBER.
2478 This macro should only be used when computing the mark the \"first\"
2479 time; i.e., when generating the summary lines. After that,
2480 `gnus-summary-article-mark' should be used to examine the
2483 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2484 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2485 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2486 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2487 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2488 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2489 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2490 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2491 gnus-ancient-mark))))
2493 ;; Saving hidden threads.
2495 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2496 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2498 (defmacro gnus-save-hidden-threads (&rest forms)
2499 "Save hidden threads, eval FORMS, and restore the hidden threads."
2500 (let ((config (make-symbol "config")))
2501 `(let ((,config (gnus-hidden-threads-configuration)))
2505 (gnus-restore-hidden-threads-configuration ,config)))))
2507 (defun gnus-data-compute-positions ()
2508 "Compute the positions of all articles."
2509 (setq gnus-newsgroup-data-reverse nil)
2510 (let ((data gnus-newsgroup-data))
2512 (gnus-save-hidden-threads
2513 (gnus-summary-show-all-threads)
2514 (goto-char (point-min))
2516 (while (get-text-property (point) 'gnus-intangible)
2518 (gnus-data-set-pos (car data) (+ (point) 3))
2519 (setq data (cdr data))
2520 (forward-line 1))))))
2522 (defun gnus-hidden-threads-configuration ()
2523 "Return the current hidden threads configuration."
2526 (goto-char (point-min))
2527 (while (search-forward "\r" nil t)
2528 (push (1- (point)) config))
2531 (defun gnus-restore-hidden-threads-configuration (config)
2532 "Restore hidden threads configuration from CONFIG."
2534 (let (point buffer-read-only)
2535 (while (setq point (pop config))
2536 (when (and (< point (point-max))
2538 (eq (char-after) ?\n))
2539 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2541 ;; Various summary mode internalish functions.
2543 (defun gnus-mouse-pick-article (e)
2546 (gnus-summary-next-page nil t))
2548 (defun gnus-summary-set-display-table ()
2549 "Change the display table.
2550 Odd characters have a tendency to mess
2551 up nicely formatted displays - we make all possible glyphs
2552 display only a single character."
2554 ;; We start from the standard display table, if any.
2555 (let ((table (or (copy-sequence standard-display-table)
2556 (make-display-table)))
2558 ;; Nix out all the control chars...
2559 (while (>= (setq i (1- i)) 0)
2560 (aset table i [??]))
2561 ;; ... but not newline and cr, of course. (cr is necessary for the
2562 ;; selective display).
2563 (aset table ?\n nil)
2564 (aset table ?\r nil)
2565 ;; We keep TAB as well.
2566 (aset table ?\t nil)
2567 ;; We nix out any glyphs over 126 that are not set already.
2569 (while (>= (setq i (1- i)) 127)
2570 ;; Only modify if the entry is nil.
2571 (unless (aref table i)
2572 (aset table i [??]))))
2573 (setq buffer-display-table table)))
2575 (defun gnus-summary-setup-buffer (group)
2576 "Initialize summary buffer."
2577 (let ((buffer (concat "*Summary " group "*")))
2578 (if (get-buffer buffer)
2581 (setq gnus-summary-buffer (current-buffer))
2582 (not gnus-newsgroup-prepared))
2583 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2584 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2585 (gnus-summary-mode group)
2587 (gnus-carpal-setup-buffer 'summary))
2588 (unless gnus-single-article-buffer
2589 (make-local-variable 'gnus-article-buffer)
2590 (make-local-variable 'gnus-article-current)
2591 (make-local-variable 'gnus-original-article-buffer))
2592 (setq gnus-newsgroup-name group)
2595 (defun gnus-set-global-variables ()
2596 "Set the global equivalents of the buffer-local variables.
2597 They are set to the latest values they had. These reflect the summary
2598 buffer that was in action when the last article was fetched."
2599 (when (eq major-mode 'gnus-summary-mode)
2600 (setq gnus-summary-buffer (current-buffer))
2601 (let ((name gnus-newsgroup-name)
2602 (marked gnus-newsgroup-marked)
2603 (unread gnus-newsgroup-unreads)
2604 (headers gnus-current-headers)
2605 (data gnus-newsgroup-data)
2606 (summary gnus-summary-buffer)
2607 (article-buffer gnus-article-buffer)
2608 (original gnus-original-article-buffer)
2609 (gac gnus-article-current)
2610 (reffed gnus-reffed-article-number)
2611 (score-file gnus-current-score-file)
2612 (default-charset gnus-newsgroup-charset))
2614 (set-buffer gnus-group-buffer)
2615 (setq gnus-newsgroup-name name
2616 gnus-newsgroup-marked marked
2617 gnus-newsgroup-unreads unread
2618 gnus-current-headers headers
2619 gnus-newsgroup-data data
2620 gnus-article-current gac
2621 gnus-summary-buffer summary
2622 gnus-article-buffer article-buffer
2623 gnus-original-article-buffer original
2624 gnus-reffed-article-number reffed
2625 gnus-current-score-file score-file
2626 gnus-newsgroup-charset default-charset)
2627 ;; The article buffer also has local variables.
2628 (when (gnus-buffer-live-p gnus-article-buffer)
2629 (set-buffer gnus-article-buffer)
2630 (setq gnus-summary-buffer summary))))))
2632 (defun gnus-summary-article-unread-p (article)
2633 "Say whether ARTICLE is unread or not."
2634 (memq article gnus-newsgroup-unreads))
2636 (defun gnus-summary-first-article-p (&optional article)
2637 "Return whether ARTICLE is the first article in the buffer."
2638 (if (not (setq article (or article (gnus-summary-article-number))))
2640 (eq article (caar gnus-newsgroup-data))))
2642 (defun gnus-summary-last-article-p (&optional article)
2643 "Return whether ARTICLE is the last article in the buffer."
2644 (if (not (setq article (or article (gnus-summary-article-number))))
2645 ;; All non-existent numbers are the last article. :-)
2647 (not (cdr (gnus-data-find-list article)))))
2649 (defun gnus-make-thread-indent-array ()
2651 (unless (and gnus-thread-indent-array
2652 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2653 (setq gnus-thread-indent-array (make-vector 201 "")
2654 gnus-thread-indent-array-level gnus-thread-indent-level)
2656 (aset gnus-thread-indent-array n
2657 (make-string (* n gnus-thread-indent-level) ? ))
2660 (defun gnus-update-summary-mark-positions ()
2661 "Compute where the summary marks are to go."
2663 (when (gnus-buffer-exists-p gnus-summary-buffer)
2664 (set-buffer gnus-summary-buffer))
2665 (let ((gnus-replied-mark 129)
2666 (gnus-score-below-mark 130)
2667 (gnus-score-over-mark 130)
2668 (gnus-download-mark 131)
2669 (spec gnus-summary-line-format-spec)
2672 (gnus-set-work-buffer)
2673 (let ((gnus-summary-line-format-spec spec)
2674 (gnus-newsgroup-downloadable '((0 . t))))
2675 (gnus-summary-insert-line
2676 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2677 (goto-char (point-min))
2678 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2679 (- (point) (point-min) 1)))))
2680 (goto-char (point-min))
2681 (push (cons 'replied (and (search-forward "\201" nil t)
2682 (- (point) (point-min) 1)))
2684 (goto-char (point-min))
2685 (push (cons 'score (and (search-forward "\202" nil t)
2686 (- (point) (point-min) 1)))
2688 (goto-char (point-min))
2689 (push (cons 'download
2690 (and (search-forward "\203" nil t)
2691 (- (point) (point-min) 1)))
2693 (setq gnus-summary-mark-positions pos))))
2695 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2696 "Insert a dummy root in the summary buffer."
2698 (gnus-add-text-properties
2699 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2700 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2702 (defun gnus-summary-from-or-to-or-newsgroups (header)
2703 (let ((to (cdr (assq 'To (mail-header-extra header))))
2704 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2705 (mail-parse-charset gnus-newsgroup-charset)
2706 (mail-parse-ignored-charsets
2707 (save-excursion (set-buffer gnus-summary-buffer)
2708 gnus-newsgroup-ignored-charsets)))
2711 gnus-ignored-from-addresses
2712 (string-match gnus-ignored-from-addresses
2713 (mail-header-from header)))
2715 (or (car (funcall gnus-extract-address-components
2717 gnus-decode-encoded-word-function to)))
2718 (funcall gnus-decode-encoded-word-function to))))
2720 gnus-ignored-from-addresses
2721 (string-match gnus-ignored-from-addresses
2722 (mail-header-from header)))
2723 (concat "=> " newsgroups))
2725 (or (car (funcall gnus-extract-address-components
2726 (mail-header-from header)))
2727 (mail-header-from header))))))
2729 (defun gnus-summary-insert-line (gnus-tmp-header
2730 gnus-tmp-level gnus-tmp-current
2731 gnus-tmp-unread gnus-tmp-replied
2732 gnus-tmp-expirable gnus-tmp-subject-or-nil
2733 &optional gnus-tmp-dummy gnus-tmp-score
2735 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2736 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2737 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2738 (gnus-tmp-score-char
2739 (if (or (null gnus-summary-default-score)
2740 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2741 gnus-summary-zcore-fuzz))
2743 (if (< gnus-tmp-score gnus-summary-default-score)
2744 gnus-score-below-mark gnus-score-over-mark)))
2746 (cond (gnus-tmp-process gnus-process-mark)
2747 ((memq gnus-tmp-current gnus-newsgroup-cached)
2749 (gnus-tmp-replied gnus-replied-mark)
2750 ((memq gnus-tmp-current gnus-newsgroup-saved)
2752 (t gnus-unread-mark)))
2753 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2756 ((string-match "<[^>]+> *$" gnus-tmp-from)
2757 (let ((beg (match-beginning 0)))
2758 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2759 (substring gnus-tmp-from (1+ (match-beginning 0))
2760 (1- (match-end 0))))
2761 (substring gnus-tmp-from 0 beg))))
2762 ((string-match "(.+)" gnus-tmp-from)
2763 (substring gnus-tmp-from
2764 (1+ (match-beginning 0)) (1- (match-end 0))))
2766 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2767 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2768 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2769 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2770 (buffer-read-only nil))
2771 (when (string= gnus-tmp-name "")
2772 (setq gnus-tmp-name gnus-tmp-from))
2773 (unless (numberp gnus-tmp-lines)
2774 (setq gnus-tmp-lines 0))
2775 (gnus-put-text-property
2777 (progn (eval gnus-summary-line-format-spec) (point))
2778 'gnus-number gnus-tmp-number)
2779 (when (gnus-visual-p 'summary-highlight 'highlight)
2781 (gnus-run-hooks 'gnus-summary-update-hook)
2784 (defun gnus-summary-update-line (&optional dont-update)
2785 "Update summary line after change."
2786 (when (and gnus-summary-default-score
2787 (not gnus-summary-inhibit-highlight))
2788 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2789 (article (gnus-summary-article-number))
2790 (score (gnus-summary-article-score article)))
2792 (if (and gnus-summary-mark-below
2793 (< (gnus-summary-article-score)
2794 gnus-summary-mark-below))
2795 ;; This article has a low score, so we mark it as read.
2796 (when (memq article gnus-newsgroup-unreads)
2797 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2798 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2799 ;; This article was previously marked as read on account
2800 ;; of a low score, but now it has risen, so we mark it as
2802 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2803 (gnus-summary-update-mark
2804 (if (or (null gnus-summary-default-score)
2805 (<= (abs (- score gnus-summary-default-score))
2806 gnus-summary-zcore-fuzz))
2808 (if (< score gnus-summary-default-score)
2809 gnus-score-below-mark gnus-score-over-mark))
2811 ;; Do visual highlighting.
2812 (when (gnus-visual-p 'summary-highlight 'highlight)
2813 (gnus-run-hooks 'gnus-summary-update-hook)))))
2815 (defvar gnus-tmp-new-adopts nil)
2817 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2818 "Return the number of articles in THREAD.
2819 This may be 0 in some cases -- if none of the articles in
2820 the thread are to be displayed."
2822 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2824 ((not (listp thread))
2826 ((and (consp thread) (cdr thread))
2829 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2832 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2835 (when (and level (zerop level) gnus-tmp-new-adopts)
2838 'gnus-summary-number-of-articles-in-thread
2839 gnus-tmp-new-adopts))))
2841 (if (> number 1) gnus-not-empty-thread-mark
2842 gnus-empty-thread-mark)
2845 (defun gnus-summary-set-local-parameters (group)
2846 "Go through the local params of GROUP and set all variable specs in that list."
2847 (let ((params (gnus-group-find-parameter group))
2850 (setq elem (car params)
2851 params (cdr params))
2852 (and (consp elem) ; Has to be a cons.
2853 (consp (cdr elem)) ; The cdr has to be a list.
2854 (symbolp (car elem)) ; Has to be a symbol in there.
2855 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2856 (ignore-errors ; So we set it.
2857 (make-local-variable (car elem))
2858 (set (car elem) (eval (nth 1 elem))))))))
2860 (defun gnus-summary-read-group (group &optional show-all no-article
2861 kill-buffer no-display backward
2863 "Start reading news in newsgroup GROUP.
2864 If SHOW-ALL is non-nil, already read articles are also listed.
2865 If NO-ARTICLE is non-nil, no article is selected initially.
2866 If NO-DISPLAY, don't generate a summary buffer."
2870 (let ((gnus-auto-select-next nil))
2871 (or (gnus-summary-read-group-1
2872 group show-all no-article
2873 kill-buffer no-display
2876 select-articles nil)))))
2877 (eq gnus-auto-select-next 'quietly))
2878 (set-buffer gnus-group-buffer)
2879 ;; The entry function called above goes to the next
2880 ;; group automatically, so we go two groups back
2881 ;; if we are searching for the previous group.
2883 (gnus-group-prev-unread-group 2))
2884 (if (not (equal group (gnus-group-group-name)))
2885 (setq group (gnus-group-group-name))
2889 (defun gnus-summary-read-group-1 (group show-all no-article
2890 kill-buffer no-display
2891 &optional select-articles)
2892 ;; Killed foreign groups can't be entered.
2893 (when (and (not (gnus-group-native-p group))
2894 (not (gnus-gethash group gnus-newsrc-hashtb)))
2895 (error "Dead non-native groups can't be entered"))
2896 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2897 (let* ((new-group (gnus-summary-setup-buffer group))
2898 (quit-config (gnus-group-quit-config group))
2899 (did-select (and new-group (gnus-select-newsgroup
2900 group show-all select-articles))))
2902 ;; This summary buffer exists already, so we just select it.
2904 (gnus-set-global-variables)
2906 (gnus-kill-or-deaden-summary kill-buffer))
2907 (gnus-configure-windows 'summary 'force)
2908 (gnus-set-mode-line 'summary)
2909 (gnus-summary-position-point)
2912 ;; We couldn't select this group.
2914 (when (and (eq major-mode 'gnus-summary-mode)
2915 (not (equal (current-buffer) kill-buffer)))
2916 (kill-buffer (current-buffer))
2917 (if (not quit-config)
2919 ;; Update the info -- marks might need to be removed,
2921 (gnus-summary-update-info)
2922 (set-buffer gnus-group-buffer)
2923 (gnus-group-jump-to-group group)
2924 (gnus-group-next-unread-group 1))
2925 (gnus-handle-ephemeral-exit quit-config)))
2926 (gnus-message 3 "Can't select group")
2928 ;; The user did a `C-g' while prompting for number of articles,
2929 ;; so we exit this group.
2930 ((eq did-select 'quit)
2931 (and (eq major-mode 'gnus-summary-mode)
2932 (not (equal (current-buffer) kill-buffer))
2933 (kill-buffer (current-buffer)))
2935 (gnus-kill-or-deaden-summary kill-buffer))
2936 (if (not quit-config)
2938 (set-buffer gnus-group-buffer)
2939 (gnus-group-jump-to-group group)
2940 (gnus-group-next-unread-group 1)
2941 (gnus-configure-windows 'group 'force))
2942 (gnus-handle-ephemeral-exit quit-config))
2943 ;; Finally signal the quit.
2945 ;; The group was successfully selected.
2947 (gnus-set-global-variables)
2948 ;; Save the active value in effect when the group was entered.
2949 (setq gnus-newsgroup-active
2951 (gnus-active gnus-newsgroup-name)))
2952 ;; You can change the summary buffer in some way with this hook.
2953 (gnus-run-hooks 'gnus-select-group-hook)
2954 ;; Set any local variables in the group parameters.
2955 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2956 (gnus-update-format-specifications
2957 nil 'summary 'summary-mode 'summary-dummy)
2958 (gnus-update-summary-mark-positions)
2959 ;; Do score processing.
2960 (when gnus-use-scoring
2961 (gnus-possibly-score-headers))
2962 ;; Check whether to fill in the gaps in the threads.
2963 (when gnus-build-sparse-threads
2964 (gnus-build-sparse-threads))
2965 ;; Find the initial limit.
2966 (if gnus-show-threads
2968 (let ((gnus-newsgroup-dormant nil))
2969 (gnus-summary-initial-limit show-all))
2970 (gnus-summary-initial-limit show-all))
2971 ;; When unthreaded, all articles are always shown.
2972 (setq gnus-newsgroup-limit
2974 (lambda (header) (mail-header-number header))
2975 gnus-newsgroup-headers)))
2976 ;; Generate the summary buffer.
2978 (gnus-summary-prepare))
2979 (when gnus-use-trees
2980 (gnus-tree-open group)
2981 (setq gnus-summary-highlight-line-function
2982 'gnus-tree-highlight-article))
2983 ;; If the summary buffer is empty, but there are some low-scored
2984 ;; articles or some excluded dormants, we include these in the
2986 (when (and (zerop (buffer-size))
2988 (cond (gnus-newsgroup-dormant
2989 (gnus-summary-limit-include-dormant))
2990 ((and gnus-newsgroup-scored show-all)
2991 (gnus-summary-limit-include-expunged t))))
2992 ;; Function `gnus-apply-kill-file' must be called in this hook.
2993 (gnus-run-hooks 'gnus-apply-kill-hook)
2994 (if (and (zerop (buffer-size))
2997 ;; This newsgroup is empty.
2998 (gnus-summary-catchup-and-exit nil t)
2999 (gnus-message 6 "No unread news")
3001 (gnus-kill-or-deaden-summary kill-buffer))
3002 ;; Return nil from this function.
3004 ;; Hide conversation thread subtrees. We cannot do this in
3005 ;; gnus-summary-prepare-hook since kill processing may not
3006 ;; work with hidden articles.
3007 (and gnus-show-threads
3008 gnus-thread-hide-subtree
3009 (gnus-summary-hide-all-threads))
3011 (gnus-kill-or-deaden-summary kill-buffer))
3012 ;; Show first unread article if requested.
3013 (if (and (not no-article)
3015 gnus-newsgroup-unreads
3016 gnus-auto-select-first)
3018 (gnus-configure-windows 'summary)
3020 ((eq gnus-auto-select-first 'best)
3021 (gnus-summary-best-unread-article))
3022 ((eq gnus-auto-select-first t)
3023 (gnus-summary-first-unread-article))
3024 ((gnus-functionp gnus-auto-select-first)
3025 (funcall gnus-auto-select-first))))
3026 ;; Don't select any articles, just move point to the first
3027 ;; article in the group.
3028 (goto-char (point-min))
3029 (gnus-summary-position-point)
3030 (gnus-configure-windows 'summary 'force)
3031 (gnus-set-mode-line 'summary))
3032 (when (get-buffer-window gnus-group-buffer t)
3033 ;; Gotta use windows, because recenter does weird stuff if
3034 ;; the current buffer ain't the displayed window.
3035 (let ((owin (selected-window)))
3036 (select-window (get-buffer-window gnus-group-buffer t))
3037 (when (gnus-group-goto-group group)
3039 (select-window owin)))
3040 ;; Mark this buffer as "prepared".
3041 (setq gnus-newsgroup-prepared t)
3042 (gnus-run-hooks 'gnus-summary-prepared-hook)
3045 (defun gnus-summary-prepare ()
3046 "Generate the summary buffer."
3048 (let ((buffer-read-only nil))
3050 (setq gnus-newsgroup-data nil
3051 gnus-newsgroup-data-reverse nil)
3052 (gnus-run-hooks 'gnus-summary-generate-hook)
3053 ;; Generate the buffer, either with threads or without.
3054 (when gnus-newsgroup-headers
3055 (gnus-summary-prepare-threads
3056 (if gnus-show-threads
3057 (gnus-sort-gathered-threads
3058 (funcall gnus-summary-thread-gathering-function
3060 (gnus-cut-threads (gnus-make-threads)))))
3061 ;; Unthreaded display.
3062 (gnus-sort-articles gnus-newsgroup-headers))))
3063 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3064 ;; Call hooks for modifying summary buffer.
3065 (goto-char (point-min))
3066 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3068 (defsubst gnus-general-simplify-subject (subject)
3069 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3072 ;; Truncate the subject.
3073 (gnus-simplify-subject-functions
3074 (gnus-map-function gnus-simplify-subject-functions subject))
3075 ((numberp gnus-summary-gather-subject-limit)
3076 (setq subject (gnus-simplify-subject-re subject))
3077 (if (> (length subject) gnus-summary-gather-subject-limit)
3078 (substring subject 0 gnus-summary-gather-subject-limit)
3080 ;; Fuzzily simplify it.
3081 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3082 (gnus-simplify-subject-fuzzy subject))
3083 ;; Just remove the leading "Re:".
3085 (gnus-simplify-subject-re subject))))
3087 (if (and gnus-summary-gather-exclude-subject
3088 (string-match gnus-summary-gather-exclude-subject subject))
3089 nil ; This article shouldn't be gathered
3092 (defun gnus-summary-simplify-subject-query ()
3093 "Query where the respool algorithm would put this article."
3095 (gnus-summary-select-article)
3096 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3098 (defun gnus-gather-threads-by-subject (threads)
3099 "Gather threads by looking at Subject headers."
3100 (if (not gnus-summary-make-false-root)
3102 (let ((hashtb (gnus-make-hashtable 1024))
3105 subject hthread whole-subject)
3107 (setq subject (gnus-general-simplify-subject
3108 (setq whole-subject (mail-header-subject
3111 (if (setq hthread (gnus-gethash subject hashtb))
3113 ;; We enter a dummy root into the thread, if we
3114 ;; haven't done that already.
3115 (unless (stringp (caar hthread))
3116 (setcar hthread (list whole-subject (car hthread))))
3117 ;; We add this new gathered thread to this gathered
3119 (setcdr (car hthread)
3120 (nconc (cdar hthread) (list (car threads))))
3121 ;; Remove it from the list of threads.
3122 (setcdr prev (cdr threads))
3123 (setq threads prev))
3124 ;; Enter this thread into the hash table.
3125 (gnus-sethash subject threads hashtb)))
3127 (setq threads (cdr threads)))
3130 (defun gnus-gather-threads-by-references (threads)
3131 "Gather threads by looking at References headers."
3132 (let ((idhashtb (gnus-make-hashtable 1024))
3133 (thhashtb (gnus-make-hashtable 1024))
3136 ids references id gthread gid entered ref)
3138 (when (setq references (mail-header-references (caar threads)))
3139 (setq id (mail-header-id (caar threads))
3140 ids (gnus-split-references references)
3142 (while (setq ref (pop ids))
3143 (setq ids (delete ref ids))
3144 (if (not (setq gid (gnus-gethash ref idhashtb)))
3146 (gnus-sethash ref id idhashtb)
3147 (gnus-sethash id threads thhashtb))
3148 (setq gthread (gnus-gethash gid thhashtb))
3150 ;; We enter a dummy root into the thread, if we
3151 ;; haven't done that already.
3152 (unless (stringp (caar gthread))
3153 (setcar gthread (list (mail-header-subject (caar gthread))
3155 ;; We add this new gathered thread to this gathered
3157 (setcdr (car gthread)
3158 (nconc (cdar gthread) (list (car threads)))))
3159 ;; Add it into the thread hash table.
3160 (gnus-sethash id gthread thhashtb)
3162 ;; Remove it from the list of threads.
3163 (setcdr prev (cdr threads))
3164 (setq threads prev))))
3166 (setq threads (cdr threads)))
3169 (defun gnus-sort-gathered-threads (threads)
3170 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3171 (let ((result threads))
3173 (when (stringp (caar threads))
3174 (setcdr (car threads)
3175 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3176 (setq threads (cdr threads)))
3179 (defun gnus-thread-loop-p (root thread)
3180 "Say whether ROOT is in THREAD."
3181 (let ((stack (list thread))
3184 (while (setq thread (pop stack))
3185 (setq th (cdr thread))
3187 (not (eq (caar th) root)))
3190 ;; We have found a loop.
3192 (setcdr thread (delq (car th) (cdr thread)))
3193 (if (boundp (setq ref-dep (intern "none"
3194 gnus-newsgroup-dependencies)))
3195 (setcdr (symbol-value ref-dep)
3196 (nconc (cdr (symbol-value ref-dep))
3198 (set ref-dep (list nil (car th))))
3201 ;; Push all the subthreads onto the stack.
3202 (push (cdr thread) stack)))
3205 (defun gnus-make-threads ()
3206 "Go through the dependency hashtb and find the roots. Return all threads."
3208 (while (catch 'infloop
3211 ;; Deal with self-referencing References loops.
3212 (when (and (car (symbol-value refs))
3219 (car (symbol-value refs)) thread))
3220 (cdr (symbol-value refs)))))))
3223 (unless (car (symbol-value refs))
3224 ;; These threads do not refer back to any other articles,
3225 ;; so they're roots.
3226 (setq threads (append (cdr (symbol-value refs)) threads))))
3227 gnus-newsgroup-dependencies)))
3230 ;; Build the thread tree.
3231 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3232 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3234 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3235 if it was already present.
3237 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3238 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3239 Message-IDs will be renamed be renamed to a unique Message-ID before
3242 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3243 (let* ((id (mail-header-id header))
3244 (id-dep (and id (intern id dependencies)))
3245 ref ref-dep ref-header)
3246 ;; Enter this `header' in the `dependencies' table.
3250 ;; The first two cases do the normal part: enter a new `header'
3251 ;; in the `dependencies' table.
3252 ((not (boundp id-dep))
3253 (set id-dep (list header)))
3254 ((null (car (symbol-value id-dep)))
3255 (setcar (symbol-value id-dep) header))
3257 ;; From here the `header' was already present in the
3258 ;; `dependencies' table.
3260 ;; Overrides an existing entry;
3261 ;; just set the header part of the entry.
3262 (setcar (symbol-value id-dep) header))
3264 ;; Renames the existing `header' to a unique Message-ID.
3265 ((not gnus-summary-ignore-duplicates)
3266 ;; An article with this Message-ID has already been seen.
3267 ;; We rename the Message-ID.
3268 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3270 (mail-header-set-id header id))
3272 ;; The last case ignores an existing entry, except it adds any
3273 ;; additional Xrefs (in case the two articles came from different
3275 ;; Also sets `header' to `nil' meaning that the `dependencies'
3276 ;; table was *not* modified.
3278 (mail-header-set-xref
3279 (car (symbol-value id-dep))
3280 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3282 (or (mail-header-xref header) "")))
3286 ;; First check if that we are not creating a References loop.
3287 (setq ref (gnus-parent-id (mail-header-references header)))
3289 (setq ref-dep (intern-soft ref dependencies))
3291 (setq ref-header (car (symbol-value ref-dep))))
3292 (if (string= id ref)
3293 ;; Yuk! This is a reference loop. Make the article be a
3296 (mail-header-set-references (car (symbol-value id-dep)) "none")
3298 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3299 (setq ref (gnus-parent-id (mail-header-references header)))
3300 (setq ref-dep (intern (or ref "none") dependencies))
3301 (if (boundp ref-dep)
3302 (setcdr (symbol-value ref-dep)
3303 (nconc (cdr (symbol-value ref-dep))
3304 (list (symbol-value id-dep))))
3305 (set ref-dep (list nil (symbol-value id-dep)))))
3308 (defun gnus-build-sparse-threads ()
3309 (let ((headers gnus-newsgroup-headers)
3310 (mail-parse-charset gnus-newsgroup-charset)
3311 (gnus-summary-ignore-duplicates t)
3312 header references generation relations
3313 subject child end new-child date)
3314 ;; First we create an alist of generations/relations, where
3315 ;; generations is how much we trust the relation, and the relation
3317 (gnus-message 7 "Making sparse threads...")
3319 (nnheader-set-temp-buffer " *gnus sparse threads*")
3320 (while (setq header (pop headers))
3321 (when (and (setq references (mail-header-references header))
3322 (not (string= references "")))
3324 (setq child (mail-header-id header)
3325 subject (mail-header-subject header)
3326 date (mail-header-date header)
3328 (while (search-backward ">" nil t)
3329 (setq end (1+ (point)))
3330 (when (search-backward "<" nil t)
3331 (setq new-child (buffer-substring (point) end))
3332 (push (list (incf generation)
3333 child (setq child new-child)
3337 (push (list (1+ generation) child nil subject) relations))
3339 (kill-buffer (current-buffer)))
3340 ;; Sort over trustworthiness.
3343 (when (gnus-dependencies-add-header
3344 (make-full-mail-header
3345 gnus-reffed-article-number
3346 (nth 3 relation) "" (or (nth 4 relation) "")
3348 (or (nth 2 relation) "") 0 0 "")
3349 gnus-newsgroup-dependencies nil)
3350 (push gnus-reffed-article-number gnus-newsgroup-limit)
3351 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3352 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3353 gnus-newsgroup-reads)
3354 (decf gnus-reffed-article-number)))
3355 (sort relations 'car-less-than-car))
3356 (gnus-message 7 "Making sparse threads...done")))
3358 (defun gnus-build-old-threads ()
3359 ;; Look at all the articles that refer back to old articles, and
3360 ;; fetch the headers for the articles that aren't there. This will
3361 ;; build complete threads - if the roots haven't been expired by the
3363 (let ((mail-parse-charset gnus-newsgroup-charset)
3367 (when (not (car (symbol-value refs)))
3368 (setq heads (cdr (symbol-value refs)))
3370 (if (memq (mail-header-number (caar heads))
3371 gnus-newsgroup-dormant)
3372 (setq heads (cdr heads))
3373 (setq id (symbol-name refs))
3374 (while (and (setq id (gnus-build-get-header id))
3375 (not (car (gnus-id-to-thread id)))))
3376 (setq heads nil)))))
3377 gnus-newsgroup-dependencies)))
3379 ;; This function has to be called with point after the article number
3380 ;; on the beginning of the line.
3381 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3382 (let ((eol (gnus-point-at-eol))
3383 (buffer (current-buffer))
3386 ;; overview: [num subject from date id refs chars lines misc]
3389 (narrow-to-region (point) eol)
3394 (make-full-mail-header
3396 (funcall gnus-decode-encoded-word-function
3397 (nnheader-nov-field)) ; subject
3398 (funcall gnus-decode-encoded-word-function
3399 (nnheader-nov-field)) ; from
3400 (nnheader-nov-field) ; date
3401 (nnheader-nov-read-message-id) ; id
3402 (nnheader-nov-field) ; refs
3403 (nnheader-nov-read-integer) ; chars
3404 (nnheader-nov-read-integer) ; lines
3406 (if (looking-at "Xref: ")
3407 (goto-char (match-end 0)))
3408 (nnheader-nov-field)) ; Xref
3409 (nnheader-nov-parse-extra)))) ; extra
3413 (when gnus-alter-header-function
3414 (funcall gnus-alter-header-function header))
3415 (gnus-dependencies-add-header header dependencies force-new)))
3417 (defun gnus-build-get-header (id)
3418 "Look through the buffer of NOV lines and find the header to ID.
3419 Enter this line into the dependencies hash table, and return
3420 the id of the parent article (if any)."
3421 (let ((deps gnus-newsgroup-dependencies)
3425 (set-buffer nntp-server-buffer)
3426 (let ((case-fold-search nil))
3427 (goto-char (point-min))
3428 (while (and (not found)
3429 (search-forward id nil t))
3431 (setq found (looking-at
3432 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3433 (regexp-quote id))))
3434 (or found (beginning-of-line 2)))
3438 (setq header (gnus-nov-parse-line
3439 (read (current-buffer)) deps))
3440 (gnus-parent-id (mail-header-references header))))))
3442 (let ((number (mail-header-number header)))
3443 (push number gnus-newsgroup-limit)
3444 (push header gnus-newsgroup-headers)
3445 (if (memq number gnus-newsgroup-unselected)
3447 (push number gnus-newsgroup-unreads)
3448 (setq gnus-newsgroup-unselected
3449 (delq number gnus-newsgroup-unselected)))
3450 (push number gnus-newsgroup-ancient)))))))
3452 (defun gnus-build-all-threads ()
3453 "Read all the headers."
3454 (let ((gnus-summary-ignore-duplicates t)
3455 (mail-parse-charset gnus-newsgroup-charset)
3456 (dependencies gnus-newsgroup-dependencies)
3459 (set-buffer nntp-server-buffer)
3460 (let ((case-fold-search nil))
3461 (goto-char (point-min))
3464 (setq article (read (current-buffer))
3465 header (gnus-nov-parse-line article dependencies)))
3468 (set-buffer gnus-summary-buffer)
3469 (push header gnus-newsgroup-headers)
3470 (if (memq (setq article (mail-header-number header))
3471 gnus-newsgroup-unselected)
3473 (push article gnus-newsgroup-unreads)
3474 (setq gnus-newsgroup-unselected
3475 (delq article gnus-newsgroup-unselected)))
3476 (push article gnus-newsgroup-ancient)))
3477 (forward-line 1)))))))
3479 (defun gnus-summary-update-article-line (article header)
3480 "Update the line for ARTICLE using HEADERS."
3481 (let* ((id (mail-header-id header))
3482 (thread (gnus-id-to-thread id)))
3484 (error "Article in no thread"))
3485 ;; Update the thread.
3486 (setcar thread header)
3487 (gnus-summary-goto-subject article)
3488 (let* ((datal (gnus-data-find-list article))
3490 (length (when (cdr datal)
3491 (- (gnus-data-pos data)
3492 (gnus-data-pos (cadr datal)))))
3493 (buffer-read-only nil)
3494 (level (gnus-summary-thread-level)))
3496 (gnus-summary-insert-line
3497 header level nil (gnus-article-mark article)
3498 (memq article gnus-newsgroup-replied)
3499 (memq article gnus-newsgroup-expirable)
3500 ;; Only insert the Subject string when it's different
3501 ;; from the previous Subject string.
3506 (mail-header-subject
3509 (gnus-data-find-list
3511 (gnus-data-list t)))))
3512 ;; Error on the side of excessive subjects.
3514 (mail-header-subject header)))
3516 (mail-header-subject header))
3517 nil (cdr (assq article gnus-newsgroup-scored))
3518 (memq article gnus-newsgroup-processable))
3520 (gnus-data-update-list
3521 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3523 (defun gnus-summary-update-article (article &optional iheader)
3524 "Update ARTICLE in the summary buffer."
3525 (set-buffer gnus-summary-buffer)
3526 (let* ((header (gnus-summary-article-header article))
3527 (id (mail-header-id header))
3528 (data (gnus-data-find article))
3529 (thread (gnus-id-to-thread id))
3530 (references (mail-header-references header))
3534 (when (and references
3535 (not (equal "" references)))
3538 (buffer-read-only nil)
3544 (delq thread parent)))
3545 (if (gnus-summary-insert-subject id header)
3546 ;; Set the (possibly) new article number in the data structure.
3547 (gnus-data-set-number data (gnus-id-to-article id))
3551 (defun gnus-rebuild-thread (id &optional line)
3552 "Rebuild the thread containing ID.
3553 If LINE, insert the rebuilt thread starting on line LINE."
3554 (let ((buffer-read-only nil)
3555 old-pos current thread data)
3556 (if (not gnus-show-threads)
3557 (setq thread (list (car (gnus-id-to-thread id))))
3558 ;; Get the thread this article is part of.
3559 (setq thread (gnus-remove-thread id)))
3560 (setq old-pos (gnus-point-at-bol))
3561 (setq current (save-excursion
3562 (and (re-search-backward "[\r\n]" nil t)
3563 (gnus-summary-article-number))))
3564 ;; If this is a gathered thread, we have to go some re-gathering.
3565 (when (stringp (car thread))
3566 (let ((subject (car thread))
3568 (setq thread (cdr thread))
3570 (unless (memq (setq thr (gnus-id-to-thread
3572 (mail-header-id (caar thread)))))
3575 (setq thread (cdr thread)))
3576 ;; We now have all (unique) roots.
3577 (if (= (length roots) 1)
3578 ;; All the loose roots are now one solid root.
3579 (setq thread (car roots))
3580 (setq thread (cons subject (gnus-sort-threads roots))))))
3582 ;; We then insert this thread into the summary buffer.
3584 (goto-char (point-min))
3585 (forward-line (1- line)))
3586 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3587 (if gnus-show-threads
3588 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3589 (gnus-summary-prepare-unthreaded thread))
3590 (setq data (nreverse gnus-newsgroup-data))
3591 (setq threads gnus-newsgroup-threads))
3592 ;; We splice the new data into the data structure.
3593 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3594 ;;!!! then we want to insert at the beginning of the buffer.
3595 ;;!!! That happens to be true with Gnus now, but that may
3596 ;;!!! change in the future. Perhaps.
3597 (gnus-data-enter-list
3598 (if line nil current) data (- (point) old-pos))
3599 (setq gnus-newsgroup-threads
3600 (nconc threads gnus-newsgroup-threads))
3601 (gnus-data-compute-positions))))
3603 (defun gnus-number-to-header (number)
3604 "Return the header for article NUMBER."
3605 (let ((headers gnus-newsgroup-headers))
3607 (not (= number (mail-header-number (car headers)))))
3612 (defun gnus-parent-headers (in-headers &optional generation)
3613 "Return the headers of the GENERATIONeth parent of HEADERS."
3615 (setq generation 1))
3617 (headers in-headers)
3620 (not (zerop generation))
3621 (setq references (mail-header-references headers)))
3622 (setq headers (if (and references
3623 (setq parent (gnus-parent-id references)))
3624 (car (gnus-id-to-thread parent))
3627 (and (not (eq headers in-headers))
3630 (defun gnus-id-to-thread (id)
3631 "Return the (sub-)thread where ID appears."
3632 (gnus-gethash id gnus-newsgroup-dependencies))
3634 (defun gnus-id-to-article (id)
3635 "Return the article number of ID."
3636 (let ((thread (gnus-id-to-thread id)))
3639 (mail-header-number (car thread)))))
3641 (defun gnus-id-to-header (id)
3642 "Return the article headers of ID."
3643 (car (gnus-id-to-thread id)))
3645 (defun gnus-article-displayed-root-p (article)
3646 "Say whether ARTICLE is a root(ish) article."
3647 (let ((level (gnus-summary-thread-level article))
3648 (refs (mail-header-references (gnus-summary-article-header article)))
3654 ((null (gnus-parent-id refs)) t)
3656 (null (setq particle (gnus-id-to-article
3657 (gnus-parent-id refs))))
3658 (null (gnus-summary-thread-level particle)))))))
3660 (defun gnus-root-id (id)
3661 "Return the id of the root of the thread where ID appears."
3663 (while (and id (setq prev (car (gnus-id-to-thread id))))
3665 id (gnus-parent-id (mail-header-references prev))))
3668 (defun gnus-articles-in-thread (thread)
3669 "Return the list of articles in THREAD."
3670 (cons (mail-header-number (car thread))
3671 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3673 (defun gnus-remove-thread (id &optional dont-remove)
3674 "Remove the thread that has ID in it."
3675 (let (headers thread last-id)
3676 ;; First go up in this thread until we find the root.
3677 (setq last-id (gnus-root-id id)
3678 headers (message-flatten-list (gnus-id-to-thread last-id)))
3679 ;; We have now found the real root of this thread. It might have
3680 ;; been gathered into some loose thread, so we have to search
3681 ;; through the threads to find the thread we wanted.
3682 (let ((threads gnus-newsgroup-threads)
3685 (setq sub (car threads))
3686 (if (stringp (car sub))
3687 ;; This is a gathered thread, so we look at the roots
3688 ;; below it to find whether this article is in this
3691 (setq sub (cdr sub))
3693 (when (member (caar sub) headers)
3694 (setq thread (car threads)
3697 (setq sub (cdr sub))))
3698 ;; It's an ordinary thread, so we check it.
3699 (when (eq (car sub) (car headers))
3702 (setq threads (cdr threads)))
3703 ;; If this article is in no thread, then it's a root.
3706 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3707 (setq thread (gnus-id-to-thread last-id)))
3710 thread ; We return this thread.
3712 (if (stringp (car thread))
3714 ;; If we use dummy roots, then we have to remove the
3715 ;; dummy root as well.
3716 (when (eq gnus-summary-make-false-root 'dummy)
3717 ;; We go to the dummy root by going to
3718 ;; the first sub-"thread", and then one line up.
3719 (gnus-summary-goto-article
3720 (mail-header-number (caadr thread)))
3723 (gnus-data-compute-positions))
3724 (setq thread (cdr thread))
3726 (gnus-remove-thread-1 (car thread))
3727 (setq thread (cdr thread))))
3728 (gnus-remove-thread-1 thread))))))))
3730 (defun gnus-remove-thread-1 (thread)
3731 "Remove the thread THREAD recursively."
3732 (let ((number (mail-header-number (pop thread)))
3734 (setq thread (reverse thread))
3736 (gnus-remove-thread-1 (pop thread)))
3737 (when (setq d (gnus-data-find number))
3738 (goto-char (gnus-data-pos d))
3739 (gnus-summary-show-thread)
3742 (- (gnus-point-at-bol)
3744 (1+ (gnus-point-at-eol))
3745 (gnus-delete-line)))))))
3747 (defun gnus-sort-threads-1 (threads func)
3748 (sort (mapcar (lambda (thread)
3751 (gnus-sort-threads-1 (cdr thread) func))))
3754 (defun gnus-sort-threads (threads)
3756 (if (not gnus-thread-sort-functions)
3758 (gnus-message 8 "Sorting threads...")
3760 (gnus-sort-threads-1
3762 (gnus-make-sort-function gnus-thread-sort-functions))
3763 (gnus-message 8 "Sorting threads...done"))))
3765 (defun gnus-sort-articles (articles)
3767 (when gnus-article-sort-functions
3768 (gnus-message 7 "Sorting articles...")
3770 (setq gnus-newsgroup-headers
3771 (sort articles (gnus-make-sort-function
3772 gnus-article-sort-functions)))
3773 (gnus-message 7 "Sorting articles...done"))))
3775 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3776 (defmacro gnus-thread-header (thread)
3777 "Return header of first article in THREAD.
3778 Note that THREAD must never, ever be anything else than a variable -
3779 using some other form will lead to serious barfage."
3780 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3781 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3782 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
3785 (defsubst gnus-article-sort-by-number (h1 h2)
3786 "Sort articles by article number."
3787 (< (mail-header-number h1)
3788 (mail-header-number h2)))
3790 (defun gnus-thread-sort-by-number (h1 h2)
3791 "Sort threads by root article number."
3792 (gnus-article-sort-by-number
3793 (gnus-thread-header h1) (gnus-thread-header h2)))
3795 (defsubst gnus-article-sort-by-lines (h1 h2)
3796 "Sort articles by article Lines header."
3797 (< (mail-header-lines h1)
3798 (mail-header-lines h2)))
3800 (defun gnus-thread-sort-by-lines (h1 h2)
3801 "Sort threads by root article Lines header."
3802 (gnus-article-sort-by-lines
3803 (gnus-thread-header h1) (gnus-thread-header h2)))
3805 (defsubst gnus-article-sort-by-chars (h1 h2)
3806 "Sort articles by octet length."
3807 (< (mail-header-chars h1)
3808 (mail-header-chars h2)))
3810 (defun gnus-thread-sort-by-chars (h1 h2)
3811 "Sort threads by root article octet length."
3812 (gnus-article-sort-by-chars
3813 (gnus-thread-header h1) (gnus-thread-header h2)))
3815 (defsubst gnus-article-sort-by-author (h1 h2)
3816 "Sort articles by root author."
3818 (let ((extract (funcall
3819 gnus-extract-address-components
3820 (mail-header-from h1))))
3821 (or (car extract) (cadr extract) ""))
3822 (let ((extract (funcall
3823 gnus-extract-address-components
3824 (mail-header-from h2))))
3825 (or (car extract) (cadr extract) ""))))
3827 (defun gnus-thread-sort-by-author (h1 h2)
3828 "Sort threads by root author."
3829 (gnus-article-sort-by-author
3830 (gnus-thread-header h1) (gnus-thread-header h2)))
3832 (defsubst gnus-article-sort-by-subject (h1 h2)
3833 "Sort articles by root subject."
3835 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3836 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3838 (defun gnus-thread-sort-by-subject (h1 h2)
3839 "Sort threads by root subject."
3840 (gnus-article-sort-by-subject
3841 (gnus-thread-header h1) (gnus-thread-header h2)))
3843 (defsubst gnus-article-sort-by-date (h1 h2)
3844 "Sort articles by root article date."
3846 (gnus-date-get-time (mail-header-date h1))
3847 (gnus-date-get-time (mail-header-date h2))))
3849 (defun gnus-thread-sort-by-date (h1 h2)
3850 "Sort threads by root article date."
3851 (gnus-article-sort-by-date
3852 (gnus-thread-header h1) (gnus-thread-header h2)))
3854 (defsubst gnus-article-sort-by-score (h1 h2)
3855 "Sort articles by root article score.
3856 Unscored articles will be counted as having a score of zero."
3857 (> (or (cdr (assq (mail-header-number h1)
3858 gnus-newsgroup-scored))
3859 gnus-summary-default-score 0)
3860 (or (cdr (assq (mail-header-number h2)
3861 gnus-newsgroup-scored))
3862 gnus-summary-default-score 0)))
3864 (defun gnus-thread-sort-by-score (h1 h2)
3865 "Sort threads by root article score."
3866 (gnus-article-sort-by-score
3867 (gnus-thread-header h1) (gnus-thread-header h2)))
3869 (defun gnus-thread-sort-by-total-score (h1 h2)
3870 "Sort threads by the sum of all scores in the thread.
3871 Unscored articles will be counted as having a score of zero."
3872 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3874 (defun gnus-thread-total-score (thread)
3875 ;; This function find the total score of THREAD.
3876 (cond ((null thread)
3879 (if (stringp (car thread))
3880 (apply gnus-thread-score-function 0
3881 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3882 (gnus-thread-total-score-1 thread)))
3884 (gnus-thread-total-score-1 (list thread)))))
3886 (defun gnus-thread-total-score-1 (root)
3887 ;; This function find the total score of the thread below ROOT.
3888 (setq root (car root))
3889 (apply gnus-thread-score-function
3891 (mapcar 'gnus-thread-total-score
3892 (cdr (gnus-id-to-thread (mail-header-id root))))
3893 (when (> (mail-header-number root) 0)
3894 (list (or (cdr (assq (mail-header-number root)
3895 gnus-newsgroup-scored))
3896 gnus-summary-default-score 0))))
3897 (list gnus-summary-default-score)
3900 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3901 (defvar gnus-tmp-prev-subject nil)
3902 (defvar gnus-tmp-false-parent nil)
3903 (defvar gnus-tmp-root-expunged nil)
3904 (defvar gnus-tmp-dummy-line nil)
3906 (eval-when-compile (defvar gnus-tmp-header))
3907 (defun gnus-extra-header (type &optional header)
3908 "Return the extra header of TYPE."
3909 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3912 (defun gnus-summary-prepare-threads (threads)
3913 "Prepare summary buffer from THREADS and indentation LEVEL.
3914 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3915 or a straight list of headers."
3916 (gnus-message 7 "Generating summary...")
3918 (setq gnus-newsgroup-threads threads)
3921 (let ((gnus-tmp-level 0)
3922 (default-score (or gnus-summary-default-score 0))
3923 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3924 thread number subject stack state gnus-tmp-gathered beg-match
3925 new-roots gnus-tmp-new-adopts thread-end
3926 gnus-tmp-header gnus-tmp-unread
3927 gnus-tmp-replied gnus-tmp-subject-or-nil
3928 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3929 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3930 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3932 (setq gnus-tmp-prev-subject nil)
3934 (if (vectorp (car threads))
3935 ;; If this is a straight (sic) list of headers, then a
3936 ;; threaded summary display isn't required, so we just create
3937 ;; an unthreaded one.
3938 (gnus-summary-prepare-unthreaded threads)
3940 ;; Do the threaded display.
3942 (while (or threads stack gnus-tmp-new-adopts new-roots)
3944 (if (and (= gnus-tmp-level 0)
3947 (not gnus-tmp-false-parent)
3948 (or gnus-tmp-new-adopts new-roots))
3949 (if gnus-tmp-new-adopts
3950 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3951 thread (list (car gnus-tmp-new-adopts))
3952 gnus-tmp-header (caar thread)
3953 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3955 (setq thread (list (car new-roots))
3956 gnus-tmp-header (caar thread)
3957 new-roots (cdr new-roots))))
3960 ;; If there are some threads, we do them before the
3961 ;; threads on the stack.
3962 (setq thread threads
3963 gnus-tmp-header (caar thread))
3964 ;; There were no current threads, so we pop something off
3966 (setq state (car stack)
3967 gnus-tmp-level (car state)
3970 gnus-tmp-header (caar thread))))
3972 (setq gnus-tmp-false-parent nil)
3973 (setq gnus-tmp-root-expunged nil)
3974 (setq thread-end nil)
3976 (if (stringp gnus-tmp-header)
3977 ;; The header is a dummy root.
3979 ((eq gnus-summary-make-false-root 'adopt)
3980 ;; We let the first article adopt the rest.
3981 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3983 (setq gnus-tmp-gathered
3985 (lambda (h) (mail-header-number (car h)))
3988 (setq thread (cons (list (caar thread)
3991 (setq gnus-tmp-level -1
3992 gnus-tmp-false-parent t))
3993 ((eq gnus-summary-make-false-root 'empty)
3994 ;; We print adopted articles with empty subject fields.
3995 (setq gnus-tmp-gathered
3997 (lambda (h) (mail-header-number (car h)))
4000 (setq gnus-tmp-level -1))
4001 ((eq gnus-summary-make-false-root 'dummy)
4002 ;; We remember that we probably want to output a dummy
4004 (setq gnus-tmp-dummy-line gnus-tmp-header)
4005 (setq gnus-tmp-prev-subject gnus-tmp-header))
4007 ;; We do not make a root for the gathered
4008 ;; sub-threads at all.
4009 (setq gnus-tmp-level -1)))
4011 (setq number (mail-header-number gnus-tmp-header)
4012 subject (mail-header-subject gnus-tmp-header))
4015 ;; If the thread has changed subject, we might want to make
4016 ;; this subthread into a root.
4017 ((and (null gnus-thread-ignore-subject)
4018 (not (zerop gnus-tmp-level))
4019 gnus-tmp-prev-subject
4021 (gnus-subject-equal gnus-tmp-prev-subject subject))))
4022 (setq new-roots (nconc new-roots (list (car thread)))
4024 gnus-tmp-header nil))
4025 ;; If the article lies outside the current limit,
4026 ;; then we do not display it.
4027 ((not (memq number gnus-newsgroup-limit))
4028 (setq gnus-tmp-gathered
4030 (lambda (h) (mail-header-number (car h)))
4033 (setq gnus-tmp-new-adopts (if (cdar thread)
4034 (append gnus-tmp-new-adopts
4036 gnus-tmp-new-adopts)
4038 gnus-tmp-header nil)
4039 (when (zerop gnus-tmp-level)
4040 (setq gnus-tmp-root-expunged t)))
4041 ;; Perhaps this article is to be marked as read?
4042 ((and gnus-summary-mark-below
4043 (< (or (cdr (assq number gnus-newsgroup-scored))
4045 gnus-summary-mark-below)
4046 ;; Don't touch sparse articles.
4047 (not (gnus-summary-article-sparse-p number))
4048 (not (gnus-summary-article-ancient-p number)))
4049 (setq gnus-newsgroup-unreads
4050 (delq number gnus-newsgroup-unreads))
4051 (if gnus-newsgroup-auto-expire
4052 (push number gnus-newsgroup-expirable)
4053 (push (cons number gnus-low-score-mark)
4054 gnus-newsgroup-reads))))
4056 (when gnus-tmp-header
4057 ;; We may have an old dummy line to output before this
4059 (when (and gnus-tmp-dummy-line
4062 (mail-header-subject gnus-tmp-header)))
4063 (gnus-summary-insert-dummy-line
4064 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4065 (setq gnus-tmp-dummy-line nil))
4067 ;; Compute the mark.
4068 (setq gnus-tmp-unread (gnus-article-mark number))
4070 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4071 gnus-tmp-header gnus-tmp-level)
4072 gnus-newsgroup-data)
4074 ;; Actually insert the line.
4076 gnus-tmp-subject-or-nil
4078 ((and gnus-thread-ignore-subject
4079 gnus-tmp-prev-subject
4080 (not (inline (gnus-subject-equal
4081 gnus-tmp-prev-subject subject))))
4083 ((zerop gnus-tmp-level)
4084 (if (and (eq gnus-summary-make-false-root 'empty)
4085 (memq number gnus-tmp-gathered)
4086 gnus-tmp-prev-subject
4087 (inline (gnus-subject-equal
4088 gnus-tmp-prev-subject subject)))
4089 gnus-summary-same-subject
4091 (t gnus-summary-same-subject)))
4092 (if (and (eq gnus-summary-make-false-root 'adopt)
4093 (= gnus-tmp-level 1)
4094 (memq number gnus-tmp-gathered))
4095 (setq gnus-tmp-opening-bracket ?\<
4096 gnus-tmp-closing-bracket ?\>)
4097 (setq gnus-tmp-opening-bracket ?\[
4098 gnus-tmp-closing-bracket ?\]))
4100 gnus-tmp-indentation
4101 (aref gnus-thread-indent-array gnus-tmp-level)
4102 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4103 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4104 gnus-summary-default-score 0)
4106 (if (or (null gnus-summary-default-score)
4107 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4108 gnus-summary-zcore-fuzz))
4110 (if (< gnus-tmp-score gnus-summary-default-score)
4111 gnus-score-below-mark gnus-score-over-mark))
4113 (cond ((memq number gnus-newsgroup-processable)
4115 ((memq number gnus-newsgroup-cached)
4117 ((memq number gnus-newsgroup-replied)
4119 ((memq number gnus-newsgroup-saved)
4121 (t gnus-unread-mark))
4122 gnus-tmp-from (mail-header-from gnus-tmp-header)
4125 ((string-match "<[^>]+> *$" gnus-tmp-from)
4126 (setq beg-match (match-beginning 0))
4127 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
4128 (substring gnus-tmp-from (1+ (match-beginning 0))
4129 (1- (match-end 0))))
4130 (substring gnus-tmp-from 0 beg-match)))
4131 ((string-match "(.+)" gnus-tmp-from)
4132 (substring gnus-tmp-from
4133 (1+ (match-beginning 0)) (1- (match-end 0))))
4135 (when (string= gnus-tmp-name "")
4136 (setq gnus-tmp-name gnus-tmp-from))
4137 (unless (numberp gnus-tmp-lines)
4138 (setq gnus-tmp-lines 0))
4139 (gnus-put-text-property
4141 (progn (eval gnus-summary-line-format-spec) (point))
4142 'gnus-number number)
4145 (gnus-run-hooks 'gnus-summary-update-hook)
4148 (setq gnus-tmp-prev-subject subject)))
4150 (when (nth 1 thread)
4151 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4152 (incf gnus-tmp-level)
4153 (setq threads (if thread-end nil (cdar thread)))
4155 (setq gnus-tmp-level 0)))))
4156 (gnus-message 7 "Generating summary...done"))
4158 (defun gnus-summary-prepare-unthreaded (headers)
4159 "Generate an unthreaded summary buffer based on HEADERS."
4160 (let (header number mark)
4165 ;; We may have to root out some bad articles...
4166 (when (memq (setq number (mail-header-number
4167 (setq header (pop headers))))
4168 gnus-newsgroup-limit)
4169 ;; Mark article as read when it has a low score.
4170 (when (and gnus-summary-mark-below
4171 (< (or (cdr (assq number gnus-newsgroup-scored))
4172 gnus-summary-default-score 0)
4173 gnus-summary-mark-below)
4174 (not (gnus-summary-article-ancient-p number)))
4175 (setq gnus-newsgroup-unreads
4176 (delq number gnus-newsgroup-unreads))
4177 (if gnus-newsgroup-auto-expire
4178 (push number gnus-newsgroup-expirable)
4179 (push (cons number gnus-low-score-mark)
4180 gnus-newsgroup-reads)))
4182 (setq mark (gnus-article-mark number))
4183 (push (gnus-data-make number mark (1+ (point)) header 0)
4184 gnus-newsgroup-data)
4185 (gnus-summary-insert-line
4187 mark (memq number gnus-newsgroup-replied)
4188 (memq number gnus-newsgroup-expirable)
4189 (mail-header-subject header) nil
4190 (cdr (assq number gnus-newsgroup-scored))
4191 (memq number gnus-newsgroup-processable))))))
4193 (defun gnus-summary-remove-list-identifiers ()
4194 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4195 (let ((regexp (if (stringp gnus-list-identifiers)
4196 gnus-list-identifiers
4197 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4198 (dolist (header gnus-newsgroup-headers)
4199 (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
4200 " *\\)\\)+\\(Re: +\\)?\\)")
4201 (mail-header-subject header))
4202 (mail-header-set-subject
4203 header (concat (substring (mail-header-subject header)
4204 0 (match-beginning 1))
4206 (match-string 3 (mail-header-subject header))
4207 (match-string 5 (mail-header-subject header)))
4208 (substring (mail-header-subject header)
4209 (match-end 1))))))))
4211 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4212 "Select newsgroup GROUP.
4213 If READ-ALL is non-nil, all articles in the group are selected.
4214 If SELECT-ARTICLES, only select those articles from GROUP."
4215 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4216 ;;!!! Dirty hack; should be removed.
4217 (gnus-summary-ignore-duplicates
4218 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4220 gnus-summary-ignore-duplicates))
4221 (info (nth 2 entry))
4222 articles fetched-articles cached)
4224 (unless (gnus-check-server
4225 (set (make-local-variable 'gnus-current-select-method)
4226 (gnus-find-method-for-group group)))
4227 (error "Couldn't open server"))
4229 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4230 (gnus-activate-group group) ; Or we can activate it...
4231 (progn ; Or we bug out.
4232 (when (equal major-mode 'gnus-summary-mode)
4233 (kill-buffer (current-buffer)))
4234 (error "Couldn't request group %s: %s"
4235 group (gnus-status-message group))))
4237 (unless (gnus-request-group group t)
4238 (when (equal major-mode 'gnus-summary-mode)
4239 (kill-buffer (current-buffer)))
4240 (error "Couldn't request group %s: %s"
4241 group (gnus-status-message group)))
4243 (setq gnus-newsgroup-name group)
4244 (setq gnus-newsgroup-unselected nil)
4245 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4246 (gnus-summary-setup-default-charset)
4248 ;; Adjust and set lists of article marks.
4250 (gnus-adjust-marked-articles info))
4252 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4253 (when (gnus-virtual-group-p group)
4254 (setq cached gnus-newsgroup-cached))
4256 (setq gnus-newsgroup-unreads
4257 (gnus-set-difference
4258 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4259 gnus-newsgroup-dormant))
4261 (setq gnus-newsgroup-processable nil)
4263 (gnus-update-read-articles group gnus-newsgroup-unreads)
4265 (if (setq articles select-articles)
4266 (setq gnus-newsgroup-unselected
4267 (gnus-sorted-intersection
4268 gnus-newsgroup-unreads
4269 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4270 (setq articles (gnus-articles-to-read group read-all)))
4274 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4276 ((eq articles 0) nil)
4278 ;; Init the dependencies hash table.
4279 (setq gnus-newsgroup-dependencies
4280 (gnus-make-hashtable (length articles)))
4281 (gnus-set-global-variables)
4282 ;; Retrieve the headers and read them in.
4283 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4284 (setq gnus-newsgroup-headers
4286 (setq gnus-headers-retrieved-by
4287 (gnus-retrieve-headers
4288 articles gnus-newsgroup-name
4289 ;; We might want to fetch old headers, but
4290 ;; not if there is only 1 article.
4292 (not (eq gnus-fetch-old-headers 'some))
4293 (not (numberp gnus-fetch-old-headers)))
4294 (> (length articles) 1))
4295 gnus-fetch-old-headers))))
4296 (gnus-get-newsgroup-headers-xover
4297 articles nil nil gnus-newsgroup-name t)
4298 (gnus-get-newsgroup-headers)))
4299 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4301 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4303 (setq gnus-newsgroup-cached cached))
4305 ;; Suppress duplicates?
4306 (when gnus-suppress-duplicates
4307 (gnus-dup-suppress-articles))
4309 ;; Set the initial limit.
4310 (setq gnus-newsgroup-limit (copy-sequence articles))
4311 ;; Remove canceled articles from the list of unread articles.
4312 (setq gnus-newsgroup-unreads
4313 (gnus-set-sorted-intersection
4314 gnus-newsgroup-unreads
4315 (setq fetched-articles
4316 (mapcar (lambda (headers) (mail-header-number headers))
4317 gnus-newsgroup-headers))))
4318 ;; Removed marked articles that do not exist.
4319 (gnus-update-missing-marks
4320 (gnus-sorted-complement fetched-articles articles))
4321 ;; We might want to build some more threads first.
4322 (when (and gnus-fetch-old-headers
4323 (eq gnus-headers-retrieved-by 'nov))
4324 (if (eq gnus-fetch-old-headers 'invisible)
4325 (gnus-build-all-threads)
4326 (gnus-build-old-threads)))
4327 ;; Let the Gnus agent mark articles as read.
4329 (gnus-agent-get-undownloaded-list))
4330 ;; Remove list identifiers from subject
4331 (when gnus-list-identifiers
4332 (gnus-summary-remove-list-identifiers))
4333 ;; Check whether auto-expire is to be done in this group.
4334 (setq gnus-newsgroup-auto-expire
4335 (gnus-group-auto-expirable-p group))
4336 ;; Set up the article buffer now, if necessary.
4337 (unless gnus-single-article-buffer
4338 (gnus-article-setup-buffer))
4339 ;; First and last article in this newsgroup.
4340 (when gnus-newsgroup-headers
4341 (setq gnus-newsgroup-begin
4342 (mail-header-number (car gnus-newsgroup-headers))
4345 (gnus-last-element gnus-newsgroup-headers))))
4346 ;; GROUP is successfully selected.
4347 (or gnus-newsgroup-headers t)))))
4349 (defun gnus-articles-to-read (group &optional read-all)
4350 "Find out what articles the user wants to read."
4352 ;; Select all articles if `read-all' is non-nil, or if there
4353 ;; are no unread articles.
4355 (and (zerop (length gnus-newsgroup-marked))
4356 (zerop (length gnus-newsgroup-unreads)))
4357 (eq (gnus-group-find-parameter group 'display)
4360 (gnus-uncompress-range (gnus-active group))
4361 (gnus-cache-articles-in-group group))
4362 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4363 (copy-sequence gnus-newsgroup-unreads))
4365 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4366 (scored (length scored-list))
4367 (number (length articles))
4368 (marked (+ (length gnus-newsgroup-marked)
4369 (length gnus-newsgroup-dormant)))
4377 ((and (or (<= scored marked) (= scored number))
4378 (numberp gnus-large-newsgroup)
4379 (> number gnus-large-newsgroup))
4383 "How many articles from %s (default %d): "
4384 (gnus-limit-string gnus-newsgroup-name 35)
4386 (if (string-match "^[ \t]*$" input) number input)))
4387 ((and (> scored marked) (< scored number)
4388 (> (- scored number) 20))
4391 (format "%s %s (%d scored, %d total): "
4392 "How many articles from"
4393 group scored number))))
4394 (if (string-match "^[ \t]*$" input)
4398 (message "Quit getting the articles to read")
4400 (setq select (if (stringp select) (string-to-number select) select))
4401 (if (or (null select) (zerop select))
4403 (if (and (not (zerop scored)) (<= (abs select) scored))
4405 (setq articles (sort scored-list '<))
4406 (setq number (length articles)))
4407 (setq articles (copy-sequence articles)))
4409 (when (< (abs select) number)
4411 ;; Select the N oldest articles.
4412 (setcdr (nthcdr (1- (abs select)) articles) nil)
4413 ;; Select the N most recent articles.
4414 (setq articles (nthcdr (- number select) articles))))
4415 (setq gnus-newsgroup-unselected
4416 (gnus-sorted-intersection
4417 gnus-newsgroup-unreads
4418 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4419 (when gnus-alter-articles-to-read-function
4420 (setq gnus-newsgroup-unreads
4422 (funcall gnus-alter-articles-to-read-function
4423 gnus-newsgroup-name gnus-newsgroup-unreads)
4427 (defun gnus-killed-articles (killed articles)
4430 (when (inline (gnus-member-of-range (car articles) killed))
4431 (push (car articles) out))
4432 (setq articles (cdr articles)))
4435 (defun gnus-uncompress-marks (marks)
4436 "Uncompress the mark ranges in MARKS."
4437 (let ((uncompressed '(score bookmark))
4440 (if (memq (caar marks) uncompressed)
4441 (push (car marks) out)
4442 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4443 (setq marks (cdr marks)))
4446 (defun gnus-adjust-marked-articles (info)
4447 "Set all article lists and remove all marks that are no longer valid."
4448 (let* ((marked-lists (gnus-info-marks info))
4449 (active (gnus-active (gnus-info-group info)))
4452 (types gnus-article-mark-lists)
4453 (uncompressed '(score bookmark killed))
4454 marks var articles article mark)
4457 (setq marks (pop marked-lists))
4458 (set (setq var (intern (format "gnus-newsgroup-%s"
4459 (car (rassq (setq mark (car marks))
4461 (if (memq (car marks) uncompressed) (cdr marks)
4462 (gnus-uncompress-range (cdr marks))))
4464 (setq articles (symbol-value var))
4466 ;; All articles have to be subsets of the active articles.
4468 ;; Adjust "simple" lists.
4469 ((memq mark '(tick dormant expire reply save))
4471 (when (or (< (setq article (pop articles)) min) (> article max))
4472 (set var (delq article (symbol-value var))))))
4474 ((memq mark uncompressed)
4475 (when (not (listp (cdr (symbol-value var))))
4476 (set var (list (symbol-value var))))
4477 (when (not (listp (cdr articles)))
4478 (setq articles (list articles)))
4480 (when (or (not (consp (setq article (pop articles))))
4481 (< (car article) min)
4482 (> (car article) max))
4483 (set var (delq article (symbol-value var))))))))))
4485 (defun gnus-update-missing-marks (missing)
4486 "Go through the list of MISSING articles and remove them from the mark lists."
4488 (let ((types gnus-article-mark-lists)
4490 ;; Go through all types.
4492 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4493 (when (symbol-value var)
4494 ;; This list has articles. So we delete all missing articles
4498 (set var (delq (pop m) (symbol-value var)))))))))
4500 (defun gnus-update-marks ()
4501 "Enter the various lists of marked articles into the newsgroup info list."
4502 (let ((types gnus-article-mark-lists)
4503 (info (gnus-get-info gnus-newsgroup-name))
4504 (uncompressed '(score bookmark killed))
4505 type list newmarked symbol delta-marks)
4507 ;; Add all marks lists to the list of marks lists.
4508 (while (setq type (pop types))
4509 (setq list (symbol-value
4511 (intern (format "gnus-newsgroup-%s"
4515 ;; Get rid of the entries of the articles that have the
4517 (when (and (eq (cdr type) 'score)
4521 (prev (cons nil list))
4524 (if (or (not (consp (car arts)))
4525 (= (cdar arts) gnus-summary-default-score))
4526 (setcdr prev (cdr arts))
4528 (setq arts (cdr arts)))
4529 (setq list (cdr all)))))
4531 (unless (memq (cdr type) uncompressed)
4532 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4534 (when (gnus-check-backend-function
4535 'request-set-mark gnus-newsgroup-name)
4536 ;; propagate flags to server, with the following exceptions:
4537 ;; uncompressed:s are not proper flags (they are cons cells)
4538 ;; cache is a internal gnus flag
4539 ;; download are local to one gnus installation (well)
4540 ;; unsend are for nndraft groups only
4541 ;; xxx: generality of this? this suits nnimap anyway
4542 (unless (memq (cdr type) (append '(cache download unsend)
4544 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4545 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4546 (add (gnus-remove-from-range
4547 (gnus-copy-sequence list) old)))
4549 (push (list add 'add (list (cdr type))) delta-marks))
4551 (push (list del 'del (list (cdr type))) delta-marks)))))
4554 (push (cons (cdr type) list) newmarked)))
4557 (unless (gnus-check-group gnus-newsgroup-name)
4558 (error "Can't open server for %s" gnus-newsgroup-name))
4559 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4561 ;; Enter these new marks into the info of the group.
4563 (setcar (nthcdr 3 info) newmarked)
4564 ;; Add the marks lists to the end of the info.
4566 (setcdr (nthcdr 2 info) (list newmarked))))
4568 ;; Cut off the end of the info if there's nothing else there.
4572 (when (nthcdr (decf i) info)
4573 (setcdr (nthcdr i info) nil)))))))
4575 (defun gnus-set-mode-line (where)
4576 "Set the mode line of the article or summary buffers.
4577 If WHERE is `summary', the summary mode line format will be used."
4578 ;; Is this mode line one we keep updated?
4579 (when (and (memq where gnus-updated-mode-lines)
4581 (intern (format "gnus-%s-mode-line-format-spec" where))))
4584 ;; We evaluate this in the summary buffer since these
4585 ;; variables are buffer-local to that buffer.
4586 (set-buffer gnus-summary-buffer)
4587 ;; We bind all these variables that are used in the `eval' form
4589 (let* ((mformat (symbol-value
4591 (format "gnus-%s-mode-line-format-spec" where))))
4592 (gnus-tmp-group-name (gnus-group-name-decode
4594 (gnus-group-name-charset
4596 gnus-newsgroup-name)))
4597 (gnus-tmp-article-number (or gnus-current-article 0))
4598 (gnus-tmp-unread gnus-newsgroup-unreads)
4599 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4600 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4601 (gnus-tmp-unread-and-unselected
4602 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4603 (zerop gnus-tmp-unselected))
4605 ((zerop gnus-tmp-unselected)
4606 (format "{%d more}" gnus-tmp-unread-and-unticked))
4607 (t (format "{%d(+%d) more}"
4608 gnus-tmp-unread-and-unticked
4609 gnus-tmp-unselected))))
4611 (if (and gnus-current-headers
4612 (vectorp gnus-current-headers))
4613 (gnus-mode-string-quote
4614 (mail-header-subject gnus-current-headers))
4616 bufname-length max-len
4617 gnus-tmp-header);; passed as argument to any user-format-funcs
4618 (setq mode-string (eval mformat))
4619 (setq bufname-length (if (string-match "%b" mode-string)
4622 (if (eq where 'summary)
4624 (get-buffer gnus-article-buffer))))
4627 (setq max-len (max 4 (if gnus-mode-non-string-length
4629 gnus-mode-non-string-length
4631 (length mode-string))))
4632 ;; We might have to chop a bit of the string off...
4633 (when (> (length mode-string) max-len)
4635 (concat (truncate-string-to-width mode-string (- max-len 3))
4637 ;; Pad the mode string a bit.
4638 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4639 ;; Update the mode line.
4640 (setq mode-line-buffer-identification
4641 (gnus-mode-line-buffer-identification (list mode-string)))
4642 (set-buffer-modified-p t))))
4644 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4645 "Go through the HEADERS list and add all Xrefs to a hash table.
4646 The resulting hash table is returned, or nil if no Xrefs were found."
4647 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4648 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4649 (xref-hashtb (gnus-make-hashtable))
4650 start group entry number xrefs header)
4652 (setq header (pop headers))
4653 (when (and (setq xrefs (mail-header-xref header))
4654 (not (memq (setq number (mail-header-number header))
4657 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4658 (setq start (match-end 0))
4659 (setq group (if prefix
4660 (concat prefix (substring xrefs (match-beginning 1)
4662 (substring xrefs (match-beginning 1) (match-end 1))))
4664 (string-to-int (substring xrefs (match-beginning 2)
4666 (if (setq entry (gnus-gethash group xref-hashtb))
4667 (setcdr entry (cons number (cdr entry)))
4668 (gnus-sethash group (cons number nil) xref-hashtb)))))
4669 (and start xref-hashtb)))
4671 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4672 "Look through all the headers and mark the Xrefs as read."
4673 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4674 name entry info xref-hashtb idlist method nth4)
4676 (set-buffer gnus-group-buffer)
4677 (when (setq xref-hashtb
4678 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4681 (unless (string= from-newsgroup (setq name (symbol-name group)))
4682 (setq idlist (symbol-value group))
4683 ;; Dead groups are not updated.
4685 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4687 (when (stringp (setq nth4 (gnus-info-method info)))
4688 (setq nth4 (gnus-server-to-method nth4))))
4689 ;; Only do the xrefs if the group has the same
4690 ;; select method as the group we have just read.
4691 (or (gnus-methods-equal-p
4692 nth4 (gnus-find-method-for-group from-newsgroup))
4694 (equal nth4 (setq method (gnus-find-method-for-group
4696 (and (equal (car nth4) (car method))
4697 (equal (nth 1 nth4) (nth 1 method))))
4698 gnus-use-cross-reference
4699 (or (not (eq gnus-use-cross-reference t))
4701 ;; Only do cross-references on subscribed
4702 ;; groups, if that is what is wanted.
4703 (<= (gnus-info-level info) gnus-level-subscribed))
4704 (gnus-group-make-articles-read name idlist))))
4707 (defun gnus-compute-read-articles (group articles)
4708 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4709 (info (nth 2 entry))
4710 (active (gnus-active group))
4713 ;; First peel off all invalid article numbers.
4715 (let ((ids articles)
4717 (while (setq id (pop ids))
4718 (when (and first (> id (cdr active)))
4719 ;; We'll end up in this situation in one particular
4720 ;; obscure situation. If you re-scan a group and get
4721 ;; a new article that is cross-posted to a different
4722 ;; group that has not been re-scanned, you might get
4723 ;; crossposted article that has a higher number than
4724 ;; Gnus believes possible. So we re-activate this
4725 ;; group as well. This might mean doing the
4726 ;; crossposting thingy will *increase* the number
4727 ;; of articles in some groups. Tsk, tsk.
4728 (setq active (or (gnus-activate-group group) active)))
4729 (when (or (> id (cdr active))
4730 (< id (car active)))
4731 (setq articles (delq id articles))))))
4732 ;; If the read list is nil, we init it.
4734 (null (gnus-info-read info))
4736 (setq ninfo (cons 1 (1- (car active))))
4737 (setq ninfo (gnus-info-read info)))
4738 ;; Then we add the read articles to the range.
4740 ninfo (setq articles (sort articles '<))))))
4742 (defun gnus-group-make-articles-read (group articles)
4743 "Update the info of GROUP to say that ARTICLES are read."
4745 (entry (gnus-gethash group gnus-newsrc-hashtb))
4746 (info (nth 2 entry))
4747 (active (gnus-active group))
4750 (setq range (gnus-compute-read-articles group articles))
4752 (set-buffer gnus-group-buffer)
4755 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4756 (gnus-info-set-read ',info ',(gnus-info-read info))
4757 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4758 (gnus-group-update-group ,group t))))
4759 ;; Add the read articles to the range.
4760 (gnus-info-set-read info range)
4761 ;; Then we have to re-compute how many unread
4762 ;; articles there are in this group.
4766 (setq num (- (1+ (cdr active)) (car active))))
4767 ((not (listp (cdr range)))
4768 (setq num (- (cdr active) (- (1+ (cdr range))
4772 (if (numberp (car range))
4774 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4775 (setq range (cdr range)))
4776 (setq num (- (cdr active) num))))
4777 ;; Update the number of unread articles.
4779 ;; Update the group buffer.
4780 (gnus-group-update-group group t)))))
4782 (defvar gnus-newsgroup-none-id 0)
4784 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4785 (let ((cur nntp-server-buffer)
4788 (save-excursion (set-buffer gnus-summary-buffer)
4789 gnus-newsgroup-dependencies)))
4791 (mail-parse-charset gnus-newsgroup-charset)
4792 (mail-parse-ignored-charsets
4793 (save-excursion (condition-case nil
4794 (set-buffer gnus-summary-buffer)
4796 gnus-newsgroup-ignored-charsets)))
4798 (set-buffer nntp-server-buffer)
4799 ;; Translate all TAB characters into SPACE characters.
4800 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4801 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4802 (gnus-run-hooks 'gnus-parse-headers-hook)
4803 (let ((case-fold-search t)
4804 in-reply-to header p lines chars)
4805 (goto-char (point-min))
4806 ;; Search to the beginning of the next header. Error messages
4807 ;; do not begin with 2 or 3.
4808 (while (re-search-forward "^[23][0-9]+ " nil t)
4811 ;; This implementation of this function, with nine
4812 ;; search-forwards instead of the one re-search-forward and
4813 ;; a case (which basically was the old function) is actually
4814 ;; about twice as fast, even though it looks messier. You
4815 ;; can't have everything, I guess. Speed and elegance
4816 ;; doesn't always go hand in hand.
4825 (narrow-to-region (point)
4826 (or (and (search-forward "\n.\n" nil t)
4832 (if (search-forward "\nsubject: " nil t)
4833 (funcall gnus-decode-encoded-word-function
4834 (nnheader-header-value))
4839 (if (or (search-forward "\nfrom: " nil t)
4840 (search-forward "\nfrom:" nil t))
4841 (funcall gnus-decode-encoded-word-function
4842 (nnheader-header-value))
4847 (if (search-forward "\ndate: " nil t)
4848 (nnheader-header-value) ""))
4852 (setq id (if (re-search-forward
4853 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4854 ;; We do it this way to make sure the Message-ID
4855 ;; is (somewhat) syntactically valid.
4856 (buffer-substring (match-beginning 1)
4858 ;; If there was no message-id, we just fake one
4859 ;; to make subsequent routines simpler.
4860 (nnheader-generate-fake-message-id))))
4864 (if (search-forward "\nreferences: " nil t)
4868 (nnheader-header-value)
4873 (search-backward ">" end t)
4876 (search-backward "<" end t)
4878 ;; Get the references from the in-reply-to header if there
4879 ;; were no references and the in-reply-to header looks
4881 (if (and (search-forward "\nin-reply-to: " nil t)
4882 (setq in-reply-to (nnheader-header-value))
4883 (string-match "<[^>]+>" in-reply-to))
4885 (setq ref (substring in-reply-to (match-beginning 0)
4887 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4888 (setq ref2 (substring in-reply-to (match-beginning 0)
4890 (when (> (length ref2) (length ref))
4897 (if (search-forward "\nchars: " nil t)
4898 (if (numberp (setq chars (ignore-errors (read cur))))
4904 (if (search-forward "\nlines: " nil t)
4905 (if (numberp (setq lines (ignore-errors (read cur))))
4911 (and (search-forward "\nxref: " nil t)
4912 (nnheader-header-value)))
4914 (when gnus-extra-headers
4915 (let ((extra gnus-extra-headers)
4919 (when (search-forward
4920 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4921 (push (cons (car extra) (nnheader-header-value))
4925 (when (equal id ref)
4928 (when gnus-alter-header-function
4929 (funcall gnus-alter-header-function header)
4930 (setq id (mail-header-id header)
4931 ref (gnus-parent-id (mail-header-references header))))
4934 (gnus-dependencies-add-header
4935 header dependencies force-new))
4936 (push header headers))
4937 (goto-char (point-max))
4939 (nreverse headers)))))
4941 ;; Goes through the xover lines and returns a list of vectors
4942 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4943 force-new dependencies
4944 group also-fetch-heads)
4945 "Parse the news overview data in the server buffer.
4946 Return a list of headers that match SEQUENCE (see
4947 `nntp-retrieve-headers')."
4948 ;; Get the Xref when the users reads the articles since most/some
4949 ;; NNTP servers do not include Xrefs when using XOVER.
4950 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4951 (let ((mail-parse-charset gnus-newsgroup-charset)
4952 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4953 (cur nntp-server-buffer)
4954 (dependencies (or dependencies gnus-newsgroup-dependencies))
4955 number headers header)
4957 (set-buffer nntp-server-buffer)
4958 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4959 ;; Allow the user to mangle the headers before parsing them.
4960 (gnus-run-hooks 'gnus-parse-headers-hook)
4961 (goto-char (point-min))
4964 (while (and sequence (not (eobp)))
4965 (setq number (read cur))
4966 (while (and sequence
4967 (< (car sequence) number))
4968 (setq sequence (cdr sequence)))
4970 (eq number (car sequence))
4972 (setq sequence (cdr sequence))
4973 (setq header (inline
4974 (gnus-nov-parse-line
4975 number dependencies force-new))))
4976 (push header headers))
4979 (gnus-error 4 "Strange nov line (%d)"
4980 (count-lines (point-min) (point)))))
4982 ;; A common bug in inn is that if you have posted an article and
4983 ;; then retrieves the active file, it will answer correctly --
4984 ;; the new article is included. However, a NOV entry for the
4985 ;; article may not have been generated yet, so this may fail.
4986 ;; We work around this problem by retrieving the last few
4987 ;; headers using HEAD.
4988 (if (or (not also-fetch-heads)
4990 ;; We (probably) got all the headers.
4992 (let ((gnus-nov-is-evil t))
4995 (when (gnus-retrieve-headers sequence group)
4996 (gnus-get-newsgroup-headers))))))))
4998 (defun gnus-article-get-xrefs ()
4999 "Fill in the Xref value in `gnus-current-headers', if necessary.
5000 This is meant to be called in `gnus-article-internal-prepare-hook'."
5001 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5002 gnus-current-headers)))
5003 (or (not gnus-use-cross-reference)
5005 (and (mail-header-xref headers)
5006 (not (string= (mail-header-xref headers) "")))
5007 (let ((case-fold-search t)
5010 (nnheader-narrow-to-headers)
5011 (goto-char (point-min))
5012 (when (or (and (not (eobp))
5013 (eq (downcase (char-after)) ?x)
5014 (looking-at "Xref:"))
5015 (search-forward "\nXref:" nil t))
5016 (goto-char (1+ (match-end 0)))
5017 (setq xref (buffer-substring (point)
5018 (progn (end-of-line) (point))))
5019 (mail-header-set-xref headers xref)))))))
5021 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5022 "Find article ID and insert the summary line for that article.
5023 OLD-HEADER can either be a header or a line number to insert
5024 the subject line on."
5025 (let* ((line (and (numberp old-header) old-header))
5026 (old-header (and (vectorp old-header) old-header))
5027 (header (cond ((and old-header use-old-header)
5030 (gnus-number-to-header id))
5031 (gnus-number-to-header id))
5033 (gnus-read-header id))))
5034 (number (and (numberp id) id))
5037 ;; Rebuild the thread that this article is part of and go to the
5038 ;; article we have fetched.
5039 (when (and (not gnus-show-threads)
5042 (setq d (gnus-data-find (mail-header-number old-header))))
5043 (goto-char (gnus-data-pos d))
5046 (- (gnus-point-at-bol)
5048 (1+ (gnus-point-at-eol))
5049 (gnus-delete-line))))))
5051 (mail-header-set-number header (mail-header-number old-header)))
5052 (setq gnus-newsgroup-sparse
5053 (delq (setq number (mail-header-number header))
5054 gnus-newsgroup-sparse))
5055 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5056 (push number gnus-newsgroup-limit)
5057 (gnus-rebuild-thread (mail-header-id header) line)
5058 (gnus-summary-goto-subject number nil t))
5059 (when (and (numberp number)
5061 ;; We have to update the boundaries even if we can't fetch the
5062 ;; article if ID is a number -- so that the next `P' or `N'
5063 ;; command will fetch the previous (or next) article even
5064 ;; if the one we tried to fetch this time has been canceled.
5065 (when (> number gnus-newsgroup-end)
5066 (setq gnus-newsgroup-end number))
5067 (when (< number gnus-newsgroup-begin)
5068 (setq gnus-newsgroup-begin number))
5069 (setq gnus-newsgroup-unselected
5070 (delq number gnus-newsgroup-unselected)))
5071 ;; Report back a success?
5072 (and header (mail-header-number header))))
5074 ;;; Process/prefix in the summary buffer
5076 (defun gnus-summary-work-articles (n)
5077 "Return a list of articles to be worked upon.
5078 The prefix argument, the list of process marked articles, and the
5079 current article will be taken into consideration."
5081 (set-buffer gnus-summary-buffer)
5084 ;; A numerical prefix has been given.
5085 (setq n (prefix-numeric-value n))
5086 (let ((backward (< n 0))
5087 (n (abs (prefix-numeric-value n)))
5092 (push (setq article (gnus-summary-article-number))
5095 (gnus-summary-find-prev nil article)
5096 (gnus-summary-find-next nil article)))
5098 (nreverse articles)))
5099 ((and (gnus-region-active-p) (mark))
5100 (message "region active")
5101 ;; Work on the region between point and mark.
5102 (let ((max (max (point) (mark)))
5105 (goto-char (min (min (point) (mark))))
5108 (push (setq article (gnus-summary-article-number)) articles)
5109 (gnus-summary-find-next nil article)
5111 (nreverse articles))))
5112 (gnus-newsgroup-processable
5113 ;; There are process-marked articles present.
5114 ;; Save current state.
5115 (gnus-summary-save-process-mark)
5117 (reverse gnus-newsgroup-processable))
5119 ;; Just return the current article.
5120 (list (gnus-summary-article-number))))))
5122 (defmacro gnus-summary-iterate (arg &rest forms)
5123 "Iterate over the process/prefixed articles and do FORMS.
5124 ARG is the interactive prefix given to the command. FORMS will be
5125 executed with point over the summary line of the articles."
5126 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5127 `(let ((,articles (gnus-summary-work-articles ,arg)))
5129 (gnus-summary-goto-subject (car ,articles))
5133 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5134 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5136 (defun gnus-summary-save-process-mark ()
5137 "Push the current set of process marked articles on the stack."
5139 (push (copy-sequence gnus-newsgroup-processable)
5140 gnus-newsgroup-process-stack))
5142 (defun gnus-summary-kill-process-mark ()
5143 "Push the current set of process marked articles on the stack and unmark."
5145 (gnus-summary-save-process-mark)
5146 (gnus-summary-unmark-all-processable))
5148 (defun gnus-summary-yank-process-mark ()
5149 "Pop the last process mark state off the stack and restore it."
5151 (unless gnus-newsgroup-process-stack
5152 (error "Empty mark stack"))
5153 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5155 (defun gnus-summary-process-mark-set (set)
5156 "Make SET into the current process marked articles."
5157 (gnus-summary-unmark-all-processable)
5159 (gnus-summary-set-process-mark (pop set))))
5161 ;;; Searching and stuff
5163 (defun gnus-summary-search-group (&optional backward use-level)
5164 "Search for next unread newsgroup.
5165 If optional argument BACKWARD is non-nil, search backward instead."
5167 (set-buffer gnus-group-buffer)
5168 (when (gnus-group-search-forward
5169 backward nil (if use-level (gnus-group-group-level) nil))
5170 (gnus-group-group-name))))
5172 (defun gnus-summary-best-group (&optional exclude-group)
5173 "Find the name of the best unread group.
5174 If EXCLUDE-GROUP, do not go to this group."
5176 (set-buffer gnus-group-buffer)
5178 (gnus-group-best-unread-group exclude-group))))
5180 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5181 (if backward (gnus-summary-find-prev)
5182 (let* ((dummy (gnus-summary-article-intangible-p))
5183 (article (or article (gnus-summary-article-number)))
5184 (arts (gnus-data-find-list article))
5186 (when (and (not dummy)
5187 (or (not gnus-summary-check-current)
5189 (not (gnus-data-unread-p (car arts)))))
5190 (setq arts (cdr arts)))
5195 (when (or (and undownloaded
5196 (eq gnus-undownloaded-mark
5197 (gnus-data-mark (car arts))))
5198 (gnus-data-unread-p (car arts)))
5199 (setq result (car arts)
5201 (setq arts (cdr arts)))
5204 (goto-char (gnus-data-pos result))
5205 (gnus-data-number result)))))
5207 (defun gnus-summary-find-prev (&optional unread article)
5208 (let* ((eobp (eobp))
5209 (article (or article (gnus-summary-article-number)))
5210 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5212 (when (and (not eobp)
5213 (or (not gnus-summary-check-current)
5215 (not (gnus-data-unread-p (car arts)))))
5216 (setq arts (cdr arts)))
5221 (when (gnus-data-unread-p (car arts))
5222 (setq result (car arts)
5224 (setq arts (cdr arts)))
5227 (goto-char (gnus-data-pos result))
5228 (gnus-data-number result))))
5230 (defun gnus-summary-find-subject (subject &optional unread backward article)
5231 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5232 (article (or article (gnus-summary-article-number)))
5233 (articles (gnus-data-list backward))
5234 (arts (gnus-data-find-list article articles))
5236 (when (or (not gnus-summary-check-current)
5238 (not (gnus-data-unread-p (car arts))))
5239 (setq arts (cdr arts)))
5241 (and (or (not unread)
5242 (gnus-data-unread-p (car arts)))
5243 (vectorp (gnus-data-header (car arts)))
5245 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5246 (setq result (car arts)
5248 (setq arts (cdr arts)))
5250 (goto-char (gnus-data-pos result))
5251 (gnus-data-number result))))
5253 (defun gnus-summary-search-forward (&optional unread subject backward)
5254 "Search forward for an article.
5255 If UNREAD, look for unread articles. If SUBJECT, look for
5256 articles with that subject. If BACKWARD, search backward instead."
5257 (cond (subject (gnus-summary-find-subject subject unread backward))
5258 (backward (gnus-summary-find-prev unread))
5259 (t (gnus-summary-find-next unread))))
5261 (defun gnus-recenter (&optional n)
5262 "Center point in window and redisplay frame.
5263 Also do horizontal recentering."
5265 (when (and gnus-auto-center-summary
5266 (not (eq gnus-auto-center-summary 'vertical)))
5267 (gnus-horizontal-recenter))
5270 (defun gnus-summary-recenter ()
5271 "Center point in the summary window.
5272 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5273 displayed, no centering will be performed."
5274 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5275 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5277 (let* ((top (cond ((< (window-height) 4) 0)
5278 ((< (window-height) 7) 1)
5279 (t (if (numberp gnus-auto-center-summary)
5280 gnus-auto-center-summary
5282 (height (1- (window-height)))
5283 (bottom (save-excursion (goto-char (point-max))
5284 (forward-line (- height))
5286 (window (get-buffer-window (current-buffer))))
5287 ;; The user has to want it.
5288 (when gnus-auto-center-summary
5289 (when (get-buffer-window gnus-article-buffer)
5290 ;; Only do recentering when the article buffer is displayed,
5291 ;; Set the window start to either `bottom', which is the biggest
5292 ;; possible valid number, or the second line from the top,
5293 ;; whichever is the least.
5294 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
5295 (if (> bottom top-pos)
5296 ;; Keep the second line from the top visible
5297 (set-window-start window top-pos t)
5298 ;; Try to keep the bottom line visible; if it's partially
5299 ;; obscured, either scroll one more line to make it fully
5300 ;; visible, or revert to using TOP-POS.
5302 (goto-char (point-max))
5304 (let ((last-line-start (point)))
5306 (set-window-start window (point) t)
5307 (when (not (pos-visible-in-window-p last-line-start window))
5309 (set-window-start window (min (point) top-pos) t)))))))
5310 ;; Do horizontal recentering while we're at it.
5311 (when (and (get-buffer-window (current-buffer) t)
5312 (not (eq gnus-auto-center-summary 'vertical)))
5313 (let ((selected (selected-window)))
5314 (select-window (get-buffer-window (current-buffer) t))
5315 (gnus-summary-position-point)
5316 (gnus-horizontal-recenter)
5317 (select-window selected))))))
5319 (defun gnus-summary-jump-to-group (newsgroup)
5320 "Move point to NEWSGROUP in group mode buffer."
5321 ;; Keep update point of group mode buffer if visible.
5322 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5323 (save-window-excursion
5324 ;; Take care of tree window mode.
5325 (when (get-buffer-window gnus-group-buffer)
5326 (pop-to-buffer gnus-group-buffer))
5327 (gnus-group-jump-to-group newsgroup))
5329 ;; Take care of tree window mode.
5330 (if (get-buffer-window gnus-group-buffer)
5331 (pop-to-buffer gnus-group-buffer)
5332 (set-buffer gnus-group-buffer))
5333 (gnus-group-jump-to-group newsgroup))))
5335 ;; This function returns a list of article numbers based on the
5336 ;; difference between the ranges of read articles in this group and
5337 ;; the range of active articles.
5338 (defun gnus-list-of-unread-articles (group)
5339 (let* ((read (gnus-info-read (gnus-get-info group)))
5340 (active (or (gnus-active group) (gnus-activate-group group)))
5343 ;; If none are read, then all are unread.
5345 (setq first (car active))
5346 ;; If the range of read articles is a single range, then the
5347 ;; first unread article is the article after the last read
5348 ;; article. Sounds logical, doesn't it?
5349 (if (and (not (listp (cdr read)))
5350 (or (< (car read) (car active))
5351 (progn (setq read (list read))
5353 (setq first (max (car active) (1+ (cdr read))))
5354 ;; `read' is a list of ranges.
5355 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5358 (setq first (car active)))
5361 (while (< first nlast)
5363 (setq first (1+ first))))
5364 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5365 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5366 (setq read (cdr read)))))
5367 ;; And add the last unread articles.
5368 (while (<= first last)
5370 (setq first (1+ first)))
5371 ;; Return the list of unread articles.
5372 (delq 0 (nreverse unread))))
5374 (defun gnus-list-of-read-articles (group)
5375 "Return a list of unread, unticked and non-dormant articles."
5376 (let* ((info (gnus-get-info group))
5377 (marked (gnus-info-marks info))
5378 (active (gnus-active group)))
5380 (gnus-set-difference
5381 (gnus-sorted-complement
5382 (gnus-uncompress-range active)
5383 (gnus-list-of-unread-articles group))
5385 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5386 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5388 ;; Various summary commands
5390 (defun gnus-summary-select-article-buffer ()
5391 "Reconfigure windows to show article buffer."
5393 (if (not (gnus-buffer-live-p gnus-article-buffer))
5394 (error "There is no article buffer for this summary buffer")
5395 (gnus-configure-windows 'article)
5396 (select-window (get-buffer-window gnus-article-buffer))))
5398 (defun gnus-summary-universal-argument (arg)
5399 "Perform any operation on all articles that are process/prefixed."
5401 (let ((articles (gnus-summary-work-articles arg))
5408 (substitute-command-keys
5409 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
5411 (gnus-error 1 "Undefined key")
5414 (gnus-summary-goto-subject (setq article (pop articles)))
5415 (let (gnus-newsgroup-processable)
5416 (command-execute func))
5417 (gnus-summary-remove-process-mark article)))))
5418 (gnus-summary-position-point))
5420 (defun gnus-summary-toggle-truncation (&optional arg)
5421 "Toggle truncation of summary lines.
5422 With arg, turn line truncation on if arg is positive."
5424 (setq truncate-lines
5425 (if (null arg) (not truncate-lines)
5426 (> (prefix-numeric-value arg) 0)))
5429 (defun gnus-summary-reselect-current-group (&optional all rescan)
5430 "Exit and then reselect the current newsgroup.
5431 The prefix argument ALL means to select all articles."
5433 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5434 (error "Ephemeral groups can't be reselected"))
5435 (let ((current-subject (gnus-summary-article-number))
5436 (group gnus-newsgroup-name))
5437 (setq gnus-newsgroup-begin nil)
5439 ;; We have to adjust the point of group mode buffer because
5440 ;; point was moved to the next unread newsgroup by exiting.
5441 (gnus-summary-jump-to-group group)
5444 (gnus-group-get-new-news-this-group 1)))
5445 (gnus-group-read-group all t)
5446 (gnus-summary-goto-subject current-subject nil t)))
5448 (defun gnus-summary-rescan-group (&optional all)
5449 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5451 (gnus-summary-reselect-current-group all t))
5453 (defun gnus-summary-update-info (&optional non-destructive)
5455 (let ((group gnus-newsgroup-name))
5457 (when gnus-newsgroup-kill-headers
5458 (setq gnus-newsgroup-killed
5459 (gnus-compress-sequence
5461 (gnus-set-sorted-intersection
5462 (gnus-uncompress-range gnus-newsgroup-killed)
5463 (setq gnus-newsgroup-unselected
5464 (sort gnus-newsgroup-unselected '<)))
5465 (setq gnus-newsgroup-unreads
5466 (sort gnus-newsgroup-unreads '<)))
5468 (unless (listp (cdr gnus-newsgroup-killed))
5469 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5470 (let ((headers gnus-newsgroup-headers))
5471 ;; Set the new ranges of read articles.
5473 (set-buffer gnus-group-buffer)
5474 (gnus-undo-force-boundary))
5475 (gnus-update-read-articles
5476 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5477 ;; Set the current article marks.
5478 (let ((gnus-newsgroup-scored
5479 (if (and (not gnus-save-score)
5480 (not non-destructive))
5482 gnus-newsgroup-scored)))
5484 (gnus-update-marks)))
5485 ;; Do the cross-ref thing.
5486 (when gnus-use-cross-reference
5487 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5488 ;; Do not switch windows but change the buffer to work.
5489 (set-buffer gnus-group-buffer)
5490 (unless (gnus-ephemeral-group-p group)
5491 (gnus-group-update-group group)))))))
5493 (defun gnus-summary-save-newsrc (&optional force)
5494 "Save the current number of read/marked articles in the dribble buffer.
5495 The dribble buffer will then be saved.
5496 If FORCE (the prefix), also save the .newsrc file(s)."
5498 (gnus-summary-update-info t)
5500 (gnus-save-newsrc-file)
5501 (gnus-dribble-save)))
5503 (defun gnus-summary-exit (&optional temporary)
5504 "Exit reading current newsgroup, and then return to group selection mode.
5505 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
5507 (gnus-set-global-variables)
5508 (when (gnus-buffer-live-p gnus-article-buffer)
5510 (set-buffer gnus-article-buffer)
5511 (mm-destroy-parts gnus-article-mime-handles)
5512 ;; Set it to nil for safety reason.
5513 (setq gnus-article-mime-handle-alist nil)
5514 (setq gnus-article-mime-handles nil)))
5515 (gnus-kill-save-kill-buffer)
5516 (gnus-async-halt-prefetch)
5517 (let* ((group gnus-newsgroup-name)
5518 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5521 (buf (current-buffer)))
5523 ;; Do adaptive scoring, and possibly save score files.
5524 (when gnus-newsgroup-adaptive
5525 (gnus-score-adaptive))
5526 (when gnus-use-scoring
5528 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5529 ;; If we have several article buffers, we kill them at exit.
5530 (unless gnus-single-article-buffer
5531 (gnus-kill-buffer gnus-original-article-buffer)
5532 (setq gnus-article-current nil))
5533 (when gnus-use-cache
5534 (gnus-cache-possibly-remove-articles)
5535 (gnus-cache-save-buffers))
5536 (gnus-async-prefetch-remove-group group)
5537 (when gnus-suppress-duplicates
5538 (gnus-dup-enter-articles))
5539 (when gnus-use-trees
5540 (gnus-tree-close group))
5541 (when gnus-use-cache
5542 (gnus-cache-write-active))
5543 ;; Remove entries for this group.
5544 (nnmail-purge-split-history (gnus-group-real-name group))
5545 ;; Make all changes in this group permanent.
5547 (gnus-run-hooks 'gnus-exit-group-hook)
5548 (gnus-summary-update-info))
5549 (gnus-close-group group)
5550 ;; Make sure where we were, and go to next newsgroup.
5551 (set-buffer gnus-group-buffer)
5553 (gnus-group-jump-to-group group))
5554 (gnus-run-hooks 'gnus-summary-exit-hook)
5555 (unless (or quit-config
5556 ;; If this group has disappeared from the summary
5557 ;; buffer, don't skip forwards.
5558 (not (string= group (gnus-group-group-name))))
5559 (gnus-group-next-unread-group 1))
5560 (setq group-point (point))
5563 ;; If we have several article buffers, we kill them at exit.
5564 (unless gnus-single-article-buffer
5565 (gnus-kill-buffer gnus-article-buffer)
5566 (gnus-kill-buffer gnus-original-article-buffer)
5567 (setq gnus-article-current nil))
5569 (if (not gnus-kill-summary-on-exit)
5570 (gnus-deaden-summary)
5571 ;; We set all buffer-local variables to nil. It is unclear why
5572 ;; this is needed, but if we don't, buffer-local variables are
5573 ;; not garbage-collected, it seems. This would the lead to en
5574 ;; ever-growing Emacs.
5575 (gnus-summary-clear-local-variables)
5576 (when (get-buffer gnus-article-buffer)
5577 (bury-buffer gnus-article-buffer))
5578 ;; We clear the global counterparts of the buffer-local
5579 ;; variables as well, just to be on the safe side.
5580 (set-buffer gnus-group-buffer)
5581 (gnus-summary-clear-local-variables)
5582 ;; Return to group mode buffer.
5583 (when (eq mode 'gnus-summary-mode)
5584 (gnus-kill-buffer buf)))
5585 (setq gnus-current-select-method gnus-select-method)
5586 (pop-to-buffer gnus-group-buffer)
5587 (if (not quit-config)
5589 (goto-char group-point)
5590 (gnus-configure-windows 'group 'force))
5591 (gnus-handle-ephemeral-exit quit-config))
5592 ;; Clear the current group name.
5594 (setq gnus-newsgroup-name nil)))))
5596 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5597 (defun gnus-summary-exit-no-update (&optional no-questions)
5598 "Quit reading current newsgroup without updating read article info."
5600 (let* ((group gnus-newsgroup-name)
5601 (quit-config (gnus-group-quit-config group)))
5602 (when (or no-questions
5604 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5605 (gnus-async-halt-prefetch)
5607 (delq 'gnus-summary-expire-articles
5608 (copy-sequence gnus-summary-prepare-exit-hook)))
5609 (when (gnus-buffer-live-p gnus-article-buffer)
5611 (set-buffer gnus-article-buffer)
5612 (mm-destroy-parts gnus-article-mime-handles)
5613 ;; Set it to nil for safety reason.
5614 (setq gnus-article-mime-handle-alist nil)
5615 (setq gnus-article-mime-handles nil)))
5616 ;; If we have several article buffers, we kill them at exit.
5617 (unless gnus-single-article-buffer
5618 (gnus-kill-buffer gnus-article-buffer)
5619 (gnus-kill-buffer gnus-original-article-buffer)
5620 (setq gnus-article-current nil))
5621 (if (not gnus-kill-summary-on-exit)
5622 (gnus-deaden-summary)
5623 (gnus-close-group group)
5624 (gnus-summary-clear-local-variables)
5625 (set-buffer gnus-group-buffer)
5626 (gnus-summary-clear-local-variables)
5627 (when (get-buffer gnus-summary-buffer)
5628 (kill-buffer gnus-summary-buffer)))
5629 (unless gnus-single-article-buffer
5630 (setq gnus-article-current nil))
5631 (when gnus-use-trees
5632 (gnus-tree-close group))
5633 (gnus-async-prefetch-remove-group group)
5634 (when (get-buffer gnus-article-buffer)
5635 (bury-buffer gnus-article-buffer))
5636 ;; Return to the group buffer.
5637 (gnus-configure-windows 'group 'force)
5638 ;; Clear the current group name.
5639 (setq gnus-newsgroup-name nil)
5640 (when (equal (gnus-group-group-name) group)
5641 (gnus-group-next-unread-group 1))
5643 (gnus-handle-ephemeral-exit quit-config)))))
5645 (defun gnus-handle-ephemeral-exit (quit-config)
5646 "Handle movement when leaving an ephemeral group.
5647 The state which existed when entering the ephemeral is reset."
5648 (if (not (buffer-name (car quit-config)))
5649 (gnus-configure-windows 'group 'force)
5650 (set-buffer (car quit-config))
5651 (cond ((eq major-mode 'gnus-summary-mode)
5652 (gnus-set-global-variables))
5653 ((eq major-mode 'gnus-article-mode)
5655 ;; The `gnus-summary-buffer' variable may point
5656 ;; to the old summary buffer when using a single
5658 (unless (gnus-buffer-live-p gnus-summary-buffer)
5659 (set-buffer gnus-group-buffer))
5660 (set-buffer gnus-summary-buffer)
5661 (gnus-set-global-variables))))
5662 (if (or (eq (cdr quit-config) 'article)
5663 (eq (cdr quit-config) 'pick))
5665 ;; The current article may be from the ephemeral group
5666 ;; thus it is best that we reload this article
5667 (gnus-summary-show-article)
5668 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5669 (gnus-configure-windows 'pick 'force)
5670 (gnus-configure-windows (cdr quit-config) 'force)))
5671 (gnus-configure-windows (cdr quit-config) 'force))
5672 (when (eq major-mode 'gnus-summary-mode)
5673 (gnus-summary-next-subject 1 nil t)
5674 (gnus-summary-recenter)
5675 (gnus-summary-position-point))))
5679 (defvar gnus-dead-summary-mode-map nil)
5681 (unless gnus-dead-summary-mode-map
5682 (setq gnus-dead-summary-mode-map (make-keymap))
5683 (suppress-keymap gnus-dead-summary-mode-map)
5684 (substitute-key-definition
5685 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5686 (let ((keys '("\C-d" "\r" "\177" [delete])))
5688 (define-key gnus-dead-summary-mode-map
5689 (pop keys
) 'gnus-summary-wake-up-the-dead
))))
5691 (defvar gnus-dead-summary-mode nil
5692 "Minor mode for Gnus summary buffers.")
5694 (defun gnus-dead-summary-mode (&optional arg
)
5695 "Minor mode for Gnus summary buffers."
5697 (when (eq major-mode
'gnus-summary-mode
)
5698 (make-local-variable 'gnus-dead-summary-mode
)
5699 (setq gnus-dead-summary-mode
5700 (if (null arg
) (not gnus-dead-summary-mode
)
5701 (> (prefix-numeric-value arg
) 0)))
5702 (when gnus-dead-summary-mode
5703 (gnus-add-minor-mode
5704 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
5706 (defun gnus-deaden-summary ()
5707 "Make the current summary buffer into a dead summary buffer."
5708 ;; Kill any previous dead summary buffer.
5709 (when (and gnus-dead-summary
5710 (buffer-name gnus-dead-summary
))
5712 (set-buffer gnus-dead-summary
)
5713 (when gnus-dead-summary-mode
5714 (kill-buffer (current-buffer)))))
5715 ;; Make this the current dead summary.
5716 (setq gnus-dead-summary
(current-buffer))
5717 (gnus-dead-summary-mode 1)
5718 (let ((name (buffer-name)))
5719 (when (string-match "Summary" name
)
5721 (concat (substring name
0 (match-beginning 0)) "Dead "
5722 (substring name
(match-beginning 0)))
5726 (defun gnus-kill-or-deaden-summary (buffer)
5727 "Kill or deaden the summary BUFFER."
5729 (when (and (buffer-name buffer
)
5730 (not gnus-single-article-buffer
))
5733 (gnus-kill-buffer gnus-article-buffer
)
5734 (gnus-kill-buffer gnus-original-article-buffer
)))
5735 (cond (gnus-kill-summary-on-exit
5736 (when (and gnus-use-trees
5737 (gnus-buffer-exists-p buffer
))
5740 (gnus-tree-close gnus-newsgroup-name
)))
5741 (gnus-kill-buffer buffer
))
5742 ((gnus-buffer-exists-p buffer
)
5745 (gnus-deaden-summary))))))
5747 (defun gnus-summary-wake-up-the-dead (&rest args
)
5748 "Wake up the dead summary buffer."
5750 (gnus-dead-summary-mode -
1)
5751 (let ((name (buffer-name)))
5752 (when (string-match "Dead " name
)
5754 (concat (substring name
0 (match-beginning 0))
5755 (substring name
(match-end 0)))
5757 (gnus-message 3 "This dead summary is now alive again"))
5759 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5760 (defun gnus-summary-fetch-faq (&optional faq-dir
)
5761 "Fetch the FAQ for the current group.
5762 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5766 (when current-prefix-arg
5768 "FAQ dir: " (and (listp gnus-group-faq-directory
)
5769 (mapcar (lambda (file) (list file
))
5770 gnus-group-faq-directory
))))))
5771 (let (gnus-faq-buffer)
5772 (when (setq gnus-faq-buffer
5773 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
5774 (gnus-configure-windows 'summary-faq
))))
5776 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5777 (defun gnus-summary-describe-group (&optional force
)
5778 "Describe the current newsgroup."
5780 (gnus-group-describe-group force gnus-newsgroup-name
))
5782 (defun gnus-summary-describe-briefly ()
5783 "Describe summary mode commands briefly."
5785 (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")))
5787 ;; Walking around group mode buffer from summary mode.
5789 (defun gnus-summary-next-group (&optional no-article target-group backward
)
5790 "Exit current newsgroup and then select next unread newsgroup.
5791 If prefix argument NO-ARTICLE is non-nil, no article is selected
5792 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5793 previous group instead."
5795 ;; Stop pre-fetching.
5796 (gnus-async-halt-prefetch)
5797 (let ((current-group gnus-newsgroup-name
)
5798 (current-buffer (current-buffer))
5800 ;; First we semi-exit this group to update Xrefs and all variables.
5801 ;; We can't do a real exit, because the window conf must remain
5802 ;; the same in case the user is prompted for info, and we don't
5803 ;; want the window conf to change before that...
5804 (gnus-summary-exit t
)
5805 (while (not entered
)
5806 ;; Then we find what group we are supposed to enter.
5807 (set-buffer gnus-group-buffer
)
5808 (gnus-group-jump-to-group current-group
)
5811 (if (eq gnus-keep-same-level
'best
)
5812 (gnus-summary-best-group gnus-newsgroup-name
)
5813 (gnus-summary-search-group backward gnus-keep-same-level
))))
5814 (if (not target-group
)
5815 ;; There are no further groups, so we return to the group
5818 (gnus-message 5 "Returning to the group buffer")
5820 (when (gnus-buffer-live-p current-buffer
)
5821 (set-buffer current-buffer
)
5822 (gnus-summary-exit))
5823 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
5824 ;; We try to enter the target group.
5825 (gnus-group-jump-to-group target-group
)
5826 (let ((unreads (gnus-group-group-unread)))
5827 (if (and (or (eq t unreads
)
5828 (and unreads
(not (zerop unreads
))))
5829 (gnus-summary-read-group
5830 target-group nil no-article
5831 (and (buffer-name current-buffer
) current-buffer
)
5834 (setq current-group target-group
5835 target-group nil
)))))))
5837 (defun gnus-summary-prev-group (&optional no-article
)
5838 "Exit current newsgroup and then select previous unread newsgroup.
5839 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5841 (gnus-summary-next-group no-article nil t
))
5843 ;; Walking around summary lines.
5845 (defun gnus-summary-first-subject (&optional unread undownloaded
)
5846 "Go to the first unread subject.
5847 If UNREAD is non-nil, go to the first unread article.
5848 Returns the article selected or nil if there are no unread articles."
5853 ((null gnus-newsgroup-data
)
5854 (gnus-message 3 "No articles in the group")
5856 ;; Pick the first article.
5858 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
5859 (gnus-data-number (car gnus-newsgroup-data
)))
5860 ;; No unread articles.
5861 ((null gnus-newsgroup-unreads
)
5862 (gnus-message 3 "No more unread articles")
5864 ;; Find the first unread article.
5866 (let ((data gnus-newsgroup-data
))
5868 (and (not (and undownloaded
5869 (eq gnus-undownloaded-mark
5870 (gnus-data-mark (car data
)))))
5871 (not (gnus-data-unread-p (car data
)))))
5872 (setq data
(cdr data
)))
5874 (goto-char (gnus-data-pos (car data
)))
5875 (gnus-data-number (car data
))))))
5876 (gnus-summary-position-point)))
5878 (defun gnus-summary-next-subject (n &optional unread dont-display
)
5879 "Go to next N'th summary line.
5880 If N is negative, go to the previous N'th subject line.
5881 If UNREAD is non-nil, only unread articles are selected.
5882 The difference between N and the actual number of steps taken is
5885 (let ((backward (< n
0))
5889 (gnus-summary-find-prev unread
)
5890 (gnus-summary-find-next unread
)))
5891 (unless (zerop (setq n
(1- n
)))
5892 (gnus-summary-show-thread)))
5894 (gnus-message 7 "No more%s articles"
5895 (if unread
" unread" "")))
5896 (unless dont-display
5897 (gnus-summary-recenter)
5898 (gnus-summary-position-point))
5901 (defun gnus-summary-next-unread-subject (n)
5902 "Go to next N'th unread summary line."
5904 (gnus-summary-next-subject n t
))
5906 (defun gnus-summary-prev-subject (n &optional unread
)
5907 "Go to previous N'th summary line.
5908 If optional argument UNREAD is non-nil, only unread article is selected."
5910 (gnus-summary-next-subject (- n
) unread
))
5912 (defun gnus-summary-prev-unread-subject (n)
5913 "Go to previous N'th unread summary line."
5915 (gnus-summary-next-subject (- n
) t
))
5917 (defun gnus-summary-goto-subject (article &optional force silent
)
5918 "Go the subject line of ARTICLE.
5919 If FORCE, also allow jumping to articles not currently shown."
5920 (interactive "nArticle number: ")
5922 (data (gnus-data-find article
)))
5923 ;; We read in the article if we have to.
5926 (gnus-summary-insert-subject
5928 (if (or (numberp force
) (vectorp force
)) force
)
5930 (setq data
(gnus-data-find article
)))
5935 (gnus-message 3 "Can't find article %d" article
))
5937 (goto-char (gnus-data-pos data
))
5938 (gnus-summary-position-point)
5941 ;; Walking around summary lines with displaying articles.
5943 (defun gnus-summary-expand-window (&optional arg
)
5944 "Make the summary buffer take up the entire Emacs frame.
5945 Given a prefix, will force an `article' buffer configuration."
5948 (gnus-configure-windows 'article
'force
)
5949 (gnus-configure-windows 'summary
'force
)))
5951 (defun gnus-summary-display-article (article &optional all-header
)
5952 "Display ARTICLE in article buffer."
5953 (when (gnus-buffer-live-p gnus-article-buffer
)
5954 (with-current-buffer gnus-article-buffer
5955 (mm-enable-multibyte)))
5956 (gnus-set-global-variables)
5960 (if gnus-summary-display-article-function
5961 (funcall gnus-summary-display-article-function article all-header
)
5962 (gnus-article-prepare article all-header
))
5963 (gnus-run-hooks 'gnus-select-article-hook
)
5964 (when (and gnus-current-article
5965 (not (zerop gnus-current-article
)))
5966 (gnus-summary-goto-subject gnus-current-article
))
5967 (gnus-summary-recenter)
5968 (when (and gnus-use-trees gnus-show-threads
)
5969 (gnus-possibly-generate-tree article
)
5970 (gnus-highlight-selected-tree article
))
5971 ;; Successfully display article.
5972 (gnus-article-set-window-start
5973 (cdr (assq article gnus-newsgroup-bookmarks
))))))
5975 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
5976 "Select the current article.
5977 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5978 non-nil, the article will be re-fetched even if it already present in
5979 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5981 ;; Make sure we are in the summary buffer to work around bbdb bug.
5982 (unless (eq major-mode
'gnus-summary-mode
)
5983 (set-buffer gnus-summary-buffer
))
5984 (let ((article (or article
(gnus-summary-article-number)))
5985 (all-headers (not (not all-headers
))) ;Must be t or nil.
5986 gnus-summary-display-article-function
)
5988 (gnus-summary-article-pseudo-p article
)
5989 (error "This is a pseudo-article"))
5991 (set-buffer gnus-summary-buffer
)
5992 (if (or (and gnus-single-article-buffer
5993 (or (null gnus-current-article
)
5994 (null gnus-article-current
)
5995 (null (get-buffer gnus-article-buffer
))
5996 (not (eq article
(cdr gnus-article-current
)))
5997 (not (equal (car gnus-article-current
)
5998 gnus-newsgroup-name
))))
5999 (and (not gnus-single-article-buffer
)
6000 (or (null gnus-current-article
)
6001 (not (eq gnus-current-article article
))))
6003 ;; The requested article is different from the current article.
6005 (gnus-summary-display-article article all-headers
)
6006 (when (gnus-buffer-live-p gnus-article-buffer
)
6007 (with-current-buffer gnus-article-buffer
6008 (if (not gnus-article-decoded-p
) ;; a local variable
6009 (mm-disable-multibyte))))
6010 (when (or all-headers gnus-show-all-headers
)
6011 (gnus-article-show-all-headers))
6012 (gnus-article-set-window-start
6013 (cdr (assq article gnus-newsgroup-bookmarks
)))
6015 (when (or all-headers gnus-show-all-headers
)
6016 (gnus-article-show-all-headers))
6019 (defun gnus-summary-set-current-mark (&optional current-mark
)
6020 "Obsolete function."
6023 (defun gnus-summary-next-article (&optional unread subject backward push
)
6024 "Select the next article.
6025 If UNREAD, only unread articles are selected.
6026 If SUBJECT, only articles with SUBJECT are selected.
6027 If BACKWARD, the previous article is selected instead of the next."
6030 ;; Is there such an article?
6031 ((and (gnus-summary-search-forward unread subject backward
)
6032 (or (gnus-summary-display-article (gnus-summary-article-number))
6033 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
6034 (gnus-summary-position-point))
6035 ;; If not, we try the first unread, if that is wanted.
6037 gnus-auto-select-same
6038 (gnus-summary-first-unread-article))
6039 (gnus-summary-position-point)
6040 (gnus-message 6 "Wrapped"))
6041 ;; Try to get next/previous article not displayed in this group.
6042 ((and gnus-auto-extend-newsgroup
6043 (not unread
) (not subject
))
6044 (gnus-summary-goto-article
6045 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
6046 nil
(count-lines (point-min) (point))))
6047 ;; Go to next/previous group.
6049 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
6050 (gnus-summary-jump-to-group gnus-newsgroup-name
))
6051 (let ((cmd last-command-char
)
6054 (set-buffer gnus-group-buffer
)
6057 (if (eq gnus-keep-same-level
'best
)
6058 (gnus-summary-best-group gnus-newsgroup-name
)
6059 (gnus-summary-search-group backward gnus-keep-same-level
))))
6060 ;; For some reason, the group window gets selected. We change
6062 (select-window (get-buffer-window (current-buffer)))
6063 ;; Select next unread newsgroup automagically.
6065 ((or (not gnus-auto-select-next
)
6067 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
6068 ((or (eq gnus-auto-select-next
'quietly
)
6069 (and (eq gnus-auto-select-next
'slightly-quietly
)
6071 (and (eq gnus-auto-select-next
'almost-quietly
)
6072 (gnus-summary-last-article-p)))
6074 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
6076 (gnus-message 7 "No more%s articles (%s)..."
6077 (if unread
" unread" "")
6078 (if group
(concat "selecting " group
)
6080 (gnus-summary-next-group nil group backward
)))
6082 (when (gnus-key-press-event-p last-input-event
)
6083 (gnus-summary-walk-group-buffer
6084 gnus-newsgroup-name cmd unread backward point
))))))))
6086 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
6087 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
6088 (?\C-p
(gnus-group-prev-unread-group 1))))
6089 (cursor-in-echo-area t
)
6090 keve key group ended
)
6092 (set-buffer gnus-group-buffer
)
6095 (if (eq gnus-keep-same-level
'best
)
6096 (gnus-summary-best-group gnus-newsgroup-name
)
6097 (gnus-summary-search-group backward gnus-keep-same-level
))))
6100 5 "No more%s articles%s" (if unread
" unread" "")
6102 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
6103 (format " (Type %s for %s [%s])"
6104 (single-key-description cmd
) group
6105 (car (gnus-gethash group gnus-newsrc-hashtb
)))
6106 (format " (Type %s to exit %s)"
6107 (single-key-description cmd
)
6108 gnus-newsgroup-name
)))
6109 ;; Confirm auto selection.
6110 (setq key
(car (setq keve
(gnus-read-event-char))))
6113 ((assq key keystrokes
)
6114 (let ((obuf (current-buffer)))
6115 (switch-to-buffer gnus-group-buffer
)
6117 (gnus-group-jump-to-group group
))
6118 (eval (cadr (assq key keystrokes
)))
6119 (setq group
(gnus-group-group-name))
6120 (switch-to-buffer obuf
))
6124 (gnus-ephemeral-group-p gnus-newsgroup-name
))
6126 (gnus-summary-next-group nil group backward
)))
6128 (push (cdr keve
) unread-command-events
))))))
6130 (defun gnus-summary-next-unread-article ()
6131 "Select unread article after current one."
6133 (gnus-summary-next-article
6134 (or (not (eq gnus-summary-goto-unread
'never
))
6135 (gnus-summary-last-article-p (gnus-summary-article-number)))
6136 (and gnus-auto-select-same
6137 (gnus-summary-article-subject))))
6139 (defun gnus-summary-prev-article (&optional unread subject
)
6140 "Select the article after the current one.
6141 If UNREAD is non-nil, only unread articles are selected."
6143 (gnus-summary-next-article unread subject t
))
6145 (defun gnus-summary-prev-unread-article ()
6146 "Select unread article before current one."
6148 (gnus-summary-prev-article
6149 (or (not (eq gnus-summary-goto-unread
'never
))
6150 (gnus-summary-first-article-p (gnus-summary-article-number)))
6151 (and gnus-auto-select-same
6152 (gnus-summary-article-subject))))
6154 (defun gnus-summary-next-page (&optional lines circular
)
6155 "Show next page of the selected article.
6156 If at the end of the current article, select the next article.
6157 LINES says how many lines should be scrolled up.
6159 If CIRCULAR is non-nil, go to the start of the article instead of
6160 selecting the next article when reaching the end of the current
6163 (setq gnus-summary-buffer
(current-buffer))
6164 (gnus-set-global-variables)
6165 (let ((article (gnus-summary-article-number))
6166 (article-window (get-buffer-window gnus-article-buffer t
))
6168 ;; If the buffer is empty, we have no article.
6170 (error "No article to select"))
6171 (gnus-configure-windows 'article
)
6172 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
6173 (if (and (eq gnus-summary-goto-unread
'never
)
6174 (not (gnus-summary-last-article-p article
)))
6175 (gnus-summary-next-article)
6176 (gnus-summary-next-unread-article))
6177 (if (or (null gnus-current-article
)
6178 (null gnus-article-current
)
6179 (/= article
(cdr gnus-article-current
))
6180 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6181 ;; Selected subject is different from current article's.
6182 (gnus-summary-display-article article
)
6183 (when article-window
6184 (gnus-eval-in-buffer-window gnus-article-buffer
6185 (setq endp
(gnus-article-next-page lines
)))
6188 (gnus-summary-beginning-of-article))
6190 (gnus-message 3 "End of message"))
6192 (if (and (eq gnus-summary-goto-unread
'never
)
6193 (not (gnus-summary-last-article-p article
)))
6194 (gnus-summary-next-article)
6195 (gnus-summary-next-unread-article))))))))
6196 (gnus-summary-recenter)
6197 (gnus-summary-position-point)))
6199 (defun gnus-summary-prev-page (&optional lines move
)
6200 "Show previous page of selected article.
6201 Argument LINES specifies lines to be scrolled down.
6202 If MOVE, move to the previous unread article if point is at
6203 the beginning of the buffer."
6205 (let ((article (gnus-summary-article-number))
6206 (article-window (get-buffer-window gnus-article-buffer t
))
6208 (gnus-configure-windows 'article
)
6209 (if (or (null gnus-current-article
)
6210 (null gnus-article-current
)
6211 (/= article
(cdr gnus-article-current
))
6212 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6213 ;; Selected subject is different from current article's.
6214 (gnus-summary-display-article article
)
6215 (gnus-summary-recenter)
6216 (when article-window
6217 (gnus-eval-in-buffer-window gnus-article-buffer
6218 (setq endp
(gnus-article-prev-page lines
)))
6219 (when (and move endp
)
6221 (gnus-message 3 "Beginning of message"))
6223 (if (and (eq gnus-summary-goto-unread
'never
)
6224 (not (gnus-summary-first-article-p article
)))
6225 (gnus-summary-prev-article)
6226 (gnus-summary-prev-unread-article))))))))
6227 (gnus-summary-position-point))
6229 (defun gnus-summary-prev-page-or-article (&optional lines
)
6230 "Show previous page of selected article.
6231 Argument LINES specifies lines to be scrolled down.
6232 If at the beginning of the article, go to the next article."
6234 (gnus-summary-prev-page lines t
))
6236 (defun gnus-summary-scroll-up (lines)
6237 "Scroll up (or down) one line current article.
6238 Argument LINES specifies lines to be scrolled up (or down if negative)."
6240 (gnus-configure-windows 'article
)
6241 (gnus-summary-show-thread)
6242 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
6243 (gnus-eval-in-buffer-window gnus-article-buffer
6245 (when (gnus-article-next-page lines
)
6246 (gnus-message 3 "End of message")))
6248 (gnus-article-prev-page (- lines
))))))
6249 (gnus-summary-recenter)
6250 (gnus-summary-position-point))
6252 (defun gnus-summary-scroll-down (lines)
6253 "Scroll down (or up) one line current article.
6254 Argument LINES specifies lines to be scrolled down (or up if negative)."
6256 (gnus-summary-scroll-up (- lines
)))
6258 (defun gnus-summary-next-same-subject ()
6259 "Select next article which has the same subject as current one."
6261 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
6263 (defun gnus-summary-prev-same-subject ()
6264 "Select previous article which has the same subject as current one."
6266 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
6268 (defun gnus-summary-next-unread-same-subject ()
6269 "Select next unread article which has the same subject as current one."
6271 (gnus-summary-next-article t
(gnus-summary-article-subject)))
6273 (defun gnus-summary-prev-unread-same-subject ()
6274 "Select previous unread article which has the same subject as current one."
6276 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
6278 (defun gnus-summary-first-unread-article ()
6279 "Select the first unread article.
6280 Return nil if there are no unread articles."
6283 (when (gnus-summary-first-subject t
)
6284 (gnus-summary-show-thread)
6285 (gnus-summary-first-subject t
)
6286 (gnus-summary-display-article (gnus-summary-article-number)))
6287 (gnus-summary-position-point)))
6289 (defun gnus-summary-first-unread-subject ()
6290 "Place the point on the subject line of the first unread article.
6291 Return nil if there are no unread articles."
6294 (when (gnus-summary-first-subject t
)
6295 (gnus-summary-show-thread)
6296 (gnus-summary-first-subject t
))
6297 (gnus-summary-position-point)))
6299 (defun gnus-summary-first-article ()
6300 "Select the first article.
6301 Return nil if there are no articles."
6304 (when (gnus-summary-first-subject)
6305 (gnus-summary-show-thread)
6306 (gnus-summary-first-subject)
6307 (gnus-summary-display-article (gnus-summary-article-number)))
6308 (gnus-summary-position-point)))
6310 (defun gnus-summary-best-unread-article ()
6311 "Select the unread article with the highest score."
6313 (let ((best -
1000000)
6314 (data gnus-newsgroup-data
)
6317 (and (gnus-data-unread-p (car data
))
6319 (gnus-summary-article-score (gnus-data-number (car data
))))
6322 article
(gnus-data-number (car data
))))
6323 (setq data
(cdr data
)))
6326 (gnus-summary-goto-article article
)
6327 (error "No unread articles"))
6328 (gnus-summary-position-point))))
6330 (defun gnus-summary-last-subject ()
6331 "Go to the last displayed subject line in the group."
6332 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
6334 (gnus-summary-goto-subject article
))))
6336 (defun gnus-summary-goto-article (article &optional all-headers force
)
6337 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6338 If ALL-HEADERS is non-nil, no header lines are hidden.
6339 If FORCE, go to the article even if it isn't displayed. If FORCE
6340 is a number, it is the line the article is to be displayed on."
6344 "Article number or Message-ID: "
6345 (mapcar (lambda (number) (list (int-to-string number
)))
6346 gnus-newsgroup-limit
))
6350 (if (and (stringp article
)
6351 (string-match "@" article
))
6352 (gnus-summary-refer-article article
)
6353 (when (stringp article
)
6354 (setq article
(string-to-number article
)))
6355 (if (gnus-summary-goto-subject article force
)
6356 (gnus-summary-display-article article all-headers
)
6357 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
6358 (gnus-summary-position-point)))
6360 (defun gnus-summary-goto-last-article ()
6361 "Go to the previously read article."
6364 (when gnus-last-article
6365 (gnus-summary-goto-article gnus-last-article nil t
))
6366 (gnus-summary-position-point)))
6368 (defun gnus-summary-pop-article (number)
6369 "Pop one article off the history and go to the previous.
6370 NUMBER articles will be popped off."
6373 (setq gnus-newsgroup-history
6374 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
6376 (gnus-summary-goto-article (car to
) nil t
)
6377 (error "Article history empty")))
6378 (gnus-summary-position-point))
6380 ;; Summary commands and functions for limiting the summary buffer.
6382 (defun gnus-summary-limit-to-articles (n)
6383 "Limit the summary buffer to the next N articles.
6384 If not given a prefix, use the process marked articles instead."
6387 (let ((articles (gnus-summary-work-articles n
)))
6388 (setq gnus-newsgroup-processable nil
)
6389 (gnus-summary-limit articles
))
6390 (gnus-summary-position-point)))
6392 (defun gnus-summary-pop-limit (&optional total
)
6393 "Restore the previous limit.
6394 If given a prefix, remove all limits."
6397 (setq gnus-newsgroup-limits
6398 (list (mapcar (lambda (h) (mail-header-number h
))
6399 gnus-newsgroup-headers
))))
6400 (unless gnus-newsgroup-limits
6401 (error "No limit to pop"))
6403 (gnus-summary-limit nil
'pop
)
6404 (gnus-summary-position-point)))
6406 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
6407 "Limit the summary buffer to articles that have subjects that match a regexp.
6408 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
6410 (list (read-string (if current-prefix-arg
6411 "Exclude subject (regexp): "
6412 "Limit to subject (regexp): "))
6413 nil current-prefix-arg
))
6415 (setq header
"subject"))
6416 (when (not (equal "" subject
))
6418 (let ((articles (gnus-summary-find-matching
6419 (or header
"subject") subject
'all nil nil
6422 (error "Found no matches for \"%s\"" subject
))
6423 (gnus-summary-limit articles
))
6424 (gnus-summary-position-point))))
6426 (defun gnus-summary-limit-to-author (from &optional not-matching
)
6427 "Limit the summary buffer to articles that have authors that match a regexp.
6428 If NOT-MATCHING, excluding articles that have authors that match a regexp."
6430 (list (read-string (if current-prefix-arg
6431 "Exclude author (regexp): "
6432 "Limit to author (regexp): "))
6433 current-prefix-arg
))
6434 (gnus-summary-limit-to-subject from
"from" not-matching
))
6436 (defun gnus-summary-limit-to-age (age &optional younger-p
)
6437 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6438 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6439 articles that are younger than AGE days."
6441 (let ((younger current-prefix-arg
)
6444 (while (not days-got
)
6445 (setq days
(if younger
6446 (read-string "Limit to articles within (in days): ")
6447 (read-string "Limit to articles old than (in days): ")))
6448 (when (> (length days
) 0)
6449 (setq days
(read days
)))
6452 (message "Please enter a number.")
6454 (list days younger
)))
6456 (let ((data gnus-newsgroup-data
)
6457 (cutoff (days-to-time age
))
6458 articles d date is-younger
)
6459 (while (setq d
(pop data
))
6460 (when (and (vectorp (gnus-data-header d
))
6461 (setq date
(mail-header-date (gnus-data-header d
))))
6462 (setq is-younger
(time-less-p
6463 (time-since (condition-case ()
6470 (push (gnus-data-number d
) articles
))))
6471 (gnus-summary-limit (nreverse articles
)))
6472 (gnus-summary-position-point)))
6474 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
6475 "Limit the summary buffer to articles that match an 'extra' header."
6479 (gnus-completing-read
6480 (symbol-name (car gnus-extra-headers
))
6481 (if current-prefix-arg
6482 "Exclude extra header:"
6483 "Limit extra header:")
6485 (cons (symbol-name x
) x
))
6490 (read-string (format "%s header %s (regexp): "
6491 (if current-prefix-arg
"Exclude" "Limit to")
6493 current-prefix-arg
)))
6494 (when (not (equal "" regexp
))
6496 (let ((articles (gnus-summary-find-matching
6497 (cons 'extra header
) regexp
'all nil nil
6500 (error "Found no matches for \"%s\"" regexp
))
6501 (gnus-summary-limit articles
))
6502 (gnus-summary-position-point))))
6504 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6506 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6508 (defun gnus-summary-limit-to-unread (&optional all
)
6509 "Limit the summary buffer to articles that are not marked as read.
6510 If ALL is non-nil, limit strictly to unread articles."
6513 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
6514 (gnus-summary-limit-to-marks
6515 ;; Concat all the marks that say that an article is read and have
6517 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6518 gnus-killed-mark gnus-kill-file-mark
6519 gnus-low-score-mark gnus-expirable-mark
6520 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6521 gnus-duplicate-mark gnus-souped-mark
)
6524 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
6525 (make-obsolete 'gnus-summary-delete-marked-with
6526 'gnus-summary-limit-exclude-marks
)
6528 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
6529 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6530 If REVERSE, limit the summary buffer to articles that are marked
6531 with MARKS. MARKS can either be a string of marks or a list of marks.
6532 Returns how many articles were removed."
6533 (interactive "sMarks: ")
6534 (gnus-summary-limit-to-marks marks t
))
6536 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
6537 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6538 If REVERSE (the prefix), limit the summary buffer to articles that are
6539 not marked with MARKS. MARKS can either be a string of marks or a
6541 Returns how many articles were removed."
6542 (interactive "sMarks: \nP")
6544 (let ((data gnus-newsgroup-data
)
6545 (marks (if (listp marks
) marks
6546 (append marks nil
))) ; Transform to list.
6549 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
6550 (memq (gnus-data-mark (car data
)) marks
))
6551 (push (gnus-data-number (car data
)) articles
))
6552 (setq data
(cdr data
)))
6553 (gnus-summary-limit articles
))
6554 (gnus-summary-position-point)))
6556 (defun gnus-summary-limit-to-score (&optional score
)
6557 "Limit to articles with score at or above SCORE."
6559 (setq score
(if score
6560 (prefix-numeric-value score
)
6561 (or gnus-summary-default-score
0)))
6562 (let ((data gnus-newsgroup-data
)
6565 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
6567 (push (gnus-data-number (car data
)) articles
))
6568 (setq data
(cdr data
)))
6570 (gnus-summary-limit articles
)
6571 (gnus-summary-position-point))))
6573 (defun gnus-summary-limit-include-thread (id)
6574 "Display all the hidden articles that in the current thread."
6575 (interactive (list (mail-header-id (gnus-summary-article-header))))
6576 (let ((articles (gnus-articles-in-thread
6577 (gnus-id-to-thread (gnus-root-id id
)))))
6579 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
6580 (gnus-summary-position-point))))
6582 (defun gnus-summary-limit-include-dormant ()
6583 "Display all the hidden articles that are marked as dormant.
6584 Note that this command only works on a subset of the articles currently
6585 fetched for this group."
6587 (unless gnus-newsgroup-dormant
6588 (error "There are no dormant articles in this group"))
6590 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
6591 (gnus-summary-position-point)))
6593 (defun gnus-summary-limit-exclude-dormant ()
6594 "Hide all dormant articles."
6597 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
6598 (gnus-summary-position-point)))
6600 (defun gnus-summary-limit-exclude-childless-dormant ()
6601 "Hide all dormant articles that have no children."
6603 (let ((data (gnus-data-list t
))
6604 articles d children
)
6605 ;; Find all articles that are either not dormant or have
6607 (while (setq d
(pop data
))
6608 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
6610 (gnus-article-children (gnus-data-number d
)))
6613 (when (memq (car children
) articles
)
6618 (push (gnus-data-number d
) articles
)))
6621 (gnus-summary-limit articles
)
6622 (gnus-summary-position-point))))
6624 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
6625 "Mark all unread excluded articles as read.
6626 If ALL, mark even excluded ticked and dormants as read."
6628 (let ((articles (gnus-sorted-complement
6630 (mapcar (lambda (h) (mail-header-number h
))
6631 gnus-newsgroup-headers
)
6633 (sort gnus-newsgroup-limit
'<)))
6635 (setq gnus-newsgroup-unreads
6636 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit
))
6638 (setq gnus-newsgroup-dormant nil
6639 gnus-newsgroup-marked nil
6640 gnus-newsgroup-reads
6642 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
6643 gnus-newsgroup-reads
))
6644 (while (setq article
(pop articles
))
6645 (unless (or (memq article gnus-newsgroup-dormant
)
6646 (memq article gnus-newsgroup-marked
))
6647 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
6649 (defun gnus-summary-limit (articles &optional pop
)
6651 ;; We pop the previous limit off the stack and use that.
6652 (setq articles
(car gnus-newsgroup-limits
)
6653 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
6654 ;; We use the new limit, so we push the old limit on the stack.
6655 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
6657 (setq gnus-newsgroup-limit articles
)
6658 (let ((total (length gnus-newsgroup-data
))
6659 (data (gnus-data-find-list (gnus-summary-article-number)))
6660 (gnus-summary-mark-below nil
) ; Inhibit this.
6662 ;; This will do all the work of generating the new summary buffer
6663 ;; according to the new limit.
6664 (gnus-summary-prepare)
6665 ;; Hide any threads, possibly.
6666 (and gnus-show-threads
6667 gnus-thread-hide-subtree
6668 (gnus-summary-hide-all-threads))
6669 ;; Try to return to the article you were at, or one in the
6672 ;; We try to find some article after the current one.
6674 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
6677 (setq data
(cdr data
))))
6679 ;; If there is no data, that means that we were after the last
6680 ;; article. The same goes when we can't find any articles
6681 ;; after the current one.
6682 (goto-char (point-max))
6683 (gnus-summary-find-prev))
6684 (gnus-set-mode-line 'summary
)
6685 ;; We return how many articles were removed from the summary
6686 ;; buffer as a result of the new limit.
6687 (- total
(length gnus-newsgroup-data
))))
6689 (defsubst gnus-invisible-cut-children
(threads)
6692 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
6697 (defsubst gnus-cut-thread
(thread)
6698 "Go forwards in the thread until we find an article that we want to display."
6699 (when (or (eq gnus-fetch-old-headers
'some
)
6700 (eq gnus-fetch-old-headers
'invisible
)
6701 (numberp gnus-fetch-old-headers
)
6702 (eq gnus-build-sparse-threads
'some
)
6703 (eq gnus-build-sparse-threads
'more
))
6704 ;; Deal with old-fetched headers and sparse threads.
6708 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
6709 (gnus-summary-article-ancient-p
6710 (mail-header-number (car thread
))))
6711 (if (or (<= (length (cdr thread
)) 1)
6712 (eq gnus-fetch-old-headers
'invisible
))
6713 (setq gnus-newsgroup-limit
6714 (delq (mail-header-number (car thread
))
6715 gnus-newsgroup-limit
)
6716 thread
(cadr thread
))
6717 (when (gnus-invisible-cut-children (cdr thread
))
6718 (let ((th (cdr thread
)))
6720 (if (memq (mail-header-number (caar th
))
6721 gnus-newsgroup-limit
)
6722 (setq thread
(car th
)
6724 (setq th
(cdr th
))))))))))
6727 (defun gnus-cut-threads (threads)
6728 "Cut off all uninteresting articles from the beginning of threads."
6729 (when (or (eq gnus-fetch-old-headers
'some
)
6730 (eq gnus-fetch-old-headers
'invisible
)
6731 (numberp gnus-fetch-old-headers
)
6732 (eq gnus-build-sparse-threads
'some
)
6733 (eq gnus-build-sparse-threads
'more
))
6736 (setcar th
(gnus-cut-thread (car th
)))
6737 (setq th
(cdr th
)))))
6738 ;; Remove nixed out threads.
6741 (defun gnus-summary-initial-limit (&optional show-if-empty
)
6742 "Figure out what the initial limit is supposed to be on group entry.
6743 This entails weeding out unwanted dormants, low-scored articles,
6744 fetch-old-headers verbiage, and so on."
6745 ;; Most groups have nothing to remove.
6746 (if (or gnus-inhibit-limiting
6747 (and (null gnus-newsgroup-dormant
)
6748 (not (eq gnus-fetch-old-headers
'some
))
6749 (not (numberp gnus-fetch-old-headers
))
6750 (not (eq gnus-fetch-old-headers
'invisible
))
6751 (null gnus-summary-expunge-below
)
6752 (not (eq gnus-build-sparse-threads
'some
))
6753 (not (eq gnus-build-sparse-threads
'more
))
6754 (null gnus-thread-expunge-below
)
6755 (not gnus-use-nocem
)))
6757 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
6758 (setq gnus-newsgroup-limit nil
)
6761 (unless (car (symbol-value node
))
6762 ;; These threads have no parents -- they are roots.
6763 (let ((nodes (cdr (symbol-value node
)))
6766 (if (and gnus-thread-expunge-below
6767 (< (gnus-thread-total-score (car nodes
))
6768 gnus-thread-expunge-below
))
6769 (gnus-expunge-thread (pop nodes
))
6770 (setq thread
(pop nodes
))
6771 (gnus-summary-limit-children thread
))))))
6772 gnus-newsgroup-dependencies
)
6773 ;; If this limitation resulted in an empty group, we might
6774 ;; pop the previous limit and use it instead.
6775 (when (and (not gnus-newsgroup-limit
)
6777 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
6778 gnus-newsgroup-limit
))
6780 (defun gnus-summary-limit-children (thread)
6781 "Return 1 if this subthread is visible and 0 if it is not."
6782 ;; First we get the number of visible children to this thread. This
6783 ;; is done by recursing down the thread using this function, so this
6784 ;; will really go down to a leaf article first, before slowly
6785 ;; working its way up towards the root.
6789 (apply '+ (mapcar 'gnus-summary-limit-children
6792 (number (mail-header-number (car thread
)))
6795 (not (memq number gnus-newsgroup-marked
))
6797 ;; If this article is dormant and has absolutely no visible
6798 ;; children, then this article isn't visible.
6799 (and (memq number gnus-newsgroup-dormant
)
6801 ;; If this is "fetch-old-headered" and there is no
6802 ;; visible children, then we don't want this article.
6803 (and (or (eq gnus-fetch-old-headers
'some
)
6804 (numberp gnus-fetch-old-headers
))
6805 (gnus-summary-article-ancient-p number
)
6807 ;; If this is "fetch-old-headered" and `invisible', then
6808 ;; we don't want this article.
6809 (and (eq gnus-fetch-old-headers
'invisible
)
6810 (gnus-summary-article-ancient-p number
))
6811 ;; If this is a sparsely inserted article with no children,
6812 ;; we don't want it.
6813 (and (eq gnus-build-sparse-threads
'some
)
6814 (gnus-summary-article-sparse-p number
)
6816 ;; If we use expunging, and this article is really
6817 ;; low-scored, then we don't want this article.
6818 (when (and gnus-summary-expunge-below
6820 (or (cdr (assq number gnus-newsgroup-scored
))
6821 gnus-summary-default-score
))
6822 gnus-summary-expunge-below
))
6823 ;; We increase the expunge-tally here, but that has
6824 ;; nothing to do with the limits, really.
6825 (incf gnus-newsgroup-expunged-tally
)
6826 ;; We also mark as read here, if that's wanted.
6827 (when (and gnus-summary-mark-below
6828 (< score gnus-summary-mark-below
))
6829 (setq gnus-newsgroup-unreads
6830 (delq number gnus-newsgroup-unreads
))
6831 (if gnus-newsgroup-auto-expire
6832 (push number gnus-newsgroup-expirable
)
6833 (push (cons number gnus-low-score-mark
)
6834 gnus-newsgroup-reads
)))
6836 ;; Check NoCeM things.
6837 (if (and gnus-use-nocem
6838 (gnus-nocem-unwanted-article-p
6839 (mail-header-id (car thread
))))
6841 (setq gnus-newsgroup-unreads
6842 (delq number gnus-newsgroup-unreads
))
6844 ;; Nope, invisible article.
6846 ;; Ok, this article is to be visible, so we add it to the limit
6848 (push number gnus-newsgroup-limit
)
6851 (defun gnus-expunge-thread (thread)
6852 "Mark all articles in THREAD as read."
6853 (let* ((number (mail-header-number (car thread
))))
6854 (incf gnus-newsgroup-expunged-tally
)
6855 ;; We also mark as read here, if that's wanted.
6856 (setq gnus-newsgroup-unreads
6857 (delq number gnus-newsgroup-unreads
))
6858 (if gnus-newsgroup-auto-expire
6859 (push number gnus-newsgroup-expirable
)
6860 (push (cons number gnus-low-score-mark
)
6861 gnus-newsgroup-reads
)))
6862 ;; Go recursively through all subthreads.
6863 (mapcar 'gnus-expunge-thread
(cdr thread
)))
6865 ;; Summary article oriented commands
6867 (defun gnus-summary-refer-parent-article (n)
6868 "Refer parent article N times.
6869 If N is negative, go to ancestor -N instead.
6870 The difference between N and the number of articles fetched is returned."
6874 (when (not (natnump n
))
6879 (setq header
(gnus-summary-article-header))
6880 (if (and (eq (mail-header-number header
)
6881 (cdr gnus-article-current
))
6882 (equal gnus-newsgroup-name
6883 (car gnus-article-current
)))
6884 ;; If we try to find the parent of the currently
6885 ;; displayed article, then we take a look at the actual
6886 ;; References header, since this is slightly more
6887 ;; reliable than the References field we got from the
6890 (set-buffer gnus-original-article-buffer
)
6891 (nnheader-narrow-to-headers)
6892 (unless (setq ref
(message-fetch-field "references"))
6893 (setq ref
(message-fetch-field "in-reply-to")))
6896 ;; It's not the current article, so we take a bet on
6897 ;; the value we got from the server.
6898 (mail-header-references header
)))
6900 (not (equal ref
"")))
6901 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
6902 (gnus-message 1 "Couldn't find parent"))
6903 (gnus-message 1 "No references in article %d"
6904 (gnus-summary-article-number))
6907 (gnus-summary-position-point)
6910 (defun gnus-summary-refer-references ()
6911 "Fetch all articles mentioned in the References header.
6912 Return the number of articles fetched."
6914 (let ((ref (mail-header-references (gnus-summary-article-header)))
6915 (current (gnus-summary-article-number))
6919 (error "No References in the current article")
6920 ;; For each Message-ID in the References header...
6921 (while (string-match "<[^>]*>" ref
)
6923 ;; ... fetch that article.
6924 (gnus-summary-refer-article
6925 (prog1 (match-string 0 ref
)
6926 (setq ref
(substring ref
(match-end 0))))))
6927 (gnus-summary-goto-subject current
)
6928 (gnus-summary-position-point)
6931 (defun gnus-summary-refer-thread (&optional limit
)
6932 "Fetch all articles in the current thread.
6933 If LIMIT (the numerical prefix), fetch that many old headers instead
6934 of what's specified by the `gnus-refer-thread-limit' variable."
6936 (let ((id (mail-header-id (gnus-summary-article-header)))
6937 (limit (if limit
(prefix-numeric-value limit
)
6938 gnus-refer-thread-limit
)))
6939 ;; We want to fetch LIMIT *old* headers, but we also have to
6940 ;; re-fetch all the headers in the current buffer, because many of
6941 ;; them may be undisplayed. So we adjust LIMIT.
6942 (when (numberp limit
)
6943 (incf limit
(- gnus-newsgroup-end gnus-newsgroup-begin
)))
6944 (unless (eq gnus-fetch-old-headers
'invisible
)
6945 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
6946 ;; Retrieve the headers and read them in.
6947 (if (eq (gnus-retrieve-headers
6948 (list gnus-newsgroup-end
) gnus-newsgroup-name limit
)
6950 (gnus-build-all-threads)
6951 (error "Can't fetch thread from backends that don't support NOV"))
6952 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
6953 (gnus-summary-limit-include-thread id
)))
6955 (defun gnus-summary-refer-article (message-id)
6956 "Fetch an article specified by MESSAGE-ID."
6957 (interactive "sMessage-ID: ")
6958 (when (and (stringp message-id
)
6959 (not (zerop (length message-id
))))
6960 ;; Construct the correct Message-ID if necessary.
6961 ;; Suggested by tale@pawl.rpi.edu.
6962 (unless (string-match "^<" message-id
)
6963 (setq message-id
(concat "<" message-id
)))
6964 (unless (string-match ">$" message-id
)
6965 (setq message-id
(concat message-id
">")))
6966 (let* ((header (gnus-id-to-header message-id
))
6968 (gnus-summary-article-sparse-p
6969 (mail-header-number header
))
6970 (memq (mail-header-number header
)
6971 gnus-newsgroup-limit
)))
6974 ;; If the article is present in the buffer we just go to it.
6976 (or (not (gnus-summary-article-sparse-p
6977 (mail-header-number header
)))
6980 (gnus-summary-goto-article
6981 (mail-header-number header
) nil t
)
6983 (gnus-summary-update-article (mail-header-number header
)))))
6985 ;; We fetch the article.
6987 (dolist (gnus-override-method (gnus-refer-article-methods))
6988 (gnus-check-server gnus-override-method
)
6989 ;; Fetch the header, and display the article.
6990 (when (setq number
(gnus-summary-insert-subject message-id
))
6991 (gnus-summary-select-article nil nil nil number
)
6993 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
6995 (defun gnus-refer-article-methods ()
6996 "Return a list of referable methods."
6998 ;; No method, so we default to current and native.
6999 ((null gnus-refer-article-method
)
7000 (list gnus-current-select-method gnus-select-method
))
7002 ((eq 'current gnus-refer-article-method
)
7003 (list gnus-current-select-method
))
7004 ;; List of select methods.
7005 ((not (and (symbolp (car gnus-refer-article-method
))
7006 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
7008 (dolist (method gnus-refer-article-method
)
7009 (push (if (eq 'current method
)
7010 gnus-current-select-method
7014 ;; One single select method.
7016 (list gnus-refer-article-method
))))
7018 (defun gnus-summary-edit-parameters ()
7019 "Edit the group parameters of the current group."
7021 (gnus-group-edit-group gnus-newsgroup-name
'params
))
7023 (defun gnus-summary-customize-parameters ()
7024 "Customize the group parameters of the current group."
7026 (gnus-group-customize gnus-newsgroup-name
))
7028 (defun gnus-summary-enter-digest-group (&optional force
)
7029 "Enter an nndoc group based on the current article.
7030 If FORCE, force a digest interpretation. If not, try
7031 to guess what the document format is."
7033 (let ((conf gnus-current-window-configuration
))
7035 (gnus-summary-select-article))
7036 (setq gnus-current-window-configuration conf
)
7037 (let* ((name (format "%s-%d"
7038 (gnus-group-prefixed-name
7039 gnus-newsgroup-name
(list 'nndoc
""))
7041 (set-buffer gnus-summary-buffer
)
7042 gnus-current-article
)))
7043 (ogroup gnus-newsgroup-name
)
7044 (params (append (gnus-info-params (gnus-get-info ogroup
))
7045 (list (cons 'to-group ogroup
))
7046 (list (cons 'save-article-group ogroup
))))
7047 (case-fold-search t
)
7048 (buf (current-buffer))
7051 (set-buffer gnus-original-article-buffer
)
7052 ;; Have the digest group inherit the main mail address of
7053 ;; the parent article.
7054 (when (setq to-address
(or (message-fetch-field "reply-to")
7055 (message-fetch-field "from")))
7056 (setq params
(append
7057 (list (cons 'to-address
7058 (funcall gnus-decode-encoded-word-function
7060 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
7061 (insert-buffer-substring gnus-original-article-buffer
)
7062 ;; Remove lines that may lead nndoc to misinterpret the
7065 (goto-char (point-min))
7066 (or (search-forward "\n\n" nil t
) (point)))
7067 (goto-char (point-min))
7068 (delete-matching-lines "^Path:\\|^From ")
7071 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
7072 (gnus-newsgroup-ephemeral-ignored-charsets
7073 gnus-newsgroup-ignored-charsets
))
7074 (gnus-group-read-ephemeral-group
7075 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
7077 ,(if force
'mbox
'guess
))) t
))
7078 ;; Make all postings to this group go to the parent group.
7079 (nconc (gnus-info-params (gnus-get-info name
))
7081 ;; Couldn't select this doc group.
7082 (switch-to-buffer buf
)
7083 (gnus-set-global-variables)
7084 (gnus-configure-windows 'summary
)
7085 (gnus-message 3 "Article couldn't be entered?"))
7086 (kill-buffer dig
)))))
7088 (defun gnus-summary-read-document (n)
7089 "Open a new group based on the current article(s).
7090 This will allow you to read digests and other similar
7091 documents as newsgroups.
7092 Obeys the standard process/prefix convention."
7094 (let* ((articles (gnus-summary-work-articles n
))
7095 (ogroup gnus-newsgroup-name
)
7096 (params (append (gnus-info-params (gnus-get-info ogroup
))
7097 (list (cons 'to-group ogroup
))))
7098 article group egroup groups vgroup
)
7099 (while (setq article
(pop articles
))
7100 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
7101 (gnus-summary-remove-process-mark article
)
7102 (when (gnus-summary-display-article article
)
7105 (insert-buffer-substring gnus-original-article-buffer
)
7106 ;; Remove some headers that may lead nndoc to make
7108 (message-narrow-to-head)
7109 (goto-char (point-min))
7110 (delete-matching-lines "^\\(Path\\):\\|^From ")
7113 (gnus-group-read-ephemeral-group
7114 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
7115 (nndoc-article-type guess
))
7118 ;; Make all postings to this group go to the parent group.
7119 (nconc (gnus-info-params (gnus-get-info egroup
))
7121 (push egroup groups
))
7122 ;; Couldn't select this doc group.
7123 (gnus-error 3 "Article couldn't be entered"))))))
7124 ;; Now we have selected all the documents.
7127 (error "None of the articles could be interpreted as documents"))
7128 ((gnus-group-read-ephemeral-group
7129 (setq vgroup
(format
7130 "nnvirtual:%s-%s" gnus-newsgroup-name
7131 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7132 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
7134 (cons (current-buffer) 'summary
)))
7136 (error "Couldn't select virtual nndoc group")))))
7138 (defun gnus-summary-isearch-article (&optional regexp-p
)
7139 "Do incremental search forward on the current article.
7140 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7142 (gnus-summary-select-article)
7143 (gnus-configure-windows 'article
)
7144 (gnus-eval-in-buffer-window gnus-article-buffer
7147 (isearch-forward regexp-p
))))
7149 (defun gnus-summary-search-article-forward (regexp &optional backward
)
7150 "Search for an article containing REGEXP forward.
7151 If BACKWARD, search backward instead."
7154 (format "Search article %s (regexp%s): "
7155 (if current-prefix-arg
"backward" "forward")
7156 (if gnus-last-search-regexp
7157 (concat ", default " gnus-last-search-regexp
)
7159 current-prefix-arg
))
7160 (if (string-equal regexp
"")
7161 (setq regexp
(or gnus-last-search-regexp
""))
7162 (setq gnus-last-search-regexp regexp
))
7163 (if (gnus-summary-search-article regexp backward
)
7164 (gnus-summary-show-thread)
7165 (error "Search failed: \"%s\"" regexp
)))
7167 (defun gnus-summary-search-article-backward (regexp)
7168 "Search for an article containing REGEXP backward."
7171 (format "Search article backward (regexp%s): "
7172 (if gnus-last-search-regexp
7173 (concat ", default " gnus-last-search-regexp
)
7175 (gnus-summary-search-article-forward regexp
'backward
))
7177 (defun gnus-summary-search-article (regexp &optional backward
)
7178 "Search for an article containing REGEXP.
7179 Optional argument BACKWARD means do search for backward.
7180 `gnus-select-article-hook' is not called during the search."
7181 ;; We have to require this here to make sure that the following
7182 ;; dynamic binding isn't shadowed by autoloading.
7183 (require 'gnus-async
)
7185 (let ((gnus-select-article-hook nil
) ;Disable hook.
7186 (gnus-article-prepare-hook nil
)
7187 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
7188 (gnus-use-article-prefetch nil
)
7189 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
7190 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
7191 (sum (current-buffer))
7192 (gnus-display-mime-function nil
)
7195 (gnus-save-hidden-threads
7196 (gnus-summary-select-article)
7197 (set-buffer gnus-article-buffer
)
7198 (goto-char (window-point (get-buffer-window (current-buffer))))
7202 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
7204 (re-search-backward regexp nil t
)
7205 (re-search-forward regexp nil t
))
7206 ;; We found the regexp.
7211 (get-buffer-window (current-buffer))
7215 (get-buffer-window (current-buffer))
7218 (setq point
(point)))
7219 ;; We didn't find it, so we go to the next article.
7222 (while (eq found
'not
)
7223 (if (not (if backward
(gnus-summary-find-prev)
7224 (gnus-summary-find-next)))
7225 ;; No more articles.
7227 ;; Select the next article and adjust point.
7228 (unless (gnus-summary-article-sparse-p
7229 (gnus-summary-article-number))
7231 (gnus-summary-select-article)
7232 (set-buffer gnus-article-buffer
)
7234 (goto-char (if backward
(point-max) (point-min))))))))
7235 (gnus-message 7 ""))
7236 ;; Return whether we found the regexp.
7237 (when (eq found
'found
)
7239 (gnus-summary-show-thread)
7240 (gnus-summary-goto-subject gnus-current-article
)
7241 (gnus-summary-position-point)
7244 (defun gnus-summary-find-matching (header regexp
&optional backward unread
7245 not-case-fold not-matching
)
7246 "Return a list of all articles that match REGEXP on HEADER.
7247 The search stars on the current article and goes forwards unless
7248 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7249 If UNREAD is non-nil, only unread articles will
7250 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7251 in the comparisons. If NOT-MATCHING, return a list of all articles that
7252 not match REGEXP on HEADER."
7253 (let ((case-fold-search (not not-case-fold
))
7256 (if (eq (car header
) 'extra
)
7259 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
7261 (error "%s is an invalid header" header
))
7262 (unless (fboundp (intern (concat "mail-header-" header
)))
7263 (error "%s is not a valid header" header
))
7264 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
7265 (dolist (d (if (eq backward
'all
)
7267 (gnus-data-find-list
7268 (gnus-summary-article-number)
7269 (gnus-data-list backward
))))
7270 (when (and (or (not unread
) ; We want all articles...
7271 (gnus-data-unread-p d
)) ; Or just unreads.
7272 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
7276 (funcall func
(gnus-data-header d
))))
7277 (string-match regexp
7278 (funcall func
(gnus-data-header d
)))))
7279 (push (gnus-data-number d
) articles
))) ; Success!
7280 (nreverse articles
)))
7282 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
7283 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7284 If HEADER is an empty string (or nil), the match is done on the entire
7285 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7287 (list (let ((completion-ignore-case t
))
7290 (mapcar (lambda (string) (list string
))
7291 '("Number" "Subject" "From" "Lines" "Date"
7292 "Message-ID" "Xref" "References" "Body"))
7293 nil
'require-match
))
7294 (read-string "Regexp: ")
7295 (read-key-sequence "Command: ")
7296 current-prefix-arg
))
7297 (when (equal header
"Body")
7299 ;; Hidden thread subtrees must be searched as well.
7300 (gnus-summary-show-all-threads)
7301 ;; We don't want to change current point nor window configuration.
7303 (save-window-excursion
7304 (gnus-message 6 "Executing %s..." (key-description command
))
7305 ;; We'd like to execute COMMAND interactively so as to give arguments.
7306 (gnus-execute header regexp
7307 `(call-interactively ',(key-binding command
))
7309 (gnus-message 6 "Executing %s...done" (key-description command
)))))
7311 (defun gnus-summary-beginning-of-article ()
7312 "Scroll the article back to the beginning."
7314 (gnus-summary-select-article)
7315 (gnus-configure-windows 'article
)
7316 (gnus-eval-in-buffer-window gnus-article-buffer
7318 (goto-char (point-min))
7319 (when gnus-page-broken
7320 (gnus-narrow-to-page))))
7322 (defun gnus-summary-end-of-article ()
7323 "Scroll to the end of the article."
7325 (gnus-summary-select-article)
7326 (gnus-configure-windows 'article
)
7327 (gnus-eval-in-buffer-window gnus-article-buffer
7329 (goto-char (point-max))
7331 (when gnus-page-broken
7332 (gnus-narrow-to-page))))
7334 (defun gnus-summary-print-article (&optional filename n
)
7335 "Generate and print a PostScript image of the N next (mail) articles.
7337 If N is negative, print the N previous articles. If N is nil and articles
7338 have been marked with the process mark, print these instead.
7340 If the optional first argument FILENAME is nil, send the image to the
7341 printer. If FILENAME is a string, save the PostScript image in a file with
7342 that name. If FILENAME is a number, prompt the user for the name of the file
7344 (interactive (list (ps-print-preprint current-prefix-arg
)))
7345 (dolist (article (gnus-summary-work-articles n
))
7346 (gnus-summary-select-article nil nil
'pseudo article
)
7347 (gnus-eval-in-buffer-window gnus-article-buffer
7348 (let ((buffer (generate-new-buffer " *print*")))
7351 (copy-to-buffer buffer
(point-min) (point-max))
7353 (gnus-article-delete-invisible-text)
7354 (let ((ps-left-header
7357 (mail-header-subject gnus-current-headers
) ")")
7359 (mail-header-from gnus-current-headers
) ")")))
7362 "/pagenumberstring load"
7364 (mail-header-date gnus-current-headers
) ")"))))
7365 (gnus-run-hooks 'gnus-ps-print-hook
)
7367 (ps-spool-buffer-with-faces))))
7368 (kill-buffer buffer
))))
7369 (gnus-summary-remove-process-mark article
))
7370 (ps-despool filename
))
7372 (defun gnus-summary-show-article (&optional arg
)
7373 "Force re-fetching of the current article.
7374 If ARG (the prefix) is a number, show the article with the charset
7375 defined in `gnus-summary-show-article-charset-alist', or the charset
7377 If ARG (the prefix) is non-nil and not a number, show the raw article
7378 without any article massaging functions being run."
7382 (let ((gnus-newsgroup-charset
7383 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
7384 (read-coding-system "Charset: ")))
7385 (gnus-newsgroup-ignored-charsets 'gnus-all
))
7386 (gnus-summary-select-article nil
'force
)))
7388 ;; Select the article the normal way.
7389 (gnus-summary-select-article nil
'force
))
7391 ;; We have to require this here to make sure that the following
7392 ;; dynamic binding isn't shadowed by autoloading.
7393 (require 'gnus-async
)
7395 ;; Bind the article treatment functions to nil.
7396 (let ((gnus-have-all-headers t
)
7397 gnus-article-prepare-hook
7398 gnus-article-decode-hook
7399 gnus-display-mime-function
7401 ;; Destroy any MIME parts.
7402 (when (gnus-buffer-live-p gnus-article-buffer
)
7404 (set-buffer gnus-article-buffer
)
7405 (mm-destroy-parts gnus-article-mime-handles
)
7406 ;; Set it to nil for safety reason.
7407 (setq gnus-article-mime-handle-alist nil
)
7408 (setq gnus-article-mime-handles nil
)))
7409 (gnus-summary-select-article nil
'force
))))
7410 (gnus-summary-goto-subject gnus-current-article
)
7411 (gnus-summary-position-point))
7413 (defun gnus-summary-verbose-headers (&optional arg
)
7414 "Toggle permanent full header display.
7415 If ARG is a positive number, turn header display on.
7416 If ARG is a negative number, turn header display off."
7418 (setq gnus-show-all-headers
7419 (cond ((or (not (numberp arg
))
7421 (not gnus-show-all-headers
))
7424 (gnus-summary-show-article))
7426 (defun gnus-summary-toggle-header (&optional arg
)
7427 "Show the headers if they are hidden, or hide them if they are shown.
7428 If ARG is a positive number, show the entire header.
7429 If ARG is a negative number, hide the unwanted header lines."
7432 (set-buffer gnus-article-buffer
)
7434 (let* ((buffer-read-only nil
)
7435 (inhibit-point-motion-hooks t
)
7441 (article-narrow-to-head)
7442 (gnus-article-hidden-text-p 'headers
))))
7443 (goto-char (point-min))
7444 (when (search-forward "\n\n" nil t
)
7445 (delete-region (point-min) (1- (point))))
7446 (goto-char (point-min))
7447 (with-current-buffer gnus-original-article-buffer
7448 (goto-char (setq s
(point-min)))
7449 (setq e
(1- (or (search-forward "\n\n" nil t
) (point-max)))))
7450 (insert-buffer-substring gnus-original-article-buffer s e
)
7452 (narrow-to-region (point-min) (point))
7453 (article-decode-encoded-words)
7455 (let ((gnus-treat-hide-headers nil
)
7456 (gnus-treat-hide-boring-headers nil
))
7457 (setq gnus-article-wash-types
7458 (delq 'headers gnus-article-wash-types
))
7459 (gnus-treat-article 'head
))
7460 (gnus-treat-article 'head
)))
7461 (gnus-set-mode-line 'article
)))))
7463 (defun gnus-summary-show-all-headers ()
7464 "Make all header lines visible."
7466 (gnus-article-show-all-headers))
7468 (defun gnus-summary-caesar-message (&optional arg
)
7469 "Caesar rotate the current article by 13.
7470 The numerical prefix specifies how many places to rotate each letter
7473 (gnus-summary-select-article)
7474 (let ((mail-header-separator ""))
7475 (gnus-eval-in-buffer-window gnus-article-buffer
7478 (let ((start (window-start))
7480 (message-caesar-buffer-body arg
)
7481 (set-window-start (get-buffer-window (current-buffer)) start
))))))
7483 (defun gnus-summary-stop-page-breaking ()
7484 "Stop page breaking in the current article."
7486 (gnus-summary-select-article)
7487 (gnus-eval-in-buffer-window gnus-article-buffer
7489 (when (gnus-visual-p 'page-marker
)
7490 (let ((buffer-read-only nil
))
7491 (gnus-remove-text-with-property 'gnus-prev
)
7492 (gnus-remove-text-with-property 'gnus-next
))
7493 (setq gnus-page-broken nil
))))
7495 (defun gnus-summary-move-article (&optional n to-newsgroup
7496 select-method action
)
7497 "Move the current article to a different newsgroup.
7498 If N is a positive number, move the N next articles.
7499 If N is a negative number, move the N previous articles.
7500 If N is nil and any articles have been marked with the process mark,
7501 move those articles instead.
7502 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7503 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7504 re-spool using this method.
7506 For this function to work, both the current newsgroup and the
7507 newsgroup that you want to move to have to support the `request-move'
7508 and `request-accept' functions.
7510 ACTION can be either `move' (the default), `crosspost' or `copy'."
7513 (setq action
'move
))
7514 ;; Disable marking as read.
7515 (let (gnus-mark-article-hook)
7516 (save-window-excursion
7517 (gnus-summary-select-article)))
7518 ;; Check whether the source group supports the required functions.
7519 (cond ((and (eq action
'move
)
7520 (not (gnus-check-backend-function
7521 'request-move-article gnus-newsgroup-name
)))
7522 (error "The current group does not support article moving"))
7523 ((and (eq action
'crosspost
)
7524 (not (gnus-check-backend-function
7525 'request-replace-article gnus-newsgroup-name
)))
7526 (error "The current group does not support article editing")))
7527 (let ((articles (gnus-summary-work-articles n
))
7528 (prefix (if (gnus-check-backend-function
7529 'request-move-article gnus-newsgroup-name
)
7530 (gnus-group-real-prefix gnus-newsgroup-name
)
7532 (names '((move "Move" "Moving")
7533 (copy "Copy" "Copying")
7534 (crosspost "Crosspost" "Crossposting")))
7535 (copy-buf (save-excursion
7536 (nnheader-set-temp-buffer " *copy article*")))
7537 art-group to-method new-xref article to-groups
)
7538 (unless (assq action names
)
7539 (error "Unknown action %s" action
))
7540 ;; Read the newsgroup name.
7541 (when (and (not to-newsgroup
)
7542 (not select-method
))
7544 (gnus-read-move-group-name
7545 (cadr (assq action names
))
7546 (symbol-value (intern (format "gnus-current-%s-group" action
)))
7548 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
7549 (setq to-method
(or select-method
7550 (gnus-server-to-method
7551 (gnus-group-method to-newsgroup
))))
7552 ;; Check the method we are to move this article to...
7553 (unless (gnus-check-backend-function
7554 'request-accept-article
(car to-method
))
7555 (error "%s does not support article copying" (car to-method
)))
7556 (unless (gnus-check-server to-method
)
7557 (error "Can't open server %s" (car to-method
)))
7558 (gnus-message 6 "%s to %s: %s..."
7559 (caddr (assq action names
))
7560 (or (car select-method
) to-newsgroup
) articles
)
7562 (setq article
(pop articles
))
7566 ;; Move the article.
7568 ;; Remove this article from future suppression.
7569 (gnus-dup-unsuppress-article article
)
7570 (gnus-request-move-article
7571 article
; Article to move
7572 gnus-newsgroup-name
; From newsgroup
7573 (nth 1 (gnus-find-method-for-group
7574 gnus-newsgroup-name
)) ; Server
7575 (list 'gnus-request-accept-article
7576 to-newsgroup
(list 'quote select-method
)
7577 (not articles
) t
) ; Accept form
7578 (not articles
))) ; Only save nov last time
7579 ;; Copy the article.
7582 (set-buffer copy-buf
)
7583 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7584 (gnus-request-accept-article
7585 to-newsgroup select-method
(not articles
) t
))))
7586 ;; Crosspost the article.
7587 ((eq action
'crosspost
)
7588 (let ((xref (message-tokenize-header
7589 (mail-header-xref (gnus-summary-article-header article
))
7591 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
7594 (setq xref
(list (system-name))))
7597 (mapconcat 'identity
7598 (delete "Xref:" (delete new-xref xref
))
7602 (set-buffer copy-buf
)
7603 ;; First put the article in the destination group.
7604 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7605 (when (consp (setq art-group
7606 (gnus-request-accept-article
7607 to-newsgroup select-method
(not articles
))))
7608 (setq new-xref
(concat new-xref
" " (car art-group
)
7609 ":" (cdr art-group
)))
7610 ;; Now we have the new Xrefs header, so we insert
7611 ;; it and replace the new article.
7612 (nnheader-replace-header "Xref" new-xref
)
7613 (gnus-request-replace-article
7614 (cdr art-group
) to-newsgroup
(current-buffer))
7618 (gnus-message 1 "Couldn't %s article %s: %s"
7619 (cadr (assq action names
)) article
7620 (nnheader-get-report (car to-method
))))
7621 ((eq art-group
'junk
)
7622 (when (eq action
'move
)
7623 (gnus-summary-mark-article article gnus-canceled-mark
)
7624 (gnus-message 4 "Deleted article %s" article
)))
7626 (let* ((pto-group (gnus-group-prefixed-name
7627 (car art-group
) to-method
))
7629 (gnus-gethash pto-group gnus-newsrc-hashtb
))
7630 (info (nth 2 entry
))
7631 (to-group (gnus-info-group info
))
7633 ;; Update the group that has been moved to.
7635 (memq action
'(move copy
)))
7636 (unless (member to-group to-groups
)
7637 (push to-group to-groups
))
7639 (unless (memq article gnus-newsgroup-unreads
)
7640 (push 'read to-marks
)
7642 info
(gnus-add-to-range (gnus-info-read info
)
7643 (list (cdr art-group
)))))
7645 ;; See whether the article is to be put in the cache.
7646 (let ((marks gnus-article-mark-lists
)
7647 (to-article (cdr art-group
)))
7649 ;; Enter the article into the cache in the new group,
7650 ;; if that is required.
7651 (when gnus-use-cache
7652 (gnus-cache-possibly-enter-article
7654 (memq article gnus-newsgroup-marked
)
7655 (memq article gnus-newsgroup-dormant
)
7656 (memq article gnus-newsgroup-unreads
)))
7658 (when gnus-preserve-marks
7659 ;; Copy any marks over to the new group.
7660 (when (and (equal to-group gnus-newsgroup-name
)
7661 (not (memq article gnus-newsgroup-unreads
)))
7662 ;; Mark this article as read in this group.
7663 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
7664 (setcdr (gnus-active to-group
) to-article
)
7665 (setcdr gnus-newsgroup-active to-article
))
7668 (when (memq article
(symbol-value
7669 (intern (format "gnus-newsgroup-%s"
7671 (push (cdar marks
) to-marks
)
7672 ;; If the other group is the same as this group,
7673 ;; then we have to add the mark to the list.
7674 (when (equal to-group gnus-newsgroup-name
)
7675 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
7678 (intern (format "gnus-newsgroup-%s"
7680 ;; Copy the marks to other group.
7681 (gnus-add-marked-articles
7682 to-group
(cdar marks
) (list to-article
) info
))
7683 (setq marks
(cdr marks
)))
7685 (gnus-request-set-mark to-group
(list (list (list to-article
)
7690 (concat "(gnus-group-set-info '"
7691 (gnus-prin1-to-string (gnus-get-info to-group
))
7694 ;; Update the Xref header in this article to point to
7695 ;; the new crossposted article we have just created.
7696 (when (eq action
'crosspost
)
7698 (set-buffer copy-buf
)
7699 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7700 (nnheader-replace-header "Xref" new-xref
)
7701 (gnus-request-replace-article
7702 article gnus-newsgroup-name
(current-buffer)))))
7704 ;;;!!!Why is this necessary?
7705 (set-buffer gnus-summary-buffer
)
7707 (gnus-summary-goto-subject article
)
7708 (when (eq action
'move
)
7709 (gnus-summary-mark-article article gnus-canceled-mark
))))
7710 (gnus-summary-remove-process-mark article
))
7711 ;; Re-activate all groups that have been moved to.
7714 (set-buffer gnus-group-buffer
)
7715 (when (gnus-group-goto-group (car to-groups
) t
)
7716 (gnus-group-get-new-news-this-group 1 t
))
7719 (gnus-kill-buffer copy-buf
)
7720 (gnus-summary-position-point)
7721 (gnus-set-mode-line 'summary
)))
7723 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
7724 "Move the current article to a different newsgroup.
7725 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7726 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7727 re-spool using this method."
7729 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
7731 (defun gnus-summary-crosspost-article (&optional n
)
7732 "Crosspost the current article to some other group."
7734 (gnus-summary-move-article n nil nil
'crosspost
))
7736 (defcustom gnus-summary-respool-default-method nil
7737 "Default method for respooling an article.
7738 If nil, use to the current newsgroup method."
7739 :type
'(choice (gnus-select-method :value
(nnml ""))
7741 :group
'gnus-summary-mail
)
7743 (defun gnus-summary-respool-article (&optional n method
)
7744 "Respool the current article.
7745 The article will be squeezed through the mail spooling process again,
7746 which means that it will be put in some mail newsgroup or other
7747 depending on `nnmail-split-methods'.
7748 If N is a positive number, respool the N next articles.
7749 If N is a negative number, respool the N previous articles.
7750 If N is nil and any articles have been marked with the process mark,
7751 respool those articles instead.
7753 Respooling can be done both from mail groups and \"real\" newsgroups.
7754 In the former case, the articles in question will be moved from the
7755 current group into whatever groups they are destined to. In the
7756 latter case, they will be copied into the relevant groups."
7758 (list current-prefix-arg
7759 (let* ((methods (gnus-methods-using 'respool
))
7761 (symbol-name (or gnus-summary-respool-default-method
7762 (car (gnus-find-method-for-group
7763 gnus-newsgroup-name
)))))
7765 (gnus-completing-read
7766 methname
"What backend do you want to use when respooling?"
7767 methods nil t nil
'gnus-mail-method-history
))
7770 ((zerop (length (setq ms
(gnus-servers-using-backend
7772 (list (intern method
) ""))
7776 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
7777 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
7780 (error "No method given for respooling"))
7781 (if (assoc (symbol-name
7782 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
7783 (gnus-methods-using 'respool
))
7784 (gnus-summary-move-article n nil method
)
7785 (gnus-summary-copy-article n nil method
)))
7787 (defun gnus-summary-import-article (file)
7788 "Import an arbitrary file into a mail newsgroup."
7789 (interactive "fImport file: ")
7790 (let ((group gnus-newsgroup-name
)
7791 (now (current-time))
7793 (unless (gnus-check-backend-function 'request-accept-article group
)
7794 (error "%s does not support article importing" group
))
7795 (or (file-readable-p file
)
7796 (not (file-regular-p file
))
7797 (error "Can't read %s" file
))
7799 (set-buffer (gnus-get-buffer-create " *import file*"))
7801 (nnheader-insert-file-contents file
)
7802 (goto-char (point-min))
7803 (unless (nnheader-article-p)
7804 ;; This doesn't look like an article, so we fudge some headers.
7805 (setq atts
(file-attributes file
)
7806 lines
(count-lines (point-min) (point-max)))
7807 (insert "From: " (read-string "From: ") "\n"
7808 "Subject: " (read-string "Subject: ") "\n"
7809 "Date: " (message-make-date (nth 5 atts
))
7811 "Message-ID: " (message-make-message-id) "\n"
7812 "Lines: " (int-to-string lines
) "\n"
7813 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
7814 (gnus-request-accept-article group nil t
)
7815 (kill-buffer (current-buffer)))))
7817 (defun gnus-summary-article-posted-p ()
7818 "Say whether the current (mail) article is available from news as well.
7819 This will be the case if the article has both been mailed and posted."
7821 (let ((id (mail-header-references (gnus-summary-article-header)))
7822 (gnus-override-method (car (gnus-refer-article-methods))))
7823 (if (gnus-request-head id
"")
7824 (gnus-message 2 "The current message was found on %s"
7825 gnus-override-method
)
7826 (gnus-message 2 "The current message couldn't be found on %s"
7827 gnus-override-method
)
7830 (defun gnus-summary-expire-articles (&optional now
)
7831 "Expire all articles that are marked as expirable in the current group."
7833 (when (gnus-check-backend-function
7834 'request-expire-articles gnus-newsgroup-name
)
7835 ;; This backend supports expiry.
7836 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
7837 (expirable (if total
7839 ;; We need to update the info for
7840 ;; this group for `gnus-list-of-read-articles'
7841 ;; to give us the right answer.
7842 (gnus-run-hooks 'gnus-exit-group-hook
)
7843 (gnus-summary-update-info)
7844 (gnus-list-of-read-articles gnus-newsgroup-name
))
7845 (setq gnus-newsgroup-expirable
7846 (sort gnus-newsgroup-expirable
'<))))
7847 (expiry-wait (if now
'immediate
7848 (gnus-group-find-parameter
7849 gnus-newsgroup-name
'expiry-wait
)))
7850 (nnmail-expiry-target
7851 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
7852 nnmail-expiry-target
))
7855 ;; There are expirable articles in this group, so we run them
7856 ;; through the expiry process.
7857 (gnus-message 6 "Expiring articles...")
7858 (unless (gnus-check-group gnus-newsgroup-name
)
7859 (error "Can't open server for %s" gnus-newsgroup-name
))
7860 ;; The list of articles that weren't expired is returned.
7863 (let ((nnmail-expiry-wait-function nil
)
7864 (nnmail-expiry-wait expiry-wait
))
7865 (setq es
(gnus-request-expire-articles
7866 expirable gnus-newsgroup-name
)))
7867 (setq es
(gnus-request-expire-articles
7868 expirable gnus-newsgroup-name
))))
7870 (setq gnus-newsgroup-expirable es
))
7871 ;; We go through the old list of expirable, and mark all
7872 ;; really expired articles as nonexistent.
7873 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
7874 (let ((gnus-use-cache nil
))
7876 (unless (memq (car expirable
) es
)
7877 (when (gnus-data-find (car expirable
))
7878 (gnus-summary-mark-article
7879 (car expirable
) gnus-canceled-mark
)))
7880 (setq expirable
(cdr expirable
)))))
7881 (gnus-message 6 "Expiring articles...done")))))
7883 (defun gnus-summary-expire-articles-now ()
7884 "Expunge all expirable articles in the current group.
7885 This means that *all* articles that are marked as expirable will be
7886 deleted forever, right now."
7888 (or gnus-expert-user
7890 "Are you really, really, really sure you want to delete all these messages? ")
7892 (gnus-summary-expire-articles t
))
7894 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7895 (defun gnus-summary-delete-article (&optional n
)
7896 "Delete the N next (mail) articles.
7897 This command actually deletes articles. This is not a marking
7898 command. The article will disappear forever from your life, never to
7900 If N is negative, delete backwards.
7901 If N is nil and articles have been marked with the process mark,
7902 delete these instead."
7904 (unless (gnus-check-backend-function 'request-expire-articles
7905 gnus-newsgroup-name
)
7906 (error "The current newsgroup does not support article deletion"))
7907 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
7908 (error "Couldn't open server"))
7909 ;; Compute the list of articles to delete.
7910 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
7912 (if (and gnus-novice-user
7913 (not (gnus-yes-or-no-p
7914 (format "Do you really want to delete %s forever? "
7915 (if (> (length articles
) 1)
7916 (format "these %s articles" (length articles
))
7919 ;; Delete the articles.
7920 (setq not-deleted
(gnus-request-expire-articles
7921 articles gnus-newsgroup-name
'force
))
7923 (gnus-summary-remove-process-mark (car articles
))
7924 ;; The backend might not have been able to delete the article
7926 (unless (memq (car articles
) not-deleted
)
7927 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
7928 (setq articles
(cdr articles
)))
7930 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
7931 (gnus-summary-position-point)
7932 (gnus-set-mode-line 'summary
)
7935 (defun gnus-summary-edit-article (&optional arg
)
7936 "Edit the current article.
7937 This will have permanent effect only in mail groups.
7938 If ARG is nil, edit the decoded articles.
7939 If ARG is 1, edit the raw articles.
7940 If ARG is 2, edit the raw articles even in read-only groups.
7941 Otherwise, allow editing of articles even in read-only
7947 ((eq arg
1) (setq raw t
))
7948 ((eq arg
2) (setq raw t
7951 (if (and raw
(not force
) (equal gnus-newsgroup-name
"nndraft:drafts"))
7952 (error "Can't edit the raw article in group nndraft:drafts"))
7954 (set-buffer gnus-summary-buffer
)
7955 (let ((mail-parse-charset gnus-newsgroup-charset
)
7956 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
7957 (gnus-set-global-variables)
7958 (when (and (not force
)
7959 (gnus-group-read-only-p))
7960 (error "The current newsgroup does not support article editing"))
7961 (gnus-summary-show-article t
)
7962 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
7963 (with-current-buffer gnus-article-buffer
7964 (mm-enable-multibyte)))
7965 (if (equal gnus-newsgroup-name
"nndraft:drafts")
7967 (gnus-article-edit-article
7970 (let ((mbl mml-buffer-list
))
7971 (setq mml-buffer-list nil
)
7973 (make-local-hook 'kill-buffer-hook
)
7974 (let ((mml-buffer-list mml-buffer-list
))
7975 (setq mml-buffer-list mbl
)
7976 (make-local-variable 'mml-buffer-list
))
7977 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
7978 `(lambda (no-highlight)
7979 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
7980 (mail-parse-ignored-charsets
7981 ',gnus-newsgroup-ignored-charsets
))
7982 ,(if (not raw
) '(progn
7984 (mml-destroy-buffers)
7985 (remove-hook 'kill-buffer-hook
7986 'mml-destroy-buffers t
)
7987 (kill-local-variable 'mml-buffer-list
)))
7988 (gnus-summary-edit-article-done
7989 ,(or (mail-header-references gnus-current-headers
) "")
7990 ,(gnus-group-read-only-p)
7991 ,gnus-summary-buffer no-highlight
))))))))
7993 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
7995 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7997 "Make edits to the current article permanent."
7999 ;; Replace the article.
8000 (let ((buf (current-buffer)))
8002 (insert-buffer-substring buf
)
8003 (if (and (not read-only
)
8004 (not (gnus-request-replace-article
8005 (cdr gnus-article-current
) (car gnus-article-current
)
8006 (current-buffer) t
)))
8007 (error "Couldn't replace article")
8008 ;; Update the summary buffer.
8010 (equal (message-tokenize-header references
" ")
8011 (message-tokenize-header
8012 (or (message-fetch-field "references") "") " ")))
8013 ;; We only have to update this line.
8016 (message-narrow-to-head)
8017 (let ((head (buffer-string))
8020 (insert (format "211 %d Article retrieved.\n"
8021 (cdr gnus-article-current
)))
8024 (let ((nntp-server-buffer (current-buffer)))
8025 (setq header
(car (gnus-get-newsgroup-headers
8027 (set-buffer gnus-summary-buffer
)
8028 gnus-newsgroup-dependencies
)
8031 (set-buffer gnus-summary-buffer
)
8032 (gnus-data-set-header
8033 (gnus-data-find (cdr gnus-article-current
))
8035 (gnus-summary-update-article-line
8036 (cdr gnus-article-current
) header
))))))
8038 (set-buffer (or buffer gnus-summary-buffer
))
8039 (gnus-summary-update-article (cdr gnus-article-current
)))
8040 ;; Prettify the article buffer again.
8041 (unless no-highlight
8043 (set-buffer gnus-article-buffer
)
8044 ;;;!!! Fix this -- article should be rehighlighted.
8045 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8046 (set-buffer gnus-original-article-buffer
)
8047 (gnus-request-article
8048 (cdr gnus-article-current
)
8049 (car gnus-article-current
) (current-buffer))))
8050 ;; Prettify the summary buffer line.
8051 (when (gnus-visual-p 'summary-highlight
'highlight
)
8052 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
8054 (defun gnus-summary-edit-wash (key)
8055 "Perform editing command KEY in the article buffer."
8059 (message "%s" (concat (this-command-keys) "- "))
8062 (gnus-summary-edit-article)
8063 (execute-kbd-macro (concat (this-command-keys) key
))
8064 (gnus-article-edit-done))
8068 (defun gnus-summary-respool-query (&optional silent trace
)
8069 "Query where the respool algorithm would put this article."
8071 (let (gnus-mark-article-hook)
8072 (gnus-summary-select-article)
8074 (set-buffer gnus-original-article-buffer
)
8076 (message-narrow-to-head)
8077 (let ((groups (nnmail-article-group 'identity trace
)))
8080 (message "This message would go to %s"
8081 (mapconcat 'car groups
", "))
8082 (message "This message would go to no groups"))
8085 (defun gnus-summary-respool-trace ()
8086 "Trace where the respool algorithm would put this article.
8087 Display a buffer showing all fancy splitting patterns which matched."
8089 (gnus-summary-respool-query nil t
))
8091 ;; Summary marking commands.
8093 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
8094 "Mark articles which has the same subject as read, and then select the next.
8095 If UNMARK is positive, remove any kind of mark.
8096 If UNMARK is negative, tick articles."
8099 (setq unmark
(prefix-numeric-value unmark
)))
8101 (gnus-summary-mark-same-subject
8102 (gnus-summary-article-subject) unmark
)))
8103 ;; Select next unread article. If auto-select-same mode, should
8104 ;; select the first unread article.
8105 (gnus-summary-next-article t
(and gnus-auto-select-same
8106 (gnus-summary-article-subject)))
8107 (gnus-message 7 "%d article%s marked as %s"
8108 count
(if (= count
1) " is" "s are")
8109 (if unmark
"unread" "read"))))
8111 (defun gnus-summary-kill-same-subject (&optional unmark
)
8112 "Mark articles which has the same subject as read.
8113 If UNMARK is positive, remove any kind of mark.
8114 If UNMARK is negative, tick articles."
8117 (setq unmark
(prefix-numeric-value unmark
)))
8119 (gnus-summary-mark-same-subject
8120 (gnus-summary-article-subject) unmark
)))
8121 ;; If marked as read, go to next unread subject.
8123 ;; Go to next unread subject.
8124 (gnus-summary-next-subject 1 t
))
8125 (gnus-message 7 "%d articles are marked as %s"
8126 count
(if unmark
"unread" "read"))))
8128 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
8129 "Mark articles with same SUBJECT as read, and return marked number.
8130 If optional argument UNMARK is positive, remove any kinds of marks.
8131 If optional argument UNMARK is negative, mark articles as unread instead."
8135 ((null unmark
) ; Mark as read.
8138 (gnus-summary-mark-article-as-read gnus-killed-mark
)
8139 (gnus-summary-show-thread) t
)
8140 (gnus-summary-find-subject subject
))
8141 (setq count
(1+ count
))))
8142 ((> unmark
0) ; Tick.
8145 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
8146 (gnus-summary-show-thread) t
)
8147 (gnus-summary-find-subject subject
))
8148 (setq count
(1+ count
))))
8149 (t ; Mark as unread.
8152 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
8153 (gnus-summary-show-thread) t
)
8154 (gnus-summary-find-subject subject
))
8155 (setq count
(1+ count
)))))
8156 (gnus-set-mode-line 'summary
)
8157 ;; Return the number of marked articles.
8160 (defun gnus-summary-mark-as-processable (n &optional unmark
)
8161 "Set the process mark on the next N articles.
8162 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8163 the process mark instead. The difference between N and the actual
8164 number of articles marked is returned."
8166 (let ((backward (< n
0))
8171 (gnus-summary-remove-process-mark
8172 (gnus-summary-article-number))
8173 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8174 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
8177 (gnus-message 7 "No more articles"))
8178 (gnus-summary-recenter)
8179 (gnus-summary-position-point)
8182 (defun gnus-summary-unmark-as-processable (n)
8183 "Remove the process mark from the next N articles.
8184 If N is negative, unmark backward instead. The difference between N and
8185 the actual number of articles unmarked is returned."
8187 (gnus-summary-mark-as-processable n t
))
8189 (defun gnus-summary-unmark-all-processable ()
8190 "Remove the process mark from all articles."
8193 (while gnus-newsgroup-processable
8194 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
8195 (gnus-summary-position-point))
8197 (defun gnus-summary-mark-as-expirable (n)
8198 "Mark N articles forward as expirable.
8199 If N is negative, mark backward instead. The difference between N and
8200 the actual number of articles marked is returned."
8202 (gnus-summary-mark-forward n gnus-expirable-mark
))
8204 (defun gnus-summary-mark-article-as-replied (article)
8205 "Mark ARTICLE replied and update the summary line."
8206 (push article gnus-newsgroup-replied
)
8207 (let ((buffer-read-only nil
))
8208 (when (gnus-summary-goto-subject article nil t
)
8209 (gnus-summary-update-secondary-mark article
))))
8211 (defun gnus-summary-set-bookmark (article)
8212 "Set a bookmark in current article."
8213 (interactive (list (gnus-summary-article-number)))
8214 (when (or (not (get-buffer gnus-article-buffer
))
8215 (not gnus-current-article
)
8216 (not gnus-article-current
)
8217 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
8218 (error "No current article selected"))
8219 ;; Remove old bookmark, if one exists.
8220 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8222 (setq gnus-newsgroup-bookmarks
8223 (delq old gnus-newsgroup-bookmarks
))))
8224 ;; Set the new bookmark, which is on the form
8225 ;; (article-number . line-number-in-body).
8229 (set-buffer gnus-article-buffer
)
8233 (goto-char (point-min))
8234 (search-forward "\n\n" nil t
)
8237 gnus-newsgroup-bookmarks
)
8238 (gnus-message 6 "A bookmark has been added to the current article."))
8240 (defun gnus-summary-remove-bookmark (article)
8241 "Remove the bookmark from the current article."
8242 (interactive (list (gnus-summary-article-number)))
8243 ;; Remove old bookmark, if one exists.
8244 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8247 (setq gnus-newsgroup-bookmarks
8248 (delq old gnus-newsgroup-bookmarks
))
8249 (gnus-message 6 "Removed bookmark."))
8250 (gnus-message 6 "No bookmark in current article."))))
8252 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8253 (defun gnus-summary-mark-as-dormant (n)
8254 "Mark N articles forward as dormant.
8255 If N is negative, mark backward instead. The difference between N and
8256 the actual number of articles marked is returned."
8258 (gnus-summary-mark-forward n gnus-dormant-mark
))
8260 (defun gnus-summary-set-process-mark (article)
8261 "Set the process mark on ARTICLE and update the summary line."
8262 (setq gnus-newsgroup-processable
8264 (delq article gnus-newsgroup-processable
)))
8265 (when (gnus-summary-goto-subject article
)
8266 (gnus-summary-show-thread)
8267 (gnus-summary-goto-subject article
)
8268 (gnus-summary-update-secondary-mark article
)))
8270 (defun gnus-summary-remove-process-mark (article)
8271 "Remove the process mark from ARTICLE and update the summary line."
8272 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
8273 (when (gnus-summary-goto-subject article
)
8274 (gnus-summary-show-thread)
8275 (gnus-summary-goto-subject article
)
8276 (gnus-summary-update-secondary-mark article
)))
8278 (defun gnus-summary-set-saved-mark (article)
8279 "Set the process mark on ARTICLE and update the summary line."
8280 (push article gnus-newsgroup-saved
)
8281 (when (gnus-summary-goto-subject article
)
8282 (gnus-summary-update-secondary-mark article
)))
8284 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
8285 "Mark N articles as read forwards.
8286 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8287 The difference between N and the actual number of articles marked is
8289 If NO-EXPIRE, auto-expiry will be inhibited."
8291 (gnus-summary-show-thread)
8292 (let ((backward (< n
0))
8293 (gnus-summary-goto-unread
8294 (and gnus-summary-goto-unread
8295 (not (eq gnus-summary-goto-unread
'never
))
8296 (not (memq mark
(list gnus-unread-mark
8297 gnus-ticked-mark gnus-dormant-mark
)))))
8299 (mark (or mark gnus-del-mark
)))
8301 (gnus-summary-mark-article nil mark no-expire
)
8302 (zerop (gnus-summary-next-subject
8304 (and gnus-summary-goto-unread
8305 (not (eq gnus-summary-goto-unread
'never
)))
8309 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
8310 (gnus-summary-recenter)
8311 (gnus-summary-position-point)
8312 (gnus-set-mode-line 'summary
)
8315 (defun gnus-summary-mark-article-as-read (mark)
8316 "Mark the current article quickly as read with MARK."
8317 (let ((article (gnus-summary-article-number)))
8318 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8319 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8320 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8321 (push (cons article mark
) gnus-newsgroup-reads
)
8322 ;; Possibly remove from cache, if that is used.
8323 (when gnus-use-cache
8324 (gnus-cache-enter-remove-article article
))
8325 ;; Allow the backend to change the mark.
8326 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8327 ;; Check for auto-expiry.
8328 (when (and gnus-newsgroup-auto-expire
8329 (memq mark gnus-auto-expirable-marks
))
8330 (setq mark gnus-expirable-mark
)
8331 ;; Let the backend know about the mark change.
8332 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8333 (push article gnus-newsgroup-expirable
))
8334 ;; Set the mark in the buffer.
8335 (gnus-summary-update-mark mark
'unread
)
8338 (defun gnus-summary-mark-article-as-unread (mark)
8339 "Mark the current article quickly as unread with MARK."
8340 (let* ((article (gnus-summary-article-number))
8341 (old-mark (gnus-summary-article-mark article
)))
8342 ;; Allow the backend to change the mark.
8343 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8344 (if (eq mark old-mark
)
8348 (gnus-error 1 "Can't mark negative article numbers")
8350 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8351 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8352 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
8353 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
8354 (cond ((= mark gnus-ticked-mark
)
8355 (push article gnus-newsgroup-marked
))
8356 ((= mark gnus-dormant-mark
)
8357 (push article gnus-newsgroup-dormant
))
8359 (push article gnus-newsgroup-unreads
)))
8360 (gnus-pull article gnus-newsgroup-reads
)
8362 ;; See whether the article is to be put in the cache.
8364 (vectorp (gnus-summary-article-header article
))
8366 (gnus-cache-possibly-enter-article
8367 gnus-newsgroup-name article
8368 (= mark gnus-ticked-mark
)
8369 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8372 (gnus-summary-update-mark mark
'unread
)
8375 (defun gnus-summary-mark-article (&optional article mark no-expire
)
8376 "Mark ARTICLE with MARK. MARK can be any character.
8377 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8378 `??' (dormant) and `?E' (expirable).
8379 If MARK is nil, then the default character `?r' is used.
8380 If ARTICLE is nil, then the article on the current line will be
8382 If NO-EXPIRE, auto-expiry will be inhibited."
8383 ;; The mark might be a string.
8384 (when (stringp mark
)
8385 (setq mark
(aref mark
0)))
8386 ;; If no mark is given, then we check auto-expiring.
8388 (setq mark gnus-del-mark
))
8389 (when (and (not no-expire
)
8390 gnus-newsgroup-auto-expire
8391 (memq mark gnus-auto-expirable-marks
))
8392 (setq mark gnus-expirable-mark
))
8393 (let ((article (or article
(gnus-summary-article-number)))
8394 (old-mark (gnus-summary-article-mark article
)))
8395 ;; Allow the backend to change the mark.
8396 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8397 (if (eq mark old-mark
)
8400 (error "No article on current line"))
8401 (if (not (if (or (= mark gnus-unread-mark
)
8402 (= mark gnus-ticked-mark
)
8403 (= mark gnus-dormant-mark
))
8404 (gnus-mark-article-as-unread article mark
)
8405 (gnus-mark-article-as-read article mark
)))
8407 ;; See whether the article is to be put in the cache.
8409 (not (= mark gnus-canceled-mark
))
8410 (vectorp (gnus-summary-article-header article
))
8412 (gnus-cache-possibly-enter-article
8413 gnus-newsgroup-name article
8414 (= mark gnus-ticked-mark
)
8415 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8417 (when (gnus-summary-goto-subject article nil t
)
8418 (let ((buffer-read-only nil
))
8419 (gnus-summary-show-thread)
8421 (gnus-summary-update-mark mark
'unread
)
8424 (defun gnus-summary-update-secondary-mark (article)
8425 "Update the secondary (read, process, cache) mark."
8426 (gnus-summary-update-mark
8427 (cond ((memq article gnus-newsgroup-processable
)
8429 ((memq article gnus-newsgroup-cached
)
8431 ((memq article gnus-newsgroup-replied
)
8433 ((memq article gnus-newsgroup-saved
)
8435 (t gnus-unread-mark
))
8437 (when (gnus-visual-p 'summary-highlight
'highlight
)
8438 (gnus-run-hooks 'gnus-summary-update-hook
))
8441 (defun gnus-summary-update-mark (mark type
)
8442 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
8443 (buffer-read-only nil
))
8444 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
8446 (when (looking-at "\r")
8448 (when (<= (+ forward
(point)) (point-max))
8449 ;; Go to the right position on the line.
8450 (goto-char (+ forward
(point)))
8451 ;; Replace the old mark with the new mark.
8452 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
8453 ;; Optionally update the marks by some user rule.
8454 (when (eq type
'unread
)
8456 (gnus-data-find (gnus-summary-article-number)) mark
)
8457 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
8459 (defun gnus-mark-article-as-read (article &optional mark
)
8460 "Enter ARTICLE in the pertinent lists and remove it from others."
8461 ;; Make the article expirable.
8462 (let ((mark (or mark gnus-del-mark
)))
8463 (if (= mark gnus-expirable-mark
)
8464 (push article gnus-newsgroup-expirable
)
8465 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)))
8466 ;; Remove from unread and marked lists.
8467 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8468 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8469 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8470 (push (cons article mark
) gnus-newsgroup-reads
)
8471 ;; Possibly remove from cache, if that is used.
8472 (when gnus-use-cache
8473 (gnus-cache-enter-remove-article article
))
8476 (defun gnus-mark-article-as-unread (article &optional mark
)
8477 "Enter ARTICLE in the pertinent lists and remove it from others."
8478 (let ((mark (or mark gnus-ticked-mark
)))
8481 (gnus-error 1 "Can't mark negative article numbers")
8483 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
8484 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
8485 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
8486 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8488 ;; Unsuppress duplicates?
8489 (when gnus-suppress-duplicates
8490 (gnus-dup-unsuppress-article article
))
8492 (cond ((= mark gnus-ticked-mark
)
8493 (push article gnus-newsgroup-marked
))
8494 ((= mark gnus-dormant-mark
)
8495 (push article gnus-newsgroup-dormant
))
8497 (push article gnus-newsgroup-unreads
)))
8498 (gnus-pull article gnus-newsgroup-reads
)
8501 (defalias 'gnus-summary-mark-as-unread-forward
8502 'gnus-summary-tick-article-forward
)
8503 (make-obsolete 'gnus-summary-mark-as-unread-forward
8504 'gnus-summary-tick-article-forward
)
8505 (defun gnus-summary-tick-article-forward (n)
8506 "Tick N articles forwards.
8507 If N is negative, tick backwards instead.
8508 The difference between N and the number of articles ticked is returned."
8510 (gnus-summary-mark-forward n gnus-ticked-mark
))
8512 (defalias 'gnus-summary-mark-as-unread-backward
8513 'gnus-summary-tick-article-backward
)
8514 (make-obsolete 'gnus-summary-mark-as-unread-backward
8515 'gnus-summary-tick-article-backward
)
8516 (defun gnus-summary-tick-article-backward (n)
8517 "Tick N articles backwards.
8518 The difference between N and the number of articles ticked is returned."
8520 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
8522 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8523 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8524 (defun gnus-summary-tick-article (&optional article clear-mark
)
8525 "Mark current article as unread.
8526 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8527 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8529 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
8532 (defun gnus-summary-mark-as-read-forward (n)
8533 "Mark N articles as read forwards.
8534 If N is negative, mark backwards instead.
8535 The difference between N and the actual number of articles marked is
8538 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
8540 (defun gnus-summary-mark-as-read-backward (n)
8541 "Mark the N articles as read backwards.
8542 The difference between N and the actual number of articles marked is
8545 (gnus-summary-mark-forward
8546 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
8548 (defun gnus-summary-mark-as-read (&optional article mark
)
8549 "Mark current article as read.
8550 ARTICLE specifies the article to be marked as read.
8551 MARK specifies a string to be inserted at the beginning of the line."
8552 (gnus-summary-mark-article article mark
))
8554 (defun gnus-summary-clear-mark-forward (n)
8555 "Clear marks from N articles forward.
8556 If N is negative, clear backward instead.
8557 The difference between N and the number of marks cleared is returned."
8559 (gnus-summary-mark-forward n gnus-unread-mark
))
8561 (defun gnus-summary-clear-mark-backward (n)
8562 "Clear marks from N articles backward.
8563 The difference between N and the number of marks cleared is returned."
8565 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
8567 (defun gnus-summary-mark-unread-as-read ()
8568 "Intended to be used by `gnus-summary-mark-article-hook'."
8569 (when (memq gnus-current-article gnus-newsgroup-unreads
)
8570 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
8572 (defun gnus-summary-mark-read-and-unread-as-read ()
8573 "Intended to be used by `gnus-summary-mark-article-hook'."
8574 (let ((mark (gnus-summary-article-mark)))
8575 (when (or (gnus-unread-mark-p mark
)
8576 (gnus-read-mark-p mark
))
8577 (gnus-summary-mark-article gnus-current-article gnus-read-mark
))))
8579 (defun gnus-summary-mark-region-as-read (point mark all
)
8580 "Mark all unread articles between point and mark as read.
8581 If given a prefix, mark all articles between point and mark as read,
8582 even ticked and dormant ones."
8583 (interactive "r\nP")
8592 (memq (setq article
(gnus-summary-article-number))
8593 gnus-newsgroup-unreads
))
8594 (gnus-summary-mark-article article gnus-del-mark
))
8596 (gnus-summary-find-next))))))
8598 (defun gnus-summary-mark-below (score mark
)
8599 "Mark articles with score less than SCORE with MARK."
8600 (interactive "P\ncMark: ")
8601 (setq score
(if score
8602 (prefix-numeric-value score
)
8603 (or gnus-summary-default-score
0)))
8605 (set-buffer gnus-summary-buffer
)
8606 (goto-char (point-min))
8609 (and (< (gnus-summary-article-score) score
)
8610 (gnus-summary-mark-article nil mark
))
8611 (gnus-summary-find-next)))))
8613 (defun gnus-summary-kill-below (&optional score
)
8614 "Mark articles with score below SCORE as read."
8616 (gnus-summary-mark-below score gnus-killed-mark
))
8618 (defun gnus-summary-clear-above (&optional score
)
8619 "Clear all marks from articles with score above SCORE."
8621 (gnus-summary-mark-above score gnus-unread-mark
))
8623 (defun gnus-summary-tick-above (&optional score
)
8624 "Tick all articles with score above SCORE."
8626 (gnus-summary-mark-above score gnus-ticked-mark
))
8628 (defun gnus-summary-mark-above (score mark
)
8629 "Mark articles with score over SCORE with MARK."
8630 (interactive "P\ncMark: ")
8631 (setq score
(if score
8632 (prefix-numeric-value score
)
8633 (or gnus-summary-default-score
0)))
8635 (set-buffer gnus-summary-buffer
)
8636 (goto-char (point-min))
8638 (when (> (gnus-summary-article-score) score
)
8639 (gnus-summary-mark-article nil mark
))
8641 (gnus-summary-find-next)))))
8643 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8644 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
8645 (defun gnus-summary-limit-include-expunged (&optional no-error
)
8646 "Display all the hidden articles that were expunged for low scores."
8648 (let ((buffer-read-only nil
))
8649 (let ((scored gnus-newsgroup-scored
)
8652 (unless (gnus-summary-goto-subject (caar scored
))
8653 (and (setq h
(gnus-summary-article-header (caar scored
)))
8654 (< (cdar scored
) gnus-summary-expunge-below
)
8656 (setq scored
(cdr scored
)))
8658 (when (not no-error
)
8659 (error "No expunged articles hidden"))
8660 (goto-char (point-min))
8661 (gnus-summary-prepare-unthreaded (nreverse headers
))
8662 (goto-char (point-min))
8663 (gnus-summary-position-point)
8666 (defun gnus-summary-catchup (&optional all quietly to-here not-mark
)
8667 "Mark all unread articles in this newsgroup as read.
8668 If prefix argument ALL is non-nil, ticked and dormant articles will
8669 also be marked as read.
8670 If QUIETLY is non-nil, no questions will be asked.
8671 If TO-HERE is non-nil, it should be a point in the buffer. All
8672 articles before this point will be marked as read.
8673 Note that this function will only catch up the unread article
8674 in the current summary buffer limitation.
8675 The number of articles marked as read is returned."
8680 (not gnus-interactive-catchup
) ;Without confirmation?
8684 "Mark absolutely all articles as read? "
8685 "Mark all unread articles as read? ")))
8687 (not gnus-newsgroup-adaptive
)
8688 (not gnus-newsgroup-auto-expire
)
8689 (not gnus-suppress-duplicates
)
8690 (or (not gnus-use-cache
)
8691 (eq gnus-use-cache
'passive
)))
8694 (setq gnus-newsgroup-marked nil
8695 gnus-newsgroup-dormant nil
))
8696 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable
))
8697 ;; We actually mark all articles as canceled, which we
8698 ;; have to do when using auto-expiry or adaptive scoring.
8699 (gnus-summary-show-all-threads)
8700 (when (gnus-summary-first-subject (not all
) t
)
8702 (if to-here
(< (point) to-here
) t
)
8703 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
8704 (gnus-summary-find-next (not all
) nil nil t
))))
8705 (gnus-set-mode-line 'summary
))
8707 (gnus-summary-position-point)))
8709 (defun gnus-summary-catchup-to-here (&optional all
)
8710 "Mark all unticked articles before the current one as read.
8711 If ALL is non-nil, also mark ticked and dormant articles as read."
8714 (gnus-save-hidden-threads
8715 (let ((beg (point)))
8716 ;; We check that there are unread articles.
8717 (when (or all
(gnus-summary-find-prev))
8718 (gnus-summary-catchup all t beg
)))))
8719 (gnus-summary-position-point))
8721 (defun gnus-summary-catchup-all (&optional quietly
)
8722 "Mark all articles in this newsgroup as read."
8724 (gnus-summary-catchup t quietly
))
8726 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
8727 "Mark all unread articles in this group as read, then exit.
8728 If prefix argument ALL is non-nil, all articles are marked as read."
8730 (when (gnus-summary-catchup all quietly nil
'fast
)
8731 ;; Select next newsgroup or exit.
8732 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
8733 (eq gnus-auto-select-next
'quietly
))
8734 (gnus-summary-next-group nil
)
8735 (gnus-summary-exit))))
8737 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
8738 "Mark all articles in this newsgroup as read, and then exit."
8740 (gnus-summary-catchup-and-exit t quietly
))
8742 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
8743 "Mark all articles in this group as read and select the next group.
8744 If given a prefix, mark all articles, unread as well as ticked, as
8748 (gnus-summary-catchup all
))
8749 (gnus-summary-next-group))
8755 (defmacro gnus-with-article
(article &rest forms
)
8756 "Select ARTICLE and perform FORMS in the original article buffer.
8757 Then replace the article with the result."
8759 ;; We don't want the article to be marked as read.
8760 (let (gnus-mark-article-hook)
8761 (gnus-summary-select-article t t nil
,article
))
8762 (set-buffer gnus-original-article-buffer
)
8764 (if (not (gnus-check-backend-function
8765 'request-replace-article
(car gnus-article-current
)))
8766 (gnus-message 5 "Read-only group; not replacing")
8767 (unless (gnus-request-replace-article
8768 ,article
(car gnus-article-current
)
8770 (error "Couldn't replace article")))
8771 ;; The cache and backlog have to be flushed somewhat.
8772 (when gnus-keep-backlog
8773 (gnus-backlog-remove-article
8774 (car gnus-article-current
) (cdr gnus-article-current
)))
8775 (when gnus-use-cache
8776 (gnus-cache-update-article
8777 (car gnus-article-current
) (cdr gnus-article-current
)))))
8779 (put 'gnus-with-article
'lisp-indent-function
1)
8780 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
8782 ;; Thread-based commands.
8784 (defun gnus-summary-articles-in-thread (&optional article
)
8785 "Return a list of all articles in the current thread.
8786 If ARTICLE is non-nil, return all articles in the thread that starts
8788 (let* ((article (or article
(gnus-summary-article-number)))
8789 (data (gnus-data-find-list article
))
8790 (top-level (gnus-data-level (car data
)))
8792 (cond ((null gnus-thread-operation-ignore-subject
)
8793 (gnus-simplify-subject-re
8794 (mail-header-subject (gnus-data-header (car data
)))))
8795 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
8796 (gnus-simplify-subject-fuzzy
8797 (mail-header-subject (gnus-data-header (car data
)))))
8799 (end-point (save-excursion
8800 (if (gnus-summary-go-to-next-thread)
8801 (point) (point-max))))
8804 (< (gnus-data-pos (car data
)) end-point
))
8805 (when (or (not top-subject
)
8806 (string= top-subject
8807 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
8808 (gnus-simplify-subject-fuzzy
8809 (mail-header-subject
8810 (gnus-data-header (car data
))))
8811 (gnus-simplify-subject-re
8812 (mail-header-subject
8813 (gnus-data-header (car data
)))))))
8814 (push (gnus-data-number (car data
)) articles
))
8815 (unless (and (setq data
(cdr data
))
8816 (> (gnus-data-level (car data
)) top-level
))
8818 ;; Return the list of articles.
8819 (nreverse articles
)))
8821 (defun gnus-summary-rethread-current ()
8822 "Rethread the thread the current article is part of."
8824 (let* ((gnus-show-threads t
)
8825 (article (gnus-summary-article-number))
8826 (id (mail-header-id (gnus-summary-article-header)))
8827 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
8829 (error "No article on the current line"))
8830 (gnus-rebuild-thread id
)
8831 (gnus-summary-goto-subject article
)))
8833 (defun gnus-summary-reparent-thread ()
8834 "Make the current article child of the marked (or previous) article.
8836 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8837 is non-nil or the Subject: of both articles are the same."
8839 (unless (not (gnus-group-read-only-p))
8840 (error "The current newsgroup does not support article editing"))
8841 (unless (<= (length gnus-newsgroup-processable
) 1)
8842 (error "No more than one article may be marked"))
8843 (save-window-excursion
8844 (let ((gnus-article-buffer " *reparent*")
8845 (current-article (gnus-summary-article-number))
8846 ;; First grab the marked article, otherwise one line up.
8847 (parent-article (if (not (null gnus-newsgroup-processable
))
8848 (car gnus-newsgroup-processable
)
8850 (if (eq (forward-line -
1) 0)
8851 (gnus-summary-article-number)
8852 (error "Beginning of summary buffer"))))))
8853 (unless (not (eq current-article parent-article
))
8854 (error "An article may not be self-referential"))
8855 (let ((message-id (mail-header-id
8856 (gnus-summary-article-header parent-article
))))
8857 (unless (and message-id
(not (equal message-id
"")))
8858 (error "No message-id in desired parent"))
8859 (gnus-with-article current-article
8861 (goto-char (point-min))
8862 (message-narrow-to-head)
8863 (if (re-search-forward "^References: " nil t
)
8865 (re-search-forward "^[^ \t]" nil t
)
8868 (insert " " message-id
))
8869 (insert "References: " message-id
"\n"))))
8870 (set-buffer gnus-summary-buffer
)
8871 (gnus-summary-unmark-all-processable)
8872 (gnus-summary-update-article current-article
)
8873 (gnus-summary-rethread-current)
8874 (gnus-message 3 "Article %d is now the child of article %d"
8875 current-article parent-article
)))))
8877 (defun gnus-summary-toggle-threads (&optional arg
)
8878 "Toggle showing conversation threads.
8879 If ARG is positive number, turn showing conversation threads on."
8881 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
8882 (setq gnus-show-threads
8883 (if (null arg
) (not gnus-show-threads
)
8884 (> (prefix-numeric-value arg
) 0)))
8885 (gnus-summary-prepare)
8886 (gnus-summary-goto-subject current
)
8887 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
8888 (gnus-summary-position-point)))
8890 (defun gnus-summary-show-all-threads ()
8894 (let ((buffer-read-only nil
))
8895 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
8896 (gnus-summary-position-point))
8898 (defun gnus-summary-show-thread ()
8899 "Show thread subtrees.
8900 Returns nil if no thread was there to be shown."
8902 (let ((buffer-read-only nil
)
8904 ;; first goto end then to beg, to have point at beg after let
8905 (end (progn (end-of-line) (point)))
8906 (beg (progn (beginning-of-line) (point))))
8908 ;; Any hidden lines here?
8909 (search-forward "\r" end t
)
8910 (subst-char-in-region beg end ?\^M ?
\n t
)
8912 (gnus-summary-position-point))))
8914 (defun gnus-summary-hide-all-threads ()
8915 "Hide all thread subtrees."
8918 (goto-char (point-min))
8919 (gnus-summary-hide-thread)
8920 (while (zerop (gnus-summary-next-thread 1 t
))
8921 (gnus-summary-hide-thread)))
8922 (gnus-summary-position-point))
8924 (defun gnus-summary-hide-thread ()
8925 "Hide thread subtrees.
8926 Returns nil if no threads were there to be hidden."
8928 (let ((buffer-read-only nil
)
8930 (article (gnus-summary-article-number)))
8932 ;; Go forward until either the buffer ends or the subthread
8934 (when (and (not (eobp))
8935 (or (zerop (gnus-summary-next-thread 1 t
))
8936 (goto-char (point-max))))
8938 (if (and (> (point) start
)
8939 (search-backward "\n" start t
))
8941 (subst-char-in-region start
(point) ?
\n ?\^M
)
8942 (gnus-summary-goto-subject article
))
8946 (defun gnus-summary-go-to-next-thread (&optional previous
)
8947 "Go to the same level (or less) next thread.
8948 If PREVIOUS is non-nil, go to previous thread instead.
8949 Return the article number moved to, or nil if moving was impossible."
8950 (let ((level (gnus-summary-thread-level))
8951 (way (if previous -
1 1))
8954 (while (and (not (eobp))
8955 (< level
(gnus-summary-thread-level)))
8963 (gnus-summary-article-number)
8966 (defun gnus-summary-next-thread (n &optional silent
)
8967 "Go to the same level next N'th thread.
8968 If N is negative, search backward instead.
8969 Returns the difference between N and the number of skips actually
8972 If SILENT, don't output messages."
8974 (let ((backward (< n
0))
8977 (gnus-summary-go-to-next-thread backward
))
8980 (gnus-summary-position-point))
8981 (when (and (not silent
) (/= 0 n
))
8982 (gnus-message 7 "No more threads"))
8985 (defun gnus-summary-prev-thread (n)
8986 "Go to the same level previous N'th thread.
8987 Returns the difference between N and the number of skips actually
8990 (gnus-summary-next-thread (- n
)))
8992 (defun gnus-summary-go-down-thread ()
8993 "Go down one level in the current thread."
8994 (let ((children (gnus-summary-article-children)))
8996 (gnus-summary-goto-subject (car children
)))))
8998 (defun gnus-summary-go-up-thread ()
8999 "Go up one level in the current thread."
9000 (let ((parent (gnus-summary-article-parent)))
9002 (gnus-summary-goto-subject parent
))))
9004 (defun gnus-summary-down-thread (n)
9005 "Go down thread N steps.
9006 If N is negative, go up instead.
9007 Returns the difference between N and how many steps down that were
9013 (if up
(gnus-summary-go-up-thread)
9014 (gnus-summary-go-down-thread)))
9016 (gnus-summary-position-point)
9018 (gnus-message 7 "Can't go further"))
9021 (defun gnus-summary-up-thread (n)
9022 "Go up thread N steps.
9023 If N is negative, go up instead.
9024 Returns the difference between N and how many steps down that were
9027 (gnus-summary-down-thread (- n
)))
9029 (defun gnus-summary-top-thread ()
9030 "Go to the top of the thread."
9032 (while (gnus-summary-go-up-thread))
9033 (gnus-summary-article-number))
9035 (defun gnus-summary-kill-thread (&optional unmark
)
9036 "Mark articles under current thread as read.
9037 If the prefix argument is positive, remove any kinds of marks.
9038 If the prefix argument is negative, tick articles instead."
9041 (setq unmark
(prefix-numeric-value unmark
)))
9042 (let ((articles (gnus-summary-articles-in-thread)))
9044 ;; Expand the thread.
9045 (gnus-summary-show-thread)
9046 ;; Mark all the articles.
9048 (gnus-summary-goto-subject (car articles
))
9049 (cond ((null unmark
)
9050 (gnus-summary-mark-article-as-read gnus-killed-mark
))
9052 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
9054 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
9055 (setq articles
(cdr articles
))))
9056 ;; Hide killed subtrees.
9058 gnus-thread-hide-killed
9059 (gnus-summary-hide-thread))
9060 ;; If marked as read, go to next unread subject.
9062 ;; Go to next unread subject.
9063 (gnus-summary-next-subject 1 t
)))
9064 (gnus-set-mode-line 'summary
))
9066 ;; Summary sorting commands
9068 (defun gnus-summary-sort-by-number (&optional reverse
)
9069 "Sort the summary buffer by article number.
9070 Argument REVERSE means reverse order."
9072 (gnus-summary-sort 'number reverse
))
9074 (defun gnus-summary-sort-by-author (&optional reverse
)
9075 "Sort the summary buffer by author name alphabetically.
9076 If `case-fold-search' is non-nil, case of letters is ignored.
9077 Argument REVERSE means reverse order."
9079 (gnus-summary-sort 'author reverse
))
9081 (defun gnus-summary-sort-by-subject (&optional reverse
)
9082 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
9083 If `case-fold-search' is non-nil, case of letters is ignored.
9084 Argument REVERSE means reverse order."
9086 (gnus-summary-sort 'subject reverse
))
9088 (defun gnus-summary-sort-by-date (&optional reverse
)
9089 "Sort the summary buffer by date.
9090 Argument REVERSE means reverse order."
9092 (gnus-summary-sort 'date reverse
))
9094 (defun gnus-summary-sort-by-score (&optional reverse
)
9095 "Sort the summary buffer by score.
9096 Argument REVERSE means reverse order."
9098 (gnus-summary-sort 'score reverse
))
9100 (defun gnus-summary-sort-by-lines (&optional reverse
)
9101 "Sort the summary buffer by the number of lines.
9102 Argument REVERSE means reverse order."
9104 (gnus-summary-sort 'lines reverse
))
9106 (defun gnus-summary-sort-by-chars (&optional reverse
)
9107 "Sort the summary buffer by article length.
9108 Argument REVERSE means reverse order."
9110 (gnus-summary-sort 'chars reverse
))
9112 (defun gnus-summary-sort (predicate reverse
)
9113 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
9114 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
9115 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
9116 (gnus-thread-sort-functions
9121 (gnus-sort-gathered-threads-function
9122 gnus-thread-sort-functions
)
9123 (gnus-article-sort-functions
9129 (gnus-summary-prepare-hook nil
))
9130 ;; We do the sorting by regenerating the threads.
9131 (gnus-summary-prepare)
9132 ;; Hide subthreads if needed.
9133 (when (and gnus-show-threads gnus-thread-hide-subtree
)
9134 (gnus-summary-hide-all-threads))))
9136 ;; Summary saving commands.
9138 (defun gnus-summary-save-article (&optional n not-saved
)
9139 "Save the current article using the default saver function.
9140 If N is a positive number, save the N next articles.
9141 If N is a negative number, save the N previous articles.
9142 If N is nil and any articles have been marked with the process mark,
9143 save those articles instead.
9144 The variable `gnus-default-article-saver' specifies the saver function."
9146 (let* ((articles (gnus-summary-work-articles n
))
9147 (save-buffer (save-excursion
9148 (nnheader-set-temp-buffer " *Gnus Save*")))
9149 (num (length articles
))
9151 (dolist (article articles
)
9152 (setq header
(gnus-summary-article-header article
))
9153 (if (not (vectorp header
))
9154 ;; This is a pseudo-article.
9155 (if (assq 'name header
)
9156 (gnus-copy-file (cdr (assq 'name header
)))
9157 (gnus-message 1 "Article %d is unsaveable" article
))
9158 ;; This is a real article.
9159 (save-window-excursion
9160 (let ((gnus-display-mime-function nil
)
9161 (gnus-article-prepare-hook nil
))
9162 (gnus-summary-select-article t nil nil article
)))
9164 (set-buffer save-buffer
)
9166 (insert-buffer-substring gnus-original-article-buffer
))
9167 (setq file
(gnus-article-save save-buffer file num
))
9168 (gnus-summary-remove-process-mark article
)
9170 (gnus-summary-set-saved-mark article
))))
9171 (gnus-kill-buffer save-buffer
)
9172 (gnus-summary-position-point)
9173 (gnus-set-mode-line 'summary
)
9176 (defun gnus-summary-pipe-output (&optional arg
)
9177 "Pipe the current article to a subprocess.
9178 If N is a positive number, pipe the N next articles.
9179 If N is a negative number, pipe the N previous articles.
9180 If N is nil and any articles have been marked with the process mark,
9181 pipe those articles instead."
9184 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
))
9185 (gnus-summary-save-article arg t
))
9186 (gnus-configure-windows 'pipe
))
9188 (defun gnus-summary-save-article-mail (&optional arg
)
9189 "Append the current article to an mail file.
9190 If N is a positive number, save the N next articles.
9191 If N is a negative number, save the N previous articles.
9192 If N is nil and any articles have been marked with the process mark,
9193 save those articles instead."
9196 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
9197 (gnus-summary-save-article arg
)))
9199 (defun gnus-summary-save-article-rmail (&optional arg
)
9200 "Append the current article to an rmail file.
9201 If N is a positive number, save the N next articles.
9202 If N is a negative number, save the N previous articles.
9203 If N is nil and any articles have been marked with the process mark,
9204 save those articles instead."
9207 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
9208 (gnus-summary-save-article arg
)))
9210 (defun gnus-summary-save-article-file (&optional arg
)
9211 "Append the current article to a file.
9212 If N is a positive number, save the N next articles.
9213 If N is a negative number, save the N previous articles.
9214 If N is nil and any articles have been marked with the process mark,
9215 save those articles instead."
9218 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
9219 (gnus-summary-save-article arg
)))
9221 (defun gnus-summary-write-article-file (&optional arg
)
9222 "Write the current article to a file, deleting the previous file.
9223 If N is a positive number, save the N next articles.
9224 If N is a negative number, save the N previous articles.
9225 If N is nil and any articles have been marked with the process mark,
9226 save those articles instead."
9229 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
9230 (gnus-summary-save-article arg
)))
9232 (defun gnus-summary-save-article-body-file (&optional arg
)
9233 "Append the current article body to a file.
9234 If N is a positive number, save the N next articles.
9235 If N is a negative number, save the N previous articles.
9236 If N is nil and any articles have been marked with the process mark,
9237 save those articles instead."
9240 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
9241 (gnus-summary-save-article arg
)))
9243 (defun gnus-summary-pipe-message (program)
9244 "Pipe the current article through PROGRAM."
9245 (interactive "sProgram: ")
9246 (gnus-summary-select-article)
9247 (let ((mail-header-separator ""))
9248 (gnus-eval-in-buffer-window gnus-article-buffer
9251 (let ((start (window-start))
9253 (message-pipe-buffer-body program
)
9254 (set-window-start (get-buffer-window (current-buffer)) start
))))))
9256 (defun gnus-get-split-value (methods)
9257 "Return a value based on the split METHODS."
9258 (let (split-name method result match
)
9261 (set-buffer gnus-original-article-buffer
)
9263 (nnheader-narrow-to-headers)
9264 (while (and methods
(not split-name
))
9265 (goto-char (point-min))
9266 (setq method
(pop methods
))
9267 (setq match
(car method
))
9270 ;; Regular expression.
9272 (re-search-forward match nil t
)))
9273 ((gnus-functionp match
)
9277 (setq result
(funcall match gnus-newsgroup-name
))))
9282 (setq result
(eval match
)))))
9283 (setq split-name
(cdr method
))
9284 (cond ((stringp result
)
9285 (push (expand-file-name
9286 result gnus-article-save-directory
)
9289 (setq split-name
(append result split-name
)))))))))
9290 (nreverse split-name
)))
9292 (defun gnus-valid-move-group-p (group)
9295 (symbol-value group
)
9296 (gnus-get-function (gnus-find-method-for-group
9297 (symbol-name group
)) 'request-accept-article t
)))
9299 (defun gnus-read-move-group-name (prompt default articles prefix
)
9300 "Read a group name."
9301 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
9302 (minibuffer-confirm-incomplete nil
) ; XEmacs
9306 (if (> (length articles
) 1)
9307 (format "these %d articles" (length articles
))
9312 (gnus-completing-read default prom
9314 'gnus-valid-move-group-p
9316 'gnus-group-history
))
9317 ((= 1 (length split-name
))
9318 (gnus-completing-read (car split-name
) prom
9320 'gnus-valid-move-group-p
9322 'gnus-group-history
))
9324 (gnus-completing-read nil prom
9325 (mapcar (lambda (el) (list el
))
9326 (nreverse split-name
))
9328 'gnus-group-history
))))
9329 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
9331 (if (or (string= to-newsgroup
"")
9332 (string= to-newsgroup prefix
))
9333 (setq to-newsgroup default
))
9334 (unless to-newsgroup
9335 (error "No group name entered"))
9336 (or (gnus-active to-newsgroup
)
9337 (gnus-activate-group to-newsgroup nil nil to-method
)
9338 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9340 (or (and (gnus-request-create-group to-newsgroup to-method
)
9341 (gnus-activate-group
9342 to-newsgroup nil nil to-method
)
9343 (gnus-subscribe-group to-newsgroup
))
9344 (error "Couldn't create group %s" to-newsgroup
)))
9345 (error "No such group: %s" to-newsgroup
)))
9348 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
9349 "Save parts matching TYPE to DIR.
9350 If REVERSE, save parts that do not match TYPE."
9352 (list (read-string "Save parts of type: "
9353 (or (car gnus-summary-save-parts-type-history
)
9354 gnus-summary-save-parts-default-mime
)
9355 'gnus-summary-save-parts-type-history
)
9356 (setq gnus-summary-save-parts-last-directory
9357 (read-file-name "Save to directory: "
9358 gnus-summary-save-parts-last-directory
9360 current-prefix-arg
))
9361 (gnus-summary-iterate n
9362 (let ((gnus-display-mime-function nil
)
9363 (gnus-inhibit-treatment t
))
9364 (gnus-summary-select-article))
9366 (set-buffer gnus-article-buffer
)
9367 (let ((handles (or gnus-article-mime-handles
9368 (mm-dissect-buffer) (mm-uu-dissect))))
9370 (gnus-summary-save-parts-1 type dir handles reverse
)
9371 (unless gnus-article-mime-handles
;; Don't destroy this case.
9372 (mm-destroy-parts handles
)))))))
9374 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
9375 (if (stringp (car handle
))
9376 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
9379 (not (string-match type
(mm-handle-media-type handle
)))
9380 (string-match type
(mm-handle-media-type handle
)))
9381 (let ((file (expand-file-name
9382 (file-name-nondirectory
9384 (mail-content-type-get
9385 (mm-handle-disposition handle
) 'filename
)
9386 (concat gnus-newsgroup-name
9387 "." (number-to-string
9388 (cdr gnus-article-current
)))))
9390 (unless (file-exists-p file
)
9391 (mm-save-part-to-file handle file
))))))
9393 ;; Summary extract commands
9395 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
9396 (let ((buffer-read-only nil
)
9397 (article (gnus-summary-article-number))
9399 (unless (gnus-summary-goto-subject article
)
9400 (error "No such article: %d" article
))
9401 (gnus-summary-position-point)
9402 ;; If all commands are to be bunched up on one line, we collect
9404 (unless gnus-view-pseudos-separately
9405 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
9408 (setq action
(cdr (assq 'action
(car ps
))))
9409 (setq files
(list (cdr (assq 'name
(car ps
)))))
9410 (while (and ps
(cdr ps
)
9411 (string= (or action
"1")
9412 (or (cdr (assq 'action
(cadr ps
))) "2")))
9413 (push (cdr (assq 'name
(cadr ps
))) files
)
9414 (setcdr ps
(cddr ps
)))
9416 (when (not (string-match "%s" action
))
9419 (when (assq 'execute
(car ps
))
9420 (setcdr (assq 'execute
(car ps
))
9421 (funcall (if (string-match "%s" action
)
9430 (setq ps
(cdr ps
)))))
9431 (if (and gnus-view-pseudos
(not not-view
))
9433 (when (assq 'execute
(car pslist
))
9434 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
9435 (eq gnus-view-pseudos
'not-confirm
)))
9436 (setq pslist
(cdr pslist
)))
9439 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
9440 (gnus-summary-article-number)))
9441 (gnus-summary-goto-subject after-article
)
9444 (insert " " (file-name-nondirectory
9445 (cdr (assq 'name
(car pslist
))))
9446 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
9448 (forward-line -
1) ; back to `b'
9449 (gnus-add-text-properties
9450 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
9451 gnus-mouse-face-prop gnus-mouse-face
))
9453 after-article gnus-reffed-article-number
9454 gnus-unread-mark b
(car pslist
) 0 (- e b
))
9455 (push gnus-reffed-article-number gnus-newsgroup-unreads
)
9456 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
9457 (setq pslist
(cdr pslist
)))))))
9459 (defun gnus-pseudos< (p1 p2
)
9460 (let ((c1 (cdr (assq 'action p1
)))
9461 (c2 (cdr (assq 'action p2
))))
9462 (and c1 c2
(string< c1 c2
))))
9464 (defun gnus-request-pseudo-article (props)
9465 (cond ((assq 'execute props
)
9466 (gnus-execute-command (cdr (assq 'execute props
)))))
9467 (let ((gnus-current-article (gnus-summary-article-number)))
9468 (gnus-run-hooks 'gnus-mark-article-hook
)))
9470 (defun gnus-execute-command (command &optional automatic
)
9472 (gnus-article-setup-buffer)
9473 (set-buffer gnus-article-buffer
)
9474 (setq buffer-read-only nil
)
9475 (let ((command (if automatic command
9476 (read-string "Command: " (cons command
0)))))
9478 (insert "$ " command
"\n\n")
9479 (if gnus-view-pseudo-asynchronously
9480 (start-process "gnus-execute" (current-buffer) shell-file-name
9481 shell-command-switch command
)
9482 (call-process shell-file-name nil t nil
9483 shell-command-switch command
)))))
9485 ;; Summary kill commands.
9487 (defun gnus-summary-edit-global-kill (article)
9488 "Edit the \"global\" kill file."
9489 (interactive (list (gnus-summary-article-number)))
9490 (gnus-group-edit-global-kill article
))
9492 (defun gnus-summary-edit-local-kill ()
9493 "Edit a local kill file applied to the current newsgroup."
9495 (setq gnus-current-headers
(gnus-summary-article-header))
9496 (gnus-group-edit-local-kill
9497 (gnus-summary-article-number) gnus-newsgroup-name
))
9501 (defun gnus-read-header (id &optional header
)
9502 "Read the headers of article ID and enter them into the Gnus system."
9503 (let ((group gnus-newsgroup-name
)
9504 (gnus-override-method
9506 gnus-override-method
9507 (and (gnus-news-group-p gnus-newsgroup-name
)
9508 (car (gnus-refer-article-methods)))))
9510 ;; First we check to see whether the header in question is already
9513 ;; This is a Message-ID.
9514 (setq header
(or header
(gnus-id-to-header id
)))
9515 ;; This is an article number.
9516 (setq header
(or header
(gnus-summary-article-header id
))))
9518 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
9519 ;; We have found the header.
9521 ;; If this is a sparse article, we have to nix out its
9522 ;; previous entry in the thread hashtb.
9524 (gnus-summary-article-sparse-p (mail-header-number header
)))
9525 (let* ((parent (gnus-parent-id (mail-header-references header
)))
9526 (thread (and parent
(gnus-id-to-thread parent
))))
9528 (delq (assq header thread
) thread
))))
9529 ;; We have to really fetch the header to this article.
9531 (set-buffer nntp-server-buffer
)
9532 (when (setq where
(gnus-request-head id group
))
9533 (nnheader-fold-continuation-lines)
9534 (goto-char (point-max))
9536 (goto-char (point-min))
9540 ((cdr where
) (cdr where
))
9541 (header (mail-header-number header
))
9542 (t gnus-reffed-article-number
))
9544 (insert " Article retrieved.\n"))
9546 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
9547 () ; Malformed head.
9548 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
9549 (when (and (stringp id
)
9550 (not (string= (gnus-group-real-name group
)
9552 ;; If we fetched by Message-ID and the article came
9553 ;; from a different group, we fudge some bogus article
9554 ;; numbers for this article.
9555 (mail-header-set-number header gnus-reffed-article-number
))
9557 (set-buffer gnus-summary-buffer
)
9558 (decf gnus-reffed-article-number
)
9559 (gnus-remove-header (mail-header-number header
))
9560 (push header gnus-newsgroup-headers
)
9561 (setq gnus-current-headers header
)
9562 (push (mail-header-number header
) gnus-newsgroup-limit
)))
9565 (defun gnus-remove-header (number)
9566 "Remove header NUMBER from `gnus-newsgroup-headers'."
9567 (if (and gnus-newsgroup-headers
9568 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
9569 (pop gnus-newsgroup-headers
)
9570 (let ((headers gnus-newsgroup-headers
))
9571 (while (and (cdr headers
)
9572 (not (= number
(mail-header-number (cadr headers
)))))
9575 (setcdr headers
(cddr headers
))))))
9578 ;;; summary highlights
9581 (defun gnus-highlight-selected-summary ()
9582 "Highlight selected article in summary buffer."
9583 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9584 (when gnus-summary-selected-face
9586 (let* ((beg (progn (beginning-of-line) (point)))
9587 (end (progn (end-of-line) (point)))
9588 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9589 (from (if (get-text-property beg gnus-mouse-face-prop
)
9591 (or (next-single-property-change
9592 beg gnus-mouse-face-prop nil end
)
9597 (or (next-single-property-change
9598 from gnus-mouse-face-prop nil end
)
9600 ;; If no mouse-face prop on line we will have to = from = end,
9601 ;; so we highlight the entire line instead.
9602 (when (= (+ to
2) from
)
9605 (if gnus-newsgroup-selected-overlay
9606 ;; Move old overlay.
9608 gnus-newsgroup-selected-overlay from to
(current-buffer))
9609 ;; Create new overlay.
9611 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
9612 'face gnus-summary-selected-face
))))))
9614 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9615 (defun gnus-summary-highlight-line ()
9616 "Highlight current line according to `gnus-summary-highlight'."
9617 (let* ((list gnus-summary-highlight
)
9619 (end (progn (end-of-line) (point)))
9620 ;; now find out where the line starts and leave point there.
9621 (beg (progn (beginning-of-line) (point)))
9622 (article (gnus-summary-article-number))
9623 (score (or (cdr (assq (or article gnus-current-article
)
9624 gnus-newsgroup-scored
))
9625 gnus-summary-default-score
0))
9626 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
9627 (inhibit-read-only t
))
9628 ;; Eval the cars of the lists until we find a match.
9629 (let ((default gnus-summary-default-score
))
9631 (not (eval (caar list
))))
9632 (setq list
(cdr list
))))
9633 (let ((face (cdar list
)))
9634 (unless (eq face
(get-text-property beg
'face
))
9635 (gnus-put-text-property-excluding-characters-with-faces
9637 (setq face
(if (boundp face
) (symbol-value face
) face
)))
9638 (when gnus-summary-highlight-line-function
9639 (funcall gnus-summary-highlight-line-function article face
))))
9642 (defun gnus-update-read-articles (group unread
&optional compute
)
9643 "Update the list of read articles in GROUP."
9644 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
9645 (entry (gnus-gethash group gnus-newsrc-hashtb
))
9646 (info (nth 2 entry
))
9648 (unread (sort (copy-sequence unread
) '<))
9650 (if (or (not info
) (not active
))
9651 ;; There is no info on this group if it was, in fact,
9652 ;; killed. Gnus stores no information on killed groups, so
9653 ;; there's nothing to be done.
9654 ;; One could store the information somewhere temporarily,
9655 ;; perhaps... Hmmm...
9657 ;; Remove any negative articles numbers.
9658 (while (and unread
(< (car unread
) 0))
9659 (setq unread
(cdr unread
)))
9660 ;; Remove any expired article numbers
9661 (while (and unread
(< (car unread
) (car active
)))
9662 (setq unread
(cdr unread
)))
9663 ;; Compute the ranges of read articles by looking at the list of
9666 (when (/= (car unread
) prev
)
9667 (push (if (= prev
(1- (car unread
))) prev
9668 (cons prev
(1- (car unread
))))
9670 (setq prev
(1+ (car unread
)))
9671 (setq unread
(cdr unread
)))
9672 (when (<= prev
(cdr active
))
9673 (push (cons prev
(cdr active
)) read
))
9674 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
9679 ;; Propagate the read marks to the backend.
9680 (when (gnus-check-backend-function 'request-set-mark group
)
9681 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
9682 (add (gnus-remove-from-range read
(gnus-info-read info
))))
9684 (unless (gnus-check-group group
)
9685 (error "Can't open server for %s" group
))
9686 (gnus-request-set-mark
9687 group
(delq nil
(list (if add
(list add
'add
'(read)))
9688 (if del
(list del
'del
'(read))))))
9690 `(gnus-request-set-mark
9693 (if del
(list del
'add
'(read)))
9694 (if add
(list add
'del
'(read))))))))))
9695 (set-buffer gnus-group-buffer
)
9698 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
9699 (gnus-info-set-read ',info
',(gnus-info-read info
))
9700 (gnus-get-unread-articles-in-group ',info
9701 (gnus-active ,group
))
9702 (gnus-group-update-group ,group t
)
9704 ;; Enter this list into the group info.
9705 (gnus-info-set-read info read
)
9706 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9707 (gnus-get-unread-articles-in-group info
(gnus-active group
))
9710 (defun gnus-offer-save-summaries ()
9711 "Offer to save all active summary buffers."
9713 (let ((buflist (buffer-list))
9715 ;; Go through all buffers and find all summaries.
9717 (and (setq bufname
(buffer-name (car buflist
)))
9718 (string-match "Summary" bufname
)
9720 (set-buffer bufname
)
9721 ;; We check that this is, indeed, a summary buffer.
9722 (and (eq major-mode
'gnus-summary-mode
)
9723 ;; Also make sure this isn't bogus.
9724 gnus-newsgroup-prepared
9725 ;; Also make sure that this isn't a dead summary buffer.
9726 (not gnus-dead-summary-mode
)))
9727 (push bufname buffers
))
9728 (setq buflist
(cdr buflist
)))
9729 ;; Go through all these summary buffers and offer to save them.
9732 "Update summary buffer %s? "
9734 (switch-to-buffer buf
)
9735 (gnus-summary-exit))
9738 (defun gnus-summary-setup-default-charset ()
9739 "Setup newsgroup default charset."
9740 (if (equal gnus-newsgroup-name
"nndraft:drafts")
9741 (setq gnus-newsgroup-charset nil
)
9742 (let* ((name (and gnus-newsgroup-name
9743 (gnus-group-real-name gnus-newsgroup-name
)))
9745 (or gnus-newsgroup-ephemeral-ignored-charsets
9747 (and gnus-newsgroup-name
9748 (or (gnus-group-find-parameter gnus-newsgroup-name
9749 'ignored-charsets t
)
9750 (let ((alist gnus-group-ignored-charsets-alist
)
9751 elem
(charsets nil
))
9752 (while (setq elem
(pop alist
))
9754 (string-match (car elem
) name
))
9756 charsets
(cdr elem
))))
9758 gnus-newsgroup-ignored-charsets
))))
9759 (setq gnus-newsgroup-charset
9760 (or gnus-newsgroup-ephemeral-charset
9761 (and gnus-newsgroup-name
9762 (or (gnus-group-find-parameter gnus-newsgroup-name
'charset
)
9763 (let ((alist gnus-group-charset-alist
)
9765 (while (setq elem
(pop alist
))
9767 (string-match (car elem
) name
))
9769 charset
(cadr elem
))))
9771 gnus-default-charset
))
9772 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
9773 ignored-charsets
))))
9779 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
9780 "Display the current article buffer fully MIME-buttonized.
9781 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9782 treated as multipart/mixed."
9785 (let ((gnus-unbuttonized-mime-types nil
)
9786 (gnus-mime-display-multipart-as-mixed show-all-parts
))
9787 (gnus-summary-show-article)))
9789 (defun gnus-summary-repair-multipart (article)
9790 "Add a Content-Type header to a multipart article without one."
9791 (interactive (list (gnus-summary-article-number)))
9792 (gnus-with-article article
9793 (message-narrow-to-head)
9794 (goto-char (point-max))
9796 (when (search-forward "\n--" nil t
)
9797 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9798 (message-narrow-to-head)
9799 (message-remove-header "Mime-Version")
9800 (message-remove-header "Content-Type")
9801 (goto-char (point-max))
9802 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9804 (insert "Mime-Version: 1.0\n")
9806 (let (gnus-mark-article-hook)
9807 (gnus-summary-select-article t t nil article
)))
9809 (defun gnus-summary-toggle-display-buttonized ()
9810 "Toggle the buttonizing of the article buffer."
9813 (if (setq gnus-inhibit-mime-unbuttonizing
9814 (not gnus-inhibit-mime-unbuttonizing
))
9815 (let ((gnus-unbuttonized-mime-types nil
))
9816 (gnus-summary-show-article))
9817 (gnus-summary-show-article)))
9820 ;;; Generic summary marking commands
9823 (defvar gnus-summary-marking-alist
9824 '((read gnus-del-mark
"d")
9825 (unread gnus-unread-mark
"u")
9826 (ticked gnus-ticked-mark
"!")
9827 (dormant gnus-dormant-mark
"?")
9828 (expirable gnus-expirable-mark
"e"))
9829 "An alist of names/marks/keystrokes.")
9831 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
9832 (defvar gnus-summary-mark-map
)
9834 (defun gnus-summary-make-all-marking-commands ()
9835 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
9836 (dolist (elem gnus-summary-marking-alist
)
9837 (apply 'gnus-summary-make-marking-command elem
)))
9839 (defun gnus-summary-make-marking-command (name mark keystroke
)
9840 (let ((map (make-sparse-keymap)))
9841 (define-key gnus-summary-generic-mark-map keystroke map
)
9842 (dolist (lway `((next "next" next nil
"n")
9843 (next-unread "next unread" next t
"N")
9844 (prev "previous" prev nil
"p")
9845 (prev-unread "previous unread" prev t
"P")
9846 (nomove "" nil nil
,keystroke
)))
9847 (let ((func (gnus-summary-make-marking-command-1
9848 mark
(car lway
) lway name
)))
9849 (setq func
(eval func
))
9850 (define-key map
(nth 4 lway
) func
)))))
9852 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
9854 (format "gnus-summary-put-mark-as-%s%s"
9855 name
(if (eq way
'nomove
)
9857 (concat "-" (symbol-name way
)))))
9860 "Mark the current article as %s%s.
9861 If N, the prefix, then repeat N times.
9862 If N is negative, move in reverse order.
9863 The difference between N and the actual number of articles marked is
9867 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
9869 (defun gnus-summary-generic-mark (n mark move unread
)
9870 "Mark N articles with MARK."
9871 (unless (eq major-mode
'gnus-summary-mode
)
9872 (error "This command can only be used in the summary buffer"))
9873 (gnus-summary-show-thread)
9877 ((eq move
'prev
) -
1)
9883 nummove
(* -
1 nummove
))))
9885 (gnus-summary-mark-article nil mark
)
9886 (zerop (gnus-summary-next-subject nummove unread t
)))
9889 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
9890 (gnus-summary-recenter)
9891 (gnus-summary-position-point)
9892 (gnus-set-mode-line 'summary
)
9895 (gnus-summary-make-all-marking-commands)
9901 (run-hooks 'gnus-sum-load-hook
)
9903 ;;; gnus-sum.el ends here