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 a particular
792 summary line should be displayed, each form is evaluated. The content
793 of the face field after the first true form is used. You can change
794 how those 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.")
811 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
812 "Variable that says which function should be used to decode a string with encoded words.")
814 (defcustom gnus-extra-headers nil
815 "*Extra headers to parse."
818 :type
'(repeat symbol
))
820 (defcustom gnus-ignored-from-addresses
821 (and user-mail-address
(regexp-quote user-mail-address
))
822 "*Regexp of From headers that may be suppressed in favor of To headers."
827 (defcustom gnus-group-charset-alist
828 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5
)
829 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312
)
830 ("^fj\\>\\|^japan\\>" iso-2022-jp-2
)
831 ("^tnn\\>\\|^pin\\>\\|^sci.lang.japan" iso-2022-7bit
)
832 ("^relcom\\>" koi8-r
)
834 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2
)
835 ("^israel\\>" iso-8859-1
)
837 ("^alt.chinese.text.big5\\>" chinese-big5
)
838 ("^soc.culture.vietnamese\\>" vietnamese-viqr
)
839 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1
)
841 "Alist of regexps (to match group names) and default charsets to be used when reading."
842 :type
'(repeat (list (regexp :tag
"Group")
843 (symbol :tag
"Charset")))
844 :group
'gnus-charset
)
846 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
847 "List of charsets that should be ignored.
848 When these charsets are used in the \"charset\" parameter, the
849 default charset will be used instead."
851 :type
'(repeat symbol
)
852 :group
'gnus-charset
)
854 (defcustom gnus-group-ignored-charsets-alist
855 '(("alt\\.chinese\\.text" iso-8859-1
))
856 "Alist of regexps (to match group names) and charsets that should be ignored.
857 When these charsets are used in the \"charset\" parameter, the
858 default charset will be used instead."
859 :type
'(repeat (cons (regexp :tag
"Group")
861 :group
'gnus-charset
)
863 (defcustom gnus-group-highlight-words-alist nil
864 "Alist of group regexps and highlight regexps.
865 This variable uses the same syntax as `gnus-emphasis-alist'."
867 :type
'(repeat (cons (regexp :tag
"Group")
868 (repeat (list (regexp :tag
"Highlight regexp")
869 (number :tag
"Group for entire word" 0)
870 (number :tag
"Group for displayed part" 0)
872 gnus-emphasis-highlight-words
)))))
873 :group
'gnus-summary-visual
)
875 (defcustom gnus-summary-show-article-charset-alist
877 "Alist of number and charset.
878 The article will be shown with the charset corresponding to the
880 For example: ((1 . cn-gb-2312) (2 . big5))."
882 :type
'(repeat (cons (number :tag
"Argument" 1)
883 (symbol :tag
"Charset")))
884 :group
'gnus-charset
)
886 (defcustom gnus-preserve-marks t
887 "Whether marks are preserved when moving, copying and respooling messages."
890 :group
'gnus-summary-marks
)
892 (defcustom gnus-alter-articles-to-read-function nil
893 "Function to be called to alter the list of articles to be selected."
894 :type
'(choice (const nil
) function
)
895 :group
'gnus-summary
)
897 (defcustom gnus-orphan-score nil
898 "*All orphans get this score added. Set in the score file."
899 :group
'gnus-score-default
900 :type
'(choice (const nil
)
903 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
904 "*A regexp to match MIME parts when saving multiple parts of a message
905 with gnus-summary-save-parts (X m). This regexp will be used by default
906 when prompting the user for which type of files to save."
911 ;;; Internal variables
913 (defvar gnus-article-mime-handles nil
)
914 (defvar gnus-article-decoded-p nil
)
915 (defvar gnus-scores-exclude-files nil
)
916 (defvar gnus-page-broken nil
)
917 (defvar gnus-inhibit-mime-unbuttonizing nil
)
919 (defvar gnus-original-article nil
)
920 (defvar gnus-article-internal-prepare-hook nil
)
921 (defvar gnus-newsgroup-process-stack nil
)
923 (defvar gnus-thread-indent-array nil
)
924 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
925 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
926 "Function called to sort the articles within a thread after it has been gathered together.")
928 (defvar gnus-summary-save-parts-type-history nil
)
929 (defvar gnus-summary-save-parts-last-directory nil
)
931 ;; Avoid highlighting in kill files.
932 (defvar gnus-summary-inhibit-highlight nil
)
933 (defvar gnus-newsgroup-selected-overlay nil
)
934 (defvar gnus-inhibit-limiting nil
)
935 (defvar gnus-newsgroup-adaptive-score-file nil
)
936 (defvar gnus-current-score-file nil
)
937 (defvar gnus-current-move-group nil
)
938 (defvar gnus-current-copy-group nil
)
939 (defvar gnus-current-crosspost-group nil
)
941 (defvar gnus-newsgroup-dependencies nil
)
942 (defvar gnus-newsgroup-adaptive nil
)
943 (defvar gnus-summary-display-article-function nil
)
944 (defvar gnus-summary-highlight-line-function nil
945 "Function called after highlighting a summary line.")
947 (defvar gnus-summary-line-format-alist
948 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
949 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
950 (?s gnus-tmp-subject-or-nil ?s
)
951 (?n gnus-tmp-name ?s
)
952 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
954 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
956 (?F gnus-tmp-from ?s
)
957 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
958 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
959 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
960 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
961 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
962 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
963 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
964 (?L gnus-tmp-lines ?d
)
965 (?I gnus-tmp-indentation ?s
)
966 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
967 (?R gnus-tmp-replied ?c
)
968 (?\
[ gnus-tmp-opening-bracket ?c
)
969 (?\
] gnus-tmp-closing-bracket ?c
)
970 (?\
> (make-string gnus-tmp-level ?
) ?s
)
971 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
972 (?i gnus-tmp-score ?d
)
973 (?z gnus-tmp-score-char ?c
)
974 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
975 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
976 (?U gnus-tmp-unread ?c
)
977 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header
) ?s
)
978 (?t
(gnus-summary-number-of-articles-in-thread
979 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
981 (?e
(gnus-summary-number-of-articles-in-thread
982 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
984 (?u gnus-tmp-user-defined ?s
)
985 (?P
(gnus-pick-line-number) ?d
))
986 "An alist of format specifications that can appear in summary lines.
987 These are paired with what variables they correspond with, along with
988 the type of the variable (string, integer, character, etc).")
990 (defvar gnus-summary-dummy-line-format-alist
991 `((?S gnus-tmp-subject ?s
)
992 (?N gnus-tmp-number ?d
)
993 (?u gnus-tmp-user-defined ?s
)))
995 (defvar gnus-summary-mode-line-format-alist
996 `((?G gnus-tmp-group-name ?s
)
997 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
998 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
999 (?A gnus-tmp-article-number ?d
)
1000 (?Z gnus-tmp-unread-and-unselected ?s
)
1001 (?V gnus-version ?s
)
1002 (?U gnus-tmp-unread-and-unticked ?d
)
1003 (?S gnus-tmp-subject ?s
)
1004 (?e gnus-tmp-unselected ?d
)
1005 (?u gnus-tmp-user-defined ?s
)
1006 (?d
(length gnus-newsgroup-dormant
) ?d
)
1007 (?t
(length gnus-newsgroup-marked
) ?d
)
1008 (?r
(length gnus-newsgroup-reads
) ?d
)
1009 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1010 (?E gnus-newsgroup-expunged-tally ?d
)
1011 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1013 (defvar gnus-last-search-regexp nil
1014 "Default regexp for article search command.")
1016 (defvar gnus-last-shell-command nil
1017 "Default shell command on article.")
1019 (defvar gnus-newsgroup-begin nil
)
1020 (defvar gnus-newsgroup-end nil
)
1021 (defvar gnus-newsgroup-last-rmail nil
)
1022 (defvar gnus-newsgroup-last-mail nil
)
1023 (defvar gnus-newsgroup-last-folder nil
)
1024 (defvar gnus-newsgroup-last-file nil
)
1025 (defvar gnus-newsgroup-auto-expire nil
)
1026 (defvar gnus-newsgroup-active nil
)
1028 (defvar gnus-newsgroup-data nil
)
1029 (defvar gnus-newsgroup-data-reverse nil
)
1030 (defvar gnus-newsgroup-limit nil
)
1031 (defvar gnus-newsgroup-limits nil
)
1033 (defvar gnus-newsgroup-unreads nil
1034 "List of unread articles in the current newsgroup.")
1036 (defvar gnus-newsgroup-unselected nil
1037 "List of unselected unread articles in the current newsgroup.")
1039 (defvar gnus-newsgroup-reads nil
1040 "Alist of read articles and article marks in the current newsgroup.")
1042 (defvar gnus-newsgroup-expunged-tally nil
)
1044 (defvar gnus-newsgroup-marked nil
1045 "List of ticked articles in the current newsgroup (a subset of unread art).")
1047 (defvar gnus-newsgroup-killed nil
1048 "List of ranges of articles that have been through the scoring process.")
1050 (defvar gnus-newsgroup-cached nil
1051 "List of articles that come from the article cache.")
1053 (defvar gnus-newsgroup-saved nil
1054 "List of articles that have been saved.")
1056 (defvar gnus-newsgroup-kill-headers nil
)
1058 (defvar gnus-newsgroup-replied nil
1059 "List of articles that have been replied to in the current newsgroup.")
1061 (defvar gnus-newsgroup-expirable nil
1062 "List of articles in the current newsgroup that can be expired.")
1064 (defvar gnus-newsgroup-processable nil
1065 "List of articles in the current newsgroup that can be processed.")
1067 (defvar gnus-newsgroup-downloadable nil
1068 "List of articles in the current newsgroup that can be processed.")
1070 (defvar gnus-newsgroup-undownloaded nil
1071 "List of articles in the current newsgroup that haven't been downloaded..")
1073 (defvar gnus-newsgroup-unsendable nil
1074 "List of articles in the current newsgroup that won't be sent.")
1076 (defvar gnus-newsgroup-bookmarks nil
1077 "List of articles in the current newsgroup that have bookmarks.")
1079 (defvar gnus-newsgroup-dormant nil
1080 "List of dormant articles in the current newsgroup.")
1082 (defvar gnus-newsgroup-scored nil
1083 "List of scored articles in the current newsgroup.")
1085 (defvar gnus-newsgroup-headers nil
1086 "List of article headers in the current newsgroup.")
1088 (defvar gnus-newsgroup-threads nil
)
1090 (defvar gnus-newsgroup-prepared nil
1091 "Whether the current group has been prepared properly.")
1093 (defvar gnus-newsgroup-ancient nil
1094 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1096 (defvar gnus-newsgroup-sparse nil
)
1098 (defvar gnus-current-article nil
)
1099 (defvar gnus-article-current nil
)
1100 (defvar gnus-current-headers nil
)
1101 (defvar gnus-have-all-headers nil
)
1102 (defvar gnus-last-article nil
)
1103 (defvar gnus-newsgroup-history nil
)
1104 (defvar gnus-newsgroup-charset nil
)
1105 (defvar gnus-newsgroup-ephemeral-charset nil
)
1106 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1108 (defconst gnus-summary-local-variables
1109 '(gnus-newsgroup-name
1110 gnus-newsgroup-begin gnus-newsgroup-end
1111 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1112 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1113 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1114 gnus-newsgroup-unselected gnus-newsgroup-marked
1115 gnus-newsgroup-reads gnus-newsgroup-saved
1116 gnus-newsgroup-replied gnus-newsgroup-expirable
1117 gnus-newsgroup-processable gnus-newsgroup-killed
1118 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1119 gnus-newsgroup-unsendable
1120 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1121 gnus-newsgroup-headers gnus-newsgroup-threads
1122 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1123 gnus-current-article gnus-current-headers gnus-have-all-headers
1124 gnus-last-article gnus-article-internal-prepare-hook
1125 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1126 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1127 gnus-thread-expunge-below
1128 gnus-score-alist gnus-current-score-file
1129 (gnus-summary-expunge-below . global
)
1130 (gnus-summary-mark-below . global
)
1131 (gnus-orphan-score . global
)
1132 gnus-newsgroup-active gnus-scores-exclude-files
1133 gnus-newsgroup-history gnus-newsgroup-ancient
1134 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1135 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1136 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1137 (gnus-newsgroup-expunged-tally .
0)
1138 gnus-cache-removable-articles gnus-newsgroup-cached
1139 gnus-newsgroup-data gnus-newsgroup-data-reverse
1140 gnus-newsgroup-limit gnus-newsgroup-limits
1141 gnus-newsgroup-charset
)
1142 "Variables that are buffer-local to the summary buffers.")
1144 ;; Byte-compiler warning.
1145 (eval-when-compile (defvar gnus-article-mode-map
))
1149 (defvar gnus-decode-encoded-word-methods
1150 '(mail-decode-encoded-word-string)
1151 "List of methods used to decode encoded words.
1153 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1154 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1155 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1156 whose names match REGEXP.
1159 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1160 mail-decode-encoded-word-string
1161 (\"chinese\" . rfc1843-decode-string))")
1163 (defvar gnus-decode-encoded-word-methods-cache nil
)
1165 (defun gnus-multi-decode-encoded-word-string (string)
1166 "Apply the functions from `gnus-encoded-word-methods' that match."
1167 (unless (and gnus-decode-encoded-word-methods-cache
1168 (eq gnus-newsgroup-name
1169 (car gnus-decode-encoded-word-methods-cache
)))
1170 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1173 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1174 (if (and gnus-newsgroup-name
1175 (string-match (car x
) gnus-newsgroup-name
))
1176 (nconc gnus-decode-encoded-word-methods-cache
1178 gnus-decode-encoded-word-methods
))
1179 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1182 (setq string
(funcall (pop xlist
) string
))))
1185 ;; Subject simplification.
1187 (defun gnus-simplify-whitespace (str)
1188 "Remove excessive whitespace from STR."
1191 (while (string-match "[ \t][ \t]+" mystr
)
1192 (setq mystr
(concat (substring mystr
0 (match-beginning 0))
1194 (substring mystr
(match-end 0)))))
1196 (when (string-match "^[ \t]+" mystr
)
1197 (setq mystr
(substring mystr
(match-end 0))))
1199 (when (string-match "[ \t]+$" mystr
)
1200 (setq mystr
(substring mystr
0 (match-beginning 0))))
1203 (defsubst gnus-simplify-subject-re
(subject)
1204 "Remove \"Re:\" from subject lines."
1205 (if (string-match "^[Rr][Ee]: *" subject
)
1206 (substring subject
(match-end 0))
1209 (defun gnus-simplify-subject (subject &optional re-only
)
1210 "Remove `Re:' and words in parentheses.
1211 If RE-ONLY is non-nil, strip leading `Re:'s only."
1212 (let ((case-fold-search t
)) ;Ignore case.
1213 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1214 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1215 (setq subject
(substring subject
(match-end 0))))
1216 ;; Remove uninteresting prefixes.
1217 (when (and (not re-only
)
1218 gnus-simplify-ignored-prefixes
1219 (string-match gnus-simplify-ignored-prefixes subject
))
1220 (setq subject
(substring subject
(match-end 0))))
1221 ;; Remove words in parentheses from end.
1223 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1224 (setq subject
(substring subject
0 (match-beginning 0)))))
1225 ;; Return subject string.
1228 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1230 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1231 (goto-char (point-min))
1232 (while (re-search-forward regexp nil t
)
1233 (replace-match (or newtext
""))))
1235 (defun gnus-simplify-buffer-fuzzy ()
1236 "Simplify string in the buffer fuzzily.
1237 The string in the accessible portion of the current buffer is simplified.
1238 It is assumed to be a single-line subject.
1239 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1240 matter is removed. Additional things can be deleted by setting
1241 `gnus-simplify-subject-fuzzy-regexp'."
1242 (let ((case-fold-search t
)
1244 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1246 (while (not (eq modified-tick
(buffer-modified-tick)))
1247 (setq modified-tick
(buffer-modified-tick))
1249 ((listp gnus-simplify-subject-fuzzy-regexp
)
1250 (mapcar 'gnus-simplify-buffer-fuzzy-step
1251 gnus-simplify-subject-fuzzy-regexp
))
1252 (gnus-simplify-subject-fuzzy-regexp
1253 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1254 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1255 (gnus-simplify-buffer-fuzzy-step
1256 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1257 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1259 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1260 (gnus-simplify-buffer-fuzzy-step " +" " ")
1261 (gnus-simplify-buffer-fuzzy-step " $")
1262 (gnus-simplify-buffer-fuzzy-step "^ +")))
1264 (defun gnus-simplify-subject-fuzzy (subject)
1265 "Simplify a subject string fuzzily.
1266 See `gnus-simplify-buffer-fuzzy' for details."
1268 (gnus-set-work-buffer)
1269 (let ((case-fold-search t
))
1270 ;; Remove uninteresting prefixes.
1271 (when (and gnus-simplify-ignored-prefixes
1272 (string-match gnus-simplify-ignored-prefixes subject
))
1273 (setq subject
(substring subject
(match-end 0))))
1275 (inline (gnus-simplify-buffer-fuzzy))
1278 (defsubst gnus-simplify-subject-fully
(subject)
1279 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1281 (gnus-simplify-subject-functions
1282 (gnus-map-function gnus-simplify-subject-functions subject
))
1283 ((null gnus-summary-gather-subject-limit
)
1284 (gnus-simplify-subject-re subject
))
1285 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1286 (gnus-simplify-subject-fuzzy subject
))
1287 ((numberp gnus-summary-gather-subject-limit
)
1288 (gnus-limit-string (gnus-simplify-subject-re subject
)
1289 gnus-summary-gather-subject-limit
))
1293 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1294 "Check whether two subjects are equal.
1295 If optional argument simple-first is t, first argument is already
1298 ((null simple-first
)
1299 (equal (gnus-simplify-subject-fully s1
)
1300 (gnus-simplify-subject-fully s2
)))
1303 (gnus-simplify-subject-fully s2
)))))
1305 (defun gnus-summary-bubble-group ()
1306 "Increase the score of the current group.
1307 This is a handy function to add to `gnus-summary-exit-hook' to
1308 increase the score of each group you read."
1309 (gnus-group-add-score gnus-newsgroup-name
))
1313 ;;; Gnus summary mode
1316 (put 'gnus-summary-mode
'mode-class
'special
)
1318 (defvar gnus-article-commands-menu
)
1321 ;; Non-orthogonal keys
1323 (gnus-define-keys gnus-summary-mode-map
1324 " " gnus-summary-next-page
1325 "\177" gnus-summary-prev-page
1326 [delete] gnus-summary-prev-page
1327 [backspace] gnus-summary-prev-page
1328 "\r" gnus-summary-scroll-up
1329 "\M-\r" gnus-summary-scroll-down
1330 "n" gnus-summary-next-unread-article
1331 "p" gnus-summary-prev-unread-article
1332 "N" gnus-summary-next-article
1333 "P" gnus-summary-prev-article
1334 "\M-\C-n" gnus-summary-next-same-subject
1335 "\M-\C-p" gnus-summary-prev-same-subject
1336 "\M-n" gnus-summary-next-unread-subject
1337 "\M-p" gnus-summary-prev-unread-subject
1338 "." gnus-summary-first-unread-article
1339 "," gnus-summary-best-unread-article
1340 "\M-s" gnus-summary-search-article-forward
1341 "\M-r" gnus-summary-search-article-backward
1342 "<" gnus-summary-beginning-of-article
1343 ">" gnus-summary-end-of-article
1344 "j" gnus-summary-goto-article
1345 "^" gnus-summary-refer-parent-article
1346 "\M-^" gnus-summary-refer-article
1347 "u" gnus-summary-tick-article-forward
1348 "!" gnus-summary-tick-article-forward
1349 "U" gnus-summary-tick-article-backward
1350 "d" gnus-summary-mark-as-read-forward
1351 "D" gnus-summary-mark-as-read-backward
1352 "E" gnus-summary-mark-as-expirable
1353 "\M-u" gnus-summary-clear-mark-forward
1354 "\M-U" gnus-summary-clear-mark-backward
1355 "k" gnus-summary-kill-same-subject-and-select
1356 "\C-k" gnus-summary-kill-same-subject
1357 "\M-\C-k" gnus-summary-kill-thread
1358 "\M-\C-l" gnus-summary-lower-thread
1359 "e" gnus-summary-edit-article
1360 "#" gnus-summary-mark-as-processable
1361 "\M-#" gnus-summary-unmark-as-processable
1362 "\M-\C-t" gnus-summary-toggle-threads
1363 "\M-\C-s" gnus-summary-show-thread
1364 "\M-\C-h" gnus-summary-hide-thread
1365 "\M-\C-f" gnus-summary-next-thread
1366 "\M-\C-b" gnus-summary-prev-thread
1367 [(meta down)] gnus-summary-next-thread
1368 [(meta up)] gnus-summary-prev-thread
1369 "\M-\C-u" gnus-summary-up-thread
1370 "\M-\C-d" gnus-summary-down-thread
1371 "&" gnus-summary-execute-command
1372 "c" gnus-summary-catchup-and-exit
1373 "\C-w" gnus-summary-mark-region-as-read
1374 "\C-t" gnus-summary-toggle-truncation
1375 "?" gnus-summary-mark-as-dormant
1376 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1377 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1378 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1379 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1380 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1381 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1382 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1383 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1384 "=" gnus-summary-expand-window
1385 "\C-x\C-s" gnus-summary-reselect-current-group
1386 "\M-g" gnus-summary-rescan-group
1387 "w" gnus-summary-stop-page-breaking
1388 "\C-c\C-r" gnus-summary-caesar-message
1389 "f" gnus-summary-followup
1390 "F" gnus-summary-followup-with-original
1391 "C" gnus-summary-cancel-article
1392 "r" gnus-summary-reply
1393 "R" gnus-summary-reply-with-original
1394 "\C-c\C-f" gnus-summary-mail-forward
1395 "o" gnus-summary-save-article
1396 "\C-o" gnus-summary-save-article-mail
1397 "|" gnus-summary-pipe-output
1398 "\M-k" gnus-summary-edit-local-kill
1399 "\M-K" gnus-summary-edit-global-kill
1401 "\C-c\C-d" gnus-summary-describe-group
1402 "q" gnus-summary-exit
1403 "Q" gnus-summary-exit-no-update
1404 "\C-c\C-i" gnus-info-find-node
1405 gnus-mouse-2 gnus-mouse-pick-article
1406 "m" gnus-summary-mail-other-window
1407 "a" gnus-summary-post-news
1408 "x" gnus-summary-limit-to-unread
1409 "s" gnus-summary-isearch-article
1410 "t" gnus-summary-toggle-header
1411 "g" gnus-summary-show-article
1412 "l" gnus-summary-goto-last-article
1413 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1414 "\C-d" gnus-summary-enter-digest-group
1415 "\M-\C-d" gnus-summary-read-document
1416 "\M-\C-e" gnus-summary-edit-parameters
1417 "\M-\C-a" gnus-summary-customize-parameters
1419 "*" gnus-cache-enter-article
1420 "\M-*" gnus-cache-remove-article
1421 "\M-&" gnus-summary-universal-argument
1422 "\C-l" gnus-recenter
1423 "I" gnus-summary-increase-score
1424 "L" gnus-summary-lower-score
1425 "\M-i" gnus-symbolic-argument
1426 "h" gnus-summary-select-article-buffer
1428 "b" gnus-article-view-part
1429 "\M-t" gnus-summary-toggle-display-buttonized
1431 "V" gnus-summary-score-map
1432 "X" gnus-uu-extract-map
1433 "S" gnus-summary-send-map)
1435 ;; Sort of orthogonal keymap
1436 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1437 "t" gnus-summary-tick-article-forward
1438 "!" gnus-summary-tick-article-forward
1439 "d" gnus-summary-mark-as-read-forward
1440 "r" gnus-summary-mark-as-read-forward
1441 "c" gnus-summary-clear-mark-forward
1442 " " gnus-summary-clear-mark-forward
1443 "e" gnus-summary-mark-as-expirable
1444 "x" gnus-summary-mark-as-expirable
1445 "?" gnus-summary-mark-as-dormant
1446 "b" gnus-summary-set-bookmark
1447 "B" gnus-summary-remove-bookmark
1448 "#" gnus-summary-mark-as-processable
1449 "\M-#" gnus-summary-unmark-as-processable
1450 "S" gnus-summary-limit-include-expunged
1451 "C" gnus-summary-catchup
1452 "H" gnus-summary-catchup-to-here
1453 "\C-c" gnus-summary-catchup-all
1454 "k" gnus-summary-kill-same-subject-and-select
1455 "K" gnus-summary-kill-same-subject
1456 "P" gnus-uu-mark-map)
1458 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1459 "c" gnus-summary-clear-above
1460 "u" gnus-summary-tick-above
1461 "m" gnus-summary-mark-above
1462 "k" gnus-summary-kill-below)
1464 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1465 "/" gnus-summary-limit-to-subject
1466 "n" gnus-summary-limit-to-articles
1467 "w" gnus-summary-pop-limit
1468 "s" gnus-summary-limit-to-subject
1469 "a" gnus-summary-limit-to-author
1470 "u" gnus-summary-limit-to-unread
1471 "m" gnus-summary-limit-to-marks
1472 "M" gnus-summary-limit-exclude-marks
1473 "v" gnus-summary-limit-to-score
1474 "*" gnus-summary-limit-include-cached
1475 "D" gnus-summary-limit-include-dormant
1476 "T" gnus-summary-limit-include-thread
1477 "d" gnus-summary-limit-exclude-dormant
1478 "t" gnus-summary-limit-to-age
1479 "x" gnus-summary-limit-to-extra
1480 "E" gnus-summary-limit-include-expunged
1481 "c" gnus-summary-limit-exclude-childless-dormant
1482 "C" gnus-summary-limit-mark-excluded-as-read)
1484 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1485 "n" gnus-summary-next-unread-article
1486 "p" gnus-summary-prev-unread-article
1487 "N" gnus-summary-next-article
1488 "P" gnus-summary-prev-article
1489 "\C-n" gnus-summary-next-same-subject
1490 "\C-p" gnus-summary-prev-same-subject
1491 "\M-n" gnus-summary-next-unread-subject
1492 "\M-p" gnus-summary-prev-unread-subject
1493 "f" gnus-summary-first-unread-article
1494 "b" gnus-summary-best-unread-article
1495 "j" gnus-summary-goto-article
1496 "g" gnus-summary-goto-subject
1497 "l" gnus-summary-goto-last-article
1498 "o" gnus-summary-pop-article)
1500 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1501 "k" gnus-summary-kill-thread
1502 "l" gnus-summary-lower-thread
1503 "i" gnus-summary-raise-thread
1504 "T" gnus-summary-toggle-threads
1505 "t" gnus-summary-rethread-current
1506 "^" gnus-summary-reparent-thread
1507 "s" gnus-summary-show-thread
1508 "S" gnus-summary-show-all-threads
1509 "h" gnus-summary-hide-thread
1510 "H" gnus-summary-hide-all-threads
1511 "n" gnus-summary-next-thread
1512 "p" gnus-summary-prev-thread
1513 "u" gnus-summary-up-thread
1514 "o" gnus-summary-top-thread
1515 "d" gnus-summary-down-thread
1516 "#" gnus-uu-mark-thread
1517 "\M-#" gnus-uu-unmark-thread)
1519 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1520 "g" gnus-summary-prepare
1521 "c" gnus-summary-insert-cached-articles)
1523 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1524 "c" gnus-summary-catchup-and-exit
1525 "C" gnus-summary-catchup-all-and-exit
1526 "E" gnus-summary-exit-no-update
1527 "Q" gnus-summary-exit
1528 "Z" gnus-summary-exit
1529 "n" gnus-summary-catchup-and-goto-next-group
1530 "R" gnus-summary-reselect-current-group
1531 "G" gnus-summary-rescan-group
1532 "N" gnus-summary-next-group
1533 "s" gnus-summary-save-newsrc
1534 "P" gnus-summary-prev-group)
1536 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1537 " " gnus-summary-next-page
1538 "n" gnus-summary-next-page
1539 "\177" gnus-summary-prev-page
1540 [delete] gnus-summary-prev-page
1541 "p" gnus-summary-prev-page
1542 "\r" gnus-summary-scroll-up
1543 "\M-\r" gnus-summary-scroll-down
1544 "<" gnus-summary-beginning-of-article
1545 ">" gnus-summary-end-of-article
1546 "b" gnus-summary-beginning-of-article
1547 "e" gnus-summary-end-of-article
1548 "^" gnus-summary-refer-parent-article
1549 "r" gnus-summary-refer-parent-article
1550 "D" gnus-summary-enter-digest-group
1551 "R" gnus-summary-refer-references
1552 "T" gnus-summary-refer-thread
1553 "g" gnus-summary-show-article
1554 "s" gnus-summary-isearch-article
1555 "P" gnus-summary-print-article
1556 "t" gnus-article-babel
)
1558 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1559 "b" gnus-article-add-buttons
1560 "B" gnus-article-add-buttons-to-head
1561 "o" gnus-article-treat-overstrike
1562 "e" gnus-article-emphasize
1563 "w" gnus-article-fill-cited-article
1564 "Q" gnus-article-fill-long-lines
1565 "C" gnus-article-capitalize-sentences
1566 "c" gnus-article-remove-cr
1567 "q" gnus-article-de-quoted-unreadable
1568 "6" gnus-article-de-base64-unreadable
1569 "Z" gnus-article-decode-HZ
1570 "h" gnus-article-wash-html
1571 "f" gnus-article-display-x-face
1572 "l" gnus-summary-stop-page-breaking
1573 "r" gnus-summary-caesar-message
1574 "t" gnus-summary-toggle-header
1575 "v" gnus-summary-verbose-headers
1576 "H" gnus-article-strip-headers-in-body
1577 "d" gnus-article-treat-dumbquotes
)
1579 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1580 "a" gnus-article-hide
1581 "h" gnus-article-hide-headers
1582 "b" gnus-article-hide-boring-headers
1583 "s" gnus-article-hide-signature
1584 "c" gnus-article-hide-citation
1585 "C" gnus-article-hide-citation-in-followups
1586 "l" gnus-article-hide-list-identifiers
1587 "p" gnus-article-hide-pgp
1588 "B" gnus-article-strip-banner
1589 "P" gnus-article-hide-pem
1590 "\C-c" gnus-article-hide-citation-maybe
)
1592 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1593 "a" gnus-article-highlight
1594 "h" gnus-article-highlight-headers
1595 "c" gnus-article-highlight-citation
1596 "s" gnus-article-highlight-signature
)
1598 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1599 "w" gnus-article-decode-mime-words
1600 "c" gnus-article-decode-charset
1601 "v" gnus-mime-view-all-parts
1602 "b" gnus-article-view-part
)
1604 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1605 "z" gnus-article-date-ut
1606 "u" gnus-article-date-ut
1607 "l" gnus-article-date-local
1608 "e" gnus-article-date-lapsed
1609 "o" gnus-article-date-original
1610 "i" gnus-article-date-iso8601
1611 "s" gnus-article-date-user
)
1613 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1614 "t" gnus-article-remove-trailing-blank-lines
1615 "l" gnus-article-strip-leading-blank-lines
1616 "m" gnus-article-strip-multiple-blank-lines
1617 "a" gnus-article-strip-blank-lines
1618 "A" gnus-article-strip-all-blank-lines
1619 "s" gnus-article-strip-leading-space
1620 "e" gnus-article-strip-trailing-space
)
1622 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1624 "f" gnus-summary-fetch-faq
1625 "d" gnus-summary-describe-group
1626 "h" gnus-summary-describe-briefly
1627 "i" gnus-info-find-node
)
1629 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1630 "e" gnus-summary-expire-articles
1631 "\M-\C-e" gnus-summary-expire-articles-now
1632 "\177" gnus-summary-delete-article
1633 [delete] gnus-summary-delete-article
1634 [backspace] gnus-summary-delete-article
1635 "m" gnus-summary-move-article
1636 "r" gnus-summary-respool-article
1637 "w" gnus-summary-edit-article
1638 "c" gnus-summary-copy-article
1639 "B" gnus-summary-crosspost-article
1640 "q" gnus-summary-respool-query
1641 "t" gnus-summary-respool-trace
1642 "i" gnus-summary-import-article
1643 "p" gnus-summary-article-posted-p)
1645 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1646 "o" gnus-summary-save-article
1647 "m" gnus-summary-save-article-mail
1648 "F" gnus-summary-write-article-file
1649 "r" gnus-summary-save-article-rmail
1650 "f" gnus-summary-save-article-file
1651 "b" gnus-summary-save-article-body-file
1652 "h" gnus-summary-save-article-folder
1653 "v" gnus-summary-save-article-vm
1654 "p" gnus-summary-pipe-output
1655 "s" gnus-soup-add-article)
1657 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1658 "b" gnus-summary-display-buttonized
1659 "m" gnus-summary-repair-multipart
1660 "v" gnus-article-view-part
1661 "o" gnus-article-save-part
1662 "c" gnus-article-copy-part
1663 "e" gnus-article-externalize-part
1664 "i" gnus-article-inline-part
1665 "|" gnus-article-pipe-part))
1667 (defun gnus-summary-make-menu-bar ()
1668 (gnus-turn-off-edit-menu 'summary)
1670 (unless (boundp 'gnus-summary-misc-menu)
1673 gnus-summary-kill-menu gnus-summary-mode-map ""
1678 ["Enter score..." gnus-summary-score-entry t]
1679 ["Customize" gnus-score-customize t])
1680 (gnus-make-score-map 'increase)
1681 (gnus-make-score-map 'lower)
1683 ["Kill below" gnus-summary-kill-below t]
1684 ["Mark above" gnus-summary-mark-above t]
1685 ["Tick above" gnus-summary-tick-above t]
1686 ["Clear above" gnus-summary-clear-above t])
1687 ["Current score" gnus-summary-current-score t]
1688 ["Set score" gnus-summary-set-score t]
1689 ["Switch current score file..." gnus-score-change-score-file t]
1690 ["Set mark below..." gnus-score-set-mark-below t]
1691 ["Set expunge below..." gnus-score-set-expunge-below t]
1692 ["Edit current score file" gnus-score-edit-current-scores t]
1693 ["Edit score file" gnus-score-edit-file t]
1694 ["Trace score" gnus-score-find-trace t]
1695 ["Find words" gnus-score-find-favourite-words t]
1696 ["Rescore buffer" gnus-summary-rescore t]
1697 ["Increase score..." gnus-summary-increase-score t]
1698 ["Lower score..." gnus-summary-lower-score t]))))
1700 ;; Define both the Article menu in the summary buffer and the equivalent
1701 ;; Commands menu in the article buffer here for consistency.
1704 ["All" gnus-article-hide t]
1705 ["Headers" gnus-article-hide-headers t]
1706 ["Signature" gnus-article-hide-signature t]
1707 ["Citation" gnus-article-hide-citation t]
1708 ["List identifiers" gnus-article-hide-list-identifiers t]
1709 ["PGP" gnus-article-hide-pgp t]
1710 ["Banner" gnus-article-strip-banner t]
1711 ["Boring headers" gnus-article-hide-boring-headers t])
1713 ["All" gnus-article-highlight t]
1714 ["Headers" gnus-article-highlight-headers t]
1715 ["Signature" gnus-article-highlight-signature t]
1716 ["Citation" gnus-article-highlight-citation t])
1718 ["Words" gnus-article-decode-mime-words t]
1719 ["Charset" gnus-article-decode-charset t]
1720 ["QP" gnus-article-de-quoted-unreadable t]
1721 ["Base64" gnus-article-de-base64-unreadable t]
1722 ["View all" gnus-mime-view-all-parts t])
1724 ["Local" gnus-article-date-local t]
1725 ["ISO8601" gnus-article-date-iso8601 t]
1726 ["UT" gnus-article-date-ut t]
1727 ["Original" gnus-article-date-original t]
1728 ["Lapsed" gnus-article-date-lapsed t]
1729 ["User-defined" gnus-article-date-user t])
1732 ["Leading" gnus-article-strip-leading-blank-lines t]
1733 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1734 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1735 ["All of the above" gnus-article-strip-blank-lines t]
1736 ["All" gnus-article-strip-all-blank-lines t]
1737 ["Leading space" gnus-article-strip-leading-space t]
1738 ["Trailing space" gnus-article-strip-trailing-space t])
1739 ["Overstrike" gnus-article-treat-overstrike t]
1740 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1741 ["Emphasis" gnus-article-emphasize t]
1742 ["Word wrap" gnus-article-fill-cited-article t]
1743 ["Fill long lines" gnus-article-fill-long-lines t]
1744 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1745 ["CR" gnus-article-remove-cr t]
1746 ["Show X-Face" gnus-article-display-x-face t]
1747 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1748 ["Base64" gnus-article-de-base64-unreadable t]
1749 ["Rot 13" gnus-summary-caesar-message
1750 :help "\"Caesar rotate\" article by 13"]
1751 ["Unix pipe" gnus-summary-pipe-message t]
1752 ["Add buttons" gnus-article-add-buttons t]
1753 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1754 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1755 ["Verbose header" gnus-summary-verbose-headers t]
1756 ["Toggle header" gnus-summary-toggle-header t]
1757 ["Html" gnus-article-wash-html t]
1758 ["HZ" gnus-article-decode-HZ t])
1760 ["Save in default format" gnus-summary-save-article
1761 :help "Save article using default method"]
1762 ["Save in file" gnus-summary-save-article-file
1763 :help "Save article in file"]
1764 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1765 ["Save in MH folder" gnus-summary-save-article-folder t]
1766 ["Save in VM folder" gnus-summary-save-article-vm t]
1767 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1768 ["Save body in file" gnus-summary-save-article-body-file t]
1769 ["Pipe through a filter" gnus-summary-pipe-output t]
1770 ["Add to SOUP packet" gnus-soup-add-article t]
1771 ["Print" gnus-summary-print-article t])
1773 ["Respool article..." gnus-summary-respool-article t]
1774 ["Move article..." gnus-summary-move-article
1775 (gnus-check-backend-function
1776 'request-move-article gnus-newsgroup-name)]
1777 ["Copy article..." gnus-summary-copy-article t]
1778 ["Crosspost article..." gnus-summary-crosspost-article
1779 (gnus-check-backend-function
1780 'request-replace-article gnus-newsgroup-name)]
1781 ["Import file..." gnus-summary-import-article t]
1782 ["Check if posted" gnus-summary-article-posted-p t]
1783 ["Edit article" gnus-summary-edit-article
1784 (not (gnus-group-read-only-p))]
1785 ["Delete article" gnus-summary-delete-article
1786 (gnus-check-backend-function
1787 'request-expire-articles gnus-newsgroup-name)]
1788 ["Query respool" gnus-summary-respool-query t]
1789 ["Trace respool" gnus-summary-respool-trace t]
1790 ["Delete expirable articles" gnus-summary-expire-articles-now
1791 (gnus-check-backend-function
1792 'request-expire-articles gnus-newsgroup-name)])
1794 ["Uudecode" gnus-uu-decode-uu
1795 :help "Decode uuencoded article(s)"]
1796 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1797 ["Unshar" gnus-uu-decode-unshar t]
1798 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1799 ["Save" gnus-uu-decode-save t]
1800 ["Binhex" gnus-uu-decode-binhex t]
1801 ["Postscript" gnus-uu-decode-postscript t])
1803 ["Enter article" gnus-cache-enter-article t]
1804 ["Remove article" gnus-cache-remove-article t])
1805 ["Translate" gnus-article-babel t]
1806 ["Select article buffer" gnus-summary-select-article-buffer t]
1807 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1808 ["Isearch article..." gnus-summary-isearch-article t]
1809 ["Beginning of the article" gnus-summary-beginning-of-article t]
1810 ["End of the article" gnus-summary-end-of-article t]
1811 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1812 ["Fetch referenced articles" gnus-summary-refer-references t]
1813 ["Fetch current thread" gnus-summary-refer-thread t]
1814 ["Fetch article with id..." gnus-summary-refer-article t]
1815 ["Redisplay" gnus-summary-show-article t])))
1817 gnus-summary-article-menu gnus-summary-mode-map ""
1818 (cons "Article" innards))
1820 (if (not (keymapp gnus-summary-article-menu))
1822 gnus-article-commands-menu gnus-article-mode-map ""
1823 (cons "Commands" innards))
1824 ;; in Emacs, don't share menu.
1825 (setq gnus-article-commands-menu
1826 (copy-keymap gnus-summary-article-menu))
1827 (define-key gnus-article-mode-map [menu-bar commands]
1828 (cons "Commands" gnus-article-commands-menu))))
1831 gnus-summary-thread-menu gnus-summary-mode-map ""
1833 ["Toggle threading" gnus-summary-toggle-threads t]
1834 ["Hide threads" gnus-summary-hide-all-threads t]
1835 ["Show threads" gnus-summary-show-all-threads t]
1836 ["Hide thread" gnus-summary-hide-thread t]
1837 ["Show thread" gnus-summary-show-thread t]
1838 ["Go to next thread" gnus-summary-next-thread t]
1839 ["Go to previous thread" gnus-summary-prev-thread t]
1840 ["Go down thread" gnus-summary-down-thread t]
1841 ["Go up thread" gnus-summary-up-thread t]
1842 ["Top of thread" gnus-summary-top-thread t]
1843 ["Mark thread as read" gnus-summary-kill-thread t]
1844 ["Lower thread score" gnus-summary-lower-thread t]
1845 ["Raise thread score" gnus-summary-raise-thread t]
1846 ["Rethread current" gnus-summary-rethread-current t]))
1849 gnus-summary-post-menu gnus-summary-mode-map ""
1851 ["Post an article" gnus-summary-post-news
1852 :help "Post an article"]
1853 ["Followup" gnus-summary-followup
1854 :help "Post followup to this article"]
1855 ["Followup and yank" gnus-summary-followup-with-original
1856 :help "Post followup to this article, quoting its contents"]
1857 ["Supersede article" gnus-summary-supersede-article t]
1858 ["Cancel article" gnus-summary-cancel-article
1859 :help "Cancel an article you posted"]
1860 ["Reply" gnus-summary-reply t]
1861 ["Reply and yank" gnus-summary-reply-with-original t]
1862 ["Wide reply" gnus-summary-wide-reply t]
1863 ["Wide reply and yank" gnus-summary-wide-reply-with-original
1864 :help "Mail a reply, quoting this article"]
1865 ["Mail forward" gnus-summary-mail-forward t]
1866 ["Post forward" gnus-summary-post-forward t]
1867 ["Digest and mail" gnus-uu-digest-mail-forward t]
1868 ["Digest and post" gnus-uu-digest-post-forward t]
1869 ["Resend message" gnus-summary-resend-message t]
1870 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1871 ["Send a mail" gnus-summary-mail-other-window t]
1872 ["Uuencode and post" gnus-uu-post-news
1873 :help "Post a uuencoded article"]
1874 ["Followup via news" gnus-summary-followup-to-mail t]
1875 ["Followup via news and yank"
1876 gnus-summary-followup-to-mail-with-original t]
1878 ;;["Send" gnus-summary-send-draft t]
1879 ;;["Send bounced" gnus-resend-bounced-mail t])
1883 gnus-summary-misc-menu gnus-summary-mode-map ""
1886 ["Mark as read" gnus-summary-mark-as-read-forward t]
1887 ["Mark same subject and select"
1888 gnus-summary-kill-same-subject-and-select t]
1889 ["Mark same subject" gnus-summary-kill-same-subject t]
1890 ["Catchup" gnus-summary-catchup
1891 :help "Mark unread articles in this group as read"]
1892 ["Catchup all" gnus-summary-catchup-all t]
1893 ["Catchup to here" gnus-summary-catchup-to-here t]
1894 ["Catchup region" gnus-summary-mark-region-as-read t]
1895 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1897 ["Tick" gnus-summary-tick-article-forward t]
1898 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1899 ["Remove marks" gnus-summary-clear-mark-forward t]
1900 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1901 ["Set bookmark" gnus-summary-set-bookmark t]
1902 ["Remove bookmark" gnus-summary-remove-bookmark t])
1904 ["Marks..." gnus-summary-limit-to-marks t]
1905 ["Subject..." gnus-summary-limit-to-subject t]
1906 ["Author..." gnus-summary-limit-to-author t]
1907 ["Age..." gnus-summary-limit-to-age t]
1908 ["Extra..." gnus-summary-limit-to-extra t]
1909 ["Score" gnus-summary-limit-to-score t]
1910 ["Unread" gnus-summary-limit-to-unread t]
1911 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1912 ["Articles" gnus-summary-limit-to-articles t]
1913 ["Pop limit" gnus-summary-pop-limit t]
1914 ["Show dormant" gnus-summary-limit-include-dormant t]
1915 ["Hide childless dormant"
1916 gnus-summary-limit-exclude-childless-dormant t]
1917 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1918 ["Hide marked" gnus-summary-limit-exclude-marks t]
1919 ["Show expunged" gnus-summary-show-all-expunged t])
1921 ["Set mark" gnus-summary-mark-as-processable t]
1922 ["Remove mark" gnus-summary-unmark-as-processable t]
1923 ["Remove all marks" gnus-summary-unmark-all-processable t]
1924 ["Mark above" gnus-uu-mark-over t]
1925 ["Mark series" gnus-uu-mark-series t]
1926 ["Mark region" gnus-uu-mark-region t]
1927 ["Unmark region" gnus-uu-unmark-region t]
1928 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1929 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1930 ["Mark all" gnus-uu-mark-all t]
1931 ["Mark buffer" gnus-uu-mark-buffer t]
1932 ["Mark sparse" gnus-uu-mark-sparse t]
1933 ["Mark thread" gnus-uu-mark-thread t]
1934 ["Unmark thread" gnus-uu-unmark-thread t]
1935 ("Process Mark Sets"
1936 ["Kill" gnus-summary-kill-process-mark t]
1937 ["Yank" gnus-summary-yank-process-mark
1938 gnus-newsgroup-process-stack]
1939 ["Save" gnus-summary-save-process-mark t]))
1941 ["Page forward" gnus-summary-next-page
1942 :help "Show next page of article"]
1943 ["Page backward" gnus-summary-prev-page
1944 :help "Show previous page of article"]
1945 ["Line forward" gnus-summary-scroll-up t])
1947 ["Next unread article" gnus-summary-next-unread-article t]
1948 ["Previous unread article" gnus-summary-prev-unread-article t]
1949 ["Next article" gnus-summary-next-article t]
1950 ["Previous article" gnus-summary-prev-article t]
1951 ["Next unread subject" gnus-summary-next-unread-subject t]
1952 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1953 ["Next article same subject" gnus-summary-next-same-subject t]
1954 ["Previous article same subject" gnus-summary-prev-same-subject t]
1955 ["First unread article" gnus-summary-first-unread-article t]
1956 ["Best unread article" gnus-summary-best-unread-article t]
1957 ["Go to subject number..." gnus-summary-goto-subject t]
1958 ["Go to article number..." gnus-summary-goto-article t]
1959 ["Go to the last article" gnus-summary-goto-last-article t]
1960 ["Pop article off history" gnus-summary-pop-article t])
1962 ["Sort by number" gnus-summary-sort-by-number t]
1963 ["Sort by author" gnus-summary-sort-by-author t]
1964 ["Sort by subject" gnus-summary-sort-by-subject t]
1965 ["Sort by date" gnus-summary-sort-by-date t]
1966 ["Sort by score" gnus-summary-sort-by-score t]
1967 ["Sort by lines" gnus-summary-sort-by-lines t]
1968 ["Sort by characters" gnus-summary-sort-by-chars t])
1970 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1971 ["Describe group" gnus-summary-describe-group t]
1972 ["Read manual" gnus-info-find-node t])
1974 ["Pick and read" gnus-pick-mode t]
1975 ["Binary" gnus-binary-mode t])
1977 ["Regenerate" gnus-summary-prepare t]
1978 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1979 ["Toggle threading" gnus-summary-toggle-threads t])
1980 ["Filter articles..." gnus-summary-execute-command t]
1981 ["Run command on subjects..." gnus-summary-universal-argument t]
1982 ["Search articles forward..." gnus-summary-search-article-forward t]
1983 ["Search articles backward..." gnus-summary-search-article-backward t]
1984 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1985 ["Expand window" gnus-summary-expand-window t]
1986 ["Expire expirable articles" gnus-summary-expire-articles
1987 (gnus-check-backend-function
1988 'request-expire-articles gnus-newsgroup-name)]
1989 ["Edit local kill file" gnus-summary-edit-local-kill t]
1990 ["Edit main kill file" gnus-summary-edit-global-kill t]
1991 ["Edit group parameters" gnus-summary-edit-parameters t]
1992 ["Customize group parameters" gnus-summary-customize-parameters t]
1993 ["Send a bug report" gnus-bug t]
1995 ["Catchup and exit" gnus-summary-catchup-and-exit
1996 :help "Mark unread articles in this group as read, then exit"]
1997 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1998 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1999 ["Exit group" gnus-summary-exit
2000 :help "Exit current group, return to group selection mode"]
2001 ["Exit group without updating" gnus-summary-exit-no-update t]
2002 ["Exit and goto next group" gnus-summary-next-group t]
2003 ["Exit and goto prev group" gnus-summary-prev-group t]
2004 ["Reselect group" gnus-summary-reselect-current-group t]
2005 ["Rescan group" gnus-summary-rescan-group t]
2006 ["Update dribble" gnus-summary-save-newsrc t])))
2008 (gnus-run-hooks 'gnus-summary-menu-hook)))
2010 (defvar gnus-summary-tool-bar-map nil)
2012 ;; Emacs 21 tool bar. Should be no-op otherwise.
2013 (defun gnus-summary-make-tool-bar ()
2014 (if (and (fboundp 'tool-bar-add-item-from-menu)
2015 (default-value 'tool-bar-mode)
2016 (not gnus-summary-tool-bar-map))
2017 (setq gnus-summary-tool-bar-map
2018 (let ((tool-bar-map (make-sparse-keymap)))
2019 (tool-bar-add-item-from-menu
2020 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2021 (tool-bar-add-item-from-menu
2022 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2023 (tool-bar-add-item-from-menu
2024 'gnus-summary-post-news "post" gnus-summary-mode-map)
2025 (tool-bar-add-item-from-menu
2026 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2027 (tool-bar-add-item-from-menu
2028 'gnus-summary-followup "followup" gnus-summary-mode-map)
2029 (tool-bar-add-item-from-menu
2030 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2031 (tool-bar-add-item-from-menu
2032 'gnus-summary-reply "reply" gnus-summary-mode-map)
2033 (tool-bar-add-item-from-menu
2034 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2035 (tool-bar-add-item-from-menu
2036 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2037 (tool-bar-add-item-from-menu
2038 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2039 (tool-bar-add-item-from-menu
2040 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2041 (tool-bar-add-item-from-menu
2042 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2043 (tool-bar-add-item-from-menu
2044 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2045 (tool-bar-add-item-from-menu
2046 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2047 (tool-bar-add-item-from-menu
2048 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2050 (if gnus-summary-tool-bar-map
2051 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2053 (defun gnus-score-set-default (var value)
2054 "A version of set that updates the GNU Emacs menu-bar."
2056 ;; It is the message that forces the active status to be updated.
2059 (defun gnus-make-score-map (type)
2060 "Make a summary score map of type TYPE."
2063 (let ((headers '(("author" "from" string)
2064 ("subject" "subject" string)
2065 ("article body" "body" string)
2066 ("article head" "head" string)
2067 ("xref" "xref" string)
2068 ("extra header" "extra" string)
2069 ("lines" "lines" number)
2070 ("followups to author" "followup" string)))
2071 (types '((number ("less than" <)
2074 (string ("substring" s)
2078 (perms '(("temporary" (current-time-string))
2086 (if (eq type 'lower)
2091 (setq header (car headers))
2097 (let ((ts (cdr (assoc (nth 2 header) types)))
2113 'gnus-summary-score-entry
2115 (if (or (string= (nth 1 header)
2117 (string= (nth 1 header)
2120 (list 'gnus-summary-header
2122 (list 'quote (nth 1 (car ts)))
2123 (list 'gnus-score-delta-default
2130 (list (nreverse outp))))
2133 (list (nreverse outt))))
2135 (setq headers (cdr headers)))
2136 (list (nreverse outh))))))))
2140 (defun gnus-summary-mode (&optional group)
2141 "Major mode for reading articles.
2143 All normal editing commands are switched off.
2144 \\<gnus-summary-mode-map>
2145 Each line in this buffer represents one article. To read an
2146 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2147 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2150 You can also post articles and send mail from this buffer. To
2151 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2152 of an article, type `\\[gnus-summary-reply]'.
2154 There are approx. one gazillion commands you can execute in this
2155 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2157 The following commands are available:
2159 \\{gnus-summary-mode-map}"
2161 (kill-all-local-variables)
2162 (when (gnus-visual-p 'summary-menu 'menu)
2163 (gnus-summary-make-menu-bar)
2164 (gnus-summary-make-tool-bar))
2165 (gnus-summary-make-local-variables)
2166 (gnus-make-thread-indent-array)
2167 (gnus-simplify-mode-line)
2168 (setq major-mode 'gnus-summary-mode)
2169 (setq mode-name "Summary")
2170 (make-local-variable 'minor-mode-alist)
2171 (use-local-map gnus-summary-mode-map)
2172 (buffer-disable-undo)
2173 (setq buffer-read-only t) ;Disable modification
2174 (setq truncate-lines t)
2175 (setq selective-display t)
2176 (setq selective-display-ellipses t) ;Display `...'
2177 (gnus-summary-set-display-table)
2178 (gnus-set-default-directory)
2179 (setq gnus-newsgroup-name group)
2180 (make-local-variable 'gnus-summary-line-format)
2181 (make-local-variable 'gnus-summary-line-format-spec)
2182 (make-local-variable 'gnus-summary-dummy-line-format)
2183 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2184 (make-local-variable 'gnus-summary-mark-positions)
2185 (make-local-hook 'pre-command-hook)
2186 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2187 (gnus-run-hooks 'gnus-summary-mode-hook)
2188 (mm-enable-multibyte-mule4)
2189 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2190 (gnus-update-summary-mark-positions))
2192 (defun gnus-summary-make-local-variables ()
2193 "Make all the local summary buffer variables."
2195 (dolist (local gnus-summary-local-variables)
2198 (if (eq (cdr local) 'global)
2199 ;; Copy the global value of the variable.
2200 (setq global (symbol-value (car local)))
2201 ;; Use the value from the list.
2202 (setq global (eval (cdr local))))
2203 (set (make-local-variable (car local)) global))
2204 ;; Simple nil-valued local variable.
2205 (set (make-local-variable local) nil)))))
2207 (defun gnus-summary-clear-local-variables ()
2208 (let ((locals gnus-summary-local-variables))
2210 (if (consp (car locals))
2211 (and (vectorp (caar locals))
2212 (set (caar locals) nil))
2213 (and (vectorp (car locals))
2214 (set (car locals) nil)))
2215 (setq locals (cdr locals)))))
2217 ;; Summary data functions.
2219 (defmacro gnus-data-number (data)
2222 (defmacro gnus-data-set-number (data number)
2223 `(setcar ,data ,number))
2225 (defmacro gnus-data-mark (data)
2228 (defmacro gnus-data-set-mark (data mark)
2229 `(setcar (nthcdr 1 ,data) ,mark))
2231 (defmacro gnus-data-pos (data)
2234 (defmacro gnus-data-set-pos (data pos)
2235 `(setcar (nthcdr 2 ,data) ,pos))
2237 (defmacro gnus-data-header (data)
2240 (defmacro gnus-data-set-header (data header)
2241 `(setf (nth 3 ,data) ,header))
2243 (defmacro gnus-data-level (data)
2246 (defmacro gnus-data-unread-p (data)
2247 `(= (nth 1 ,data) gnus-unread-mark))
2249 (defmacro gnus-data-read-p (data)
2250 `(/= (nth 1 ,data) gnus-unread-mark))
2252 (defmacro gnus-data-pseudo-p (data)
2253 `(consp (nth 3 ,data)))
2255 (defmacro gnus-data-find (number)
2256 `(assq ,number gnus-newsgroup-data))
2258 (defmacro gnus-data-find-list (number &optional data)
2259 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2260 (memq (assq ,number bdata)
2263 (defmacro gnus-data-make (number mark pos header level)
2264 `(list ,number ,mark ,pos ,header ,level))
2266 (defun gnus-data-enter (after-article number mark pos header level offset)
2267 (let ((data (gnus-data-find-list after-article)))
2269 (error "No such article: %d" after-article))
2270 (setcdr data (cons (gnus-data-make number mark pos header level)
2272 (setq gnus-newsgroup-data-reverse nil)
2273 (gnus-data-update-list (cddr data) offset)))
2275 (defun gnus-data-enter-list (after-article list &optional offset)
2277 (let ((data (and after-article (gnus-data-find-list after-article)))
2281 (let ((odata gnus-newsgroup-data))
2282 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2284 (gnus-data-update-list odata offset)))
2285 ;; Find the last element in the list to be spliced into the main
2288 (setq list (cdr list)))
2291 (setcdr list gnus-newsgroup-data)
2292 (setq gnus-newsgroup-data ilist)
2294 (gnus-data-update-list (cdr list) offset)))
2295 (setcdr list (cdr data))
2298 (gnus-data-update-list (cdr list) offset))))
2299 (setq gnus-newsgroup-data-reverse nil))))
2301 (defun gnus-data-remove (article &optional offset)
2302 (let ((data gnus-newsgroup-data))
2303 (if (= (gnus-data-number (car data)) article)
2305 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2306 gnus-newsgroup-data-reverse nil)
2308 (gnus-data-update-list gnus-newsgroup-data offset)))
2310 (when (= (gnus-data-number (cadr data)) article)
2311 (setcdr data (cddr data))
2313 (gnus-data-update-list (cdr data) offset))
2315 gnus-newsgroup-data-reverse nil))
2316 (setq data (cdr data))))))
2318 (defmacro gnus-data-list (backward)
2320 (or gnus-newsgroup-data-reverse
2321 (setq gnus-newsgroup-data-reverse
2322 (reverse gnus-newsgroup-data)))
2323 gnus-newsgroup-data))
2325 (defun gnus-data-update-list (data offset)
2326 "Add OFFSET to the POS of all data entries in DATA."
2327 (setq gnus-newsgroup-data-reverse nil)
2329 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2330 (setq data (cdr data))))
2332 (defun gnus-summary-article-pseudo-p (article)
2333 "Say whether this article is a pseudo article or not."
2334 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2336 (defmacro gnus-summary-article-sparse-p (article)
2337 "Say whether this article is a sparse article or not."
2338 `(memq ,article gnus-newsgroup-sparse))
2340 (defmacro gnus-summary-article-ancient-p (article)
2341 "Say whether this article is a sparse article or not."
2342 `(memq ,article gnus-newsgroup-ancient))
2344 (defun gnus-article-parent-p (number)
2345 "Say whether this article is a parent or not."
2346 (let ((data (gnus-data-find-list number)))
2347 (and (cdr data) ; There has to be an article after...
2348 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2349 (gnus-data-level (nth 1 data))))))
2351 (defun gnus-article-children (number)
2352 "Return a list of all children to NUMBER."
2353 (let* ((data (gnus-data-find-list number))
2354 (level (gnus-data-level (car data)))
2356 (setq data (cdr data))
2358 (= (gnus-data-level (car data)) (1+ level)))
2359 (push (gnus-data-number (car data)) children)
2360 (setq data (cdr data)))
2363 (defmacro gnus-summary-skip-intangible ()
2364 "If the current article is intangible, then jump to a different article."
2365 '(let ((to (get-text-property (point) 'gnus-intangible)))
2366 (and to (gnus-summary-goto-subject to))))
2368 (defmacro gnus-summary-article-intangible-p ()
2369 "Say whether this article is intangible or not."
2370 '(get-text-property (point) 'gnus-intangible))
2372 (defun gnus-article-read-p (article)
2373 "Say whether ARTICLE is read or not."
2374 (not (or (memq article gnus-newsgroup-marked)
2375 (memq article gnus-newsgroup-unreads)
2376 (memq article gnus-newsgroup-unselected)
2377 (memq article gnus-newsgroup-dormant))))
2379 ;; Some summary mode macros.
2381 (defmacro gnus-summary-article-number ()
2382 "The article number of the article on the current line.
2383 If there isn's an article number here, then we return the current
2386 (gnus-summary-skip-intangible)
2387 (or (get-text-property (point) 'gnus-number)
2388 (gnus-summary-last-subject))))
2390 (defmacro gnus-summary-article-header (&optional number)
2391 "Return the header of article NUMBER."
2392 `(gnus-data-header (gnus-data-find
2393 ,(or number '(gnus-summary-article-number)))))
2395 (defmacro gnus-summary-thread-level (&optional number)
2396 "Return the level of thread that starts with article NUMBER."
2397 `(if (and (eq gnus-summary-make-false-root 'dummy)
2398 (get-text-property (point) 'gnus-intangible))
2400 (gnus-data-level (gnus-data-find
2401 ,(or number '(gnus-summary-article-number))))))
2403 (defmacro gnus-summary-article-mark (&optional number)
2404 "Return the mark of article NUMBER."
2405 `(gnus-data-mark (gnus-data-find
2406 ,(or number '(gnus-summary-article-number)))))
2408 (defmacro gnus-summary-article-pos (&optional number)
2409 "Return the position of the line of article NUMBER."
2410 `(gnus-data-pos (gnus-data-find
2411 ,(or number '(gnus-summary-article-number)))))
2413 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2414 (defmacro gnus-summary-article-subject (&optional number)
2415 "Return current subject string or nil if nothing."
2418 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2419 '(gnus-data-header (assq (gnus-summary-article-number)
2420 gnus-newsgroup-data)))))
2423 (mail-header-subject headers))))
2425 (defmacro gnus-summary-article-score (&optional number)
2426 "Return current article score."
2427 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2428 gnus-newsgroup-scored))
2429 gnus-summary-default-score 0))
2431 (defun gnus-summary-article-children (&optional number)
2432 "Return a list of article numbers that are children of article NUMBER."
2433 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2434 (level (gnus-data-level (car data)))
2436 (while (and (setq data (cdr data))
2437 (> (setq l (gnus-data-level (car data))) level))
2438 (and (= (1+ level) l)
2439 (push (gnus-data-number (car data))
2441 (nreverse children)))
2443 (defun gnus-summary-article-parent (&optional number)
2444 "Return the article number of the parent of article NUMBER."
2445 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2446 (gnus-data-list t)))
2447 (level (gnus-data-level (car data))))
2449 () ; This is a root.
2450 ;; We search until we find an article with a level less than
2451 ;; this one. That function has to be the parent.
2452 (while (and (setq data (cdr data))
2453 (not (< (gnus-data-level (car data)) level))))
2454 (and data (gnus-data-number (car data))))))
2456 (defun gnus-unread-mark-p (mark)
2457 "Say whether MARK is the unread mark."
2458 (= mark gnus-unread-mark))
2460 (defun gnus-read-mark-p (mark)
2461 "Say whether MARK is one of the marks that mark as read.
2462 This is all marks except unread, ticked, dormant, and expirable."
2463 (not (or (= mark gnus-unread-mark)
2464 (= mark gnus-ticked-mark)
2465 (= mark gnus-dormant-mark)
2466 (= mark gnus-expirable-mark))))
2468 (defmacro gnus-article-mark (number)
2469 "Return the MARK of article NUMBER.
2470 This macro should only be used when computing the mark the \"first\"
2471 time; i.e., when generating the summary lines. After that,
2472 `gnus-summary-article-mark' should be used to examine the
2475 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2476 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2477 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2478 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2479 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2480 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2481 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2482 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2483 gnus-ancient-mark))))
2485 ;; Saving hidden threads.
2487 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2488 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2490 (defmacro gnus-save-hidden-threads (&rest forms)
2491 "Save hidden threads, eval FORMS, and restore the hidden threads."
2492 (let ((config (make-symbol "config")))
2493 `(let ((,config (gnus-hidden-threads-configuration)))
2497 (gnus-restore-hidden-threads-configuration ,config)))))
2499 (defun gnus-data-compute-positions ()
2500 "Compute the positions of all articles."
2501 (setq gnus-newsgroup-data-reverse nil)
2502 (let ((data gnus-newsgroup-data))
2504 (gnus-save-hidden-threads
2505 (gnus-summary-show-all-threads)
2506 (goto-char (point-min))
2508 (while (get-text-property (point) 'gnus-intangible)
2510 (gnus-data-set-pos (car data) (+ (point) 3))
2511 (setq data (cdr data))
2512 (forward-line 1))))))
2514 (defun gnus-hidden-threads-configuration ()
2515 "Return the current hidden threads configuration."
2518 (goto-char (point-min))
2519 (while (search-forward "\r" nil t)
2520 (push (1- (point)) config))
2523 (defun gnus-restore-hidden-threads-configuration (config)
2524 "Restore hidden threads configuration from CONFIG."
2526 (let (point buffer-read-only)
2527 (while (setq point (pop config))
2528 (when (and (< point (point-max))
2530 (eq (char-after) ?\n))
2531 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2533 ;; Various summary mode internalish functions.
2535 (defun gnus-mouse-pick-article (e)
2538 (gnus-summary-next-page nil t))
2540 (defun gnus-summary-set-display-table ()
2541 "Change the display table.
2542 Odd characters have a tendency to mess
2543 up nicely formatted displays - we make all possible glyphs
2544 display only a single character."
2546 ;; We start from the standard display table, if any.
2547 (let ((table (or (copy-sequence standard-display-table)
2548 (make-display-table)))
2550 ;; Nix out all the control chars...
2551 (while (>= (setq i (1- i)) 0)
2552 (aset table i [??]))
2553 ;; ... but not newline and cr, of course. (cr is necessary for the
2554 ;; selective display).
2555 (aset table ?\n nil)
2556 (aset table ?\r nil)
2557 ;; We keep TAB as well.
2558 (aset table ?\t nil)
2559 ;; We nix out any glyphs over 126 that are not set already.
2561 (while (>= (setq i (1- i)) 127)
2562 ;; Only modify if the entry is nil.
2563 (unless (aref table i)
2564 (aset table i [??]))))
2565 (setq buffer-display-table table)))
2567 (defun gnus-summary-setup-buffer (group)
2568 "Initialize summary buffer."
2569 (let ((buffer (concat "*Summary " group "*")))
2570 (if (get-buffer buffer)
2573 (setq gnus-summary-buffer (current-buffer))
2574 (not gnus-newsgroup-prepared))
2575 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2576 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2577 (gnus-summary-mode group)
2579 (gnus-carpal-setup-buffer 'summary))
2580 (unless gnus-single-article-buffer
2581 (make-local-variable 'gnus-article-buffer)
2582 (make-local-variable 'gnus-article-current)
2583 (make-local-variable 'gnus-original-article-buffer))
2584 (setq gnus-newsgroup-name group)
2587 (defun gnus-set-global-variables ()
2588 "Set the global equivalents of the buffer-local variables.
2589 They are set to the latest values they had. These reflect the summary
2590 buffer that was in action when the last article was fetched."
2591 (when (eq major-mode 'gnus-summary-mode)
2592 (setq gnus-summary-buffer (current-buffer))
2593 (let ((name gnus-newsgroup-name)
2594 (marked gnus-newsgroup-marked)
2595 (unread gnus-newsgroup-unreads)
2596 (headers gnus-current-headers)
2597 (data gnus-newsgroup-data)
2598 (summary gnus-summary-buffer)
2599 (article-buffer gnus-article-buffer)
2600 (original gnus-original-article-buffer)
2601 (gac gnus-article-current)
2602 (reffed gnus-reffed-article-number)
2603 (score-file gnus-current-score-file)
2604 (default-charset gnus-newsgroup-charset))
2606 (set-buffer gnus-group-buffer)
2607 (setq gnus-newsgroup-name name
2608 gnus-newsgroup-marked marked
2609 gnus-newsgroup-unreads unread
2610 gnus-current-headers headers
2611 gnus-newsgroup-data data
2612 gnus-article-current gac
2613 gnus-summary-buffer summary
2614 gnus-article-buffer article-buffer
2615 gnus-original-article-buffer original
2616 gnus-reffed-article-number reffed
2617 gnus-current-score-file score-file
2618 gnus-newsgroup-charset default-charset)
2619 ;; The article buffer also has local variables.
2620 (when (gnus-buffer-live-p gnus-article-buffer)
2621 (set-buffer gnus-article-buffer)
2622 (setq gnus-summary-buffer summary))))))
2624 (defun gnus-summary-article-unread-p (article)
2625 "Say whether ARTICLE is unread or not."
2626 (memq article gnus-newsgroup-unreads))
2628 (defun gnus-summary-first-article-p (&optional article)
2629 "Return whether ARTICLE is the first article in the buffer."
2630 (if (not (setq article (or article (gnus-summary-article-number))))
2632 (eq article (caar gnus-newsgroup-data))))
2634 (defun gnus-summary-last-article-p (&optional article)
2635 "Return whether ARTICLE is the last article in the buffer."
2636 (if (not (setq article (or article (gnus-summary-article-number))))
2637 ;; All non-existent numbers are the last article. :-)
2639 (not (cdr (gnus-data-find-list article)))))
2641 (defun gnus-make-thread-indent-array ()
2643 (unless (and gnus-thread-indent-array
2644 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2645 (setq gnus-thread-indent-array (make-vector 201 "")
2646 gnus-thread-indent-array-level gnus-thread-indent-level)
2648 (aset gnus-thread-indent-array n
2649 (make-string (* n gnus-thread-indent-level) ? ))
2652 (defun gnus-update-summary-mark-positions ()
2653 "Compute where the summary marks are to go."
2655 (when (gnus-buffer-exists-p gnus-summary-buffer)
2656 (set-buffer gnus-summary-buffer))
2657 (let ((gnus-replied-mark 129)
2658 (gnus-score-below-mark 130)
2659 (gnus-score-over-mark 130)
2660 (gnus-download-mark 131)
2661 (spec gnus-summary-line-format-spec)
2664 (gnus-set-work-buffer)
2665 (let ((gnus-summary-line-format-spec spec)
2666 (gnus-newsgroup-downloadable '((0 . t))))
2667 (gnus-summary-insert-line
2668 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2669 (goto-char (point-min))
2670 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2672 (goto-char (point-min))
2673 (push (cons 'replied (and (search-forward "\201" nil t)
2676 (goto-char (point-min))
2677 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2679 (goto-char (point-min))
2680 (push (cons 'download
2681 (and (search-forward "\203" nil t) (- (point) 2)))
2683 (setq gnus-summary-mark-positions pos))))
2685 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2686 "Insert a dummy root in the summary buffer."
2688 (gnus-add-text-properties
2689 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2690 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2692 (defun gnus-summary-from-or-to-or-newsgroups (header)
2693 (let ((to (cdr (assq 'To (mail-header-extra header))))
2694 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2695 (mail-parse-charset gnus-newsgroup-charset)
2696 (mail-parse-ignored-charsets
2697 (save-excursion (set-buffer gnus-summary-buffer)
2698 gnus-newsgroup-ignored-charsets)))
2701 gnus-ignored-from-addresses
2702 (string-match gnus-ignored-from-addresses
2703 (mail-header-from header)))
2705 (or (car (funcall gnus-extract-address-components
2707 gnus-decode-encoded-word-function to)))
2708 (funcall gnus-decode-encoded-word-function to))))
2710 gnus-ignored-from-addresses
2711 (string-match gnus-ignored-from-addresses
2712 (mail-header-from header)))
2713 (concat "=> " newsgroups))
2715 (or (car (funcall gnus-extract-address-components
2716 (mail-header-from header)))
2717 (mail-header-from header))))))
2719 (defun gnus-summary-insert-line (gnus-tmp-header
2720 gnus-tmp-level gnus-tmp-current
2721 gnus-tmp-unread gnus-tmp-replied
2722 gnus-tmp-expirable gnus-tmp-subject-or-nil
2723 &optional gnus-tmp-dummy gnus-tmp-score
2725 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2726 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2727 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2728 (gnus-tmp-score-char
2729 (if (or (null gnus-summary-default-score)
2730 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2731 gnus-summary-zcore-fuzz))
2733 (if (< gnus-tmp-score gnus-summary-default-score)
2734 gnus-score-below-mark gnus-score-over-mark)))
2736 (cond (gnus-tmp-process gnus-process-mark)
2737 ((memq gnus-tmp-current gnus-newsgroup-cached)
2739 (gnus-tmp-replied gnus-replied-mark)
2740 ((memq gnus-tmp-current gnus-newsgroup-saved)
2742 (t gnus-unread-mark)))
2743 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2746 ((string-match "<[^>]+> *$" gnus-tmp-from)
2747 (let ((beg (match-beginning 0)))
2748 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2749 (substring gnus-tmp-from (1+ (match-beginning 0))
2750 (1- (match-end 0))))
2751 (substring gnus-tmp-from 0 beg))))
2752 ((string-match "(.+)" gnus-tmp-from)
2753 (substring gnus-tmp-from
2754 (1+ (match-beginning 0)) (1- (match-end 0))))
2756 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2757 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2758 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2759 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2760 (buffer-read-only nil))
2761 (when (string= gnus-tmp-name "")
2762 (setq gnus-tmp-name gnus-tmp-from))
2763 (unless (numberp gnus-tmp-lines)
2764 (setq gnus-tmp-lines 0))
2765 (gnus-put-text-property
2767 (progn (eval gnus-summary-line-format-spec) (point))
2768 'gnus-number gnus-tmp-number)
2769 (when (gnus-visual-p 'summary-highlight 'highlight)
2771 (gnus-run-hooks 'gnus-summary-update-hook)
2774 (defun gnus-summary-update-line (&optional dont-update)
2775 "Update summary line after change."
2776 (when (and gnus-summary-default-score
2777 (not gnus-summary-inhibit-highlight))
2778 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2779 (article (gnus-summary-article-number))
2780 (score (gnus-summary-article-score article)))
2782 (if (and gnus-summary-mark-below
2783 (< (gnus-summary-article-score)
2784 gnus-summary-mark-below))
2785 ;; This article has a low score, so we mark it as read.
2786 (when (memq article gnus-newsgroup-unreads)
2787 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2788 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2789 ;; This article was previously marked as read on account
2790 ;; of a low score, but now it has risen, so we mark it as
2792 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2793 (gnus-summary-update-mark
2794 (if (or (null gnus-summary-default-score)
2795 (<= (abs (- score gnus-summary-default-score))
2796 gnus-summary-zcore-fuzz))
2798 (if (< score gnus-summary-default-score)
2799 gnus-score-below-mark gnus-score-over-mark))
2801 ;; Do visual highlighting.
2802 (when (gnus-visual-p 'summary-highlight 'highlight)
2803 (gnus-run-hooks 'gnus-summary-update-hook)))))
2805 (defvar gnus-tmp-new-adopts nil)
2807 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2808 "Return the number of articles in THREAD.
2809 This may be 0 in some cases -- if none of the articles in
2810 the thread are to be displayed."
2812 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2814 ((not (listp thread))
2816 ((and (consp thread) (cdr thread))
2819 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2822 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2825 (when (and level (zerop level) gnus-tmp-new-adopts)
2828 'gnus-summary-number-of-articles-in-thread
2829 gnus-tmp-new-adopts))))
2831 (if (> number 1) gnus-not-empty-thread-mark
2832 gnus-empty-thread-mark)
2835 (defun gnus-summary-set-local-parameters (group)
2836 "Go through the local params of GROUP and set all variable specs in that list."
2837 (let ((params (gnus-group-find-parameter group))
2840 (setq elem (car params)
2841 params (cdr params))
2842 (and (consp elem) ; Has to be a cons.
2843 (consp (cdr elem)) ; The cdr has to be a list.
2844 (symbolp (car elem)) ; Has to be a symbol in there.
2845 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2846 (ignore-errors ; So we set it.
2847 (make-local-variable (car elem))
2848 (set (car elem) (eval (nth 1 elem))))))))
2850 (defun gnus-summary-read-group (group &optional show-all no-article
2851 kill-buffer no-display backward
2853 "Start reading news in newsgroup GROUP.
2854 If SHOW-ALL is non-nil, already read articles are also listed.
2855 If NO-ARTICLE is non-nil, no article is selected initially.
2856 If NO-DISPLAY, don't generate a summary buffer."
2860 (let ((gnus-auto-select-next nil))
2861 (or (gnus-summary-read-group-1
2862 group show-all no-article
2863 kill-buffer no-display
2866 select-articles nil)))))
2867 (eq gnus-auto-select-next 'quietly))
2868 (set-buffer gnus-group-buffer)
2869 ;; The entry function called above goes to the next
2870 ;; group automatically, so we go two groups back
2871 ;; if we are searching for the previous group.
2873 (gnus-group-prev-unread-group 2))
2874 (if (not (equal group (gnus-group-group-name)))
2875 (setq group (gnus-group-group-name))
2879 (defun gnus-summary-read-group-1 (group show-all no-article
2880 kill-buffer no-display
2881 &optional select-articles)
2882 ;; Killed foreign groups can't be entered.
2883 (when (and (not (gnus-group-native-p group))
2884 (not (gnus-gethash group gnus-newsrc-hashtb)))
2885 (error "Dead non-native groups can't be entered"))
2886 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2887 (let* ((new-group (gnus-summary-setup-buffer group))
2888 (quit-config (gnus-group-quit-config group))
2889 (did-select (and new-group (gnus-select-newsgroup
2890 group show-all select-articles))))
2892 ;; This summary buffer exists already, so we just select it.
2894 (gnus-set-global-variables)
2896 (gnus-kill-or-deaden-summary kill-buffer))
2897 (gnus-configure-windows 'summary 'force)
2898 (gnus-set-mode-line 'summary)
2899 (gnus-summary-position-point)
2902 ;; We couldn't select this group.
2904 (when (and (eq major-mode 'gnus-summary-mode)
2905 (not (equal (current-buffer) kill-buffer)))
2906 (kill-buffer (current-buffer))
2907 (if (not quit-config)
2909 ;; Update the info -- marks might need to be removed,
2911 (gnus-summary-update-info)
2912 (set-buffer gnus-group-buffer)
2913 (gnus-group-jump-to-group group)
2914 (gnus-group-next-unread-group 1))
2915 (gnus-handle-ephemeral-exit quit-config)))
2916 (gnus-message 3 "Can't select group")
2918 ;; The user did a `C-g' while prompting for number of articles,
2919 ;; so we exit this group.
2920 ((eq did-select 'quit)
2921 (and (eq major-mode 'gnus-summary-mode)
2922 (not (equal (current-buffer) kill-buffer))
2923 (kill-buffer (current-buffer)))
2925 (gnus-kill-or-deaden-summary kill-buffer))
2926 (if (not quit-config)
2928 (set-buffer gnus-group-buffer)
2929 (gnus-group-jump-to-group group)
2930 (gnus-group-next-unread-group 1)
2931 (gnus-configure-windows 'group 'force))
2932 (gnus-handle-ephemeral-exit quit-config))
2933 ;; Finally signal the quit.
2935 ;; The group was successfully selected.
2937 (gnus-set-global-variables)
2938 ;; Save the active value in effect when the group was entered.
2939 (setq gnus-newsgroup-active
2941 (gnus-active gnus-newsgroup-name)))
2942 ;; You can change the summary buffer in some way with this hook.
2943 (gnus-run-hooks 'gnus-select-group-hook)
2944 ;; Set any local variables in the group parameters.
2945 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2946 (gnus-update-format-specifications
2947 nil 'summary 'summary-mode 'summary-dummy)
2948 (gnus-update-summary-mark-positions)
2949 ;; Do score processing.
2950 (when gnus-use-scoring
2951 (gnus-possibly-score-headers))
2952 ;; Check whether to fill in the gaps in the threads.
2953 (when gnus-build-sparse-threads
2954 (gnus-build-sparse-threads))
2955 ;; Find the initial limit.
2956 (if gnus-show-threads
2958 (let ((gnus-newsgroup-dormant nil))
2959 (gnus-summary-initial-limit show-all))
2960 (gnus-summary-initial-limit show-all))
2961 ;; When untreaded, all articles are always shown.
2962 (setq gnus-newsgroup-limit
2964 (lambda (header) (mail-header-number header))
2965 gnus-newsgroup-headers)))
2966 ;; Generate the summary buffer.
2968 (gnus-summary-prepare))
2969 (when gnus-use-trees
2970 (gnus-tree-open group)
2971 (setq gnus-summary-highlight-line-function
2972 'gnus-tree-highlight-article))
2973 ;; If the summary buffer is empty, but there are some low-scored
2974 ;; articles or some excluded dormants, we include these in the
2976 (when (and (zerop (buffer-size))
2978 (cond (gnus-newsgroup-dormant
2979 (gnus-summary-limit-include-dormant))
2980 ((and gnus-newsgroup-scored show-all)
2981 (gnus-summary-limit-include-expunged t))))
2982 ;; Function `gnus-apply-kill-file' must be called in this hook.
2983 (gnus-run-hooks 'gnus-apply-kill-hook)
2984 (if (and (zerop (buffer-size))
2987 ;; This newsgroup is empty.
2988 (gnus-summary-catchup-and-exit nil t)
2989 (gnus-message 6 "No unread news")
2991 (gnus-kill-or-deaden-summary kill-buffer))
2992 ;; Return nil from this function.
2994 ;; Hide conversation thread subtrees. We cannot do this in
2995 ;; gnus-summary-prepare-hook since kill processing may not
2996 ;; work with hidden articles.
2997 (and gnus-show-threads
2998 gnus-thread-hide-subtree
2999 (gnus-summary-hide-all-threads))
3001 (gnus-kill-or-deaden-summary kill-buffer))
3002 ;; Show first unread article if requested.
3003 (if (and (not no-article)
3005 gnus-newsgroup-unreads
3006 gnus-auto-select-first)
3008 (gnus-configure-windows 'summary)
3010 ((eq gnus-auto-select-first 'best)
3011 (gnus-summary-best-unread-article))
3012 ((eq gnus-auto-select-first t)
3013 (gnus-summary-first-unread-article))
3014 ((gnus-functionp gnus-auto-select-first)
3015 (funcall gnus-auto-select-first))))
3016 ;; Don't select any articles, just move point to the first
3017 ;; article in the group.
3018 (goto-char (point-min))
3019 (gnus-summary-position-point)
3020 (gnus-configure-windows 'summary 'force)
3021 (gnus-set-mode-line 'summary))
3022 (when (get-buffer-window gnus-group-buffer t)
3023 ;; Gotta use windows, because recenter does weird stuff if
3024 ;; the current buffer ain't the displayed window.
3025 (let ((owin (selected-window)))
3026 (select-window (get-buffer-window gnus-group-buffer t))
3027 (when (gnus-group-goto-group group)
3029 (select-window owin)))
3030 ;; Mark this buffer as "prepared".
3031 (setq gnus-newsgroup-prepared t)
3032 (gnus-run-hooks 'gnus-summary-prepared-hook)
3035 (defun gnus-summary-prepare ()
3036 "Generate the summary buffer."
3038 (let ((buffer-read-only nil))
3040 (setq gnus-newsgroup-data nil
3041 gnus-newsgroup-data-reverse nil)
3042 (gnus-run-hooks 'gnus-summary-generate-hook)
3043 ;; Generate the buffer, either with threads or without.
3044 (when gnus-newsgroup-headers
3045 (gnus-summary-prepare-threads
3046 (if gnus-show-threads
3047 (gnus-sort-gathered-threads
3048 (funcall gnus-summary-thread-gathering-function
3050 (gnus-cut-threads (gnus-make-threads)))))
3051 ;; Unthreaded display.
3052 (gnus-sort-articles gnus-newsgroup-headers))))
3053 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3054 ;; Call hooks for modifying summary buffer.
3055 (goto-char (point-min))
3056 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3058 (defsubst gnus-general-simplify-subject (subject)
3059 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3062 ;; Truncate the subject.
3063 (gnus-simplify-subject-functions
3064 (gnus-map-function gnus-simplify-subject-functions subject))
3065 ((numberp gnus-summary-gather-subject-limit)
3066 (setq subject (gnus-simplify-subject-re subject))
3067 (if (> (length subject) gnus-summary-gather-subject-limit)
3068 (substring subject 0 gnus-summary-gather-subject-limit)
3070 ;; Fuzzily simplify it.
3071 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3072 (gnus-simplify-subject-fuzzy subject))
3073 ;; Just remove the leading "Re:".
3075 (gnus-simplify-subject-re subject))))
3077 (if (and gnus-summary-gather-exclude-subject
3078 (string-match gnus-summary-gather-exclude-subject subject))
3079 nil ; This article shouldn't be gathered
3082 (defun gnus-summary-simplify-subject-query ()
3083 "Query where the respool algorithm would put this article."
3085 (gnus-summary-select-article)
3086 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3088 (defun gnus-gather-threads-by-subject (threads)
3089 "Gather threads by looking at Subject headers."
3090 (if (not gnus-summary-make-false-root)
3092 (let ((hashtb (gnus-make-hashtable 1024))
3095 subject hthread whole-subject)
3097 (setq subject (gnus-general-simplify-subject
3098 (setq whole-subject (mail-header-subject
3101 (if (setq hthread (gnus-gethash subject hashtb))
3103 ;; We enter a dummy root into the thread, if we
3104 ;; haven't done that already.
3105 (unless (stringp (caar hthread))
3106 (setcar hthread (list whole-subject (car hthread))))
3107 ;; We add this new gathered thread to this gathered
3109 (setcdr (car hthread)
3110 (nconc (cdar hthread) (list (car threads))))
3111 ;; Remove it from the list of threads.
3112 (setcdr prev (cdr threads))
3113 (setq threads prev))
3114 ;; Enter this thread into the hash table.
3115 (gnus-sethash subject threads hashtb)))
3117 (setq threads (cdr threads)))
3120 (defun gnus-gather-threads-by-references (threads)
3121 "Gather threads by looking at References headers."
3122 (let ((idhashtb (gnus-make-hashtable 1024))
3123 (thhashtb (gnus-make-hashtable 1024))
3126 ids references id gthread gid entered ref)
3128 (when (setq references (mail-header-references (caar threads)))
3129 (setq id (mail-header-id (caar threads))
3130 ids (gnus-split-references references)
3132 (while (setq ref (pop ids))
3133 (setq ids (delete ref ids))
3134 (if (not (setq gid (gnus-gethash ref idhashtb)))
3136 (gnus-sethash ref id idhashtb)
3137 (gnus-sethash id threads thhashtb))
3138 (setq gthread (gnus-gethash gid thhashtb))
3140 ;; We enter a dummy root into the thread, if we
3141 ;; haven't done that already.
3142 (unless (stringp (caar gthread))
3143 (setcar gthread (list (mail-header-subject (caar gthread))
3145 ;; We add this new gathered thread to this gathered
3147 (setcdr (car gthread)
3148 (nconc (cdar gthread) (list (car threads)))))
3149 ;; Add it into the thread hash table.
3150 (gnus-sethash id gthread thhashtb)
3152 ;; Remove it from the list of threads.
3153 (setcdr prev (cdr threads))
3154 (setq threads prev))))
3156 (setq threads (cdr threads)))
3159 (defun gnus-sort-gathered-threads (threads)
3160 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3161 (let ((result threads))
3163 (when (stringp (caar threads))
3164 (setcdr (car threads)
3165 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3166 (setq threads (cdr threads)))
3169 (defun gnus-thread-loop-p (root thread)
3170 "Say whether ROOT is in THREAD."
3171 (let ((stack (list thread))
3174 (while (setq thread (pop stack))
3175 (setq th (cdr thread))
3177 (not (eq (caar th) root)))
3180 ;; We have found a loop.
3182 (setcdr thread (delq (car th) (cdr thread)))
3183 (if (boundp (setq ref-dep (intern "none"
3184 gnus-newsgroup-dependencies)))
3185 (setcdr (symbol-value ref-dep)
3186 (nconc (cdr (symbol-value ref-dep))
3188 (set ref-dep (list nil (car th))))
3191 ;; Push all the subthreads onto the stack.
3192 (push (cdr thread) stack)))
3195 (defun gnus-make-threads ()
3196 "Go through the dependency hashtb and find the roots. Return all threads."
3198 (while (catch 'infloop
3201 ;; Deal with self-referencing References loops.
3202 (when (and (car (symbol-value refs))
3209 (car (symbol-value refs)) thread))
3210 (cdr (symbol-value refs)))))))
3213 (unless (car (symbol-value refs))
3214 ;; These threads do not refer back to any other articles,
3215 ;; so they're roots.
3216 (setq threads (append (cdr (symbol-value refs)) threads))))
3217 gnus-newsgroup-dependencies)))
3220 ;; Build the thread tree.
3221 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3222 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3224 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3225 if it was already present.
3227 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3228 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3229 Message-IDs will be renamed be renamed to a unique Message-ID before
3232 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3233 (let* ((id (mail-header-id header))
3234 (id-dep (and id (intern id dependencies)))
3235 ref ref-dep ref-header)
3236 ;; Enter this `header' in the `dependencies' table.
3240 ;; The first two cases do the normal part: enter a new `header'
3241 ;; in the `dependencies' table.
3242 ((not (boundp id-dep))
3243 (set id-dep (list header)))
3244 ((null (car (symbol-value id-dep)))
3245 (setcar (symbol-value id-dep) header))
3247 ;; From here the `header' was already present in the
3248 ;; `dependencies' table.
3250 ;; Overrides an existing entry;
3251 ;; just set the header part of the entry.
3252 (setcar (symbol-value id-dep) header))
3254 ;; Renames the existing `header' to a unique Message-ID.
3255 ((not gnus-summary-ignore-duplicates)
3256 ;; An article with this Message-ID has already been seen.
3257 ;; We rename the Message-ID.
3258 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3260 (mail-header-set-id header id))
3262 ;; The last case ignores an existing entry, except it adds any
3263 ;; additional Xrefs (in case the two articles came from different
3265 ;; Also sets `header' to `nil' meaning that the `dependencies'
3266 ;; table was *not* modified.
3268 (mail-header-set-xref
3269 (car (symbol-value id-dep))
3270 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3272 (or (mail-header-xref header) "")))
3276 ;; First check if that we are not creating a References loop.
3277 (setq ref (gnus-parent-id (mail-header-references header)))
3279 (setq ref-dep (intern-soft ref dependencies))
3281 (setq ref-header (car (symbol-value ref-dep))))
3282 (if (string= id ref)
3283 ;; Yuk! This is a reference loop. Make the article be a
3286 (mail-header-set-references (car (symbol-value id-dep)) "none")
3288 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3289 (setq ref (gnus-parent-id (mail-header-references header)))
3290 (setq ref-dep (intern (or ref "none") dependencies))
3291 (if (boundp ref-dep)
3292 (setcdr (symbol-value ref-dep)
3293 (nconc (cdr (symbol-value ref-dep))
3294 (list (symbol-value id-dep))))
3295 (set ref-dep (list nil (symbol-value id-dep)))))
3298 (defun gnus-build-sparse-threads ()
3299 (let ((headers gnus-newsgroup-headers)
3300 (mail-parse-charset gnus-newsgroup-charset)
3301 (gnus-summary-ignore-duplicates t)
3302 header references generation relations
3303 subject child end new-child date)
3304 ;; First we create an alist of generations/relations, where
3305 ;; generations is how much we trust the relation, and the relation
3307 (gnus-message 7 "Making sparse threads...")
3309 (nnheader-set-temp-buffer " *gnus sparse threads*")
3310 (while (setq header (pop headers))
3311 (when (and (setq references (mail-header-references header))
3312 (not (string= references "")))
3314 (setq child (mail-header-id header)
3315 subject (mail-header-subject header)
3316 date (mail-header-date header)
3318 (while (search-backward ">" nil t)
3319 (setq end (1+ (point)))
3320 (when (search-backward "<" nil t)
3321 (setq new-child (buffer-substring (point) end))
3322 (push (list (incf generation)
3323 child (setq child new-child)
3327 (push (list (1+ generation) child nil subject) relations))
3329 (kill-buffer (current-buffer)))
3330 ;; Sort over trustworthiness.
3333 (when (gnus-dependencies-add-header
3334 (make-full-mail-header
3335 gnus-reffed-article-number
3336 (nth 3 relation) "" (or (nth 4 relation) "")
3338 (or (nth 2 relation) "") 0 0 "")
3339 gnus-newsgroup-dependencies nil)
3340 (push gnus-reffed-article-number gnus-newsgroup-limit)
3341 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3342 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3343 gnus-newsgroup-reads)
3344 (decf gnus-reffed-article-number)))
3345 (sort relations 'car-less-than-car))
3346 (gnus-message 7 "Making sparse threads...done")))
3348 (defun gnus-build-old-threads ()
3349 ;; Look at all the articles that refer back to old articles, and
3350 ;; fetch the headers for the articles that aren't there. This will
3351 ;; build complete threads - if the roots haven't been expired by the
3353 (let ((mail-parse-charset gnus-newsgroup-charset)
3357 (when (not (car (symbol-value refs)))
3358 (setq heads (cdr (symbol-value refs)))
3360 (if (memq (mail-header-number (caar heads))
3361 gnus-newsgroup-dormant)
3362 (setq heads (cdr heads))
3363 (setq id (symbol-name refs))
3364 (while (and (setq id (gnus-build-get-header id))
3365 (not (car (gnus-id-to-thread id)))))
3366 (setq heads nil)))))
3367 gnus-newsgroup-dependencies)))
3369 ;; This function has to be called with point after the article number
3370 ;; on the beginning of the line.
3371 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3372 (let ((eol (gnus-point-at-eol))
3373 (buffer (current-buffer))
3376 ;; overview: [num subject from date id refs chars lines misc]
3379 (narrow-to-region (point) eol)
3384 (make-full-mail-header
3386 (funcall gnus-decode-encoded-word-function
3387 (nnheader-nov-field)) ; subject
3388 (funcall gnus-decode-encoded-word-function
3389 (nnheader-nov-field)) ; from
3390 (nnheader-nov-field) ; date
3391 (nnheader-nov-read-message-id) ; id
3392 (nnheader-nov-field) ; refs
3393 (nnheader-nov-read-integer) ; chars
3394 (nnheader-nov-read-integer) ; lines
3396 (if (looking-at "Xref: ")
3397 (goto-char (match-end 0)))
3398 (nnheader-nov-field)) ; Xref
3399 (nnheader-nov-parse-extra)))) ; extra
3403 (when gnus-alter-header-function
3404 (funcall gnus-alter-header-function header))
3405 (gnus-dependencies-add-header header dependencies force-new)))
3407 (defun gnus-build-get-header (id)
3408 "Look through the buffer of NOV lines and find the header to ID.
3409 Enter this line into the dependencies hash table, and return
3410 the id of the parent article (if any)."
3411 (let ((deps gnus-newsgroup-dependencies)
3415 (set-buffer nntp-server-buffer)
3416 (let ((case-fold-search nil))
3417 (goto-char (point-min))
3418 (while (and (not found)
3419 (search-forward id nil t))
3421 (setq found (looking-at
3422 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3423 (regexp-quote id))))
3424 (or found (beginning-of-line 2)))
3428 (setq header (gnus-nov-parse-line
3429 (read (current-buffer)) deps))
3430 (gnus-parent-id (mail-header-references header))))))
3432 (let ((number (mail-header-number header)))
3433 (push number gnus-newsgroup-limit)
3434 (push header gnus-newsgroup-headers)
3435 (if (memq number gnus-newsgroup-unselected)
3437 (push number gnus-newsgroup-unreads)
3438 (setq gnus-newsgroup-unselected
3439 (delq number gnus-newsgroup-unselected)))
3440 (push number gnus-newsgroup-ancient)))))))
3442 (defun gnus-build-all-threads ()
3443 "Read all the headers."
3444 (let ((gnus-summary-ignore-duplicates t)
3445 (mail-parse-charset gnus-newsgroup-charset)
3446 (dependencies gnus-newsgroup-dependencies)
3449 (set-buffer nntp-server-buffer)
3450 (let ((case-fold-search nil))
3451 (goto-char (point-min))
3454 (setq article (read (current-buffer))
3455 header (gnus-nov-parse-line article dependencies)))
3458 (set-buffer gnus-summary-buffer)
3459 (push header gnus-newsgroup-headers)
3460 (if (memq (setq article (mail-header-number header))
3461 gnus-newsgroup-unselected)
3463 (push article gnus-newsgroup-unreads)
3464 (setq gnus-newsgroup-unselected
3465 (delq article gnus-newsgroup-unselected)))
3466 (push article gnus-newsgroup-ancient)))
3467 (forward-line 1)))))))
3469 (defun gnus-summary-update-article-line (article header)
3470 "Update the line for ARTICLE using HEADERS."
3471 (let* ((id (mail-header-id header))
3472 (thread (gnus-id-to-thread id)))
3474 (error "Article in no thread"))
3475 ;; Update the thread.
3476 (setcar thread header)
3477 (gnus-summary-goto-subject article)
3478 (let* ((datal (gnus-data-find-list article))
3480 (length (when (cdr datal)
3481 (- (gnus-data-pos data)
3482 (gnus-data-pos (cadr datal)))))
3483 (buffer-read-only nil)
3484 (level (gnus-summary-thread-level)))
3486 (gnus-summary-insert-line
3487 header level nil (gnus-article-mark article)
3488 (memq article gnus-newsgroup-replied)
3489 (memq article gnus-newsgroup-expirable)
3490 ;; Only insert the Subject string when it's different
3491 ;; from the previous Subject string.
3496 (mail-header-subject
3499 (gnus-data-find-list
3501 (gnus-data-list t)))))
3502 ;; Error on the side of excessive subjects.
3504 (mail-header-subject header)))
3506 (mail-header-subject header))
3507 nil (cdr (assq article gnus-newsgroup-scored))
3508 (memq article gnus-newsgroup-processable))
3510 (gnus-data-update-list
3511 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3513 (defun gnus-summary-update-article (article &optional iheader)
3514 "Update ARTICLE in the summary buffer."
3515 (set-buffer gnus-summary-buffer)
3516 (let* ((header (gnus-summary-article-header article))
3517 (id (mail-header-id header))
3518 (data (gnus-data-find article))
3519 (thread (gnus-id-to-thread id))
3520 (references (mail-header-references header))
3524 (when (and references
3525 (not (equal "" references)))
3528 (buffer-read-only nil)
3534 (delq thread parent)))
3535 (if (gnus-summary-insert-subject id header)
3536 ;; Set the (possibly) new article number in the data structure.
3537 (gnus-data-set-number data (gnus-id-to-article id))
3541 (defun gnus-rebuild-thread (id &optional line)
3542 "Rebuild the thread containing ID.
3543 If LINE, insert the rebuilt thread starting on line LINE."
3544 (let ((buffer-read-only nil)
3545 old-pos current thread data)
3546 (if (not gnus-show-threads)
3547 (setq thread (list (car (gnus-id-to-thread id))))
3548 ;; Get the thread this article is part of.
3549 (setq thread (gnus-remove-thread id)))
3550 (setq old-pos (gnus-point-at-bol))
3551 (setq current (save-excursion
3552 (and (zerop (forward-line -1))
3553 (gnus-summary-article-number))))
3554 ;; If this is a gathered thread, we have to go some re-gathering.
3555 (when (stringp (car thread))
3556 (let ((subject (car thread))
3558 (setq thread (cdr thread))
3560 (unless (memq (setq thr (gnus-id-to-thread
3562 (mail-header-id (caar thread)))))
3565 (setq thread (cdr thread)))
3566 ;; We now have all (unique) roots.
3567 (if (= (length roots) 1)
3568 ;; All the loose roots are now one solid root.
3569 (setq thread (car roots))
3570 (setq thread (cons subject (gnus-sort-threads roots))))))
3572 ;; We then insert this thread into the summary buffer.
3574 (goto-char (point-min))
3575 (forward-line (1- line)))
3576 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3577 (if gnus-show-threads
3578 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3579 (gnus-summary-prepare-unthreaded thread))
3580 (setq data (nreverse gnus-newsgroup-data))
3581 (setq threads gnus-newsgroup-threads))
3582 ;; We splice the new data into the data structure.
3583 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3584 ;;!!! then we want to insert at the beginning of the buffer.
3585 ;;!!! That happens to be true with Gnus now, but that may
3586 ;;!!! change in the future. Perhaps.
3587 (gnus-data-enter-list
3588 (if line nil current) data (- (point) old-pos))
3589 (setq gnus-newsgroup-threads
3590 (nconc threads gnus-newsgroup-threads))
3591 (gnus-data-compute-positions))))
3593 (defun gnus-number-to-header (number)
3594 "Return the header for article NUMBER."
3595 (let ((headers gnus-newsgroup-headers))
3597 (not (= number (mail-header-number (car headers)))))
3602 (defun gnus-parent-headers (in-headers &optional generation)
3603 "Return the headers of the GENERATIONeth parent of HEADERS."
3605 (setq generation 1))
3607 (headers in-headers)
3610 (not (zerop generation))
3611 (setq references (mail-header-references headers)))
3612 (setq headers (if (and references
3613 (setq parent (gnus-parent-id references)))
3614 (car (gnus-id-to-thread parent))
3617 (and (not (eq headers in-headers))
3620 (defun gnus-id-to-thread (id)
3621 "Return the (sub-)thread where ID appears."
3622 (gnus-gethash id gnus-newsgroup-dependencies))
3624 (defun gnus-id-to-article (id)
3625 "Return the article number of ID."
3626 (let ((thread (gnus-id-to-thread id)))
3629 (mail-header-number (car thread)))))
3631 (defun gnus-id-to-header (id)
3632 "Return the article headers of ID."
3633 (car (gnus-id-to-thread id)))
3635 (defun gnus-article-displayed-root-p (article)
3636 "Say whether ARTICLE is a root(ish) article."
3637 (let ((level (gnus-summary-thread-level article))
3638 (refs (mail-header-references (gnus-summary-article-header article)))
3644 ((null (gnus-parent-id refs)) t)
3646 (null (setq particle (gnus-id-to-article
3647 (gnus-parent-id refs))))
3648 (null (gnus-summary-thread-level particle)))))))
3650 (defun gnus-root-id (id)
3651 "Return the id of the root of the thread where ID appears."
3653 (while (and id (setq prev (car (gnus-id-to-thread id))))
3655 id (gnus-parent-id (mail-header-references prev))))
3658 (defun gnus-articles-in-thread (thread)
3659 "Return the list of articles in THREAD."
3660 (cons (mail-header-number (car thread))
3661 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3663 (defun gnus-remove-thread (id &optional dont-remove)
3664 "Remove the thread that has ID in it."
3665 (let (headers thread last-id)
3666 ;; First go up in this thread until we find the root.
3667 (setq last-id (gnus-root-id id)
3668 headers (message-flatten-list (gnus-id-to-thread last-id)))
3669 ;; We have now found the real root of this thread. It might have
3670 ;; been gathered into some loose thread, so we have to search
3671 ;; through the threads to find the thread we wanted.
3672 (let ((threads gnus-newsgroup-threads)
3675 (setq sub (car threads))
3676 (if (stringp (car sub))
3677 ;; This is a gathered thread, so we look at the roots
3678 ;; below it to find whether this article is in this
3681 (setq sub (cdr sub))
3683 (when (member (caar sub) headers)
3684 (setq thread (car threads)
3687 (setq sub (cdr sub))))
3688 ;; It's an ordinary thread, so we check it.
3689 (when (eq (car sub) (car headers))
3692 (setq threads (cdr threads)))
3693 ;; If this article is in no thread, then it's a root.
3696 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3697 (setq thread (gnus-id-to-thread last-id)))
3700 thread ; We return this thread.
3702 (if (stringp (car thread))
3704 ;; If we use dummy roots, then we have to remove the
3705 ;; dummy root as well.
3706 (when (eq gnus-summary-make-false-root 'dummy)
3707 ;; We go to the dummy root by going to
3708 ;; the first sub-"thread", and then one line up.
3709 (gnus-summary-goto-article
3710 (mail-header-number (caadr thread)))
3713 (gnus-data-compute-positions))
3714 (setq thread (cdr thread))
3716 (gnus-remove-thread-1 (car thread))
3717 (setq thread (cdr thread))))
3718 (gnus-remove-thread-1 thread))))))))
3720 (defun gnus-remove-thread-1 (thread)
3721 "Remove the thread THREAD recursively."
3722 (let ((number (mail-header-number (pop thread)))
3724 (setq thread (reverse thread))
3726 (gnus-remove-thread-1 (pop thread)))
3727 (when (setq d (gnus-data-find number))
3728 (goto-char (gnus-data-pos d))
3729 (gnus-summary-show-thread)
3732 (- (gnus-point-at-bol)
3734 (1+ (gnus-point-at-eol))
3735 (gnus-delete-line)))))))
3737 (defun gnus-sort-threads-1 (threads func)
3738 (sort (mapcar (lambda (thread)
3741 (gnus-sort-threads-1 (cdr thread) func))))
3744 (defun gnus-sort-threads (threads)
3746 (if (not gnus-thread-sort-functions)
3748 (gnus-message 8 "Sorting threads...")
3750 (gnus-sort-threads-1
3752 (gnus-make-sort-function gnus-thread-sort-functions))
3753 (gnus-message 8 "Sorting threads...done"))))
3755 (defun gnus-sort-articles (articles)
3757 (when gnus-article-sort-functions
3758 (gnus-message 7 "Sorting articles...")
3760 (setq gnus-newsgroup-headers
3761 (sort articles (gnus-make-sort-function
3762 gnus-article-sort-functions)))
3763 (gnus-message 7 "Sorting articles...done"))))
3765 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3766 (defmacro gnus-thread-header (thread)
3767 "Return header of first article in THREAD.
3768 Note that THREAD must never, ever be anything else than a variable -
3769 using some other form will lead to serious barfage."
3770 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3771 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3772 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
3775 (defsubst gnus-article-sort-by-number (h1 h2)
3776 "Sort articles by article number."
3777 (< (mail-header-number h1)
3778 (mail-header-number h2)))
3780 (defun gnus-thread-sort-by-number (h1 h2)
3781 "Sort threads by root article number."
3782 (gnus-article-sort-by-number
3783 (gnus-thread-header h1) (gnus-thread-header h2)))
3785 (defsubst gnus-article-sort-by-lines (h1 h2)
3786 "Sort articles by article Lines header."
3787 (< (mail-header-lines h1)
3788 (mail-header-lines h2)))
3790 (defun gnus-thread-sort-by-lines (h1 h2)
3791 "Sort threads by root article Lines header."
3792 (gnus-article-sort-by-lines
3793 (gnus-thread-header h1) (gnus-thread-header h2)))
3795 (defsubst gnus-article-sort-by-chars (h1 h2)
3796 "Sort articles by octet length."
3797 (< (mail-header-chars h1)
3798 (mail-header-chars h2)))
3800 (defun gnus-thread-sort-by-chars (h1 h2)
3801 "Sort threads by root article octet length."
3802 (gnus-article-sort-by-chars
3803 (gnus-thread-header h1) (gnus-thread-header h2)))
3805 (defsubst gnus-article-sort-by-author (h1 h2)
3806 "Sort articles by root author."
3808 (let ((extract (funcall
3809 gnus-extract-address-components
3810 (mail-header-from h1))))
3811 (or (car extract) (cadr extract) ""))
3812 (let ((extract (funcall
3813 gnus-extract-address-components
3814 (mail-header-from h2))))
3815 (or (car extract) (cadr extract) ""))))
3817 (defun gnus-thread-sort-by-author (h1 h2)
3818 "Sort threads by root author."
3819 (gnus-article-sort-by-author
3820 (gnus-thread-header h1) (gnus-thread-header h2)))
3822 (defsubst gnus-article-sort-by-subject (h1 h2)
3823 "Sort articles by root subject."
3825 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3826 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3828 (defun gnus-thread-sort-by-subject (h1 h2)
3829 "Sort threads by root subject."
3830 (gnus-article-sort-by-subject
3831 (gnus-thread-header h1) (gnus-thread-header h2)))
3833 (defsubst gnus-article-sort-by-date (h1 h2)
3834 "Sort articles by root article date."
3836 (gnus-date-get-time (mail-header-date h1))
3837 (gnus-date-get-time (mail-header-date h2))))
3839 (defun gnus-thread-sort-by-date (h1 h2)
3840 "Sort threads by root article date."
3841 (gnus-article-sort-by-date
3842 (gnus-thread-header h1) (gnus-thread-header h2)))
3844 (defsubst gnus-article-sort-by-score (h1 h2)
3845 "Sort articles by root article score.
3846 Unscored articles will be counted as having a score of zero."
3847 (> (or (cdr (assq (mail-header-number h1)
3848 gnus-newsgroup-scored))
3849 gnus-summary-default-score 0)
3850 (or (cdr (assq (mail-header-number h2)
3851 gnus-newsgroup-scored))
3852 gnus-summary-default-score 0)))
3854 (defun gnus-thread-sort-by-score (h1 h2)
3855 "Sort threads by root article score."
3856 (gnus-article-sort-by-score
3857 (gnus-thread-header h1) (gnus-thread-header h2)))
3859 (defun gnus-thread-sort-by-total-score (h1 h2)
3860 "Sort threads by the sum of all scores in the thread.
3861 Unscored articles will be counted as having a score of zero."
3862 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3864 (defun gnus-thread-total-score (thread)
3865 ;; This function find the total score of THREAD.
3866 (cond ((null thread)
3869 (if (stringp (car thread))
3870 (apply gnus-thread-score-function 0
3871 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3872 (gnus-thread-total-score-1 thread)))
3874 (gnus-thread-total-score-1 (list thread)))))
3876 (defun gnus-thread-total-score-1 (root)
3877 ;; This function find the total score of the thread below ROOT.
3878 (setq root (car root))
3879 (apply gnus-thread-score-function
3881 (mapcar 'gnus-thread-total-score
3882 (cdr (gnus-id-to-thread (mail-header-id root))))
3883 (when (> (mail-header-number root) 0)
3884 (list (or (cdr (assq (mail-header-number root)
3885 gnus-newsgroup-scored))
3886 gnus-summary-default-score 0))))
3887 (list gnus-summary-default-score)
3890 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3891 (defvar gnus-tmp-prev-subject nil)
3892 (defvar gnus-tmp-false-parent nil)
3893 (defvar gnus-tmp-root-expunged nil)
3894 (defvar gnus-tmp-dummy-line nil)
3896 (eval-when-compile (defvar gnus-tmp-header))
3897 (defun gnus-extra-header (type &optional header)
3898 "Return the extra header of TYPE."
3899 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3902 (defun gnus-summary-prepare-threads (threads)
3903 "Prepare summary buffer from THREADS and indentation LEVEL.
3904 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3905 or a straight list of headers."
3906 (gnus-message 7 "Generating summary...")
3908 (setq gnus-newsgroup-threads threads)
3911 (let ((gnus-tmp-level 0)
3912 (default-score (or gnus-summary-default-score 0))
3913 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3914 thread number subject stack state gnus-tmp-gathered beg-match
3915 new-roots gnus-tmp-new-adopts thread-end
3916 gnus-tmp-header gnus-tmp-unread
3917 gnus-tmp-replied gnus-tmp-subject-or-nil
3918 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3919 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3920 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3922 (setq gnus-tmp-prev-subject nil)
3924 (if (vectorp (car threads))
3925 ;; If this is a straight (sic) list of headers, then a
3926 ;; threaded summary display isn't required, so we just create
3927 ;; an unthreaded one.
3928 (gnus-summary-prepare-unthreaded threads)
3930 ;; Do the threaded display.
3932 (while (or threads stack gnus-tmp-new-adopts new-roots)
3934 (if (and (= gnus-tmp-level 0)
3937 (not gnus-tmp-false-parent)
3938 (or gnus-tmp-new-adopts new-roots))
3939 (if gnus-tmp-new-adopts
3940 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3941 thread (list (car gnus-tmp-new-adopts))
3942 gnus-tmp-header (caar thread)
3943 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3945 (setq thread (list (car new-roots))
3946 gnus-tmp-header (caar thread)
3947 new-roots (cdr new-roots))))
3950 ;; If there are some threads, we do them before the
3951 ;; threads on the stack.
3952 (setq thread threads
3953 gnus-tmp-header (caar thread))
3954 ;; There were no current threads, so we pop something off
3956 (setq state (car stack)
3957 gnus-tmp-level (car state)
3960 gnus-tmp-header (caar thread))))
3962 (setq gnus-tmp-false-parent nil)
3963 (setq gnus-tmp-root-expunged nil)
3964 (setq thread-end nil)
3966 (if (stringp gnus-tmp-header)
3967 ;; The header is a dummy root.
3969 ((eq gnus-summary-make-false-root 'adopt)
3970 ;; We let the first article adopt the rest.
3971 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3973 (setq gnus-tmp-gathered
3975 (lambda (h) (mail-header-number (car h)))
3978 (setq thread (cons (list (caar thread)
3981 (setq gnus-tmp-level -1
3982 gnus-tmp-false-parent t))
3983 ((eq gnus-summary-make-false-root 'empty)
3984 ;; We print adopted articles with empty subject fields.
3985 (setq gnus-tmp-gathered
3987 (lambda (h) (mail-header-number (car h)))
3990 (setq gnus-tmp-level -1))
3991 ((eq gnus-summary-make-false-root 'dummy)
3992 ;; We remember that we probably want to output a dummy
3994 (setq gnus-tmp-dummy-line gnus-tmp-header)
3995 (setq gnus-tmp-prev-subject gnus-tmp-header))
3997 ;; We do not make a root for the gathered
3998 ;; sub-threads at all.
3999 (setq gnus-tmp-level -1)))
4001 (setq number (mail-header-number gnus-tmp-header)
4002 subject (mail-header-subject gnus-tmp-header))
4005 ;; If the thread has changed subject, we might want to make
4006 ;; this subthread into a root.
4007 ((and (null gnus-thread-ignore-subject)
4008 (not (zerop gnus-tmp-level))
4009 gnus-tmp-prev-subject
4011 (gnus-subject-equal gnus-tmp-prev-subject subject))))
4012 (setq new-roots (nconc new-roots (list (car thread)))
4014 gnus-tmp-header nil))
4015 ;; If the article lies outside the current limit,
4016 ;; then we do not display it.
4017 ((not (memq number gnus-newsgroup-limit))
4018 (setq gnus-tmp-gathered
4020 (lambda (h) (mail-header-number (car h)))
4023 (setq gnus-tmp-new-adopts (if (cdar thread)
4024 (append gnus-tmp-new-adopts
4026 gnus-tmp-new-adopts)
4028 gnus-tmp-header nil)
4029 (when (zerop gnus-tmp-level)
4030 (setq gnus-tmp-root-expunged t)))
4031 ;; Perhaps this article is to be marked as read?
4032 ((and gnus-summary-mark-below
4033 (< (or (cdr (assq number gnus-newsgroup-scored))
4035 gnus-summary-mark-below)
4036 ;; Don't touch sparse articles.
4037 (not (gnus-summary-article-sparse-p number))
4038 (not (gnus-summary-article-ancient-p number)))
4039 (setq gnus-newsgroup-unreads
4040 (delq number gnus-newsgroup-unreads))
4041 (if gnus-newsgroup-auto-expire
4042 (push number gnus-newsgroup-expirable)
4043 (push (cons number gnus-low-score-mark)
4044 gnus-newsgroup-reads))))
4046 (when gnus-tmp-header
4047 ;; We may have an old dummy line to output before this
4049 (when (and gnus-tmp-dummy-line
4052 (mail-header-subject gnus-tmp-header)))
4053 (gnus-summary-insert-dummy-line
4054 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4055 (setq gnus-tmp-dummy-line nil))
4057 ;; Compute the mark.
4058 (setq gnus-tmp-unread (gnus-article-mark number))
4060 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4061 gnus-tmp-header gnus-tmp-level)
4062 gnus-newsgroup-data)
4064 ;; Actually insert the line.
4066 gnus-tmp-subject-or-nil
4068 ((and gnus-thread-ignore-subject
4069 gnus-tmp-prev-subject
4070 (not (inline (gnus-subject-equal
4071 gnus-tmp-prev-subject subject))))
4073 ((zerop gnus-tmp-level)
4074 (if (and (eq gnus-summary-make-false-root 'empty)
4075 (memq number gnus-tmp-gathered)
4076 gnus-tmp-prev-subject
4077 (inline (gnus-subject-equal
4078 gnus-tmp-prev-subject subject)))
4079 gnus-summary-same-subject
4081 (t gnus-summary-same-subject)))
4082 (if (and (eq gnus-summary-make-false-root 'adopt)
4083 (= gnus-tmp-level 1)
4084 (memq number gnus-tmp-gathered))
4085 (setq gnus-tmp-opening-bracket ?\<
4086 gnus-tmp-closing-bracket ?\>)
4087 (setq gnus-tmp-opening-bracket ?\[
4088 gnus-tmp-closing-bracket ?\]))
4090 gnus-tmp-indentation
4091 (aref gnus-thread-indent-array gnus-tmp-level)
4092 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4093 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4094 gnus-summary-default-score 0)
4096 (if (or (null gnus-summary-default-score)
4097 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4098 gnus-summary-zcore-fuzz))
4100 (if (< gnus-tmp-score gnus-summary-default-score)
4101 gnus-score-below-mark gnus-score-over-mark))
4103 (cond ((memq number gnus-newsgroup-processable)
4105 ((memq number gnus-newsgroup-cached)
4107 ((memq number gnus-newsgroup-replied)
4109 ((memq number gnus-newsgroup-saved)
4111 (t gnus-unread-mark))
4112 gnus-tmp-from (mail-header-from gnus-tmp-header)
4115 ((string-match "<[^>]+> *$" gnus-tmp-from)
4116 (setq beg-match (match-beginning 0))
4117 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
4118 (substring gnus-tmp-from (1+ (match-beginning 0))
4119 (1- (match-end 0))))
4120 (substring gnus-tmp-from 0 beg-match)))
4121 ((string-match "(.+)" gnus-tmp-from)
4122 (substring gnus-tmp-from
4123 (1+ (match-beginning 0)) (1- (match-end 0))))
4125 (when (string= gnus-tmp-name "")
4126 (setq gnus-tmp-name gnus-tmp-from))
4127 (unless (numberp gnus-tmp-lines)
4128 (setq gnus-tmp-lines 0))
4129 (gnus-put-text-property
4131 (progn (eval gnus-summary-line-format-spec) (point))
4132 'gnus-number number)
4135 (gnus-run-hooks 'gnus-summary-update-hook)
4138 (setq gnus-tmp-prev-subject subject)))
4140 (when (nth 1 thread)
4141 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4142 (incf gnus-tmp-level)
4143 (setq threads (if thread-end nil (cdar thread)))
4145 (setq gnus-tmp-level 0)))))
4146 (gnus-message 7 "Generating summary...done"))
4148 (defun gnus-summary-prepare-unthreaded (headers)
4149 "Generate an unthreaded summary buffer based on HEADERS."
4150 (let (header number mark)
4155 ;; We may have to root out some bad articles...
4156 (when (memq (setq number (mail-header-number
4157 (setq header (pop headers))))
4158 gnus-newsgroup-limit)
4159 ;; Mark article as read when it has a low score.
4160 (when (and gnus-summary-mark-below
4161 (< (or (cdr (assq number gnus-newsgroup-scored))
4162 gnus-summary-default-score 0)
4163 gnus-summary-mark-below)
4164 (not (gnus-summary-article-ancient-p number)))
4165 (setq gnus-newsgroup-unreads
4166 (delq number gnus-newsgroup-unreads))
4167 (if gnus-newsgroup-auto-expire
4168 (push number gnus-newsgroup-expirable)
4169 (push (cons number gnus-low-score-mark)
4170 gnus-newsgroup-reads)))
4172 (setq mark (gnus-article-mark number))
4173 (push (gnus-data-make number mark (1+ (point)) header 0)
4174 gnus-newsgroup-data)
4175 (gnus-summary-insert-line
4177 mark (memq number gnus-newsgroup-replied)
4178 (memq number gnus-newsgroup-expirable)
4179 (mail-header-subject header) nil
4180 (cdr (assq number gnus-newsgroup-scored))
4181 (memq number gnus-newsgroup-processable))))))
4183 (defun gnus-summary-remove-list-identifiers ()
4184 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4185 (let ((regexp (if (stringp gnus-list-identifiers)
4186 gnus-list-identifiers
4187 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4188 (dolist (header gnus-newsgroup-headers)
4189 (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
4190 " *\\)\\)+\\(Re: +\\)?\\)")
4191 (mail-header-subject header))
4192 (mail-header-set-subject
4193 header (concat (substring (mail-header-subject header)
4194 0 (match-beginning 1))
4196 (match-string 3 (mail-header-subject header))
4197 (match-string 5 (mail-header-subject header)))
4198 (substring (mail-header-subject header)
4199 (match-end 1))))))))
4201 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4202 "Select newsgroup GROUP.
4203 If READ-ALL is non-nil, all articles in the group are selected.
4204 If SELECT-ARTICLES, only select those articles from GROUP."
4205 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4206 ;;!!! Dirty hack; should be removed.
4207 (gnus-summary-ignore-duplicates
4208 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4210 gnus-summary-ignore-duplicates))
4211 (info (nth 2 entry))
4212 articles fetched-articles cached)
4214 (unless (gnus-check-server
4215 (setq gnus-current-select-method
4216 (gnus-find-method-for-group group)))
4217 (error "Couldn't open server"))
4219 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4220 (gnus-activate-group group) ; Or we can activate it...
4221 (progn ; Or we bug out.
4222 (when (equal major-mode 'gnus-summary-mode)
4223 (kill-buffer (current-buffer)))
4224 (error "Couldn't request group %s: %s"
4225 group (gnus-status-message group))))
4227 (unless (gnus-request-group group t)
4228 (when (equal major-mode 'gnus-summary-mode)
4229 (kill-buffer (current-buffer)))
4230 (error "Couldn't request group %s: %s"
4231 group (gnus-status-message group)))
4233 (setq gnus-newsgroup-name group)
4234 (setq gnus-newsgroup-unselected nil)
4235 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4236 (gnus-summary-setup-default-charset)
4238 ;; Adjust and set lists of article marks.
4240 (gnus-adjust-marked-articles info))
4242 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4243 (when (gnus-virtual-group-p group)
4244 (setq cached gnus-newsgroup-cached))
4246 (setq gnus-newsgroup-unreads
4247 (gnus-set-difference
4248 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4249 gnus-newsgroup-dormant))
4251 (setq gnus-newsgroup-processable nil)
4253 (gnus-update-read-articles group gnus-newsgroup-unreads)
4255 (if (setq articles select-articles)
4256 (setq gnus-newsgroup-unselected
4257 (gnus-sorted-intersection
4258 gnus-newsgroup-unreads
4259 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4260 (setq articles (gnus-articles-to-read group read-all)))
4264 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4266 ((eq articles 0) nil)
4268 ;; Init the dependencies hash table.
4269 (setq gnus-newsgroup-dependencies
4270 (gnus-make-hashtable (length articles)))
4271 (gnus-set-global-variables)
4272 ;; Retrieve the headers and read them in.
4273 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4274 (setq gnus-newsgroup-headers
4276 (setq gnus-headers-retrieved-by
4277 (gnus-retrieve-headers
4278 articles gnus-newsgroup-name
4279 ;; We might want to fetch old headers, but
4280 ;; not if there is only 1 article.
4282 (not (eq gnus-fetch-old-headers 'some))
4283 (not (numberp gnus-fetch-old-headers)))
4284 (> (length articles) 1))
4285 gnus-fetch-old-headers))))
4286 (gnus-get-newsgroup-headers-xover
4287 articles nil nil gnus-newsgroup-name t)
4288 (gnus-get-newsgroup-headers)))
4289 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4291 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4293 (setq gnus-newsgroup-cached cached))
4295 ;; Suppress duplicates?
4296 (when gnus-suppress-duplicates
4297 (gnus-dup-suppress-articles))
4299 ;; Set the initial limit.
4300 (setq gnus-newsgroup-limit (copy-sequence articles))
4301 ;; Remove canceled articles from the list of unread articles.
4302 (setq gnus-newsgroup-unreads
4303 (gnus-set-sorted-intersection
4304 gnus-newsgroup-unreads
4305 (setq fetched-articles
4306 (mapcar (lambda (headers) (mail-header-number headers))
4307 gnus-newsgroup-headers))))
4308 ;; Removed marked articles that do not exist.
4309 (gnus-update-missing-marks
4310 (gnus-sorted-complement fetched-articles articles))
4311 ;; We might want to build some more threads first.
4312 (when (and gnus-fetch-old-headers
4313 (eq gnus-headers-retrieved-by 'nov))
4314 (if (eq gnus-fetch-old-headers 'invisible)
4315 (gnus-build-all-threads)
4316 (gnus-build-old-threads)))
4317 ;; Let the Gnus agent mark articles as read.
4319 (gnus-agent-get-undownloaded-list))
4320 ;; Remove list identifiers from subject
4321 (when gnus-list-identifiers
4322 (gnus-summary-remove-list-identifiers))
4323 ;; Check whether auto-expire is to be done in this group.
4324 (setq gnus-newsgroup-auto-expire
4325 (gnus-group-auto-expirable-p group))
4326 ;; Set up the article buffer now, if necessary.
4327 (unless gnus-single-article-buffer
4328 (gnus-article-setup-buffer))
4329 ;; First and last article in this newsgroup.
4330 (when gnus-newsgroup-headers
4331 (setq gnus-newsgroup-begin
4332 (mail-header-number (car gnus-newsgroup-headers))
4335 (gnus-last-element gnus-newsgroup-headers))))
4336 ;; GROUP is successfully selected.
4337 (or gnus-newsgroup-headers t)))))
4339 (defun gnus-articles-to-read (group &optional read-all)
4340 "Find out what articles the user wants to read."
4342 ;; Select all articles if `read-all' is non-nil, or if there
4343 ;; are no unread articles.
4345 (and (zerop (length gnus-newsgroup-marked))
4346 (zerop (length gnus-newsgroup-unreads)))
4347 (eq (gnus-group-find-parameter group 'display)
4350 (gnus-uncompress-range (gnus-active group))
4351 (gnus-cache-articles-in-group group))
4352 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4353 (copy-sequence gnus-newsgroup-unreads))
4355 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4356 (scored (length scored-list))
4357 (number (length articles))
4358 (marked (+ (length gnus-newsgroup-marked)
4359 (length gnus-newsgroup-dormant)))
4367 ((and (or (<= scored marked) (= scored number))
4368 (numberp gnus-large-newsgroup)
4369 (> number gnus-large-newsgroup))
4373 "How many articles from %s (default %d): "
4374 (gnus-limit-string gnus-newsgroup-name 35)
4376 (if (string-match "^[ \t]*$" input) number input)))
4377 ((and (> scored marked) (< scored number)
4378 (> (- scored number) 20))
4381 (format "%s %s (%d scored, %d total): "
4382 "How many articles from"
4383 group scored number))))
4384 (if (string-match "^[ \t]*$" input)
4388 (message "Quit getting the articles to read")
4390 (setq select (if (stringp select) (string-to-number select) select))
4391 (if (or (null select) (zerop select))
4393 (if (and (not (zerop scored)) (<= (abs select) scored))
4395 (setq articles (sort scored-list '<))
4396 (setq number (length articles)))
4397 (setq articles (copy-sequence articles)))
4399 (when (< (abs select) number)
4401 ;; Select the N oldest articles.
4402 (setcdr (nthcdr (1- (abs select)) articles) nil)
4403 ;; Select the N most recent articles.
4404 (setq articles (nthcdr (- number select) articles))))
4405 (setq gnus-newsgroup-unselected
4406 (gnus-sorted-intersection
4407 gnus-newsgroup-unreads
4408 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4409 (when gnus-alter-articles-to-read-function
4410 (setq gnus-newsgroup-unreads
4412 (funcall gnus-alter-articles-to-read-function
4413 gnus-newsgroup-name gnus-newsgroup-unreads)
4417 (defun gnus-killed-articles (killed articles)
4420 (when (inline (gnus-member-of-range (car articles) killed))
4421 (push (car articles) out))
4422 (setq articles (cdr articles)))
4425 (defun gnus-uncompress-marks (marks)
4426 "Uncompress the mark ranges in MARKS."
4427 (let ((uncompressed '(score bookmark))
4430 (if (memq (caar marks) uncompressed)
4431 (push (car marks) out)
4432 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4433 (setq marks (cdr marks)))
4436 (defun gnus-adjust-marked-articles (info)
4437 "Set all article lists and remove all marks that are no longer valid."
4438 (let* ((marked-lists (gnus-info-marks info))
4439 (active (gnus-active (gnus-info-group info)))
4442 (types gnus-article-mark-lists)
4443 (uncompressed '(score bookmark killed))
4444 marks var articles article mark)
4447 (setq marks (pop marked-lists))
4448 (set (setq var (intern (format "gnus-newsgroup-%s"
4449 (car (rassq (setq mark (car marks))
4451 (if (memq (car marks) uncompressed) (cdr marks)
4452 (gnus-uncompress-range (cdr marks))))
4454 (setq articles (symbol-value var))
4456 ;; All articles have to be subsets of the active articles.
4458 ;; Adjust "simple" lists.
4459 ((memq mark '(tick dormant expire reply save))
4461 (when (or (< (setq article (pop articles)) min) (> article max))
4462 (set var (delq article (symbol-value var))))))
4464 ((memq mark uncompressed)
4465 (when (not (listp (cdr (symbol-value var))))
4466 (set var (list (symbol-value var))))
4467 (when (not (listp (cdr articles)))
4468 (setq articles (list articles)))
4470 (when (or (not (consp (setq article (pop articles))))
4471 (< (car article) min)
4472 (> (car article) max))
4473 (set var (delq article (symbol-value var))))))))))
4475 (defun gnus-update-missing-marks (missing)
4476 "Go through the list of MISSING articles and remove them from the mark lists."
4478 (let ((types gnus-article-mark-lists)
4480 ;; Go through all types.
4482 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4483 (when (symbol-value var)
4484 ;; This list has articles. So we delete all missing articles
4488 (set var (delq (pop m) (symbol-value var)))))))))
4490 (defun gnus-update-marks ()
4491 "Enter the various lists of marked articles into the newsgroup info list."
4492 (let ((types gnus-article-mark-lists)
4493 (info (gnus-get-info gnus-newsgroup-name))
4494 (uncompressed '(score bookmark killed))
4495 type list newmarked symbol delta-marks)
4497 ;; Add all marks lists to the list of marks lists.
4498 (while (setq type (pop types))
4499 (setq list (symbol-value
4501 (intern (format "gnus-newsgroup-%s"
4505 ;; Get rid of the entries of the articles that have the
4507 (when (and (eq (cdr type) 'score)
4511 (prev (cons nil list))
4514 (if (or (not (consp (car arts)))
4515 (= (cdar arts) gnus-summary-default-score))
4516 (setcdr prev (cdr arts))
4518 (setq arts (cdr arts)))
4519 (setq list (cdr all)))))
4521 (unless (memq (cdr type) uncompressed)
4522 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4524 (when (gnus-check-backend-function
4525 'request-set-mark gnus-newsgroup-name)
4526 ;; propagate flags to server, with the following exceptions:
4527 ;; uncompressed:s are not proper flags (they are cons cells)
4528 ;; cache is a internal gnus flag
4529 ;; download are local to one gnus installation (well)
4530 ;; unsend are for nndraft groups only
4531 ;; xxx: generality of this? this suits nnimap anyway
4532 (unless (memq (cdr type) (append '(cache download unsend)
4534 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4535 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4536 (add (gnus-remove-from-range
4537 (gnus-copy-sequence list) old)))
4539 (push (list add 'add (list (cdr type))) delta-marks))
4541 (push (list del 'del (list (cdr type))) delta-marks)))))
4544 (push (cons (cdr type) list) newmarked)))
4547 (unless (gnus-check-group gnus-newsgroup-name)
4548 (error "Can't open server for %s" gnus-newsgroup-name))
4549 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4551 ;; Enter these new marks into the info of the group.
4553 (setcar (nthcdr 3 info) newmarked)
4554 ;; Add the marks lists to the end of the info.
4556 (setcdr (nthcdr 2 info) (list newmarked))))
4558 ;; Cut off the end of the info if there's nothing else there.
4562 (when (nthcdr (decf i) info)
4563 (setcdr (nthcdr i info) nil)))))))
4565 (defun gnus-set-mode-line (where)
4566 "Set the mode line of the article or summary buffers.
4567 If WHERE is `summary', the summary mode line format will be used."
4568 ;; Is this mode line one we keep updated?
4569 (when (and (memq where gnus-updated-mode-lines)
4571 (intern (format "gnus-%s-mode-line-format-spec" where))))
4574 ;; We evaluate this in the summary buffer since these
4575 ;; variables are buffer-local to that buffer.
4576 (set-buffer gnus-summary-buffer)
4577 ;; We bind all these variables that are used in the `eval' form
4579 (let* ((mformat (symbol-value
4581 (format "gnus-%s-mode-line-format-spec" where))))
4582 (gnus-tmp-group-name (gnus-group-name-decode
4584 (gnus-group-name-charset
4586 gnus-newsgroup-name)))
4587 (gnus-tmp-article-number (or gnus-current-article 0))
4588 (gnus-tmp-unread gnus-newsgroup-unreads)
4589 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4590 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4591 (gnus-tmp-unread-and-unselected
4592 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4593 (zerop gnus-tmp-unselected))
4595 ((zerop gnus-tmp-unselected)
4596 (format "{%d more}" gnus-tmp-unread-and-unticked))
4597 (t (format "{%d(+%d) more}"
4598 gnus-tmp-unread-and-unticked
4599 gnus-tmp-unselected))))
4601 (if (and gnus-current-headers
4602 (vectorp gnus-current-headers))
4603 (gnus-mode-string-quote
4604 (mail-header-subject gnus-current-headers))
4606 bufname-length max-len
4607 gnus-tmp-header);; passed as argument to any user-format-funcs
4608 (setq mode-string (eval mformat))
4609 (setq bufname-length (if (string-match "%b" mode-string)
4612 (if (eq where 'summary)
4614 (get-buffer gnus-article-buffer))))
4617 (setq max-len (max 4 (if gnus-mode-non-string-length
4619 gnus-mode-non-string-length
4621 (length mode-string))))
4622 ;; We might have to chop a bit of the string off...
4623 (when (> (length mode-string) max-len)
4625 (concat (truncate-string-to-width mode-string (- max-len 3))
4627 ;; Pad the mode string a bit.
4628 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4629 ;; Update the mode line.
4630 (setq mode-line-buffer-identification
4631 (gnus-mode-line-buffer-identification (list mode-string)))
4632 (set-buffer-modified-p t))))
4634 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4635 "Go through the HEADERS list and add all Xrefs to a hash table.
4636 The resulting hash table is returned, or nil if no Xrefs were found."
4637 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4638 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4639 (xref-hashtb (gnus-make-hashtable))
4640 start group entry number xrefs header)
4642 (setq header (pop headers))
4643 (when (and (setq xrefs (mail-header-xref header))
4644 (not (memq (setq number (mail-header-number header))
4647 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4648 (setq start (match-end 0))
4649 (setq group (if prefix
4650 (concat prefix (substring xrefs (match-beginning 1)
4652 (substring xrefs (match-beginning 1) (match-end 1))))
4654 (string-to-int (substring xrefs (match-beginning 2)
4656 (if (setq entry (gnus-gethash group xref-hashtb))
4657 (setcdr entry (cons number (cdr entry)))
4658 (gnus-sethash group (cons number nil) xref-hashtb)))))
4659 (and start xref-hashtb)))
4661 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4662 "Look through all the headers and mark the Xrefs as read."
4663 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4664 name entry info xref-hashtb idlist method nth4)
4666 (set-buffer gnus-group-buffer)
4667 (when (setq xref-hashtb
4668 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4671 (unless (string= from-newsgroup (setq name (symbol-name group)))
4672 (setq idlist (symbol-value group))
4673 ;; Dead groups are not updated.
4675 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4677 (when (stringp (setq nth4 (gnus-info-method info)))
4678 (setq nth4 (gnus-server-to-method nth4))))
4679 ;; Only do the xrefs if the group has the same
4680 ;; select method as the group we have just read.
4681 (or (gnus-methods-equal-p
4682 nth4 (gnus-find-method-for-group from-newsgroup))
4684 (equal nth4 (setq method (gnus-find-method-for-group
4686 (and (equal (car nth4) (car method))
4687 (equal (nth 1 nth4) (nth 1 method))))
4688 gnus-use-cross-reference
4689 (or (not (eq gnus-use-cross-reference t))
4691 ;; Only do cross-references on subscribed
4692 ;; groups, if that is what is wanted.
4693 (<= (gnus-info-level info) gnus-level-subscribed))
4694 (gnus-group-make-articles-read name idlist))))
4697 (defun gnus-compute-read-articles (group articles)
4698 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4699 (info (nth 2 entry))
4700 (active (gnus-active group))
4703 ;; First peel off all invalid article numbers.
4705 (let ((ids articles)
4707 (while (setq id (pop ids))
4708 (when (and first (> id (cdr active)))
4709 ;; We'll end up in this situation in one particular
4710 ;; obscure situation. If you re-scan a group and get
4711 ;; a new article that is cross-posted to a different
4712 ;; group that has not been re-scanned, you might get
4713 ;; crossposted article that has a higher number than
4714 ;; Gnus believes possible. So we re-activate this
4715 ;; group as well. This might mean doing the
4716 ;; crossposting thingy will *increase* the number
4717 ;; of articles in some groups. Tsk, tsk.
4718 (setq active (or (gnus-activate-group group) active)))
4719 (when (or (> id (cdr active))
4720 (< id (car active)))
4721 (setq articles (delq id articles))))))
4722 ;; If the read list is nil, we init it.
4724 (null (gnus-info-read info))
4726 (setq ninfo (cons 1 (1- (car active))))
4727 (setq ninfo (gnus-info-read info)))
4728 ;; Then we add the read articles to the range.
4730 ninfo (setq articles (sort articles '<))))))
4732 (defun gnus-group-make-articles-read (group articles)
4733 "Update the info of GROUP to say that ARTICLES are read."
4735 (entry (gnus-gethash group gnus-newsrc-hashtb))
4736 (info (nth 2 entry))
4737 (active (gnus-active group))
4740 (setq range (gnus-compute-read-articles group articles))
4742 (set-buffer gnus-group-buffer)
4745 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4746 (gnus-info-set-read ',info ',(gnus-info-read info))
4747 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4748 (gnus-group-update-group ,group t))))
4749 ;; Add the read articles to the range.
4750 (gnus-info-set-read info range)
4751 ;; Then we have to re-compute how many unread
4752 ;; articles there are in this group.
4756 (setq num (- (1+ (cdr active)) (car active))))
4757 ((not (listp (cdr range)))
4758 (setq num (- (cdr active) (- (1+ (cdr range))
4762 (if (numberp (car range))
4764 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4765 (setq range (cdr range)))
4766 (setq num (- (cdr active) num))))
4767 ;; Update the number of unread articles.
4769 ;; Update the group buffer.
4770 (gnus-group-update-group group t)))))
4772 (defvar gnus-newsgroup-none-id 0)
4774 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4775 (let ((cur nntp-server-buffer)
4778 (save-excursion (set-buffer gnus-summary-buffer)
4779 gnus-newsgroup-dependencies)))
4781 (mail-parse-charset gnus-newsgroup-charset)
4782 (mail-parse-ignored-charsets
4783 (save-excursion (condition-case nil
4784 (set-buffer gnus-summary-buffer)
4786 gnus-newsgroup-ignored-charsets)))
4788 (set-buffer nntp-server-buffer)
4789 ;; Translate all TAB characters into SPACE characters.
4790 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4791 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4792 (gnus-run-hooks 'gnus-parse-headers-hook)
4793 (let ((case-fold-search t)
4794 in-reply-to header p lines chars)
4795 (goto-char (point-min))
4796 ;; Search to the beginning of the next header. Error messages
4797 ;; do not begin with 2 or 3.
4798 (while (re-search-forward "^[23][0-9]+ " nil t)
4801 ;; This implementation of this function, with nine
4802 ;; search-forwards instead of the one re-search-forward and
4803 ;; a case (which basically was the old function) is actually
4804 ;; about twice as fast, even though it looks messier. You
4805 ;; can't have everything, I guess. Speed and elegance
4806 ;; doesn't always go hand in hand.
4815 (narrow-to-region (point)
4816 (or (and (search-forward "\n.\n" nil t)
4822 (if (search-forward "\nsubject: " nil t)
4823 (funcall gnus-decode-encoded-word-function
4824 (nnheader-header-value))
4829 (if (or (search-forward "\nfrom: " nil t)
4830 (search-forward "\nfrom:" nil t))
4831 (funcall gnus-decode-encoded-word-function
4832 (nnheader-header-value))
4837 (if (search-forward "\ndate: " nil t)
4838 (nnheader-header-value) ""))
4842 (setq id (if (re-search-forward
4843 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4844 ;; We do it this way to make sure the Message-ID
4845 ;; is (somewhat) syntactically valid.
4846 (buffer-substring (match-beginning 1)
4848 ;; If there was no message-id, we just fake one
4849 ;; to make subsequent routines simpler.
4850 (nnheader-generate-fake-message-id))))
4854 (if (search-forward "\nreferences: " nil t)
4858 (nnheader-header-value)
4863 (search-backward ">" end t)
4866 (search-backward "<" end t)
4868 ;; Get the references from the in-reply-to header if there
4869 ;; were no references and the in-reply-to header looks
4871 (if (and (search-forward "\nin-reply-to: " nil t)
4872 (setq in-reply-to (nnheader-header-value))
4873 (string-match "<[^>]+>" in-reply-to))
4875 (setq ref (substring in-reply-to (match-beginning 0)
4877 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4878 (setq ref2 (substring in-reply-to (match-beginning 0)
4880 (when (> (length ref2) (length ref))
4887 (if (search-forward "\nchars: " nil t)
4888 (if (numberp (setq chars (ignore-errors (read cur))))
4894 (if (search-forward "\nlines: " nil t)
4895 (if (numberp (setq lines (ignore-errors (read cur))))
4901 (and (search-forward "\nxref: " nil t)
4902 (nnheader-header-value)))
4904 (when gnus-extra-headers
4905 (let ((extra gnus-extra-headers)
4909 (when (search-forward
4910 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4911 (push (cons (car extra) (nnheader-header-value))
4915 (when (equal id ref)
4918 (when gnus-alter-header-function
4919 (funcall gnus-alter-header-function header)
4920 (setq id (mail-header-id header)
4921 ref (gnus-parent-id (mail-header-references header))))
4924 (gnus-dependencies-add-header
4925 header dependencies force-new))
4926 (push header headers))
4927 (goto-char (point-max))
4929 (nreverse headers)))))
4931 ;; Goes through the xover lines and returns a list of vectors
4932 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4933 force-new dependencies
4934 group also-fetch-heads)
4935 "Parse the news overview data in the server buffer.
4936 Return a list of headers that match SEQUENCE (see
4937 `nntp-retrieve-headers')."
4938 ;; Get the Xref when the users reads the articles since most/some
4939 ;; NNTP servers do not include Xrefs when using XOVER.
4940 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4941 (let ((mail-parse-charset gnus-newsgroup-charset)
4942 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4943 (cur nntp-server-buffer)
4944 (dependencies (or dependencies gnus-newsgroup-dependencies))
4945 number headers header)
4947 (set-buffer nntp-server-buffer)
4948 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4949 ;; Allow the user to mangle the headers before parsing them.
4950 (gnus-run-hooks 'gnus-parse-headers-hook)
4951 (goto-char (point-min))
4954 (while (and sequence (not (eobp)))
4955 (setq number (read cur))
4956 (while (and sequence
4957 (< (car sequence) number))
4958 (setq sequence (cdr sequence)))
4960 (eq number (car sequence))
4962 (setq sequence (cdr sequence))
4963 (setq header (inline
4964 (gnus-nov-parse-line
4965 number dependencies force-new))))
4966 (push header headers))
4969 (gnus-error 4 "Strange nov line (%d)"
4970 (count-lines (point-min) (point)))))
4972 ;; A common bug in inn is that if you have posted an article and
4973 ;; then retrieves the active file, it will answer correctly --
4974 ;; the new article is included. However, a NOV entry for the
4975 ;; article may not have been generated yet, so this may fail.
4976 ;; We work around this problem by retrieving the last few
4977 ;; headers using HEAD.
4978 (if (or (not also-fetch-heads)
4980 ;; We (probably) got all the headers.
4982 (let ((gnus-nov-is-evil t))
4985 (when (gnus-retrieve-headers sequence group)
4986 (gnus-get-newsgroup-headers))))))))
4988 (defun gnus-article-get-xrefs ()
4989 "Fill in the Xref value in `gnus-current-headers', if necessary.
4990 This is meant to be called in `gnus-article-internal-prepare-hook'."
4991 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4992 gnus-current-headers)))
4993 (or (not gnus-use-cross-reference)
4995 (and (mail-header-xref headers)
4996 (not (string= (mail-header-xref headers) "")))
4997 (let ((case-fold-search t)
5000 (nnheader-narrow-to-headers)
5001 (goto-char (point-min))
5002 (when (or (and (not (eobp))
5003 (eq (downcase (char-after)) ?x)
5004 (looking-at "Xref:"))
5005 (search-forward "\nXref:" nil t))
5006 (goto-char (1+ (match-end 0)))
5007 (setq xref (buffer-substring (point)
5008 (progn (end-of-line) (point))))
5009 (mail-header-set-xref headers xref)))))))
5011 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5012 "Find article ID and insert the summary line for that article.
5013 OLD-HEADER can either be a header or a line number to insert
5014 the subject line on."
5015 (let* ((line (and (numberp old-header) old-header))
5016 (old-header (and (vectorp old-header) old-header))
5017 (header (cond ((and old-header use-old-header)
5020 (gnus-number-to-header id))
5021 (gnus-number-to-header id))
5023 (gnus-read-header id))))
5024 (number (and (numberp id) id))
5027 ;; Rebuild the thread that this article is part of and go to the
5028 ;; article we have fetched.
5029 (when (and (not gnus-show-threads)
5032 (setq d (gnus-data-find (mail-header-number old-header))))
5033 (goto-char (gnus-data-pos d))
5036 (- (gnus-point-at-bol)
5038 (1+ (gnus-point-at-eol))
5039 (gnus-delete-line))))))
5041 (mail-header-set-number header (mail-header-number old-header)))
5042 (setq gnus-newsgroup-sparse
5043 (delq (setq number (mail-header-number header))
5044 gnus-newsgroup-sparse))
5045 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5046 (push number gnus-newsgroup-limit)
5047 (gnus-rebuild-thread (mail-header-id header) line)
5048 (gnus-summary-goto-subject number nil t))
5049 (when (and (numberp number)
5051 ;; We have to update the boundaries even if we can't fetch the
5052 ;; article if ID is a number -- so that the next `P' or `N'
5053 ;; command will fetch the previous (or next) article even
5054 ;; if the one we tried to fetch this time has been canceled.
5055 (when (> number gnus-newsgroup-end)
5056 (setq gnus-newsgroup-end number))
5057 (when (< number gnus-newsgroup-begin)
5058 (setq gnus-newsgroup-begin number))
5059 (setq gnus-newsgroup-unselected
5060 (delq number gnus-newsgroup-unselected)))
5061 ;; Report back a success?
5062 (and header (mail-header-number header))))
5064 ;;; Process/prefix in the summary buffer
5066 (defun gnus-summary-work-articles (n)
5067 "Return a list of articles to be worked upon.
5068 The prefix argument, the list of process marked articles, and the
5069 current article will be taken into consideration."
5071 (set-buffer gnus-summary-buffer)
5074 ;; A numerical prefix has been given.
5075 (setq n (prefix-numeric-value n))
5076 (let ((backward (< n 0))
5077 (n (abs (prefix-numeric-value n)))
5082 (push (setq article (gnus-summary-article-number))
5085 (gnus-summary-find-prev nil article)
5086 (gnus-summary-find-next nil article)))
5088 (nreverse articles)))
5089 ((and (gnus-region-active-p) (mark))
5090 (message "region active")
5091 ;; Work on the region between point and mark.
5092 (let ((max (max (point) (mark)))
5095 (goto-char (min (min (point) (mark))))
5098 (push (setq article (gnus-summary-article-number)) articles)
5099 (gnus-summary-find-next nil article)
5101 (nreverse articles))))
5102 (gnus-newsgroup-processable
5103 ;; There are process-marked articles present.
5104 ;; Save current state.
5105 (gnus-summary-save-process-mark)
5107 (reverse gnus-newsgroup-processable))
5109 ;; Just return the current article.
5110 (list (gnus-summary-article-number))))))
5112 (defmacro gnus-summary-iterate (arg &rest forms)
5113 "Iterate over the process/prefixed articles and do FORMS.
5114 ARG is the interactive prefix given to the command. FORMS will be
5115 executed with point over the summary line of the articles."
5116 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5117 `(let ((,articles (gnus-summary-work-articles ,arg)))
5119 (gnus-summary-goto-subject (car ,articles))
5123 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5124 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5126 (defun gnus-summary-save-process-mark ()
5127 "Push the current set of process marked articles on the stack."
5129 (push (copy-sequence gnus-newsgroup-processable)
5130 gnus-newsgroup-process-stack))
5132 (defun gnus-summary-kill-process-mark ()
5133 "Push the current set of process marked articles on the stack and unmark."
5135 (gnus-summary-save-process-mark)
5136 (gnus-summary-unmark-all-processable))
5138 (defun gnus-summary-yank-process-mark ()
5139 "Pop the last process mark state off the stack and restore it."
5141 (unless gnus-newsgroup-process-stack
5142 (error "Empty mark stack"))
5143 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5145 (defun gnus-summary-process-mark-set (set)
5146 "Make SET into the current process marked articles."
5147 (gnus-summary-unmark-all-processable)
5149 (gnus-summary-set-process-mark (pop set))))
5151 ;;; Searching and stuff
5153 (defun gnus-summary-search-group (&optional backward use-level)
5154 "Search for next unread newsgroup.
5155 If optional argument BACKWARD is non-nil, search backward instead."
5157 (set-buffer gnus-group-buffer)
5158 (when (gnus-group-search-forward
5159 backward nil (if use-level (gnus-group-group-level) nil))
5160 (gnus-group-group-name))))
5162 (defun gnus-summary-best-group (&optional exclude-group)
5163 "Find the name of the best unread group.
5164 If EXCLUDE-GROUP, do not go to this group."
5166 (set-buffer gnus-group-buffer)
5168 (gnus-group-best-unread-group exclude-group))))
5170 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5171 (if backward (gnus-summary-find-prev)
5172 (let* ((dummy (gnus-summary-article-intangible-p))
5173 (article (or article (gnus-summary-article-number)))
5174 (arts (gnus-data-find-list article))
5176 (when (and (not dummy)
5177 (or (not gnus-summary-check-current)
5179 (not (gnus-data-unread-p (car arts)))))
5180 (setq arts (cdr arts)))
5185 (when (or (and undownloaded
5186 (eq gnus-undownloaded-mark
5187 (gnus-data-mark (car arts))))
5188 (gnus-data-unread-p (car arts)))
5189 (setq result (car arts)
5191 (setq arts (cdr arts)))
5194 (goto-char (gnus-data-pos result))
5195 (gnus-data-number result)))))
5197 (defun gnus-summary-find-prev (&optional unread article)
5198 (let* ((eobp (eobp))
5199 (article (or article (gnus-summary-article-number)))
5200 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5202 (when (and (not eobp)
5203 (or (not gnus-summary-check-current)
5205 (not (gnus-data-unread-p (car arts)))))
5206 (setq arts (cdr arts)))
5211 (when (gnus-data-unread-p (car arts))
5212 (setq result (car arts)
5214 (setq arts (cdr arts)))
5217 (goto-char (gnus-data-pos result))
5218 (gnus-data-number result))))
5220 (defun gnus-summary-find-subject (subject &optional unread backward article)
5221 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5222 (article (or article (gnus-summary-article-number)))
5223 (articles (gnus-data-list backward))
5224 (arts (gnus-data-find-list article articles))
5226 (when (or (not gnus-summary-check-current)
5228 (not (gnus-data-unread-p (car arts))))
5229 (setq arts (cdr arts)))
5231 (and (or (not unread)
5232 (gnus-data-unread-p (car arts)))
5233 (vectorp (gnus-data-header (car arts)))
5235 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5236 (setq result (car arts)
5238 (setq arts (cdr arts)))
5240 (goto-char (gnus-data-pos result))
5241 (gnus-data-number result))))
5243 (defun gnus-summary-search-forward (&optional unread subject backward)
5244 "Search forward for an article.
5245 If UNREAD, look for unread articles. If SUBJECT, look for
5246 articles with that subject. If BACKWARD, search backward instead."
5247 (cond (subject (gnus-summary-find-subject subject unread backward))
5248 (backward (gnus-summary-find-prev unread))
5249 (t (gnus-summary-find-next unread))))
5251 (defun gnus-recenter (&optional n)
5252 "Center point in window and redisplay frame.
5253 Also do horizontal recentering."
5255 (when (and gnus-auto-center-summary
5256 (not (eq gnus-auto-center-summary 'vertical)))
5257 (gnus-horizontal-recenter))
5260 (defun gnus-summary-recenter ()
5261 "Center point in the summary window.
5262 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5263 displayed, no centering will be performed."
5264 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5265 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5267 (let* ((top (cond ((< (window-height) 4) 0)
5268 ((< (window-height) 7) 1)
5269 (t (if (numberp gnus-auto-center-summary)
5270 gnus-auto-center-summary
5272 (height (1- (window-height)))
5273 (bottom (save-excursion (goto-char (point-max))
5274 (forward-line (- height))
5276 (window (get-buffer-window (current-buffer))))
5277 ;; The user has to want it.
5278 (when gnus-auto-center-summary
5279 (when (get-buffer-window gnus-article-buffer)
5280 ;; Only do recentering when the article buffer is displayed,
5281 ;; Set the window start to either `bottom', which is the biggest
5282 ;; possible valid number, or the second line from the top,
5283 ;; whichever is the least.
5284 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
5285 (if (> bottom top-pos)
5286 ;; Keep the second line from the top visible
5287 (set-window-start window top-pos t)
5288 ;; Try to keep the bottom line visible; if it's partially
5289 ;; obscured, either scroll one more line to make it fully
5290 ;; visible, or revert to using TOP-POS.
5292 (goto-char (point-max))
5294 (let ((last-line-start (point)))
5296 (set-window-start window (point) t)
5297 (when (not (pos-visible-in-window-p last-line-start window))
5299 (set-window-start window (min (point) top-pos) t)))))))
5300 ;; Do horizontal recentering while we're at it.
5301 (when (and (get-buffer-window (current-buffer) t)
5302 (not (eq gnus-auto-center-summary 'vertical)))
5303 (let ((selected (selected-window)))
5304 (select-window (get-buffer-window (current-buffer) t))
5305 (gnus-summary-position-point)
5306 (gnus-horizontal-recenter)
5307 (select-window selected))))))
5309 (defun gnus-summary-jump-to-group (newsgroup)
5310 "Move point to NEWSGROUP in group mode buffer."
5311 ;; Keep update point of group mode buffer if visible.
5312 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5313 (save-window-excursion
5314 ;; Take care of tree window mode.
5315 (when (get-buffer-window gnus-group-buffer)
5316 (pop-to-buffer gnus-group-buffer))
5317 (gnus-group-jump-to-group newsgroup))
5319 ;; Take care of tree window mode.
5320 (if (get-buffer-window gnus-group-buffer)
5321 (pop-to-buffer gnus-group-buffer)
5322 (set-buffer gnus-group-buffer))
5323 (gnus-group-jump-to-group newsgroup))))
5325 ;; This function returns a list of article numbers based on the
5326 ;; difference between the ranges of read articles in this group and
5327 ;; the range of active articles.
5328 (defun gnus-list-of-unread-articles (group)
5329 (let* ((read (gnus-info-read (gnus-get-info group)))
5330 (active (or (gnus-active group) (gnus-activate-group group)))
5333 ;; If none are read, then all are unread.
5335 (setq first (car active))
5336 ;; If the range of read articles is a single range, then the
5337 ;; first unread article is the article after the last read
5338 ;; article. Sounds logical, doesn't it?
5339 (if (and (not (listp (cdr read)))
5340 (or (< (car read) (car active))
5341 (progn (setq read (list read))
5343 (setq first (max (car active) (1+ (cdr read))))
5344 ;; `read' is a list of ranges.
5345 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5348 (setq first (car active)))
5351 (while (< first nlast)
5353 (setq first (1+ first))))
5354 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5355 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5356 (setq read (cdr read)))))
5357 ;; And add the last unread articles.
5358 (while (<= first last)
5360 (setq first (1+ first)))
5361 ;; Return the list of unread articles.
5362 (delq 0 (nreverse unread))))
5364 (defun gnus-list-of-read-articles (group)
5365 "Return a list of unread, unticked and non-dormant articles."
5366 (let* ((info (gnus-get-info group))
5367 (marked (gnus-info-marks info))
5368 (active (gnus-active group)))
5370 (gnus-set-difference
5371 (gnus-sorted-complement
5372 (gnus-uncompress-range active)
5373 (gnus-list-of-unread-articles group))
5375 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5376 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5378 ;; Various summary commands
5380 (defun gnus-summary-select-article-buffer ()
5381 "Reconfigure windows to show article buffer."
5383 (if (not (gnus-buffer-live-p gnus-article-buffer))
5384 (error "There is no article buffer for this summary buffer")
5385 (gnus-configure-windows 'article)
5386 (select-window (get-buffer-window gnus-article-buffer))))
5388 (defun gnus-summary-universal-argument (arg)
5389 "Perform any operation on all articles that are process/prefixed."
5391 (let ((articles (gnus-summary-work-articles arg))
5398 (substitute-command-keys
5399 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
5401 (gnus-error 1 "Undefined key")
5404 (gnus-summary-goto-subject (setq article (pop articles)))
5405 (let (gnus-newsgroup-processable)
5406 (command-execute func))
5407 (gnus-summary-remove-process-mark article)))))
5408 (gnus-summary-position-point))
5410 (defun gnus-summary-toggle-truncation (&optional arg)
5411 "Toggle truncation of summary lines.
5412 With arg, turn line truncation on iff arg is positive."
5414 (setq truncate-lines
5415 (if (null arg) (not truncate-lines)
5416 (> (prefix-numeric-value arg) 0)))
5419 (defun gnus-summary-reselect-current-group (&optional all rescan)
5420 "Exit and then reselect the current newsgroup.
5421 The prefix argument ALL means to select all articles."
5423 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5424 (error "Ephemeral groups can't be reselected"))
5425 (let ((current-subject (gnus-summary-article-number))
5426 (group gnus-newsgroup-name))
5427 (setq gnus-newsgroup-begin nil)
5429 ;; We have to adjust the point of group mode buffer because
5430 ;; point was moved to the next unread newsgroup by exiting.
5431 (gnus-summary-jump-to-group group)
5434 (gnus-group-get-new-news-this-group 1)))
5435 (gnus-group-read-group all t)
5436 (gnus-summary-goto-subject current-subject nil t)))
5438 (defun gnus-summary-rescan-group (&optional all)
5439 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5441 (gnus-summary-reselect-current-group all t))
5443 (defun gnus-summary-update-info (&optional non-destructive)
5445 (let ((group gnus-newsgroup-name))
5447 (when gnus-newsgroup-kill-headers
5448 (setq gnus-newsgroup-killed
5449 (gnus-compress-sequence
5451 (gnus-set-sorted-intersection
5452 (gnus-uncompress-range gnus-newsgroup-killed)
5453 (setq gnus-newsgroup-unselected
5454 (sort gnus-newsgroup-unselected '<)))
5455 (setq gnus-newsgroup-unreads
5456 (sort gnus-newsgroup-unreads '<)))
5458 (unless (listp (cdr gnus-newsgroup-killed))
5459 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5460 (let ((headers gnus-newsgroup-headers))
5461 ;; Set the new ranges of read articles.
5463 (set-buffer gnus-group-buffer)
5464 (gnus-undo-force-boundary))
5465 (gnus-update-read-articles
5466 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5467 ;; Set the current article marks.
5468 (let ((gnus-newsgroup-scored
5469 (if (and (not gnus-save-score)
5470 (not non-destructive))
5472 gnus-newsgroup-scored)))
5474 (gnus-update-marks)))
5475 ;; Do the cross-ref thing.
5476 (when gnus-use-cross-reference
5477 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5478 ;; Do not switch windows but change the buffer to work.
5479 (set-buffer gnus-group-buffer)
5480 (unless (gnus-ephemeral-group-p group)
5481 (gnus-group-update-group group)))))))
5483 (defun gnus-summary-save-newsrc (&optional force)
5484 "Save the current number of read/marked articles in the dribble buffer.
5485 The dribble buffer will then be saved.
5486 If FORCE (the prefix), also save the .newsrc file(s)."
5488 (gnus-summary-update-info t)
5490 (gnus-save-newsrc-file)
5491 (gnus-dribble-save)))
5493 (defun gnus-summary-exit (&optional temporary)
5494 "Exit reading current newsgroup, and then return to group selection mode.
5495 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
5497 (gnus-set-global-variables)
5498 (when (gnus-buffer-live-p gnus-article-buffer)
5500 (set-buffer gnus-article-buffer)
5501 (mm-destroy-parts gnus-article-mime-handles)
5502 ;; Set it to nil for safety reason.
5503 (setq gnus-article-mime-handle-alist nil)
5504 (setq gnus-article-mime-handles nil)))
5505 (gnus-kill-save-kill-buffer)
5506 (gnus-async-halt-prefetch)
5507 (let* ((group gnus-newsgroup-name)
5508 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5511 (buf (current-buffer)))
5513 ;; Do adaptive scoring, and possibly save score files.
5514 (when gnus-newsgroup-adaptive
5515 (gnus-score-adaptive))
5516 (when gnus-use-scoring
5518 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5519 ;; If we have several article buffers, we kill them at exit.
5520 (unless gnus-single-article-buffer
5521 (gnus-kill-buffer gnus-original-article-buffer)
5522 (setq gnus-article-current nil))
5523 (when gnus-use-cache
5524 (gnus-cache-possibly-remove-articles)
5525 (gnus-cache-save-buffers))
5526 (gnus-async-prefetch-remove-group group)
5527 (when gnus-suppress-duplicates
5528 (gnus-dup-enter-articles))
5529 (when gnus-use-trees
5530 (gnus-tree-close group))
5531 (when gnus-use-cache
5532 (gnus-cache-write-active))
5533 ;; Remove entries for this group.
5534 (nnmail-purge-split-history (gnus-group-real-name group))
5535 ;; Make all changes in this group permanent.
5537 (gnus-run-hooks 'gnus-exit-group-hook)
5538 (gnus-summary-update-info))
5539 (gnus-close-group group)
5540 ;; Make sure where we were, and go to next newsgroup.
5541 (set-buffer gnus-group-buffer)
5543 (gnus-group-jump-to-group group))
5544 (gnus-run-hooks 'gnus-summary-exit-hook)
5545 (unless (or quit-config
5546 ;; If this group has disappeared from the summary
5547 ;; buffer, don't skip forwards.
5548 (not (string= group (gnus-group-group-name))))
5549 (gnus-group-next-unread-group 1))
5550 (setq group-point (point))
5553 ;; If we have several article buffers, we kill them at exit.
5554 (unless gnus-single-article-buffer
5555 (gnus-kill-buffer gnus-article-buffer)
5556 (gnus-kill-buffer gnus-original-article-buffer)
5557 (setq gnus-article-current nil))
5559 (if (not gnus-kill-summary-on-exit)
5560 (gnus-deaden-summary)
5561 ;; We set all buffer-local variables to nil. It is unclear why
5562 ;; this is needed, but if we don't, buffer-local variables are
5563 ;; not garbage-collected, it seems. This would the lead to en
5564 ;; ever-growing Emacs.
5565 (gnus-summary-clear-local-variables)
5566 (when (get-buffer gnus-article-buffer)
5567 (bury-buffer gnus-article-buffer))
5568 ;; We clear the global counterparts of the buffer-local
5569 ;; variables as well, just to be on the safe side.
5570 (set-buffer gnus-group-buffer)
5571 (gnus-summary-clear-local-variables)
5572 ;; Return to group mode buffer.
5573 (when (eq mode 'gnus-summary-mode)
5574 (gnus-kill-buffer buf)))
5575 (setq gnus-current-select-method gnus-select-method)
5576 (pop-to-buffer gnus-group-buffer)
5577 (if (not quit-config)
5579 (goto-char group-point)
5580 (gnus-configure-windows 'group 'force))
5581 (gnus-handle-ephemeral-exit quit-config))
5582 ;; Clear the current group name.
5584 (setq gnus-newsgroup-name nil)))))
5586 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5587 (defun gnus-summary-exit-no-update (&optional no-questions)
5588 "Quit reading current newsgroup without updating read article info."
5590 (let* ((group gnus-newsgroup-name)
5591 (quit-config (gnus-group-quit-config group)))
5592 (when (or no-questions
5594 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5595 (gnus-async-halt-prefetch)
5597 (delq 'gnus-summary-expire-articles
5598 (copy-sequence gnus-summary-prepare-exit-hook)))
5599 (when (gnus-buffer-live-p gnus-article-buffer)
5601 (set-buffer gnus-article-buffer)
5602 (mm-destroy-parts gnus-article-mime-handles)
5603 ;; Set it to nil for safety reason.
5604 (setq gnus-article-mime-handle-alist nil)
5605 (setq gnus-article-mime-handles nil)))
5606 ;; If we have several article buffers, we kill them at exit.
5607 (unless gnus-single-article-buffer
5608 (gnus-kill-buffer gnus-article-buffer)
5609 (gnus-kill-buffer gnus-original-article-buffer)
5610 (setq gnus-article-current nil))
5611 (if (not gnus-kill-summary-on-exit)
5612 (gnus-deaden-summary)
5613 (gnus-close-group group)
5614 (gnus-summary-clear-local-variables)
5615 (set-buffer gnus-group-buffer)
5616 (gnus-summary-clear-local-variables)
5617 (when (get-buffer gnus-summary-buffer)
5618 (kill-buffer gnus-summary-buffer)))
5619 (unless gnus-single-article-buffer
5620 (setq gnus-article-current nil))
5621 (when gnus-use-trees
5622 (gnus-tree-close group))
5623 (gnus-async-prefetch-remove-group group)
5624 (when (get-buffer gnus-article-buffer)
5625 (bury-buffer gnus-article-buffer))
5626 ;; Return to the group buffer.
5627 (gnus-configure-windows 'group 'force)
5628 ;; Clear the current group name.
5629 (setq gnus-newsgroup-name nil)
5630 (when (equal (gnus-group-group-name) group)
5631 (gnus-group-next-unread-group 1))
5633 (gnus-handle-ephemeral-exit quit-config)))))
5635 (defun gnus-handle-ephemeral-exit (quit-config)
5636 "Handle movement when leaving an ephemeral group.
5637 The state which existed when entering the ephemeral is reset."
5638 (if (not (buffer-name (car quit-config)))
5639 (gnus-configure-windows 'group 'force)
5640 (set-buffer (car quit-config))
5641 (cond ((eq major-mode 'gnus-summary-mode)
5642 (gnus-set-global-variables))
5643 ((eq major-mode 'gnus-article-mode)
5645 ;; The `gnus-summary-buffer' variable may point
5646 ;; to the old summary buffer when using a single
5648 (unless (gnus-buffer-live-p gnus-summary-buffer)
5649 (set-buffer gnus-group-buffer))
5650 (set-buffer gnus-summary-buffer)
5651 (gnus-set-global-variables))))
5652 (if (or (eq (cdr quit-config) 'article)
5653 (eq (cdr quit-config) 'pick))
5655 ;; The current article may be from the ephemeral group
5656 ;; thus it is best that we reload this article
5657 (gnus-summary-show-article)
5658 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5659 (gnus-configure-windows 'pick 'force)
5660 (gnus-configure-windows (cdr quit-config) 'force)))
5661 (gnus-configure-windows (cdr quit-config) 'force))
5662 (when (eq major-mode 'gnus-summary-mode)
5663 (gnus-summary-next-subject 1 nil t)
5664 (gnus-summary-recenter)
5665 (gnus-summary-position-point))))
5669 (defvar gnus-dead-summary-mode-map nil)
5671 (unless gnus-dead-summary-mode-map
5672 (setq gnus-dead-summary-mode-map (make-keymap))
5673 (suppress-keymap gnus-dead-summary-mode-map)
5674 (substitute-key-definition
5675 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5676 (let ((keys '("\C-d" "\r" "\177" [delete])))
5678 (define-key gnus-dead-summary-mode-map
5679 (pop keys
) 'gnus-summary-wake-up-the-dead
))))
5681 (defvar gnus-dead-summary-mode nil
5682 "Minor mode for Gnus summary buffers.")
5684 (defun gnus-dead-summary-mode (&optional arg
)
5685 "Minor mode for Gnus summary buffers."
5687 (when (eq major-mode
'gnus-summary-mode
)
5688 (make-local-variable 'gnus-dead-summary-mode
)
5689 (setq gnus-dead-summary-mode
5690 (if (null arg
) (not gnus-dead-summary-mode
)
5691 (> (prefix-numeric-value arg
) 0)))
5692 (when gnus-dead-summary-mode
5693 (gnus-add-minor-mode
5694 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
5696 (defun gnus-deaden-summary ()
5697 "Make the current summary buffer into a dead summary buffer."
5698 ;; Kill any previous dead summary buffer.
5699 (when (and gnus-dead-summary
5700 (buffer-name gnus-dead-summary
))
5702 (set-buffer gnus-dead-summary
)
5703 (when gnus-dead-summary-mode
5704 (kill-buffer (current-buffer)))))
5705 ;; Make this the current dead summary.
5706 (setq gnus-dead-summary
(current-buffer))
5707 (gnus-dead-summary-mode 1)
5708 (let ((name (buffer-name)))
5709 (when (string-match "Summary" name
)
5711 (concat (substring name
0 (match-beginning 0)) "Dead "
5712 (substring name
(match-beginning 0)))
5716 (defun gnus-kill-or-deaden-summary (buffer)
5717 "Kill or deaden the summary BUFFER."
5719 (when (and (buffer-name buffer
)
5720 (not gnus-single-article-buffer
))
5723 (gnus-kill-buffer gnus-article-buffer
)
5724 (gnus-kill-buffer gnus-original-article-buffer
)))
5725 (cond (gnus-kill-summary-on-exit
5726 (when (and gnus-use-trees
5727 (gnus-buffer-exists-p buffer
))
5730 (gnus-tree-close gnus-newsgroup-name
)))
5731 (gnus-kill-buffer buffer
))
5732 ((gnus-buffer-exists-p buffer
)
5735 (gnus-deaden-summary))))))
5737 (defun gnus-summary-wake-up-the-dead (&rest args
)
5738 "Wake up the dead summary buffer."
5740 (gnus-dead-summary-mode -
1)
5741 (let ((name (buffer-name)))
5742 (when (string-match "Dead " name
)
5744 (concat (substring name
0 (match-beginning 0))
5745 (substring name
(match-end 0)))
5747 (gnus-message 3 "This dead summary is now alive again"))
5749 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5750 (defun gnus-summary-fetch-faq (&optional faq-dir
)
5751 "Fetch the FAQ for the current group.
5752 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5756 (when current-prefix-arg
5758 "Faq dir: " (and (listp gnus-group-faq-directory
)
5759 (mapcar (lambda (file) (list file
))
5760 gnus-group-faq-directory
))))))
5761 (let (gnus-faq-buffer)
5762 (when (setq gnus-faq-buffer
5763 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
5764 (gnus-configure-windows 'summary-faq
))))
5766 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5767 (defun gnus-summary-describe-group (&optional force
)
5768 "Describe the current newsgroup."
5770 (gnus-group-describe-group force gnus-newsgroup-name
))
5772 (defun gnus-summary-describe-briefly ()
5773 "Describe summary mode commands briefly."
5775 (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")))
5777 ;; Walking around group mode buffer from summary mode.
5779 (defun gnus-summary-next-group (&optional no-article target-group backward
)
5780 "Exit current newsgroup and then select next unread newsgroup.
5781 If prefix argument NO-ARTICLE is non-nil, no article is selected
5782 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5783 previous group instead."
5785 ;; Stop pre-fetching.
5786 (gnus-async-halt-prefetch)
5787 (let ((current-group gnus-newsgroup-name
)
5788 (current-buffer (current-buffer))
5790 ;; First we semi-exit this group to update Xrefs and all variables.
5791 ;; We can't do a real exit, because the window conf must remain
5792 ;; the same in case the user is prompted for info, and we don't
5793 ;; want the window conf to change before that...
5794 (gnus-summary-exit t
)
5795 (while (not entered
)
5796 ;; Then we find what group we are supposed to enter.
5797 (set-buffer gnus-group-buffer
)
5798 (gnus-group-jump-to-group current-group
)
5801 (if (eq gnus-keep-same-level
'best
)
5802 (gnus-summary-best-group gnus-newsgroup-name
)
5803 (gnus-summary-search-group backward gnus-keep-same-level
))))
5804 (if (not target-group
)
5805 ;; There are no further groups, so we return to the group
5808 (gnus-message 5 "Returning to the group buffer")
5810 (when (gnus-buffer-live-p current-buffer
)
5811 (set-buffer current-buffer
)
5812 (gnus-summary-exit))
5813 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
5814 ;; We try to enter the target group.
5815 (gnus-group-jump-to-group target-group
)
5816 (let ((unreads (gnus-group-group-unread)))
5817 (if (and (or (eq t unreads
)
5818 (and unreads
(not (zerop unreads
))))
5819 (gnus-summary-read-group
5820 target-group nil no-article
5821 (and (buffer-name current-buffer
) current-buffer
)
5824 (setq current-group target-group
5825 target-group nil
)))))))
5827 (defun gnus-summary-prev-group (&optional no-article
)
5828 "Exit current newsgroup and then select previous unread newsgroup.
5829 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5831 (gnus-summary-next-group no-article nil t
))
5833 ;; Walking around summary lines.
5835 (defun gnus-summary-first-subject (&optional unread undownloaded
)
5836 "Go to the first unread subject.
5837 If UNREAD is non-nil, go to the first unread article.
5838 Returns the article selected or nil if there are no unread articles."
5843 ((null gnus-newsgroup-data
)
5844 (gnus-message 3 "No articles in the group")
5846 ;; Pick the first article.
5848 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
5849 (gnus-data-number (car gnus-newsgroup-data
)))
5850 ;; No unread articles.
5851 ((null gnus-newsgroup-unreads
)
5852 (gnus-message 3 "No more unread articles")
5854 ;; Find the first unread article.
5856 (let ((data gnus-newsgroup-data
))
5858 (and (not (and undownloaded
5859 (eq gnus-undownloaded-mark
5860 (gnus-data-mark (car data
)))))
5861 (not (gnus-data-unread-p (car data
)))))
5862 (setq data
(cdr data
)))
5864 (goto-char (gnus-data-pos (car data
)))
5865 (gnus-data-number (car data
))))))
5866 (gnus-summary-position-point)))
5868 (defun gnus-summary-next-subject (n &optional unread dont-display
)
5869 "Go to next N'th summary line.
5870 If N is negative, go to the previous N'th subject line.
5871 If UNREAD is non-nil, only unread articles are selected.
5872 The difference between N and the actual number of steps taken is
5875 (let ((backward (< n
0))
5879 (gnus-summary-find-prev unread
)
5880 (gnus-summary-find-next unread
)))
5881 (unless (zerop (setq n
(1- n
)))
5882 (gnus-summary-show-thread)))
5884 (gnus-message 7 "No more%s articles"
5885 (if unread
" unread" "")))
5886 (unless dont-display
5887 (gnus-summary-recenter)
5888 (gnus-summary-position-point))
5891 (defun gnus-summary-next-unread-subject (n)
5892 "Go to next N'th unread summary line."
5894 (gnus-summary-next-subject n t
))
5896 (defun gnus-summary-prev-subject (n &optional unread
)
5897 "Go to previous N'th summary line.
5898 If optional argument UNREAD is non-nil, only unread article is selected."
5900 (gnus-summary-next-subject (- n
) unread
))
5902 (defun gnus-summary-prev-unread-subject (n)
5903 "Go to previous N'th unread summary line."
5905 (gnus-summary-next-subject (- n
) t
))
5907 (defun gnus-summary-goto-subject (article &optional force silent
)
5908 "Go the subject line of ARTICLE.
5909 If FORCE, also allow jumping to articles not currently shown."
5910 (interactive "nArticle number: ")
5912 (data (gnus-data-find article
)))
5913 ;; We read in the article if we have to.
5916 (gnus-summary-insert-subject
5918 (if (or (numberp force
) (vectorp force
)) force
)
5920 (setq data
(gnus-data-find article
)))
5925 (gnus-message 3 "Can't find article %d" article
))
5927 (goto-char (gnus-data-pos data
))
5928 (gnus-summary-position-point)
5931 ;; Walking around summary lines with displaying articles.
5933 (defun gnus-summary-expand-window (&optional arg
)
5934 "Make the summary buffer take up the entire Emacs frame.
5935 Given a prefix, will force an `article' buffer configuration."
5938 (gnus-configure-windows 'article
'force
)
5939 (gnus-configure-windows 'summary
'force
)))
5941 (defun gnus-summary-display-article (article &optional all-header
)
5942 "Display ARTICLE in article buffer."
5943 (when (gnus-buffer-live-p gnus-article-buffer
)
5944 (with-current-buffer gnus-article-buffer
5945 (mm-enable-multibyte-mule4)))
5946 (gnus-set-global-variables)
5950 (if gnus-summary-display-article-function
5951 (funcall gnus-summary-display-article-function article all-header
)
5952 (gnus-article-prepare article all-header
))
5953 (gnus-run-hooks 'gnus-select-article-hook
)
5954 (when (and gnus-current-article
5955 (not (zerop gnus-current-article
)))
5956 (gnus-summary-goto-subject gnus-current-article
))
5957 (gnus-summary-recenter)
5958 (when (and gnus-use-trees gnus-show-threads
)
5959 (gnus-possibly-generate-tree article
)
5960 (gnus-highlight-selected-tree article
))
5961 ;; Successfully display article.
5962 (gnus-article-set-window-start
5963 (cdr (assq article gnus-newsgroup-bookmarks
))))))
5965 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
5966 "Select the current article.
5967 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5968 non-nil, the article will be re-fetched even if it already present in
5969 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5971 ;; Make sure we are in the summary buffer to work around bbdb bug.
5972 (unless (eq major-mode
'gnus-summary-mode
)
5973 (set-buffer gnus-summary-buffer
))
5974 (let ((article (or article
(gnus-summary-article-number)))
5975 (all-headers (not (not all-headers
))) ;Must be T or NIL.
5976 gnus-summary-display-article-function
)
5978 (gnus-summary-article-pseudo-p article
)
5979 (error "This is a pseudo-article"))
5981 (set-buffer gnus-summary-buffer
)
5982 (if (or (and gnus-single-article-buffer
5983 (or (null gnus-current-article
)
5984 (null gnus-article-current
)
5985 (null (get-buffer gnus-article-buffer
))
5986 (not (eq article
(cdr gnus-article-current
)))
5987 (not (equal (car gnus-article-current
)
5988 gnus-newsgroup-name
))))
5989 (and (not gnus-single-article-buffer
)
5990 (or (null gnus-current-article
)
5991 (not (eq gnus-current-article article
))))
5993 ;; The requested article is different from the current article.
5995 (gnus-summary-display-article article all-headers
)
5996 (when (gnus-buffer-live-p gnus-article-buffer
)
5997 (with-current-buffer gnus-article-buffer
5998 (if (not gnus-article-decoded-p
) ;; a local variable
5999 (mm-disable-multibyte-mule4))))
6000 (when (or all-headers gnus-show-all-headers
)
6001 (gnus-article-show-all-headers))
6002 (gnus-article-set-window-start
6003 (cdr (assq article gnus-newsgroup-bookmarks
)))
6005 (when (or all-headers gnus-show-all-headers
)
6006 (gnus-article-show-all-headers))
6009 (defun gnus-summary-set-current-mark (&optional current-mark
)
6010 "Obsolete function."
6013 (defun gnus-summary-next-article (&optional unread subject backward push
)
6014 "Select the next article.
6015 If UNREAD, only unread articles are selected.
6016 If SUBJECT, only articles with SUBJECT are selected.
6017 If BACKWARD, the previous article is selected instead of the next."
6020 ;; Is there such an article?
6021 ((and (gnus-summary-search-forward unread subject backward
)
6022 (or (gnus-summary-display-article (gnus-summary-article-number))
6023 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
6024 (gnus-summary-position-point))
6025 ;; If not, we try the first unread, if that is wanted.
6027 gnus-auto-select-same
6028 (gnus-summary-first-unread-article))
6029 (gnus-summary-position-point)
6030 (gnus-message 6 "Wrapped"))
6031 ;; Try to get next/previous article not displayed in this group.
6032 ((and gnus-auto-extend-newsgroup
6033 (not unread
) (not subject
))
6034 (gnus-summary-goto-article
6035 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
6036 nil
(count-lines (point-min) (point))))
6037 ;; Go to next/previous group.
6039 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
6040 (gnus-summary-jump-to-group gnus-newsgroup-name
))
6041 (let ((cmd last-command-char
)
6044 (set-buffer gnus-group-buffer
)
6047 (if (eq gnus-keep-same-level
'best
)
6048 (gnus-summary-best-group gnus-newsgroup-name
)
6049 (gnus-summary-search-group backward gnus-keep-same-level
))))
6050 ;; For some reason, the group window gets selected. We change
6052 (select-window (get-buffer-window (current-buffer)))
6053 ;; Select next unread newsgroup automagically.
6055 ((or (not gnus-auto-select-next
)
6057 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
6058 ((or (eq gnus-auto-select-next
'quietly
)
6059 (and (eq gnus-auto-select-next
'slightly-quietly
)
6061 (and (eq gnus-auto-select-next
'almost-quietly
)
6062 (gnus-summary-last-article-p)))
6064 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
6066 (gnus-message 7 "No more%s articles (%s)..."
6067 (if unread
" unread" "")
6068 (if group
(concat "selecting " group
)
6070 (gnus-summary-next-group nil group backward
)))
6072 (when (gnus-key-press-event-p last-input-event
)
6073 (gnus-summary-walk-group-buffer
6074 gnus-newsgroup-name cmd unread backward point
))))))))
6076 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
6077 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
6078 (?\C-p
(gnus-group-prev-unread-group 1))))
6079 (cursor-in-echo-area t
)
6080 keve key group ended
)
6082 (set-buffer gnus-group-buffer
)
6085 (if (eq gnus-keep-same-level
'best
)
6086 (gnus-summary-best-group gnus-newsgroup-name
)
6087 (gnus-summary-search-group backward gnus-keep-same-level
))))
6090 5 "No more%s articles%s" (if unread
" unread" "")
6092 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
6093 (format " (Type %s for %s [%s])"
6094 (single-key-description cmd
) group
6095 (car (gnus-gethash group gnus-newsrc-hashtb
)))
6096 (format " (Type %s to exit %s)"
6097 (single-key-description cmd
)
6098 gnus-newsgroup-name
)))
6099 ;; Confirm auto selection.
6100 (setq key
(car (setq keve
(gnus-read-event-char))))
6103 ((assq key keystrokes
)
6104 (let ((obuf (current-buffer)))
6105 (switch-to-buffer gnus-group-buffer
)
6107 (gnus-group-jump-to-group group
))
6108 (eval (cadr (assq key keystrokes
)))
6109 (setq group
(gnus-group-group-name))
6110 (switch-to-buffer obuf
))
6114 (gnus-ephemeral-group-p gnus-newsgroup-name
))
6116 (gnus-summary-next-group nil group backward
)))
6118 (push (cdr keve
) unread-command-events
))))))
6120 (defun gnus-summary-next-unread-article ()
6121 "Select unread article after current one."
6123 (gnus-summary-next-article
6124 (or (not (eq gnus-summary-goto-unread
'never
))
6125 (gnus-summary-last-article-p (gnus-summary-article-number)))
6126 (and gnus-auto-select-same
6127 (gnus-summary-article-subject))))
6129 (defun gnus-summary-prev-article (&optional unread subject
)
6130 "Select the article after the current one.
6131 If UNREAD is non-nil, only unread articles are selected."
6133 (gnus-summary-next-article unread subject t
))
6135 (defun gnus-summary-prev-unread-article ()
6136 "Select unread article before current one."
6138 (gnus-summary-prev-article
6139 (or (not (eq gnus-summary-goto-unread
'never
))
6140 (gnus-summary-first-article-p (gnus-summary-article-number)))
6141 (and gnus-auto-select-same
6142 (gnus-summary-article-subject))))
6144 (defun gnus-summary-next-page (&optional lines circular
)
6145 "Show next page of the selected article.
6146 If at the end of the current article, select the next article.
6147 LINES says how many lines should be scrolled up.
6149 If CIRCULAR is non-nil, go to the start of the article instead of
6150 selecting the next article when reaching the end of the current
6153 (setq gnus-summary-buffer
(current-buffer))
6154 (gnus-set-global-variables)
6155 (let ((article (gnus-summary-article-number))
6156 (article-window (get-buffer-window gnus-article-buffer t
))
6158 ;; If the buffer is empty, we have no article.
6160 (error "No article to select"))
6161 (gnus-configure-windows 'article
)
6162 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
6163 (if (and (eq gnus-summary-goto-unread
'never
)
6164 (not (gnus-summary-last-article-p article
)))
6165 (gnus-summary-next-article)
6166 (gnus-summary-next-unread-article))
6167 (if (or (null gnus-current-article
)
6168 (null gnus-article-current
)
6169 (/= article
(cdr gnus-article-current
))
6170 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6171 ;; Selected subject is different from current article's.
6172 (gnus-summary-display-article article
)
6173 (when article-window
6174 (gnus-eval-in-buffer-window gnus-article-buffer
6175 (setq endp
(gnus-article-next-page lines
)))
6178 (gnus-summary-beginning-of-article))
6180 (gnus-message 3 "End of message"))
6182 (if (and (eq gnus-summary-goto-unread
'never
)
6183 (not (gnus-summary-last-article-p article
)))
6184 (gnus-summary-next-article)
6185 (gnus-summary-next-unread-article))))))))
6186 (gnus-summary-recenter)
6187 (gnus-summary-position-point)))
6189 (defun gnus-summary-prev-page (&optional lines move
)
6190 "Show previous page of selected article.
6191 Argument LINES specifies lines to be scrolled down.
6192 If MOVE, move to the previous unread article if point is at
6193 the beginning of the buffer."
6195 (let ((article (gnus-summary-article-number))
6196 (article-window (get-buffer-window gnus-article-buffer t
))
6198 (gnus-configure-windows 'article
)
6199 (if (or (null gnus-current-article
)
6200 (null gnus-article-current
)
6201 (/= article
(cdr gnus-article-current
))
6202 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6203 ;; Selected subject is different from current article's.
6204 (gnus-summary-display-article article
)
6205 (gnus-summary-recenter)
6206 (when article-window
6207 (gnus-eval-in-buffer-window gnus-article-buffer
6208 (setq endp
(gnus-article-prev-page lines
)))
6209 (when (and move endp
)
6211 (gnus-message 3 "Beginning of message"))
6213 (if (and (eq gnus-summary-goto-unread
'never
)
6214 (not (gnus-summary-first-article-p article
)))
6215 (gnus-summary-prev-article)
6216 (gnus-summary-prev-unread-article))))))))
6217 (gnus-summary-position-point))
6219 (defun gnus-summary-prev-page-or-article (&optional lines
)
6220 "Show previous page of selected article.
6221 Argument LINES specifies lines to be scrolled down.
6222 If at the beginning of the article, go to the next article."
6224 (gnus-summary-prev-page lines t
))
6226 (defun gnus-summary-scroll-up (lines)
6227 "Scroll up (or down) one line current article.
6228 Argument LINES specifies lines to be scrolled up (or down if negative)."
6230 (gnus-configure-windows 'article
)
6231 (gnus-summary-show-thread)
6232 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
6233 (gnus-eval-in-buffer-window gnus-article-buffer
6235 (when (gnus-article-next-page lines
)
6236 (gnus-message 3 "End of message")))
6238 (gnus-article-prev-page (- lines
))))))
6239 (gnus-summary-recenter)
6240 (gnus-summary-position-point))
6242 (defun gnus-summary-scroll-down (lines)
6243 "Scroll down (or up) one line current article.
6244 Argument LINES specifies lines to be scrolled down (or up if negative)."
6246 (gnus-summary-scroll-up (- lines
)))
6248 (defun gnus-summary-next-same-subject ()
6249 "Select next article which has the same subject as current one."
6251 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
6253 (defun gnus-summary-prev-same-subject ()
6254 "Select previous article which has the same subject as current one."
6256 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
6258 (defun gnus-summary-next-unread-same-subject ()
6259 "Select next unread article which has the same subject as current one."
6261 (gnus-summary-next-article t
(gnus-summary-article-subject)))
6263 (defun gnus-summary-prev-unread-same-subject ()
6264 "Select previous unread article which has the same subject as current one."
6266 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
6268 (defun gnus-summary-first-unread-article ()
6269 "Select the first unread article.
6270 Return nil if there are no unread articles."
6273 (when (gnus-summary-first-subject t
)
6274 (gnus-summary-show-thread)
6275 (gnus-summary-first-subject t
)
6276 (gnus-summary-display-article (gnus-summary-article-number)))
6277 (gnus-summary-position-point)))
6279 (defun gnus-summary-first-unread-subject ()
6280 "Place the point on the subject line of the first unread article.
6281 Return nil if there are no unread articles."
6284 (when (gnus-summary-first-subject t
)
6285 (gnus-summary-show-thread)
6286 (gnus-summary-first-subject t
))
6287 (gnus-summary-position-point)))
6289 (defun gnus-summary-first-article ()
6290 "Select the first article.
6291 Return nil if there are no articles."
6294 (when (gnus-summary-first-subject)
6295 (gnus-summary-show-thread)
6296 (gnus-summary-first-subject)
6297 (gnus-summary-display-article (gnus-summary-article-number)))
6298 (gnus-summary-position-point)))
6300 (defun gnus-summary-best-unread-article ()
6301 "Select the unread article with the highest score."
6303 (let ((best -
1000000)
6304 (data gnus-newsgroup-data
)
6307 (and (gnus-data-unread-p (car data
))
6309 (gnus-summary-article-score (gnus-data-number (car data
))))
6312 article
(gnus-data-number (car data
))))
6313 (setq data
(cdr data
)))
6316 (gnus-summary-goto-article article
)
6317 (error "No unread articles"))
6318 (gnus-summary-position-point))))
6320 (defun gnus-summary-last-subject ()
6321 "Go to the last displayed subject line in the group."
6322 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
6324 (gnus-summary-goto-subject article
))))
6326 (defun gnus-summary-goto-article (article &optional all-headers force
)
6327 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6328 If ALL-HEADERS is non-nil, no header lines are hidden.
6329 If FORCE, go to the article even if it isn't displayed. If FORCE
6330 is a number, it is the line the article is to be displayed on."
6334 "Article number or Message-ID: "
6335 (mapcar (lambda (number) (list (int-to-string number
)))
6336 gnus-newsgroup-limit
))
6340 (if (and (stringp article
)
6341 (string-match "@" article
))
6342 (gnus-summary-refer-article article
)
6343 (when (stringp article
)
6344 (setq article
(string-to-number article
)))
6345 (if (gnus-summary-goto-subject article force
)
6346 (gnus-summary-display-article article all-headers
)
6347 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
6348 (gnus-summary-position-point)))
6350 (defun gnus-summary-goto-last-article ()
6351 "Go to the previously read article."
6354 (when gnus-last-article
6355 (gnus-summary-goto-article gnus-last-article nil t
))
6356 (gnus-summary-position-point)))
6358 (defun gnus-summary-pop-article (number)
6359 "Pop one article off the history and go to the previous.
6360 NUMBER articles will be popped off."
6363 (setq gnus-newsgroup-history
6364 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
6366 (gnus-summary-goto-article (car to
) nil t
)
6367 (error "Article history empty")))
6368 (gnus-summary-position-point))
6370 ;; Summary commands and functions for limiting the summary buffer.
6372 (defun gnus-summary-limit-to-articles (n)
6373 "Limit the summary buffer to the next N articles.
6374 If not given a prefix, use the process marked articles instead."
6377 (let ((articles (gnus-summary-work-articles n
)))
6378 (setq gnus-newsgroup-processable nil
)
6379 (gnus-summary-limit articles
))
6380 (gnus-summary-position-point)))
6382 (defun gnus-summary-pop-limit (&optional total
)
6383 "Restore the previous limit.
6384 If given a prefix, remove all limits."
6387 (setq gnus-newsgroup-limits
6388 (list (mapcar (lambda (h) (mail-header-number h
))
6389 gnus-newsgroup-headers
))))
6390 (unless gnus-newsgroup-limits
6391 (error "No limit to pop"))
6393 (gnus-summary-limit nil
'pop
)
6394 (gnus-summary-position-point)))
6396 (defun gnus-summary-limit-to-subject (subject &optional header
)
6397 "Limit the summary buffer to articles that have subjects that match a regexp."
6398 (interactive "sLimit to subject (regexp): ")
6400 (setq header
"subject"))
6401 (when (not (equal "" subject
))
6403 (let ((articles (gnus-summary-find-matching
6404 (or header
"subject") subject
'all
)))
6406 (error "Found no matches for \"%s\"" subject
))
6407 (gnus-summary-limit articles
))
6408 (gnus-summary-position-point))))
6410 (defun gnus-summary-limit-to-author (from)
6411 "Limit the summary buffer to articles that have authors that match a regexp."
6412 (interactive "sLimit to author (regexp): ")
6413 (gnus-summary-limit-to-subject from
"from"))
6415 (defun gnus-summary-limit-to-age (age &optional younger-p
)
6416 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6417 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6418 articles that are younger than AGE days."
6420 (let ((younger current-prefix-arg
)
6423 (while (not days-got
)
6424 (setq days
(if younger
6425 (read-string "Limit to articles within (in days): ")
6426 (read-string "Limit to articles old than (in days): ")))
6427 (when (> (length days
) 0)
6428 (setq days
(read days
)))
6431 (message "Please enter a number.")
6433 (list days younger
)))
6435 (let ((data gnus-newsgroup-data
)
6436 (cutoff (days-to-time age
))
6437 articles d date is-younger
)
6438 (while (setq d
(pop data
))
6439 (when (and (vectorp (gnus-data-header d
))
6440 (setq date
(mail-header-date (gnus-data-header d
))))
6441 (setq is-younger
(time-less-p
6442 (time-since (condition-case ()
6449 (push (gnus-data-number d
) articles
))))
6450 (gnus-summary-limit (nreverse articles
)))
6451 (gnus-summary-position-point)))
6453 (defun gnus-summary-limit-to-extra (header regexp
)
6454 "Limit the summary buffer to articles that match an 'extra' header."
6458 (gnus-completing-read
6459 (symbol-name (car gnus-extra-headers
))
6460 "Limit extra header:"
6462 (cons (symbol-name x
) x
))
6467 (read-string (format "Limit to header %s (regexp): " header
)))))
6468 (when (not (equal "" regexp
))
6470 (let ((articles (gnus-summary-find-matching
6471 (cons 'extra header
) regexp
'all
)))
6473 (error "Found no matches for \"%s\"" regexp
))
6474 (gnus-summary-limit articles
))
6475 (gnus-summary-position-point))))
6477 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6479 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6481 (defun gnus-summary-limit-to-unread (&optional all
)
6482 "Limit the summary buffer to articles that are not marked as read.
6483 If ALL is non-nil, limit strictly to unread articles."
6486 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
6487 (gnus-summary-limit-to-marks
6488 ;; Concat all the marks that say that an article is read and have
6490 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6491 gnus-killed-mark gnus-kill-file-mark
6492 gnus-low-score-mark gnus-expirable-mark
6493 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6494 gnus-duplicate-mark gnus-souped-mark
)
6497 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
6498 (make-obsolete 'gnus-summary-delete-marked-with
6499 'gnus-summary-limit-exlude-marks
)
6501 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
6502 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6503 If REVERSE, limit the summary buffer to articles that are marked
6504 with MARKS. MARKS can either be a string of marks or a list of marks.
6505 Returns how many articles were removed."
6506 (interactive "sMarks: ")
6507 (gnus-summary-limit-to-marks marks t
))
6509 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
6510 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6511 If REVERSE (the prefix), limit the summary buffer to articles that are
6512 not marked with MARKS. MARKS can either be a string of marks or a
6514 Returns how many articles were removed."
6515 (interactive "sMarks: \nP")
6517 (let ((data gnus-newsgroup-data
)
6518 (marks (if (listp marks
) marks
6519 (append marks nil
))) ; Transform to list.
6522 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
6523 (memq (gnus-data-mark (car data
)) marks
))
6524 (push (gnus-data-number (car data
)) articles
))
6525 (setq data
(cdr data
)))
6526 (gnus-summary-limit articles
))
6527 (gnus-summary-position-point)))
6529 (defun gnus-summary-limit-to-score (&optional score
)
6530 "Limit to articles with score at or above SCORE."
6532 (setq score
(if score
6533 (prefix-numeric-value score
)
6534 (or gnus-summary-default-score
0)))
6535 (let ((data gnus-newsgroup-data
)
6538 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
6540 (push (gnus-data-number (car data
)) articles
))
6541 (setq data
(cdr data
)))
6543 (gnus-summary-limit articles
)
6544 (gnus-summary-position-point))))
6546 (defun gnus-summary-limit-include-thread (id)
6547 "Display all the hidden articles that in the current thread."
6548 (interactive (list (mail-header-id (gnus-summary-article-header))))
6549 (let ((articles (gnus-articles-in-thread
6550 (gnus-id-to-thread (gnus-root-id id
)))))
6552 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
6553 (gnus-summary-position-point))))
6555 (defun gnus-summary-limit-include-dormant ()
6556 "Display all the hidden articles that are marked as dormant.
6557 Note that this command only works on a subset of the articles currently
6558 fetched for this group."
6560 (unless gnus-newsgroup-dormant
6561 (error "There are no dormant articles in this group"))
6563 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
6564 (gnus-summary-position-point)))
6566 (defun gnus-summary-limit-exclude-dormant ()
6567 "Hide all dormant articles."
6570 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
6571 (gnus-summary-position-point)))
6573 (defun gnus-summary-limit-exclude-childless-dormant ()
6574 "Hide all dormant articles that have no children."
6576 (let ((data (gnus-data-list t
))
6577 articles d children
)
6578 ;; Find all articles that are either not dormant or have
6580 (while (setq d
(pop data
))
6581 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
6583 (gnus-article-children (gnus-data-number d
)))
6586 (when (memq (car children
) articles
)
6591 (push (gnus-data-number d
) articles
)))
6594 (gnus-summary-limit articles
)
6595 (gnus-summary-position-point))))
6597 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
6598 "Mark all unread excluded articles as read.
6599 If ALL, mark even excluded ticked and dormants as read."
6601 (let ((articles (gnus-sorted-complement
6603 (mapcar (lambda (h) (mail-header-number h
))
6604 gnus-newsgroup-headers
)
6606 (sort gnus-newsgroup-limit
'<)))
6608 (setq gnus-newsgroup-unreads
6609 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit
))
6611 (setq gnus-newsgroup-dormant nil
6612 gnus-newsgroup-marked nil
6613 gnus-newsgroup-reads
6615 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
6616 gnus-newsgroup-reads
))
6617 (while (setq article
(pop articles
))
6618 (unless (or (memq article gnus-newsgroup-dormant
)
6619 (memq article gnus-newsgroup-marked
))
6620 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
6622 (defun gnus-summary-limit (articles &optional pop
)
6624 ;; We pop the previous limit off the stack and use that.
6625 (setq articles
(car gnus-newsgroup-limits
)
6626 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
6627 ;; We use the new limit, so we push the old limit on the stack.
6628 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
6630 (setq gnus-newsgroup-limit articles
)
6631 (let ((total (length gnus-newsgroup-data
))
6632 (data (gnus-data-find-list (gnus-summary-article-number)))
6633 (gnus-summary-mark-below nil
) ; Inhibit this.
6635 ;; This will do all the work of generating the new summary buffer
6636 ;; according to the new limit.
6637 (gnus-summary-prepare)
6638 ;; Hide any threads, possibly.
6639 (and gnus-show-threads
6640 gnus-thread-hide-subtree
6641 (gnus-summary-hide-all-threads))
6642 ;; Try to return to the article you were at, or one in the
6645 ;; We try to find some article after the current one.
6647 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
6650 (setq data
(cdr data
))))
6652 ;; If there is no data, that means that we were after the last
6653 ;; article. The same goes when we can't find any articles
6654 ;; after the current one.
6655 (goto-char (point-max))
6656 (gnus-summary-find-prev))
6657 (gnus-set-mode-line 'summary
)
6658 ;; We return how many articles were removed from the summary
6659 ;; buffer as a result of the new limit.
6660 (- total
(length gnus-newsgroup-data
))))
6662 (defsubst gnus-invisible-cut-children
(threads)
6665 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
6670 (defsubst gnus-cut-thread
(thread)
6671 "Go forwards in the thread until we find an article that we want to display."
6672 (when (or (eq gnus-fetch-old-headers
'some
)
6673 (eq gnus-fetch-old-headers
'invisible
)
6674 (numberp gnus-fetch-old-headers
)
6675 (eq gnus-build-sparse-threads
'some
)
6676 (eq gnus-build-sparse-threads
'more
))
6677 ;; Deal with old-fetched headers and sparse threads.
6681 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
6682 (gnus-summary-article-ancient-p
6683 (mail-header-number (car thread
))))
6684 (if (or (<= (length (cdr thread
)) 1)
6685 (eq gnus-fetch-old-headers
'invisible
))
6686 (setq gnus-newsgroup-limit
6687 (delq (mail-header-number (car thread
))
6688 gnus-newsgroup-limit
)
6689 thread
(cadr thread
))
6690 (when (gnus-invisible-cut-children (cdr thread
))
6691 (let ((th (cdr thread
)))
6693 (if (memq (mail-header-number (caar th
))
6694 gnus-newsgroup-limit
)
6695 (setq thread
(car th
)
6697 (setq th
(cdr th
))))))))))
6700 (defun gnus-cut-threads (threads)
6701 "Cut off all uninteresting articles from the beginning of threads."
6702 (when (or (eq gnus-fetch-old-headers
'some
)
6703 (eq gnus-fetch-old-headers
'invisible
)
6704 (numberp gnus-fetch-old-headers
)
6705 (eq gnus-build-sparse-threads
'some
)
6706 (eq gnus-build-sparse-threads
'more
))
6709 (setcar th
(gnus-cut-thread (car th
)))
6710 (setq th
(cdr th
)))))
6711 ;; Remove nixed out threads.
6714 (defun gnus-summary-initial-limit (&optional show-if-empty
)
6715 "Figure out what the initial limit is supposed to be on group entry.
6716 This entails weeding out unwanted dormants, low-scored articles,
6717 fetch-old-headers verbiage, and so on."
6718 ;; Most groups have nothing to remove.
6719 (if (or gnus-inhibit-limiting
6720 (and (null gnus-newsgroup-dormant
)
6721 (not (eq gnus-fetch-old-headers
'some
))
6722 (not (numberp gnus-fetch-old-headers
))
6723 (not (eq gnus-fetch-old-headers
'invisible
))
6724 (null gnus-summary-expunge-below
)
6725 (not (eq gnus-build-sparse-threads
'some
))
6726 (not (eq gnus-build-sparse-threads
'more
))
6727 (null gnus-thread-expunge-below
)
6728 (not gnus-use-nocem
)))
6730 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
6731 (setq gnus-newsgroup-limit nil
)
6734 (unless (car (symbol-value node
))
6735 ;; These threads have no parents -- they are roots.
6736 (let ((nodes (cdr (symbol-value node
)))
6739 (if (and gnus-thread-expunge-below
6740 (< (gnus-thread-total-score (car nodes
))
6741 gnus-thread-expunge-below
))
6742 (gnus-expunge-thread (pop nodes
))
6743 (setq thread
(pop nodes
))
6744 (gnus-summary-limit-children thread
))))))
6745 gnus-newsgroup-dependencies
)
6746 ;; If this limitation resulted in an empty group, we might
6747 ;; pop the previous limit and use it instead.
6748 (when (and (not gnus-newsgroup-limit
)
6750 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
6751 gnus-newsgroup-limit
))
6753 (defun gnus-summary-limit-children (thread)
6754 "Return 1 if this subthread is visible and 0 if it is not."
6755 ;; First we get the number of visible children to this thread. This
6756 ;; is done by recursing down the thread using this function, so this
6757 ;; will really go down to a leaf article first, before slowly
6758 ;; working its way up towards the root.
6762 (apply '+ (mapcar 'gnus-summary-limit-children
6765 (number (mail-header-number (car thread
)))
6768 (not (memq number gnus-newsgroup-marked
))
6770 ;; If this article is dormant and has absolutely no visible
6771 ;; children, then this article isn't visible.
6772 (and (memq number gnus-newsgroup-dormant
)
6774 ;; If this is "fetch-old-headered" and there is no
6775 ;; visible children, then we don't want this article.
6776 (and (or (eq gnus-fetch-old-headers
'some
)
6777 (numberp gnus-fetch-old-headers
))
6778 (gnus-summary-article-ancient-p number
)
6780 ;; If this is "fetch-old-headered" and `invisible', then
6781 ;; we don't want this article.
6782 (and (eq gnus-fetch-old-headers
'invisible
)
6783 (gnus-summary-article-ancient-p number
))
6784 ;; If this is a sparsely inserted article with no children,
6785 ;; we don't want it.
6786 (and (eq gnus-build-sparse-threads
'some
)
6787 (gnus-summary-article-sparse-p number
)
6789 ;; If we use expunging, and this article is really
6790 ;; low-scored, then we don't want this article.
6791 (when (and gnus-summary-expunge-below
6793 (or (cdr (assq number gnus-newsgroup-scored
))
6794 gnus-summary-default-score
))
6795 gnus-summary-expunge-below
))
6796 ;; We increase the expunge-tally here, but that has
6797 ;; nothing to do with the limits, really.
6798 (incf gnus-newsgroup-expunged-tally
)
6799 ;; We also mark as read here, if that's wanted.
6800 (when (and gnus-summary-mark-below
6801 (< score gnus-summary-mark-below
))
6802 (setq gnus-newsgroup-unreads
6803 (delq number gnus-newsgroup-unreads
))
6804 (if gnus-newsgroup-auto-expire
6805 (push number gnus-newsgroup-expirable
)
6806 (push (cons number gnus-low-score-mark
)
6807 gnus-newsgroup-reads
)))
6809 ;; Check NoCeM things.
6810 (if (and gnus-use-nocem
6811 (gnus-nocem-unwanted-article-p
6812 (mail-header-id (car thread
))))
6814 (setq gnus-newsgroup-unreads
6815 (delq number gnus-newsgroup-unreads
))
6817 ;; Nope, invisible article.
6819 ;; Ok, this article is to be visible, so we add it to the limit
6821 (push number gnus-newsgroup-limit
)
6824 (defun gnus-expunge-thread (thread)
6825 "Mark all articles in THREAD as read."
6826 (let* ((number (mail-header-number (car thread
))))
6827 (incf gnus-newsgroup-expunged-tally
)
6828 ;; We also mark as read here, if that's wanted.
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
)))
6835 ;; Go recursively through all subthreads.
6836 (mapcar 'gnus-expunge-thread
(cdr thread
)))
6838 ;; Summary article oriented commands
6840 (defun gnus-summary-refer-parent-article (n)
6841 "Refer parent article N times.
6842 If N is negative, go to ancestor -N instead.
6843 The difference between N and the number of articles fetched is returned."
6847 (when (not (natnump n
))
6852 (setq header
(gnus-summary-article-header))
6853 (if (and (eq (mail-header-number header
)
6854 (cdr gnus-article-current
))
6855 (equal gnus-newsgroup-name
6856 (car gnus-article-current
)))
6857 ;; If we try to find the parent of the currently
6858 ;; displayed article, then we take a look at the actual
6859 ;; References header, since this is slightly more
6860 ;; reliable than the References field we got from the
6863 (set-buffer gnus-original-article-buffer
)
6864 (nnheader-narrow-to-headers)
6865 (unless (setq ref
(message-fetch-field "references"))
6866 (setq ref
(message-fetch-field "in-reply-to")))
6869 ;; It's not the current article, so we take a bet on
6870 ;; the value we got from the server.
6871 (mail-header-references header
)))
6873 (not (equal ref
"")))
6874 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
6875 (gnus-message 1 "Couldn't find parent"))
6876 (gnus-message 1 "No references in article %d"
6877 (gnus-summary-article-number))
6880 (gnus-summary-position-point)
6883 (defun gnus-summary-refer-references ()
6884 "Fetch all articles mentioned in the References header.
6885 Return the number of articles fetched."
6887 (let ((ref (mail-header-references (gnus-summary-article-header)))
6888 (current (gnus-summary-article-number))
6892 (error "No References in the current article")
6893 ;; For each Message-ID in the References header...
6894 (while (string-match "<[^>]*>" ref
)
6896 ;; ... fetch that article.
6897 (gnus-summary-refer-article
6898 (prog1 (match-string 0 ref
)
6899 (setq ref
(substring ref
(match-end 0))))))
6900 (gnus-summary-goto-subject current
)
6901 (gnus-summary-position-point)
6904 (defun gnus-summary-refer-thread (&optional limit
)
6905 "Fetch all articles in the current thread.
6906 If LIMIT (the numerical prefix), fetch that many old headers instead
6907 of what's specified by the `gnus-refer-thread-limit' variable."
6909 (let ((id (mail-header-id (gnus-summary-article-header)))
6910 (limit (if limit
(prefix-numeric-value limit
)
6911 gnus-refer-thread-limit
)))
6912 ;; We want to fetch LIMIT *old* headers, but we also have to
6913 ;; re-fetch all the headers in the current buffer, because many of
6914 ;; them may be undisplayed. So we adjust LIMIT.
6915 (when (numberp limit
)
6916 (incf limit
(- gnus-newsgroup-end gnus-newsgroup-begin
)))
6917 (unless (eq gnus-fetch-old-headers
'invisible
)
6918 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
6919 ;; Retrieve the headers and read them in.
6920 (if (eq (gnus-retrieve-headers
6921 (list gnus-newsgroup-end
) gnus-newsgroup-name limit
)
6923 (gnus-build-all-threads)
6924 (error "Can't fetch thread from backends that don't support NOV"))
6925 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
6926 (gnus-summary-limit-include-thread id
)))
6928 (defun gnus-summary-refer-article (message-id)
6929 "Fetch an article specified by MESSAGE-ID."
6930 (interactive "sMessage-ID: ")
6931 (when (and (stringp message-id
)
6932 (not (zerop (length message-id
))))
6933 ;; Construct the correct Message-ID if necessary.
6934 ;; Suggested by tale@pawl.rpi.edu.
6935 (unless (string-match "^<" message-id
)
6936 (setq message-id
(concat "<" message-id
)))
6937 (unless (string-match ">$" message-id
)
6938 (setq message-id
(concat message-id
">")))
6939 (let* ((header (gnus-id-to-header message-id
))
6941 (gnus-summary-article-sparse-p
6942 (mail-header-number header
))
6943 (memq (mail-header-number header
)
6944 gnus-newsgroup-limit
)))
6947 ;; If the article is present in the buffer we just go to it.
6949 (or (not (gnus-summary-article-sparse-p
6950 (mail-header-number header
)))
6953 (gnus-summary-goto-article
6954 (mail-header-number header
) nil t
)
6956 (gnus-summary-update-article (mail-header-number header
)))))
6958 ;; We fetch the article.
6960 (dolist (gnus-override-method (gnus-refer-article-methods))
6961 (gnus-check-server gnus-override-method
)
6962 ;; Fetch the header, and display the article.
6963 (when (setq number
(gnus-summary-insert-subject message-id
))
6964 (gnus-summary-select-article nil nil nil number
)
6966 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
6968 (defun gnus-refer-article-methods ()
6969 "Return a list of referrable methods."
6971 ;; No method, so we default to current and native.
6972 ((null gnus-refer-article-method
)
6973 (list gnus-current-select-method gnus-select-method
))
6975 ((eq 'current gnus-refer-article-method
)
6976 (list gnus-current-select-method
))
6977 ;; List of select methods.
6978 ((not (and (symbolp (car gnus-refer-article-method
))
6979 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
6981 (dolist (method gnus-refer-article-method
)
6982 (push (if (eq 'current method
)
6983 gnus-current-select-method
6987 ;; One single select method.
6989 (list gnus-refer-article-method
))))
6991 (defun gnus-summary-edit-parameters ()
6992 "Edit the group parameters of the current group."
6994 (gnus-group-edit-group gnus-newsgroup-name
'params
))
6996 (defun gnus-summary-customize-parameters ()
6997 "Customize the group parameters of the current group."
6999 (gnus-group-customize gnus-newsgroup-name
))
7001 (defun gnus-summary-enter-digest-group (&optional force
)
7002 "Enter an nndoc group based on the current article.
7003 If FORCE, force a digest interpretation. If not, try
7004 to guess what the document format is."
7006 (let ((conf gnus-current-window-configuration
))
7008 (gnus-summary-select-article))
7009 (setq gnus-current-window-configuration conf
)
7010 (let* ((name (format "%s-%d"
7011 (gnus-group-prefixed-name
7012 gnus-newsgroup-name
(list 'nndoc
""))
7014 (set-buffer gnus-summary-buffer
)
7015 gnus-current-article
)))
7016 (ogroup gnus-newsgroup-name
)
7017 (params (append (gnus-info-params (gnus-get-info ogroup
))
7018 (list (cons 'to-group ogroup
))
7019 (list (cons 'save-article-group ogroup
))))
7020 (case-fold-search t
)
7021 (buf (current-buffer))
7024 (set-buffer gnus-original-article-buffer
)
7025 ;; Have the digest group inherit the main mail address of
7026 ;; the parent article.
7027 (when (setq to-address
(or (message-fetch-field "reply-to")
7028 (message-fetch-field "from")))
7029 (setq params
(append
7030 (list (cons 'to-address
7031 (funcall gnus-decode-encoded-word-function
7033 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
7034 (insert-buffer-substring gnus-original-article-buffer
)
7035 ;; Remove lines that may lead nndoc to misinterpret the
7038 (goto-char (point-min))
7039 (or (search-forward "\n\n" nil t
) (point)))
7040 (goto-char (point-min))
7041 (delete-matching-lines "^Path:\\|^From ")
7044 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
7045 (gnus-newsgroup-ephemeral-ignored-charsets
7046 gnus-newsgroup-ignored-charsets
))
7047 (gnus-group-read-ephemeral-group
7048 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
7050 ,(if force
'mbox
'guess
))) t
))
7051 ;; Make all postings to this group go to the parent group.
7052 (nconc (gnus-info-params (gnus-get-info name
))
7054 ;; Couldn't select this doc group.
7055 (switch-to-buffer buf
)
7056 (gnus-set-global-variables)
7057 (gnus-configure-windows 'summary
)
7058 (gnus-message 3 "Article couldn't be entered?"))
7059 (kill-buffer dig
)))))
7061 (defun gnus-summary-read-document (n)
7062 "Open a new group based on the current article(s).
7063 This will allow you to read digests and other similar
7064 documents as newsgroups.
7065 Obeys the standard process/prefix convention."
7067 (let* ((articles (gnus-summary-work-articles n
))
7068 (ogroup gnus-newsgroup-name
)
7069 (params (append (gnus-info-params (gnus-get-info ogroup
))
7070 (list (cons 'to-group ogroup
))))
7071 article group egroup groups vgroup
)
7072 (while (setq article
(pop articles
))
7073 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
7074 (gnus-summary-remove-process-mark article
)
7075 (when (gnus-summary-display-article article
)
7078 (insert-buffer-substring gnus-original-article-buffer
)
7079 ;; Remove some headers that may lead nndoc to make
7081 (message-narrow-to-head)
7082 (goto-char (point-min))
7083 (delete-matching-lines "^\\(Path\\):\\|^From ")
7086 (gnus-group-read-ephemeral-group
7087 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
7088 (nndoc-article-type guess
))
7091 ;; Make all postings to this group go to the parent group.
7092 (nconc (gnus-info-params (gnus-get-info egroup
))
7094 (push egroup groups
))
7095 ;; Couldn't select this doc group.
7096 (gnus-error 3 "Article couldn't be entered"))))))
7097 ;; Now we have selected all the documents.
7100 (error "None of the articles could be interpreted as documents"))
7101 ((gnus-group-read-ephemeral-group
7102 (setq vgroup
(format
7103 "nnvirtual:%s-%s" gnus-newsgroup-name
7104 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7105 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
7107 (cons (current-buffer) 'summary
)))
7109 (error "Couldn't select virtual nndoc group")))))
7111 (defun gnus-summary-isearch-article (&optional regexp-p
)
7112 "Do incremental search forward on the current article.
7113 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7115 (gnus-summary-select-article)
7116 (gnus-configure-windows 'article
)
7117 (gnus-eval-in-buffer-window gnus-article-buffer
7120 (isearch-forward regexp-p
))))
7122 (defun gnus-summary-search-article-forward (regexp &optional backward
)
7123 "Search for an article containing REGEXP forward.
7124 If BACKWARD, search backward instead."
7127 (format "Search article %s (regexp%s): "
7128 (if current-prefix-arg
"backward" "forward")
7129 (if gnus-last-search-regexp
7130 (concat ", default " gnus-last-search-regexp
)
7132 current-prefix-arg
))
7133 (if (string-equal regexp
"")
7134 (setq regexp
(or gnus-last-search-regexp
""))
7135 (setq gnus-last-search-regexp regexp
))
7136 (if (gnus-summary-search-article regexp backward
)
7137 (gnus-summary-show-thread)
7138 (error "Search failed: \"%s\"" regexp
)))
7140 (defun gnus-summary-search-article-backward (regexp)
7141 "Search for an article containing REGEXP backward."
7144 (format "Search article backward (regexp%s): "
7145 (if gnus-last-search-regexp
7146 (concat ", default " gnus-last-search-regexp
)
7148 (gnus-summary-search-article-forward regexp
'backward
))
7150 (defun gnus-summary-search-article (regexp &optional backward
)
7151 "Search for an article containing REGEXP.
7152 Optional argument BACKWARD means do search for backward.
7153 `gnus-select-article-hook' is not called during the search."
7154 ;; We have to require this here to make sure that the following
7155 ;; dynamic binding isn't shadowed by autoloading.
7156 (require 'gnus-async
)
7158 (let ((gnus-select-article-hook nil
) ;Disable hook.
7159 (gnus-article-prepare-hook nil
)
7160 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
7161 (gnus-use-article-prefetch nil
)
7162 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
7163 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
7164 (sum (current-buffer))
7165 (gnus-display-mime-function nil
)
7168 (gnus-save-hidden-threads
7169 (gnus-summary-select-article)
7170 (set-buffer gnus-article-buffer
)
7171 (goto-char (window-point (get-buffer-window (current-buffer))))
7175 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
7177 (re-search-backward regexp nil t
)
7178 (re-search-forward regexp nil t
))
7179 ;; We found the regexp.
7184 (get-buffer-window (current-buffer))
7188 (get-buffer-window (current-buffer))
7191 (setq point
(point)))
7192 ;; We didn't find it, so we go to the next article.
7195 (while (eq found
'not
)
7196 (if (not (if backward
(gnus-summary-find-prev)
7197 (gnus-summary-find-next)))
7198 ;; No more articles.
7200 ;; Select the next article and adjust point.
7201 (unless (gnus-summary-article-sparse-p
7202 (gnus-summary-article-number))
7204 (gnus-summary-select-article)
7205 (set-buffer gnus-article-buffer
)
7207 (goto-char (if backward
(point-max) (point-min))))))))
7208 (gnus-message 7 ""))
7209 ;; Return whether we found the regexp.
7210 (when (eq found
'found
)
7212 (gnus-summary-show-thread)
7213 (gnus-summary-goto-subject gnus-current-article
)
7214 (gnus-summary-position-point)
7217 (defun gnus-summary-find-matching (header regexp
&optional backward unread
7219 "Return a list of all articles that match REGEXP on HEADER.
7220 The search stars on the current article and goes forwards unless
7221 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7222 If UNREAD is non-nil, only unread articles will
7223 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7224 in the comparisons."
7225 (let ((data (if (eq backward
'all
) gnus-newsgroup-data
7226 (gnus-data-find-list
7227 (gnus-summary-article-number) (gnus-data-list backward
))))
7228 (case-fold-search (not not-case-fold
))
7231 (if (eq (car header
) 'extra
)
7234 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
7236 (error "%s is an invalid header" header
))
7237 (unless (fboundp (intern (concat "mail-header-" header
)))
7238 (error "%s is not a valid header" header
))
7239 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
7242 (and (or (not unread
) ; We want all articles...
7243 (gnus-data-unread-p d
)) ; Or just unreads.
7244 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
7245 (string-match regexp
(funcall func
(gnus-data-header d
))) ; Match.
7246 (push (gnus-data-number d
) articles
)) ; Success!
7247 (setq data
(cdr data
)))
7248 (nreverse articles
)))
7250 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
7251 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7252 If HEADER is an empty string (or nil), the match is done on the entire
7253 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7255 (list (let ((completion-ignore-case t
))
7258 (mapcar (lambda (string) (list string
))
7259 '("Number" "Subject" "From" "Lines" "Date"
7260 "Message-ID" "Xref" "References" "Body"))
7261 nil
'require-match
))
7262 (read-string "Regexp: ")
7263 (read-key-sequence "Command: ")
7264 current-prefix-arg
))
7265 (when (equal header
"Body")
7267 ;; Hidden thread subtrees must be searched as well.
7268 (gnus-summary-show-all-threads)
7269 ;; We don't want to change current point nor window configuration.
7271 (save-window-excursion
7272 (gnus-message 6 "Executing %s..." (key-description command
))
7273 ;; We'd like to execute COMMAND interactively so as to give arguments.
7274 (gnus-execute header regexp
7275 `(call-interactively ',(key-binding command
))
7277 (gnus-message 6 "Executing %s...done" (key-description command
)))))
7279 (defun gnus-summary-beginning-of-article ()
7280 "Scroll the article back to the beginning."
7282 (gnus-summary-select-article)
7283 (gnus-configure-windows 'article
)
7284 (gnus-eval-in-buffer-window gnus-article-buffer
7286 (goto-char (point-min))
7287 (when gnus-page-broken
7288 (gnus-narrow-to-page))))
7290 (defun gnus-summary-end-of-article ()
7291 "Scroll to the end of the article."
7293 (gnus-summary-select-article)
7294 (gnus-configure-windows 'article
)
7295 (gnus-eval-in-buffer-window gnus-article-buffer
7297 (goto-char (point-max))
7299 (when gnus-page-broken
7300 (gnus-narrow-to-page))))
7302 (defun gnus-summary-print-article (&optional filename n
)
7303 "Generate and print a PostScript image of the N next (mail) articles.
7305 If N is negative, print the N previous articles. If N is nil and articles
7306 have been marked with the process mark, print these instead.
7308 If the optional first argument FILENAME is nil, send the image to the
7309 printer. If FILENAME is a string, save the PostScript image in a file with
7310 that name. If FILENAME is a number, prompt the user for the name of the file
7312 (interactive (list (ps-print-preprint current-prefix-arg
)))
7313 (dolist (article (gnus-summary-work-articles n
))
7314 (gnus-summary-select-article nil nil
'pseudo article
)
7315 (gnus-eval-in-buffer-window gnus-article-buffer
7316 (let ((buffer (generate-new-buffer " *print*")))
7319 (copy-to-buffer buffer
(point-min) (point-max))
7321 (gnus-article-delete-invisible-text)
7322 (let ((ps-left-header
7325 (mail-header-subject gnus-current-headers
) ")")
7327 (mail-header-from gnus-current-headers
) ")")))
7330 "/pagenumberstring load"
7332 (mail-header-date gnus-current-headers
) ")"))))
7333 (gnus-run-hooks 'gnus-ps-print-hook
)
7335 (ps-spool-buffer-with-faces))))
7336 (kill-buffer buffer
))))
7337 (gnus-summary-remove-process-mark article
))
7338 (ps-despool filename
))
7340 (defun gnus-summary-show-article (&optional arg
)
7341 "Force re-fetching of the current article.
7342 If ARG (the prefix) is a number, show the article with the charset
7343 defined in `gnus-summary-show-article-charset-alist', or the charset
7345 If ARG (the prefix) is non-nil and not a number, show the raw article
7346 without any article massaging functions being run."
7350 (let ((gnus-newsgroup-charset
7351 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
7352 (read-coding-system "Charset: ")))
7353 (gnus-newsgroup-ignored-charsets 'gnus-all
))
7354 (gnus-summary-select-article nil
'force
)))
7356 ;; Select the article the normal way.
7357 (gnus-summary-select-article nil
'force
))
7359 ;; We have to require this here to make sure that the following
7360 ;; dynamic binding isn't shadowed by autoloading.
7361 (require 'gnus-async
)
7363 ;; Bind the article treatment functions to nil.
7364 (let ((gnus-have-all-headers t
)
7365 gnus-article-prepare-hook
7366 gnus-article-decode-hook
7367 gnus-display-mime-function
7369 ;; Destroy any MIME parts.
7370 (when (gnus-buffer-live-p gnus-article-buffer
)
7372 (set-buffer gnus-article-buffer
)
7373 (mm-destroy-parts gnus-article-mime-handles
)
7374 ;; Set it to nil for safety reason.
7375 (setq gnus-article-mime-handle-alist nil
)
7376 (setq gnus-article-mime-handles nil
)))
7377 (gnus-summary-select-article nil
'force
))))
7378 (gnus-summary-goto-subject gnus-current-article
)
7379 (gnus-summary-position-point))
7381 (defun gnus-summary-verbose-headers (&optional arg
)
7382 "Toggle permanent full header display.
7383 If ARG is a positive number, turn header display on.
7384 If ARG is a negative number, turn header display off."
7386 (setq gnus-show-all-headers
7387 (cond ((or (not (numberp arg
))
7389 (not gnus-show-all-headers
))
7392 (gnus-summary-show-article))
7394 (defun gnus-summary-toggle-header (&optional arg
)
7395 "Show the headers if they are hidden, or hide them if they are shown.
7396 If ARG is a positive number, show the entire header.
7397 If ARG is a negative number, hide the unwanted header lines."
7400 (set-buffer gnus-article-buffer
)
7402 (let* ((buffer-read-only nil
)
7403 (inhibit-point-motion-hooks t
)
7409 (article-narrow-to-head)
7410 (gnus-article-hidden-text-p 'headers
))))
7411 (goto-char (point-min))
7412 (when (search-forward "\n\n" nil t
)
7413 (delete-region (point-min) (1- (point))))
7414 (goto-char (point-min))
7416 (set-buffer gnus-original-article-buffer
)
7417 (goto-char (point-min))
7418 (setq e
(1- (or (search-forward "\n\n" nil t
) (point-max)))))
7419 (insert-buffer-substring gnus-original-article-buffer
1 e
)
7421 (narrow-to-region (point-min) (point))
7422 (article-decode-encoded-words)
7424 (let ((gnus-treat-hide-headers nil
)
7425 (gnus-treat-hide-boring-headers nil
))
7426 (setq gnus-article-wash-types
7427 (delq 'headers gnus-article-wash-types
))
7428 (gnus-treat-article 'head
))
7429 (gnus-treat-article 'head
)))
7430 (gnus-set-mode-line 'article
)))))
7432 (defun gnus-summary-show-all-headers ()
7433 "Make all header lines visible."
7435 (gnus-article-show-all-headers))
7437 (defun gnus-summary-caesar-message (&optional arg
)
7438 "Caesar rotate the current article by 13.
7439 The numerical prefix specifies how many places to rotate each letter
7442 (gnus-summary-select-article)
7443 (let ((mail-header-separator ""))
7444 (gnus-eval-in-buffer-window gnus-article-buffer
7447 (let ((start (window-start))
7449 (message-caesar-buffer-body arg
)
7450 (set-window-start (get-buffer-window (current-buffer)) start
))))))
7452 (defun gnus-summary-stop-page-breaking ()
7453 "Stop page breaking in the current article."
7455 (gnus-summary-select-article)
7456 (gnus-eval-in-buffer-window gnus-article-buffer
7458 (when (gnus-visual-p 'page-marker
)
7459 (let ((buffer-read-only nil
))
7460 (gnus-remove-text-with-property 'gnus-prev
)
7461 (gnus-remove-text-with-property 'gnus-next
))
7462 (setq gnus-page-broken nil
))))
7464 (defun gnus-summary-move-article (&optional n to-newsgroup
7465 select-method action
)
7466 "Move the current article to a different newsgroup.
7467 If N is a positive number, move the N next articles.
7468 If N is a negative number, move the N previous articles.
7469 If N is nil and any articles have been marked with the process mark,
7470 move those articles instead.
7471 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7472 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7473 re-spool using this method.
7475 For this function to work, both the current newsgroup and the
7476 newsgroup that you want to move to have to support the `request-move'
7477 and `request-accept' functions.
7479 ACTION can be either `move' (the default), `crosspost' or `copy'."
7482 (setq action
'move
))
7483 ;; Disable marking as read.
7484 (let (gnus-mark-article-hook)
7485 (save-window-excursion
7486 (gnus-summary-select-article)))
7487 ;; Check whether the source group supports the required functions.
7488 (cond ((and (eq action
'move
)
7489 (not (gnus-check-backend-function
7490 'request-move-article gnus-newsgroup-name
)))
7491 (error "The current group does not support article moving"))
7492 ((and (eq action
'crosspost
)
7493 (not (gnus-check-backend-function
7494 'request-replace-article gnus-newsgroup-name
)))
7495 (error "The current group does not support article editing")))
7496 (let ((articles (gnus-summary-work-articles n
))
7497 (prefix (if (gnus-check-backend-function
7498 'request-move-article gnus-newsgroup-name
)
7499 (gnus-group-real-prefix gnus-newsgroup-name
)
7501 (names '((move "Move" "Moving")
7502 (copy "Copy" "Copying")
7503 (crosspost "Crosspost" "Crossposting")))
7504 (copy-buf (save-excursion
7505 (nnheader-set-temp-buffer " *copy article*")))
7506 art-group to-method new-xref article to-groups
)
7507 (unless (assq action names
)
7508 (error "Unknown action %s" action
))
7509 ;; Read the newsgroup name.
7510 (when (and (not to-newsgroup
)
7511 (not select-method
))
7513 (gnus-read-move-group-name
7514 (cadr (assq action names
))
7515 (symbol-value (intern (format "gnus-current-%s-group" action
)))
7517 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
7518 (setq to-method
(or select-method
7519 (gnus-server-to-method
7520 (gnus-group-method to-newsgroup
))))
7521 ;; Check the method we are to move this article to...
7522 (unless (gnus-check-backend-function
7523 'request-accept-article
(car to-method
))
7524 (error "%s does not support article copying" (car to-method
)))
7525 (unless (gnus-check-server to-method
)
7526 (error "Can't open server %s" (car to-method
)))
7527 (gnus-message 6 "%s to %s: %s..."
7528 (caddr (assq action names
))
7529 (or (car select-method
) to-newsgroup
) articles
)
7531 (setq article
(pop articles
))
7535 ;; Move the article.
7537 ;; Remove this article from future suppression.
7538 (gnus-dup-unsuppress-article article
)
7539 (gnus-request-move-article
7540 article
; Article to move
7541 gnus-newsgroup-name
; From newsgroup
7542 (nth 1 (gnus-find-method-for-group
7543 gnus-newsgroup-name
)) ; Server
7544 (list 'gnus-request-accept-article
7545 to-newsgroup
(list 'quote select-method
)
7546 (not articles
) t
) ; Accept form
7547 (not articles
))) ; Only save nov last time
7548 ;; Copy the article.
7551 (set-buffer copy-buf
)
7552 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7553 (gnus-request-accept-article
7554 to-newsgroup select-method
(not articles
) t
))))
7555 ;; Crosspost the article.
7556 ((eq action
'crosspost
)
7557 (let ((xref (message-tokenize-header
7558 (mail-header-xref (gnus-summary-article-header article
))
7560 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
7563 (setq xref
(list (system-name))))
7566 (mapconcat 'identity
7567 (delete "Xref:" (delete new-xref xref
))
7571 (set-buffer copy-buf
)
7572 ;; First put the article in the destination group.
7573 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7574 (when (consp (setq art-group
7575 (gnus-request-accept-article
7576 to-newsgroup select-method
(not articles
))))
7577 (setq new-xref
(concat new-xref
" " (car art-group
)
7578 ":" (cdr art-group
)))
7579 ;; Now we have the new Xrefs header, so we insert
7580 ;; it and replace the new article.
7581 (nnheader-replace-header "Xref" new-xref
)
7582 (gnus-request-replace-article
7583 (cdr art-group
) to-newsgroup
(current-buffer))
7587 (gnus-message 1 "Couldn't %s article %s: %s"
7588 (cadr (assq action names
)) article
7589 (nnheader-get-report (car to-method
))))
7590 ((eq art-group
'junk
)
7591 (when (eq action
'move
)
7592 (gnus-summary-mark-article article gnus-canceled-mark
)
7593 (gnus-message 4 "Deleted article %s" article
)))
7595 (let* ((pto-group (gnus-group-prefixed-name
7596 (car art-group
) to-method
))
7598 (gnus-gethash pto-group gnus-newsrc-hashtb
))
7599 (info (nth 2 entry
))
7600 (to-group (gnus-info-group info
))
7602 ;; Update the group that has been moved to.
7604 (memq action
'(move copy
)))
7605 (unless (member to-group to-groups
)
7606 (push to-group to-groups
))
7608 (unless (memq article gnus-newsgroup-unreads
)
7609 (push 'read to-marks
)
7611 info
(gnus-add-to-range (gnus-info-read info
)
7612 (list (cdr art-group
)))))
7614 ;; See whether the article is to be put in the cache.
7615 (let ((marks gnus-article-mark-lists
)
7616 (to-article (cdr art-group
)))
7618 ;; Enter the article into the cache in the new group,
7619 ;; if that is required.
7620 (when gnus-use-cache
7621 (gnus-cache-possibly-enter-article
7623 (memq article gnus-newsgroup-marked
)
7624 (memq article gnus-newsgroup-dormant
)
7625 (memq article gnus-newsgroup-unreads
)))
7627 (when gnus-preserve-marks
7628 ;; Copy any marks over to the new group.
7629 (when (and (equal to-group gnus-newsgroup-name
)
7630 (not (memq article gnus-newsgroup-unreads
)))
7631 ;; Mark this article as read in this group.
7632 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
7633 (setcdr (gnus-active to-group
) to-article
)
7634 (setcdr gnus-newsgroup-active to-article
))
7637 (when (memq article
(symbol-value
7638 (intern (format "gnus-newsgroup-%s"
7640 (push (cdar marks
) to-marks
)
7641 ;; If the other group is the same as this group,
7642 ;; then we have to add the mark to the list.
7643 (when (equal to-group gnus-newsgroup-name
)
7644 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
7647 (intern (format "gnus-newsgroup-%s"
7649 ;; Copy the marks to other group.
7650 (gnus-add-marked-articles
7651 to-group
(cdar marks
) (list to-article
) info
))
7652 (setq marks
(cdr marks
)))
7654 (gnus-request-set-mark to-group
(list (list (list to-article
)
7659 (concat "(gnus-group-set-info '"
7660 (gnus-prin1-to-string (gnus-get-info to-group
))
7663 ;; Update the Xref header in this article to point to
7664 ;; the new crossposted article we have just created.
7665 (when (eq action
'crosspost
)
7667 (set-buffer copy-buf
)
7668 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7669 (nnheader-replace-header "Xref" new-xref
)
7670 (gnus-request-replace-article
7671 article gnus-newsgroup-name
(current-buffer)))))
7673 ;;;!!!Why is this necessary?
7674 (set-buffer gnus-summary-buffer
)
7676 (gnus-summary-goto-subject article
)
7677 (when (eq action
'move
)
7678 (gnus-summary-mark-article article gnus-canceled-mark
))))
7679 (gnus-summary-remove-process-mark article
))
7680 ;; Re-activate all groups that have been moved to.
7683 (set-buffer gnus-group-buffer
)
7684 (when (gnus-group-goto-group (car to-groups
) t
)
7685 (gnus-group-get-new-news-this-group 1 t
))
7688 (gnus-kill-buffer copy-buf
)
7689 (gnus-summary-position-point)
7690 (gnus-set-mode-line 'summary
)))
7692 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
7693 "Move the current article to a different newsgroup.
7694 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7695 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7696 re-spool using this method."
7698 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
7700 (defun gnus-summary-crosspost-article (&optional n
)
7701 "Crosspost the current article to some other group."
7703 (gnus-summary-move-article n nil nil
'crosspost
))
7705 (defcustom gnus-summary-respool-default-method nil
7706 "Default method for respooling an article.
7707 If nil, use to the current newsgroup method."
7708 :type
'(choice (gnus-select-method :value
(nnml ""))
7710 :group
'gnus-summary-mail
)
7712 (defun gnus-summary-respool-article (&optional n method
)
7713 "Respool the current article.
7714 The article will be squeezed through the mail spooling process again,
7715 which means that it will be put in some mail newsgroup or other
7716 depending on `nnmail-split-methods'.
7717 If N is a positive number, respool the N next articles.
7718 If N is a negative number, respool the N previous articles.
7719 If N is nil and any articles have been marked with the process mark,
7720 respool those articles instead.
7722 Respooling can be done both from mail groups and \"real\" newsgroups.
7723 In the former case, the articles in question will be moved from the
7724 current group into whatever groups they are destined to. In the
7725 latter case, they will be copied into the relevant groups."
7727 (list current-prefix-arg
7728 (let* ((methods (gnus-methods-using 'respool
))
7730 (symbol-name (or gnus-summary-respool-default-method
7731 (car (gnus-find-method-for-group
7732 gnus-newsgroup-name
)))))
7734 (gnus-completing-read
7735 methname
"What backend do you want to use when respooling?"
7736 methods nil t nil
'gnus-mail-method-history
))
7739 ((zerop (length (setq ms
(gnus-servers-using-backend
7741 (list (intern method
) ""))
7745 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
7746 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
7749 (error "No method given for respooling"))
7750 (if (assoc (symbol-name
7751 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
7752 (gnus-methods-using 'respool
))
7753 (gnus-summary-move-article n nil method
)
7754 (gnus-summary-copy-article n nil method
)))
7756 (defun gnus-summary-import-article (file)
7757 "Import an arbitrary file into a mail newsgroup."
7758 (interactive "fImport file: ")
7759 (let ((group gnus-newsgroup-name
)
7760 (now (current-time))
7762 (unless (gnus-check-backend-function 'request-accept-article group
)
7763 (error "%s does not support article importing" group
))
7764 (or (file-readable-p file
)
7765 (not (file-regular-p file
))
7766 (error "Can't read %s" file
))
7768 (set-buffer (gnus-get-buffer-create " *import file*"))
7770 (nnheader-insert-file-contents file
)
7771 (goto-char (point-min))
7772 (unless (nnheader-article-p)
7773 ;; This doesn't look like an article, so we fudge some headers.
7774 (setq atts
(file-attributes file
)
7775 lines
(count-lines (point-min) (point-max)))
7776 (insert "From: " (read-string "From: ") "\n"
7777 "Subject: " (read-string "Subject: ") "\n"
7778 "Date: " (message-make-date (nth 5 atts
))
7780 "Message-ID: " (message-make-message-id) "\n"
7781 "Lines: " (int-to-string lines
) "\n"
7782 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
7783 (gnus-request-accept-article group nil t
)
7784 (kill-buffer (current-buffer)))))
7786 (defun gnus-summary-article-posted-p ()
7787 "Say whether the current (mail) article is available from news as well.
7788 This will be the case if the article has both been mailed and posted."
7790 (let ((id (mail-header-references (gnus-summary-article-header)))
7791 (gnus-override-method (car (gnus-refer-article-methods))))
7792 (if (gnus-request-head id
"")
7793 (gnus-message 2 "The current message was found on %s"
7794 gnus-override-method
)
7795 (gnus-message 2 "The current message couldn't be found on %s"
7796 gnus-override-method
)
7799 (defun gnus-summary-expire-articles (&optional now
)
7800 "Expire all articles that are marked as expirable in the current group."
7802 (when (gnus-check-backend-function
7803 'request-expire-articles gnus-newsgroup-name
)
7804 ;; This backend supports expiry.
7805 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
7806 (expirable (if total
7808 ;; We need to update the info for
7809 ;; this group for `gnus-list-of-read-articles'
7810 ;; to give us the right answer.
7811 (gnus-run-hooks 'gnus-exit-group-hook
)
7812 (gnus-summary-update-info)
7813 (gnus-list-of-read-articles gnus-newsgroup-name
))
7814 (setq gnus-newsgroup-expirable
7815 (sort gnus-newsgroup-expirable
'<))))
7816 (expiry-wait (if now
'immediate
7817 (gnus-group-find-parameter
7818 gnus-newsgroup-name
'expiry-wait
)))
7819 (nnmail-expiry-target
7820 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
7821 nnmail-expiry-target
))
7824 ;; There are expirable articles in this group, so we run them
7825 ;; through the expiry process.
7826 (gnus-message 6 "Expiring articles...")
7827 (unless (gnus-check-group gnus-newsgroup-name
)
7828 (error "Can't open server for %s" gnus-newsgroup-name
))
7829 ;; The list of articles that weren't expired is returned.
7832 (let ((nnmail-expiry-wait-function nil
)
7833 (nnmail-expiry-wait expiry-wait
))
7834 (setq es
(gnus-request-expire-articles
7835 expirable gnus-newsgroup-name
)))
7836 (setq es
(gnus-request-expire-articles
7837 expirable gnus-newsgroup-name
))))
7839 (setq gnus-newsgroup-expirable es
))
7840 ;; We go through the old list of expirable, and mark all
7841 ;; really expired articles as nonexistent.
7842 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
7843 (let ((gnus-use-cache nil
))
7845 (unless (memq (car expirable
) es
)
7846 (when (gnus-data-find (car expirable
))
7847 (gnus-summary-mark-article
7848 (car expirable
) gnus-canceled-mark
)))
7849 (setq expirable
(cdr expirable
)))))
7850 (gnus-message 6 "Expiring articles...done")))))
7852 (defun gnus-summary-expire-articles-now ()
7853 "Expunge all expirable articles in the current group.
7854 This means that *all* articles that are marked as expirable will be
7855 deleted forever, right now."
7857 (or gnus-expert-user
7859 "Are you really, really, really sure you want to delete all these messages? ")
7861 (gnus-summary-expire-articles t
))
7863 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7864 (defun gnus-summary-delete-article (&optional n
)
7865 "Delete the N next (mail) articles.
7866 This command actually deletes articles. This is not a marking
7867 command. The article will disappear forever from your life, never to
7869 If N is negative, delete backwards.
7870 If N is nil and articles have been marked with the process mark,
7871 delete these instead."
7873 (unless (gnus-check-backend-function 'request-expire-articles
7874 gnus-newsgroup-name
)
7875 (error "The current newsgroup does not support article deletion"))
7876 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
7877 (error "Couldn't open server"))
7878 ;; Compute the list of articles to delete.
7879 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
7881 (if (and gnus-novice-user
7882 (not (gnus-yes-or-no-p
7883 (format "Do you really want to delete %s forever? "
7884 (if (> (length articles
) 1)
7885 (format "these %s articles" (length articles
))
7888 ;; Delete the articles.
7889 (setq not-deleted
(gnus-request-expire-articles
7890 articles gnus-newsgroup-name
'force
))
7892 (gnus-summary-remove-process-mark (car articles
))
7893 ;; The backend might not have been able to delete the article
7895 (unless (memq (car articles
) not-deleted
)
7896 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
7897 (setq articles
(cdr articles
)))
7899 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
7900 (gnus-summary-position-point)
7901 (gnus-set-mode-line 'summary
)
7904 (defun gnus-summary-edit-article (&optional arg
)
7905 "Edit the current article.
7906 This will have permanent effect only in mail groups.
7907 If ARG is nil, edit the decoded articles.
7908 If ARG is 1, edit the raw articles.
7909 If ARG is 2, edit the raw articles even in read-only groups.
7910 Otherwise, allow editing of articles even in read-only
7916 ((eq arg
1) (setq raw t
))
7917 ((eq arg
2) (setq raw t
7920 (if (and raw
(not force
) (equal gnus-newsgroup-name
"nndraft:drafts"))
7921 (error "Can't edit the raw article in group nndraft:drafts."))
7923 (set-buffer gnus-summary-buffer
)
7924 (let ((mail-parse-charset gnus-newsgroup-charset
)
7925 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
7926 (gnus-set-global-variables)
7927 (when (and (not force
)
7928 (gnus-group-read-only-p))
7929 (error "The current newsgroup does not support article editing"))
7930 (gnus-summary-show-article t
)
7931 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
7932 (with-current-buffer gnus-article-buffer
7933 (mm-enable-multibyte-mule4)))
7934 (if (equal gnus-newsgroup-name
"nndraft:drafts")
7936 (gnus-article-edit-article
7939 (let ((mbl mml-buffer-list
))
7940 (setq mml-buffer-list nil
)
7942 (make-local-hook 'kill-buffer-hook
)
7943 (let ((mml-buffer-list mml-buffer-list
))
7944 (setq mml-buffer-list mbl
)
7945 (make-local-variable 'mml-buffer-list
))
7946 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
7947 `(lambda (no-highlight)
7948 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
7949 (mail-parse-ignored-charsets
7950 ',gnus-newsgroup-ignored-charsets
))
7951 ,(if (not raw
) '(progn
7953 (mml-destroy-buffers)
7954 (remove-hook 'kill-buffer-hook
7955 'mml-destroy-buffers t
)
7956 (kill-local-variable 'mml-buffer-list
)))
7957 (gnus-summary-edit-article-done
7958 ,(or (mail-header-references gnus-current-headers
) "")
7959 ,(gnus-group-read-only-p)
7960 ,gnus-summary-buffer no-highlight
))))))))
7962 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
7964 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7966 "Make edits to the current article permanent."
7968 ;; Replace the article.
7969 (let ((buf (current-buffer)))
7971 (insert-buffer-substring buf
)
7972 (if (and (not read-only
)
7973 (not (gnus-request-replace-article
7974 (cdr gnus-article-current
) (car gnus-article-current
)
7975 (current-buffer) t
)))
7976 (error "Couldn't replace article")
7977 ;; Update the summary buffer.
7979 (equal (message-tokenize-header references
" ")
7980 (message-tokenize-header
7981 (or (message-fetch-field "references") "") " ")))
7982 ;; We only have to update this line.
7985 (message-narrow-to-head)
7986 (let ((head (buffer-string))
7989 (insert (format "211 %d Article retrieved.\n"
7990 (cdr gnus-article-current
)))
7993 (let ((nntp-server-buffer (current-buffer)))
7994 (setq header
(car (gnus-get-newsgroup-headers
7996 (set-buffer gnus-summary-buffer
)
7997 gnus-newsgroup-dependencies
)
8000 (set-buffer gnus-summary-buffer
)
8001 (gnus-data-set-header
8002 (gnus-data-find (cdr gnus-article-current
))
8004 (gnus-summary-update-article-line
8005 (cdr gnus-article-current
) header
))))))
8007 (set-buffer (or buffer gnus-summary-buffer
))
8008 (gnus-summary-update-article (cdr gnus-article-current
)))
8009 ;; Prettify the article buffer again.
8010 (unless no-highlight
8012 (set-buffer gnus-article-buffer
)
8013 ;;;!!! Fix this -- article should be rehighlighted.
8014 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8015 (set-buffer gnus-original-article-buffer
)
8016 (gnus-request-article
8017 (cdr gnus-article-current
)
8018 (car gnus-article-current
) (current-buffer))))
8019 ;; Prettify the summary buffer line.
8020 (when (gnus-visual-p 'summary-highlight
'highlight
)
8021 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
8023 (defun gnus-summary-edit-wash (key)
8024 "Perform editing command KEY in the article buffer."
8028 (message "%s" (concat (this-command-keys) "- "))
8031 (gnus-summary-edit-article)
8032 (execute-kbd-macro (concat (this-command-keys) key
))
8033 (gnus-article-edit-done))
8037 (defun gnus-summary-respool-query (&optional silent trace
)
8038 "Query where the respool algorithm would put this article."
8040 (let (gnus-mark-article-hook)
8041 (gnus-summary-select-article)
8043 (set-buffer gnus-original-article-buffer
)
8045 (message-narrow-to-head)
8046 (let ((groups (nnmail-article-group 'identity trace
)))
8049 (message "This message would go to %s"
8050 (mapconcat 'car groups
", "))
8051 (message "This message would go to no groups"))
8054 (defun gnus-summary-respool-trace ()
8055 "Trace where the respool algorithm would put this article.
8056 Display a buffer showing all fancy splitting patterns which matched."
8058 (gnus-summary-respool-query nil t
))
8060 ;; Summary marking commands.
8062 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
8063 "Mark articles which has the same subject as read, and then select the next.
8064 If UNMARK is positive, remove any kind of mark.
8065 If UNMARK is negative, tick articles."
8068 (setq unmark
(prefix-numeric-value unmark
)))
8070 (gnus-summary-mark-same-subject
8071 (gnus-summary-article-subject) unmark
)))
8072 ;; Select next unread article. If auto-select-same mode, should
8073 ;; select the first unread article.
8074 (gnus-summary-next-article t
(and gnus-auto-select-same
8075 (gnus-summary-article-subject)))
8076 (gnus-message 7 "%d article%s marked as %s"
8077 count
(if (= count
1) " is" "s are")
8078 (if unmark
"unread" "read"))))
8080 (defun gnus-summary-kill-same-subject (&optional unmark
)
8081 "Mark articles which has the same subject as read.
8082 If UNMARK is positive, remove any kind of mark.
8083 If UNMARK is negative, tick articles."
8086 (setq unmark
(prefix-numeric-value unmark
)))
8088 (gnus-summary-mark-same-subject
8089 (gnus-summary-article-subject) unmark
)))
8090 ;; If marked as read, go to next unread subject.
8092 ;; Go to next unread subject.
8093 (gnus-summary-next-subject 1 t
))
8094 (gnus-message 7 "%d articles are marked as %s"
8095 count
(if unmark
"unread" "read"))))
8097 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
8098 "Mark articles with same SUBJECT as read, and return marked number.
8099 If optional argument UNMARK is positive, remove any kinds of marks.
8100 If optional argument UNMARK is negative, mark articles as unread instead."
8104 ((null unmark
) ; Mark as read.
8107 (gnus-summary-mark-article-as-read gnus-killed-mark
)
8108 (gnus-summary-show-thread) t
)
8109 (gnus-summary-find-subject subject
))
8110 (setq count
(1+ count
))))
8111 ((> unmark
0) ; Tick.
8114 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
8115 (gnus-summary-show-thread) t
)
8116 (gnus-summary-find-subject subject
))
8117 (setq count
(1+ count
))))
8118 (t ; Mark as unread.
8121 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
8122 (gnus-summary-show-thread) t
)
8123 (gnus-summary-find-subject subject
))
8124 (setq count
(1+ count
)))))
8125 (gnus-set-mode-line 'summary
)
8126 ;; Return the number of marked articles.
8129 (defun gnus-summary-mark-as-processable (n &optional unmark
)
8130 "Set the process mark on the next N articles.
8131 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8132 the process mark instead. The difference between N and the actual
8133 number of articles marked is returned."
8135 (let ((backward (< n
0))
8140 (gnus-summary-remove-process-mark
8141 (gnus-summary-article-number))
8142 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8143 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
8146 (gnus-message 7 "No more articles"))
8147 (gnus-summary-recenter)
8148 (gnus-summary-position-point)
8151 (defun gnus-summary-unmark-as-processable (n)
8152 "Remove the process mark from the next N articles.
8153 If N is negative, unmark backward instead. The difference between N and
8154 the actual number of articles unmarked is returned."
8156 (gnus-summary-mark-as-processable n t
))
8158 (defun gnus-summary-unmark-all-processable ()
8159 "Remove the process mark from all articles."
8162 (while gnus-newsgroup-processable
8163 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
8164 (gnus-summary-position-point))
8166 (defun gnus-summary-mark-as-expirable (n)
8167 "Mark N articles forward as expirable.
8168 If N is negative, mark backward instead. The difference between N and
8169 the actual number of articles marked is returned."
8171 (gnus-summary-mark-forward n gnus-expirable-mark
))
8173 (defun gnus-summary-mark-article-as-replied (article)
8174 "Mark ARTICLE replied and update the summary line."
8175 (push article gnus-newsgroup-replied
)
8176 (let ((buffer-read-only nil
))
8177 (when (gnus-summary-goto-subject article nil t
)
8178 (gnus-summary-update-secondary-mark article
))))
8180 (defun gnus-summary-set-bookmark (article)
8181 "Set a bookmark in current article."
8182 (interactive (list (gnus-summary-article-number)))
8183 (when (or (not (get-buffer gnus-article-buffer
))
8184 (not gnus-current-article
)
8185 (not gnus-article-current
)
8186 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
8187 (error "No current article selected"))
8188 ;; Remove old bookmark, if one exists.
8189 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8191 (setq gnus-newsgroup-bookmarks
8192 (delq old gnus-newsgroup-bookmarks
))))
8193 ;; Set the new bookmark, which is on the form
8194 ;; (article-number . line-number-in-body).
8198 (set-buffer gnus-article-buffer
)
8202 (goto-char (point-min))
8203 (search-forward "\n\n" nil t
)
8206 gnus-newsgroup-bookmarks
)
8207 (gnus-message 6 "A bookmark has been added to the current article."))
8209 (defun gnus-summary-remove-bookmark (article)
8210 "Remove the bookmark from the current article."
8211 (interactive (list (gnus-summary-article-number)))
8212 ;; Remove old bookmark, if one exists.
8213 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8216 (setq gnus-newsgroup-bookmarks
8217 (delq old gnus-newsgroup-bookmarks
))
8218 (gnus-message 6 "Removed bookmark."))
8219 (gnus-message 6 "No bookmark in current article."))))
8221 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8222 (defun gnus-summary-mark-as-dormant (n)
8223 "Mark N articles forward as dormant.
8224 If N is negative, mark backward instead. The difference between N and
8225 the actual number of articles marked is returned."
8227 (gnus-summary-mark-forward n gnus-dormant-mark
))
8229 (defun gnus-summary-set-process-mark (article)
8230 "Set the process mark on ARTICLE and update the summary line."
8231 (setq gnus-newsgroup-processable
8233 (delq article gnus-newsgroup-processable
)))
8234 (when (gnus-summary-goto-subject article
)
8235 (gnus-summary-show-thread)
8236 (gnus-summary-goto-subject article
)
8237 (gnus-summary-update-secondary-mark article
)))
8239 (defun gnus-summary-remove-process-mark (article)
8240 "Remove the process mark from ARTICLE and update the summary line."
8241 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
8242 (when (gnus-summary-goto-subject article
)
8243 (gnus-summary-show-thread)
8244 (gnus-summary-goto-subject article
)
8245 (gnus-summary-update-secondary-mark article
)))
8247 (defun gnus-summary-set-saved-mark (article)
8248 "Set the process mark on ARTICLE and update the summary line."
8249 (push article gnus-newsgroup-saved
)
8250 (when (gnus-summary-goto-subject article
)
8251 (gnus-summary-update-secondary-mark article
)))
8253 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
8254 "Mark N articles as read forwards.
8255 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8256 The difference between N and the actual number of articles marked is
8258 Iff NO-EXPIRE, auto-expiry will be inhibited."
8260 (gnus-summary-show-thread)
8261 (let ((backward (< n
0))
8262 (gnus-summary-goto-unread
8263 (and gnus-summary-goto-unread
8264 (not (eq gnus-summary-goto-unread
'never
))
8265 (not (memq mark
(list gnus-unread-mark
8266 gnus-ticked-mark gnus-dormant-mark
)))))
8268 (mark (or mark gnus-del-mark
)))
8270 (gnus-summary-mark-article nil mark no-expire
)
8271 (zerop (gnus-summary-next-subject
8273 (and gnus-summary-goto-unread
8274 (not (eq gnus-summary-goto-unread
'never
)))
8278 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
8279 (gnus-summary-recenter)
8280 (gnus-summary-position-point)
8281 (gnus-set-mode-line 'summary
)
8284 (defun gnus-summary-mark-article-as-read (mark)
8285 "Mark the current article quickly as read with MARK."
8286 (let ((article (gnus-summary-article-number)))
8287 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8288 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8289 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8290 (push (cons article mark
) gnus-newsgroup-reads
)
8291 ;; Possibly remove from cache, if that is used.
8292 (when gnus-use-cache
8293 (gnus-cache-enter-remove-article article
))
8294 ;; Allow the backend to change the mark.
8295 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8296 ;; Check for auto-expiry.
8297 (when (and gnus-newsgroup-auto-expire
8298 (memq mark gnus-auto-expirable-marks
))
8299 (setq mark gnus-expirable-mark
)
8300 ;; Let the backend know about the mark change.
8301 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8302 (push article gnus-newsgroup-expirable
))
8303 ;; Set the mark in the buffer.
8304 (gnus-summary-update-mark mark
'unread
)
8307 (defun gnus-summary-mark-article-as-unread (mark)
8308 "Mark the current article quickly as unread with MARK."
8309 (let* ((article (gnus-summary-article-number))
8310 (old-mark (gnus-summary-article-mark article
)))
8311 ;; Allow the backend to change the mark.
8312 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8313 (if (eq mark old-mark
)
8317 (gnus-error 1 "Can't mark negative article numbers")
8319 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8320 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8321 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
8322 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
8323 (cond ((= mark gnus-ticked-mark
)
8324 (push article gnus-newsgroup-marked
))
8325 ((= mark gnus-dormant-mark
)
8326 (push article gnus-newsgroup-dormant
))
8328 (push article gnus-newsgroup-unreads
)))
8329 (gnus-pull article gnus-newsgroup-reads
)
8331 ;; See whether the article is to be put in the cache.
8333 (vectorp (gnus-summary-article-header article
))
8335 (gnus-cache-possibly-enter-article
8336 gnus-newsgroup-name article
8337 (= mark gnus-ticked-mark
)
8338 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8341 (gnus-summary-update-mark mark
'unread
)
8344 (defun gnus-summary-mark-article (&optional article mark no-expire
)
8345 "Mark ARTICLE with MARK. MARK can be any character.
8346 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8347 `??' (dormant) and `?E' (expirable).
8348 If MARK is nil, then the default character `?r' is used.
8349 If ARTICLE is nil, then the article on the current line will be
8351 Iff NO-EXPIRE, auto-expiry will be inhibited."
8352 ;; The mark might be a string.
8353 (when (stringp mark
)
8354 (setq mark
(aref mark
0)))
8355 ;; If no mark is given, then we check auto-expiring.
8357 (setq mark gnus-del-mark
))
8358 (when (and (not no-expire
)
8359 gnus-newsgroup-auto-expire
8360 (memq mark gnus-auto-expirable-marks
))
8361 (setq mark gnus-expirable-mark
))
8362 (let ((article (or article
(gnus-summary-article-number)))
8363 (old-mark (gnus-summary-article-mark article
)))
8364 ;; Allow the backend to change the mark.
8365 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8366 (if (eq mark old-mark
)
8369 (error "No article on current line"))
8370 (if (not (if (or (= mark gnus-unread-mark
)
8371 (= mark gnus-ticked-mark
)
8372 (= mark gnus-dormant-mark
))
8373 (gnus-mark-article-as-unread article mark
)
8374 (gnus-mark-article-as-read article mark
)))
8376 ;; See whether the article is to be put in the cache.
8378 (not (= mark gnus-canceled-mark
))
8379 (vectorp (gnus-summary-article-header article
))
8381 (gnus-cache-possibly-enter-article
8382 gnus-newsgroup-name article
8383 (= mark gnus-ticked-mark
)
8384 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8386 (when (gnus-summary-goto-subject article nil t
)
8387 (let ((buffer-read-only nil
))
8388 (gnus-summary-show-thread)
8390 (gnus-summary-update-mark mark
'unread
)
8393 (defun gnus-summary-update-secondary-mark (article)
8394 "Update the secondary (read, process, cache) mark."
8395 (gnus-summary-update-mark
8396 (cond ((memq article gnus-newsgroup-processable
)
8398 ((memq article gnus-newsgroup-cached
)
8400 ((memq article gnus-newsgroup-replied
)
8402 ((memq article gnus-newsgroup-saved
)
8404 (t gnus-unread-mark
))
8406 (when (gnus-visual-p 'summary-highlight
'highlight
)
8407 (gnus-run-hooks 'gnus-summary-update-hook
))
8410 (defun gnus-summary-update-mark (mark type
)
8411 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
8412 (buffer-read-only nil
))
8413 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
8415 (when (looking-at "\r")
8417 (when (<= (+ forward
(point)) (point-max))
8418 ;; Go to the right position on the line.
8419 (goto-char (+ forward
(point)))
8420 ;; Replace the old mark with the new mark.
8421 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
8422 ;; Optionally update the marks by some user rule.
8423 (when (eq type
'unread
)
8425 (gnus-data-find (gnus-summary-article-number)) mark
)
8426 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
8428 (defun gnus-mark-article-as-read (article &optional mark
)
8429 "Enter ARTICLE in the pertinent lists and remove it from others."
8430 ;; Make the article expirable.
8431 (let ((mark (or mark gnus-del-mark
)))
8432 (if (= mark gnus-expirable-mark
)
8433 (push article gnus-newsgroup-expirable
)
8434 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)))
8435 ;; Remove from unread and marked lists.
8436 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8437 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8438 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8439 (push (cons article mark
) gnus-newsgroup-reads
)
8440 ;; Possibly remove from cache, if that is used.
8441 (when gnus-use-cache
8442 (gnus-cache-enter-remove-article article
))
8445 (defun gnus-mark-article-as-unread (article &optional mark
)
8446 "Enter ARTICLE in the pertinent lists and remove it from others."
8447 (let ((mark (or mark gnus-ticked-mark
)))
8450 (gnus-error 1 "Can't mark negative article numbers")
8452 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
8453 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
8454 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
8455 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8457 ;; Unsuppress duplicates?
8458 (when gnus-suppress-duplicates
8459 (gnus-dup-unsuppress-article article
))
8461 (cond ((= mark gnus-ticked-mark
)
8462 (push article gnus-newsgroup-marked
))
8463 ((= mark gnus-dormant-mark
)
8464 (push article gnus-newsgroup-dormant
))
8466 (push article gnus-newsgroup-unreads
)))
8467 (gnus-pull article gnus-newsgroup-reads
)
8470 (defalias 'gnus-summary-mark-as-unread-forward
8471 'gnus-summary-tick-article-forward
)
8472 (make-obsolete 'gnus-summary-mark-as-unread-forward
8473 'gnus-summary-tick-article-forward
)
8474 (defun gnus-summary-tick-article-forward (n)
8475 "Tick N articles forwards.
8476 If N is negative, tick backwards instead.
8477 The difference between N and the number of articles ticked is returned."
8479 (gnus-summary-mark-forward n gnus-ticked-mark
))
8481 (defalias 'gnus-summary-mark-as-unread-backward
8482 'gnus-summary-tick-article-backward
)
8483 (make-obsolete 'gnus-summary-mark-as-unread-backward
8484 'gnus-summary-tick-article-backward
)
8485 (defun gnus-summary-tick-article-backward (n)
8486 "Tick N articles backwards.
8487 The difference between N and the number of articles ticked is returned."
8489 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
8491 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8492 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8493 (defun gnus-summary-tick-article (&optional article clear-mark
)
8494 "Mark current article as unread.
8495 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8496 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8498 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
8501 (defun gnus-summary-mark-as-read-forward (n)
8502 "Mark N articles as read forwards.
8503 If N is negative, mark backwards instead.
8504 The difference between N and the actual number of articles marked is
8507 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
8509 (defun gnus-summary-mark-as-read-backward (n)
8510 "Mark the N articles as read backwards.
8511 The difference between N and the actual number of articles marked is
8514 (gnus-summary-mark-forward
8515 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
8517 (defun gnus-summary-mark-as-read (&optional article mark
)
8518 "Mark current article as read.
8519 ARTICLE specifies the article to be marked as read.
8520 MARK specifies a string to be inserted at the beginning of the line."
8521 (gnus-summary-mark-article article mark
))
8523 (defun gnus-summary-clear-mark-forward (n)
8524 "Clear marks from N articles forward.
8525 If N is negative, clear backward instead.
8526 The difference between N and the number of marks cleared is returned."
8528 (gnus-summary-mark-forward n gnus-unread-mark
))
8530 (defun gnus-summary-clear-mark-backward (n)
8531 "Clear marks from N articles backward.
8532 The difference between N and the number of marks cleared is returned."
8534 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
8536 (defun gnus-summary-mark-unread-as-read ()
8537 "Intended to be used by `gnus-summary-mark-article-hook'."
8538 (when (memq gnus-current-article gnus-newsgroup-unreads
)
8539 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
8541 (defun gnus-summary-mark-read-and-unread-as-read ()
8542 "Intended to be used by `gnus-summary-mark-article-hook'."
8543 (let ((mark (gnus-summary-article-mark)))
8544 (when (or (gnus-unread-mark-p mark
)
8545 (gnus-read-mark-p mark
))
8546 (gnus-summary-mark-article gnus-current-article gnus-read-mark
))))
8548 (defun gnus-summary-mark-region-as-read (point mark all
)
8549 "Mark all unread articles between point and mark as read.
8550 If given a prefix, mark all articles between point and mark as read,
8551 even ticked and dormant ones."
8552 (interactive "r\nP")
8561 (memq (setq article
(gnus-summary-article-number))
8562 gnus-newsgroup-unreads
))
8563 (gnus-summary-mark-article article gnus-del-mark
))
8565 (gnus-summary-find-next))))))
8567 (defun gnus-summary-mark-below (score mark
)
8568 "Mark articles with score less than SCORE with MARK."
8569 (interactive "P\ncMark: ")
8570 (setq score
(if score
8571 (prefix-numeric-value score
)
8572 (or gnus-summary-default-score
0)))
8574 (set-buffer gnus-summary-buffer
)
8575 (goto-char (point-min))
8578 (and (< (gnus-summary-article-score) score
)
8579 (gnus-summary-mark-article nil mark
))
8580 (gnus-summary-find-next)))))
8582 (defun gnus-summary-kill-below (&optional score
)
8583 "Mark articles with score below SCORE as read."
8585 (gnus-summary-mark-below score gnus-killed-mark
))
8587 (defun gnus-summary-clear-above (&optional score
)
8588 "Clear all marks from articles with score above SCORE."
8590 (gnus-summary-mark-above score gnus-unread-mark
))
8592 (defun gnus-summary-tick-above (&optional score
)
8593 "Tick all articles with score above SCORE."
8595 (gnus-summary-mark-above score gnus-ticked-mark
))
8597 (defun gnus-summary-mark-above (score mark
)
8598 "Mark articles with score over SCORE with MARK."
8599 (interactive "P\ncMark: ")
8600 (setq score
(if score
8601 (prefix-numeric-value score
)
8602 (or gnus-summary-default-score
0)))
8604 (set-buffer gnus-summary-buffer
)
8605 (goto-char (point-min))
8607 (when (> (gnus-summary-article-score) score
)
8608 (gnus-summary-mark-article nil mark
))
8610 (gnus-summary-find-next)))))
8612 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8613 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
8614 (defun gnus-summary-limit-include-expunged (&optional no-error
)
8615 "Display all the hidden articles that were expunged for low scores."
8617 (let ((buffer-read-only nil
))
8618 (let ((scored gnus-newsgroup-scored
)
8621 (unless (gnus-summary-goto-subject (caar scored
))
8622 (and (setq h
(gnus-summary-article-header (caar scored
)))
8623 (< (cdar scored
) gnus-summary-expunge-below
)
8625 (setq scored
(cdr scored
)))
8627 (when (not no-error
)
8628 (error "No expunged articles hidden"))
8629 (goto-char (point-min))
8630 (gnus-summary-prepare-unthreaded (nreverse headers
))
8631 (goto-char (point-min))
8632 (gnus-summary-position-point)
8635 (defun gnus-summary-catchup (&optional all quietly to-here not-mark
)
8636 "Mark all unread articles in this newsgroup as read.
8637 If prefix argument ALL is non-nil, ticked and dormant articles will
8638 also be marked as read.
8639 If QUIETLY is non-nil, no questions will be asked.
8640 If TO-HERE is non-nil, it should be a point in the buffer. All
8641 articles before this point will be marked as read.
8642 Note that this function will only catch up the unread article
8643 in the current summary buffer limitation.
8644 The number of articles marked as read is returned."
8649 (not gnus-interactive-catchup
) ;Without confirmation?
8653 "Mark absolutely all articles as read? "
8654 "Mark all unread articles as read? ")))
8656 (not gnus-newsgroup-adaptive
)
8657 (not gnus-newsgroup-auto-expire
)
8658 (not gnus-suppress-duplicates
)
8659 (or (not gnus-use-cache
)
8660 (eq gnus-use-cache
'passive
)))
8663 (setq gnus-newsgroup-marked nil
8664 gnus-newsgroup-dormant nil
))
8665 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable
))
8666 ;; We actually mark all articles as canceled, which we
8667 ;; have to do when using auto-expiry or adaptive scoring.
8668 (gnus-summary-show-all-threads)
8669 (when (gnus-summary-first-subject (not all
) t
)
8671 (if to-here
(< (point) to-here
) t
)
8672 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
8673 (gnus-summary-find-next (not all
) nil nil t
))))
8674 (gnus-set-mode-line 'summary
))
8676 (gnus-summary-position-point)))
8678 (defun gnus-summary-catchup-to-here (&optional all
)
8679 "Mark all unticked articles before the current one as read.
8680 If ALL is non-nil, also mark ticked and dormant articles as read."
8683 (gnus-save-hidden-threads
8684 (let ((beg (point)))
8685 ;; We check that there are unread articles.
8686 (when (or all
(gnus-summary-find-prev))
8687 (gnus-summary-catchup all t beg
)))))
8688 (gnus-summary-position-point))
8690 (defun gnus-summary-catchup-all (&optional quietly
)
8691 "Mark all articles in this newsgroup as read."
8693 (gnus-summary-catchup t quietly
))
8695 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
8696 "Mark all unread articles in this group as read, then exit.
8697 If prefix argument ALL is non-nil, all articles are marked as read."
8699 (when (gnus-summary-catchup all quietly nil
'fast
)
8700 ;; Select next newsgroup or exit.
8701 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
8702 (eq gnus-auto-select-next
'quietly
))
8703 (gnus-summary-next-group nil
)
8704 (gnus-summary-exit))))
8706 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
8707 "Mark all articles in this newsgroup as read, and then exit."
8709 (gnus-summary-catchup-and-exit t quietly
))
8711 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
8712 "Mark all articles in this group as read and select the next group.
8713 If given a prefix, mark all articles, unread as well as ticked, as
8717 (gnus-summary-catchup all
))
8718 (gnus-summary-next-group))
8724 (defmacro gnus-with-article
(article &rest forms
)
8725 "Select ARTICLE and perform FORMS in the original article buffer.
8726 Then replace the article with the result."
8728 ;; We don't want the article to be marked as read.
8729 (let (gnus-mark-article-hook)
8730 (gnus-summary-select-article t t nil
,article
))
8731 (set-buffer gnus-original-article-buffer
)
8733 (if (not (gnus-check-backend-function
8734 'request-replace-article
(car gnus-article-current
)))
8735 (gnus-message 5 "Read-only group; not replacing")
8736 (unless (gnus-request-replace-article
8737 ,article
(car gnus-article-current
)
8739 (error "Couldn't replace article")))
8740 ;; The cache and backlog have to be flushed somewhat.
8741 (when gnus-keep-backlog
8742 (gnus-backlog-remove-article
8743 (car gnus-article-current
) (cdr gnus-article-current
)))
8744 (when gnus-use-cache
8745 (gnus-cache-update-article
8746 (car gnus-article-current
) (cdr gnus-article-current
)))))
8748 (put 'gnus-with-article
'lisp-indent-function
1)
8749 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
8751 ;; Thread-based commands.
8753 (defun gnus-summary-articles-in-thread (&optional article
)
8754 "Return a list of all articles in the current thread.
8755 If ARTICLE is non-nil, return all articles in the thread that starts
8757 (let* ((article (or article
(gnus-summary-article-number)))
8758 (data (gnus-data-find-list article
))
8759 (top-level (gnus-data-level (car data
)))
8761 (cond ((null gnus-thread-operation-ignore-subject
)
8762 (gnus-simplify-subject-re
8763 (mail-header-subject (gnus-data-header (car data
)))))
8764 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
8765 (gnus-simplify-subject-fuzzy
8766 (mail-header-subject (gnus-data-header (car data
)))))
8768 (end-point (save-excursion
8769 (if (gnus-summary-go-to-next-thread)
8770 (point) (point-max))))
8773 (< (gnus-data-pos (car data
)) end-point
))
8774 (when (or (not top-subject
)
8775 (string= top-subject
8776 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
8777 (gnus-simplify-subject-fuzzy
8778 (mail-header-subject
8779 (gnus-data-header (car data
))))
8780 (gnus-simplify-subject-re
8781 (mail-header-subject
8782 (gnus-data-header (car data
)))))))
8783 (push (gnus-data-number (car data
)) articles
))
8784 (unless (and (setq data
(cdr data
))
8785 (> (gnus-data-level (car data
)) top-level
))
8787 ;; Return the list of articles.
8788 (nreverse articles
)))
8790 (defun gnus-summary-rethread-current ()
8791 "Rethread the thread the current article is part of."
8793 (let* ((gnus-show-threads t
)
8794 (article (gnus-summary-article-number))
8795 (id (mail-header-id (gnus-summary-article-header)))
8796 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
8798 (error "No article on the current line"))
8799 (gnus-rebuild-thread id
)
8800 (gnus-summary-goto-subject article
)))
8802 (defun gnus-summary-reparent-thread ()
8803 "Make the current article child of the marked (or previous) article.
8805 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8806 is non-nil or the Subject: of both articles are the same."
8808 (unless (not (gnus-group-read-only-p))
8809 (error "The current newsgroup does not support article editing"))
8810 (unless (<= (length gnus-newsgroup-processable
) 1)
8811 (error "No more than one article may be marked"))
8812 (save-window-excursion
8813 (let ((gnus-article-buffer " *reparent*")
8814 (current-article (gnus-summary-article-number))
8815 ;; First grab the marked article, otherwise one line up.
8816 (parent-article (if (not (null gnus-newsgroup-processable
))
8817 (car gnus-newsgroup-processable
)
8819 (if (eq (forward-line -
1) 0)
8820 (gnus-summary-article-number)
8821 (error "Beginning of summary buffer"))))))
8822 (unless (not (eq current-article parent-article
))
8823 (error "An article may not be self-referential"))
8824 (let ((message-id (mail-header-id
8825 (gnus-summary-article-header parent-article
))))
8826 (unless (and message-id
(not (equal message-id
"")))
8827 (error "No message-id in desired parent"))
8828 (gnus-with-article current-article
8830 (goto-char (point-min))
8831 (message-narrow-to-head)
8832 (if (re-search-forward "^References: " nil t
)
8834 (re-search-forward "^[^ \t]" nil t
)
8837 (insert " " message-id
))
8838 (insert "References: " message-id
"\n"))))
8839 (set-buffer gnus-summary-buffer
)
8840 (gnus-summary-unmark-all-processable)
8841 (gnus-summary-update-article current-article
)
8842 (gnus-summary-rethread-current)
8843 (gnus-message 3 "Article %d is now the child of article %d"
8844 current-article parent-article
)))))
8846 (defun gnus-summary-toggle-threads (&optional arg
)
8847 "Toggle showing conversation threads.
8848 If ARG is positive number, turn showing conversation threads on."
8850 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
8851 (setq gnus-show-threads
8852 (if (null arg
) (not gnus-show-threads
)
8853 (> (prefix-numeric-value arg
) 0)))
8854 (gnus-summary-prepare)
8855 (gnus-summary-goto-subject current
)
8856 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
8857 (gnus-summary-position-point)))
8859 (defun gnus-summary-show-all-threads ()
8863 (let ((buffer-read-only nil
))
8864 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
8865 (gnus-summary-position-point))
8867 (defun gnus-summary-show-thread ()
8868 "Show thread subtrees.
8869 Returns nil if no thread was there to be shown."
8871 (let ((buffer-read-only nil
)
8873 ;; first goto end then to beg, to have point at beg after let
8874 (end (progn (end-of-line) (point)))
8875 (beg (progn (beginning-of-line) (point))))
8877 ;; Any hidden lines here?
8878 (search-forward "\r" end t
)
8879 (subst-char-in-region beg end ?\^M ?
\n t
)
8881 (gnus-summary-position-point))))
8883 (defun gnus-summary-hide-all-threads ()
8884 "Hide all thread subtrees."
8887 (goto-char (point-min))
8888 (gnus-summary-hide-thread)
8889 (while (zerop (gnus-summary-next-thread 1 t
))
8890 (gnus-summary-hide-thread)))
8891 (gnus-summary-position-point))
8893 (defun gnus-summary-hide-thread ()
8894 "Hide thread subtrees.
8895 Returns nil if no threads were there to be hidden."
8897 (let ((buffer-read-only nil
)
8899 (article (gnus-summary-article-number)))
8901 ;; Go forward until either the buffer ends or the subthread
8903 (when (and (not (eobp))
8904 (or (zerop (gnus-summary-next-thread 1 t
))
8905 (goto-char (point-max))))
8907 (if (and (> (point) start
)
8908 (search-backward "\n" start t
))
8910 (subst-char-in-region start
(point) ?
\n ?\^M
)
8911 (gnus-summary-goto-subject article
))
8915 (defun gnus-summary-go-to-next-thread (&optional previous
)
8916 "Go to the same level (or less) next thread.
8917 If PREVIOUS is non-nil, go to previous thread instead.
8918 Return the article number moved to, or nil if moving was impossible."
8919 (let ((level (gnus-summary-thread-level))
8920 (way (if previous -
1 1))
8923 (while (and (not (eobp))
8924 (< level
(gnus-summary-thread-level)))
8932 (gnus-summary-article-number)
8935 (defun gnus-summary-next-thread (n &optional silent
)
8936 "Go to the same level next N'th thread.
8937 If N is negative, search backward instead.
8938 Returns the difference between N and the number of skips actually
8941 If SILENT, don't output messages."
8943 (let ((backward (< n
0))
8946 (gnus-summary-go-to-next-thread backward
))
8949 (gnus-summary-position-point))
8950 (when (and (not silent
) (/= 0 n
))
8951 (gnus-message 7 "No more threads"))
8954 (defun gnus-summary-prev-thread (n)
8955 "Go to the same level previous N'th thread.
8956 Returns the difference between N and the number of skips actually
8959 (gnus-summary-next-thread (- n
)))
8961 (defun gnus-summary-go-down-thread ()
8962 "Go down one level in the current thread."
8963 (let ((children (gnus-summary-article-children)))
8965 (gnus-summary-goto-subject (car children
)))))
8967 (defun gnus-summary-go-up-thread ()
8968 "Go up one level in the current thread."
8969 (let ((parent (gnus-summary-article-parent)))
8971 (gnus-summary-goto-subject parent
))))
8973 (defun gnus-summary-down-thread (n)
8974 "Go down thread N steps.
8975 If N is negative, go up instead.
8976 Returns the difference between N and how many steps down that were
8982 (if up
(gnus-summary-go-up-thread)
8983 (gnus-summary-go-down-thread)))
8985 (gnus-summary-position-point)
8987 (gnus-message 7 "Can't go further"))
8990 (defun gnus-summary-up-thread (n)
8991 "Go up thread N steps.
8992 If N is negative, go up instead.
8993 Returns the difference between N and how many steps down that were
8996 (gnus-summary-down-thread (- n
)))
8998 (defun gnus-summary-top-thread ()
8999 "Go to the top of the thread."
9001 (while (gnus-summary-go-up-thread))
9002 (gnus-summary-article-number))
9004 (defun gnus-summary-kill-thread (&optional unmark
)
9005 "Mark articles under current thread as read.
9006 If the prefix argument is positive, remove any kinds of marks.
9007 If the prefix argument is negative, tick articles instead."
9010 (setq unmark
(prefix-numeric-value unmark
)))
9011 (let ((articles (gnus-summary-articles-in-thread)))
9013 ;; Expand the thread.
9014 (gnus-summary-show-thread)
9015 ;; Mark all the articles.
9017 (gnus-summary-goto-subject (car articles
))
9018 (cond ((null unmark
)
9019 (gnus-summary-mark-article-as-read gnus-killed-mark
))
9021 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
9023 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
9024 (setq articles
(cdr articles
))))
9025 ;; Hide killed subtrees.
9027 gnus-thread-hide-killed
9028 (gnus-summary-hide-thread))
9029 ;; If marked as read, go to next unread subject.
9031 ;; Go to next unread subject.
9032 (gnus-summary-next-subject 1 t
)))
9033 (gnus-set-mode-line 'summary
))
9035 ;; Summary sorting commands
9037 (defun gnus-summary-sort-by-number (&optional reverse
)
9038 "Sort the summary buffer by article number.
9039 Argument REVERSE means reverse order."
9041 (gnus-summary-sort 'number reverse
))
9043 (defun gnus-summary-sort-by-author (&optional reverse
)
9044 "Sort the summary buffer by author name alphabetically.
9045 If `case-fold-search' is non-nil, case of letters is ignored.
9046 Argument REVERSE means reverse order."
9048 (gnus-summary-sort 'author reverse
))
9050 (defun gnus-summary-sort-by-subject (&optional reverse
)
9051 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
9052 If `case-fold-search' is non-nil, case of letters is ignored.
9053 Argument REVERSE means reverse order."
9055 (gnus-summary-sort 'subject reverse
))
9057 (defun gnus-summary-sort-by-date (&optional reverse
)
9058 "Sort the summary buffer by date.
9059 Argument REVERSE means reverse order."
9061 (gnus-summary-sort 'date reverse
))
9063 (defun gnus-summary-sort-by-score (&optional reverse
)
9064 "Sort the summary buffer by score.
9065 Argument REVERSE means reverse order."
9067 (gnus-summary-sort 'score reverse
))
9069 (defun gnus-summary-sort-by-lines (&optional reverse
)
9070 "Sort the summary buffer by the number of lines.
9071 Argument REVERSE means reverse order."
9073 (gnus-summary-sort 'lines reverse
))
9075 (defun gnus-summary-sort-by-chars (&optional reverse
)
9076 "Sort the summary buffer by article length.
9077 Argument REVERSE means reverse order."
9079 (gnus-summary-sort 'chars reverse
))
9081 (defun gnus-summary-sort (predicate reverse
)
9082 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
9083 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
9084 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
9085 (gnus-thread-sort-functions
9090 (gnus-sort-gathered-threads-function
9091 gnus-thread-sort-functions
)
9092 (gnus-article-sort-functions
9098 (gnus-summary-prepare-hook nil
))
9099 ;; We do the sorting by regenerating the threads.
9100 (gnus-summary-prepare)
9101 ;; Hide subthreads if needed.
9102 (when (and gnus-show-threads gnus-thread-hide-subtree
)
9103 (gnus-summary-hide-all-threads))))
9105 ;; Summary saving commands.
9107 (defun gnus-summary-save-article (&optional n not-saved
)
9108 "Save the current article using the default saver function.
9109 If N is a positive number, save the N next articles.
9110 If N is a negative number, save the N previous articles.
9111 If N is nil and any articles have been marked with the process mark,
9112 save those articles instead.
9113 The variable `gnus-default-article-saver' specifies the saver function."
9115 (let* ((articles (gnus-summary-work-articles n
))
9116 (save-buffer (save-excursion
9117 (nnheader-set-temp-buffer " *Gnus Save*")))
9118 (num (length articles
))
9120 (dolist (article articles
)
9121 (setq header
(gnus-summary-article-header article
))
9122 (if (not (vectorp header
))
9123 ;; This is a pseudo-article.
9124 (if (assq 'name header
)
9125 (gnus-copy-file (cdr (assq 'name header
)))
9126 (gnus-message 1 "Article %d is unsaveable" article
))
9127 ;; This is a real article.
9128 (save-window-excursion
9129 (gnus-summary-select-article t nil nil article
))
9131 (set-buffer save-buffer
)
9133 (insert-buffer-substring gnus-original-article-buffer
))
9134 (setq file
(gnus-article-save save-buffer file num
))
9135 (gnus-summary-remove-process-mark article
)
9137 (gnus-summary-set-saved-mark article
))))
9138 (gnus-kill-buffer save-buffer
)
9139 (gnus-summary-position-point)
9140 (gnus-set-mode-line 'summary
)
9143 (defun gnus-summary-pipe-output (&optional arg
)
9144 "Pipe the current article to a subprocess.
9145 If N is a positive number, pipe the N next articles.
9146 If N is a negative number, pipe the N previous articles.
9147 If N is nil and any articles have been marked with the process mark,
9148 pipe those articles instead."
9151 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
))
9152 (gnus-summary-save-article arg t
))
9153 (gnus-configure-windows 'pipe
))
9155 (defun gnus-summary-save-article-mail (&optional arg
)
9156 "Append the current article to an mail file.
9157 If N is a positive number, save the N next articles.
9158 If N is a negative number, save the N previous articles.
9159 If N is nil and any articles have been marked with the process mark,
9160 save those articles instead."
9163 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
9164 (gnus-summary-save-article arg
)))
9166 (defun gnus-summary-save-article-rmail (&optional arg
)
9167 "Append the current article to an rmail file.
9168 If N is a positive number, save the N next articles.
9169 If N is a negative number, save the N previous articles.
9170 If N is nil and any articles have been marked with the process mark,
9171 save those articles instead."
9174 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
9175 (gnus-summary-save-article arg
)))
9177 (defun gnus-summary-save-article-file (&optional arg
)
9178 "Append the current article to a file.
9179 If N is a positive number, save the N next articles.
9180 If N is a negative number, save the N previous articles.
9181 If N is nil and any articles have been marked with the process mark,
9182 save those articles instead."
9185 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
9186 (gnus-summary-save-article arg
)))
9188 (defun gnus-summary-write-article-file (&optional arg
)
9189 "Write the current article to a file, deleting the previous 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-write-to-file
))
9197 (gnus-summary-save-article arg
)))
9199 (defun gnus-summary-save-article-body-file (&optional arg
)
9200 "Append the current article body to a 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-body-in-file
))
9208 (gnus-summary-save-article arg
)))
9210 (defun gnus-summary-pipe-message (program)
9211 "Pipe the current article through PROGRAM."
9212 (interactive "sProgram: ")
9213 (gnus-summary-select-article)
9214 (let ((mail-header-separator ""))
9215 (gnus-eval-in-buffer-window gnus-article-buffer
9218 (let ((start (window-start))
9220 (message-pipe-buffer-body program
)
9221 (set-window-start (get-buffer-window (current-buffer)) start
))))))
9223 (defun gnus-get-split-value (methods)
9224 "Return a value based on the split METHODS."
9225 (let (split-name method result match
)
9228 (set-buffer gnus-original-article-buffer
)
9230 (nnheader-narrow-to-headers)
9231 (while (and methods
(not split-name
))
9232 (goto-char (point-min))
9233 (setq method
(pop methods
))
9234 (setq match
(car method
))
9237 ;; Regular expression.
9239 (re-search-forward match nil t
)))
9240 ((gnus-functionp match
)
9244 (setq result
(funcall match gnus-newsgroup-name
))))
9249 (setq result
(eval match
)))))
9250 (setq split-name
(cdr method
))
9251 (cond ((stringp result
)
9252 (push (expand-file-name
9253 result gnus-article-save-directory
)
9256 (setq split-name
(append result split-name
)))))))))
9257 (nreverse split-name
)))
9259 (defun gnus-valid-move-group-p (group)
9262 (symbol-value group
)
9263 (gnus-get-function (gnus-find-method-for-group
9264 (symbol-name group
)) 'request-accept-article t
)))
9266 (defun gnus-read-move-group-name (prompt default articles prefix
)
9267 "Read a group name."
9268 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
9269 (minibuffer-confirm-incomplete nil
) ; XEmacs
9273 (if (> (length articles
) 1)
9274 (format "these %d articles" (length articles
))
9279 (gnus-completing-read default prom
9281 'gnus-valid-move-group-p
9283 'gnus-group-history
))
9284 ((= 1 (length split-name
))
9285 (gnus-completing-read (car split-name
) prom
9287 'gnus-valid-move-group-p
9289 'gnus-group-history
))
9291 (gnus-completing-read nil prom
9292 (mapcar (lambda (el) (list el
))
9293 (nreverse split-name
))
9295 'gnus-group-history
))))
9296 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
9298 (if (or (string= to-newsgroup
"")
9299 (string= to-newsgroup prefix
))
9300 (setq to-newsgroup default
))
9301 (unless to-newsgroup
9302 (error "No group name entered"))
9303 (or (gnus-active to-newsgroup
)
9304 (gnus-activate-group to-newsgroup nil nil to-method
)
9305 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9307 (or (and (gnus-request-create-group to-newsgroup to-method
)
9308 (gnus-activate-group
9309 to-newsgroup nil nil to-method
)
9310 (gnus-subscribe-group to-newsgroup
))
9311 (error "Couldn't create group %s" to-newsgroup
)))
9312 (error "No such group: %s" to-newsgroup
)))
9315 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
9316 "Save parts matching TYPE to DIR.
9317 If REVERSE, save parts that do not match TYPE."
9319 (list (read-string "Save parts of type: "
9320 (or (car gnus-summary-save-parts-type-history
)
9321 gnus-summary-save-parts-default-mime
)
9322 'gnus-summary-save-parts-type-history
)
9323 (setq gnus-summary-save-parts-last-directory
9324 (read-file-name "Save to directory: "
9325 gnus-summary-save-parts-last-directory
9327 current-prefix-arg
))
9328 (gnus-summary-iterate n
9329 (let ((gnus-display-mime-function nil
)
9330 (gnus-inhibit-treatment t
))
9331 (gnus-summary-select-article))
9333 (set-buffer gnus-article-buffer
)
9334 (let ((handles (or gnus-article-mime-handles
9335 (mm-dissect-buffer) (mm-uu-dissect))))
9337 (gnus-summary-save-parts-1 type dir handles reverse
)
9338 (unless gnus-article-mime-handles
;; Don't destroy this case.
9339 (mm-destroy-parts handles
)))))))
9341 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
9342 (if (stringp (car handle
))
9343 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
9346 (not (string-match type
(mm-handle-media-type handle
)))
9347 (string-match type
(mm-handle-media-type handle
)))
9348 (let ((file (expand-file-name
9349 (file-name-nondirectory
9351 (mail-content-type-get
9352 (mm-handle-disposition handle
) 'filename
)
9353 (concat gnus-newsgroup-name
9354 "." (number-to-string
9355 (cdr gnus-article-current
)))))
9357 (unless (file-exists-p file
)
9358 (mm-save-part-to-file handle file
))))))
9360 ;; Summary extract commands
9362 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
9363 (let ((buffer-read-only nil
)
9364 (article (gnus-summary-article-number))
9366 (unless (gnus-summary-goto-subject article
)
9367 (error "No such article: %d" article
))
9368 (gnus-summary-position-point)
9369 ;; If all commands are to be bunched up on one line, we collect
9371 (unless gnus-view-pseudos-separately
9372 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
9375 (setq action
(cdr (assq 'action
(car ps
))))
9376 (setq files
(list (cdr (assq 'name
(car ps
)))))
9377 (while (and ps
(cdr ps
)
9378 (string= (or action
"1")
9379 (or (cdr (assq 'action
(cadr ps
))) "2")))
9380 (push (cdr (assq 'name
(cadr ps
))) files
)
9381 (setcdr ps
(cddr ps
)))
9383 (when (not (string-match "%s" action
))
9386 (when (assq 'execute
(car ps
))
9387 (setcdr (assq 'execute
(car ps
))
9388 (funcall (if (string-match "%s" action
)
9397 (setq ps
(cdr ps
)))))
9398 (if (and gnus-view-pseudos
(not not-view
))
9400 (when (assq 'execute
(car pslist
))
9401 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
9402 (eq gnus-view-pseudos
'not-confirm
)))
9403 (setq pslist
(cdr pslist
)))
9406 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
9407 (gnus-summary-article-number)))
9408 (gnus-summary-goto-subject after-article
)
9411 (insert " " (file-name-nondirectory
9412 (cdr (assq 'name
(car pslist
))))
9413 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
9415 (forward-line -
1) ; back to `b'
9416 (gnus-add-text-properties
9417 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
9418 gnus-mouse-face-prop gnus-mouse-face
))
9420 after-article gnus-reffed-article-number
9421 gnus-unread-mark b
(car pslist
) 0 (- e b
))
9422 (push gnus-reffed-article-number gnus-newsgroup-unreads
)
9423 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
9424 (setq pslist
(cdr pslist
)))))))
9426 (defun gnus-pseudos< (p1 p2
)
9427 (let ((c1 (cdr (assq 'action p1
)))
9428 (c2 (cdr (assq 'action p2
))))
9429 (and c1 c2
(string< c1 c2
))))
9431 (defun gnus-request-pseudo-article (props)
9432 (cond ((assq 'execute props
)
9433 (gnus-execute-command (cdr (assq 'execute props
)))))
9434 (let ((gnus-current-article (gnus-summary-article-number)))
9435 (gnus-run-hooks 'gnus-mark-article-hook
)))
9437 (defun gnus-execute-command (command &optional automatic
)
9439 (gnus-article-setup-buffer)
9440 (set-buffer gnus-article-buffer
)
9441 (setq buffer-read-only nil
)
9442 (let ((command (if automatic command
9443 (read-string "Command: " (cons command
0)))))
9445 (insert "$ " command
"\n\n")
9446 (if gnus-view-pseudo-asynchronously
9447 (start-process "gnus-execute" (current-buffer) shell-file-name
9448 shell-command-switch command
)
9449 (call-process shell-file-name nil t nil
9450 shell-command-switch command
)))))
9452 ;; Summary kill commands.
9454 (defun gnus-summary-edit-global-kill (article)
9455 "Edit the \"global\" kill file."
9456 (interactive (list (gnus-summary-article-number)))
9457 (gnus-group-edit-global-kill article
))
9459 (defun gnus-summary-edit-local-kill ()
9460 "Edit a local kill file applied to the current newsgroup."
9462 (setq gnus-current-headers
(gnus-summary-article-header))
9463 (gnus-group-edit-local-kill
9464 (gnus-summary-article-number) gnus-newsgroup-name
))
9468 (defun gnus-read-header (id &optional header
)
9469 "Read the headers of article ID and enter them into the Gnus system."
9470 (let ((group gnus-newsgroup-name
)
9471 (gnus-override-method
9473 gnus-override-method
9474 (and (gnus-news-group-p gnus-newsgroup-name
)
9475 (car (gnus-refer-article-methods)))))
9477 ;; First we check to see whether the header in question is already
9480 ;; This is a Message-ID.
9481 (setq header
(or header
(gnus-id-to-header id
)))
9482 ;; This is an article number.
9483 (setq header
(or header
(gnus-summary-article-header id
))))
9485 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
9486 ;; We have found the header.
9488 ;; If this is a sparse article, we have to nix out its
9489 ;; previous entry in the thread hashtb.
9491 (gnus-summary-article-sparse-p (mail-header-number header
)))
9492 (let* ((parent (gnus-parent-id (mail-header-references header
)))
9493 (thread (and parent
(gnus-id-to-thread parent
))))
9495 (delq (assq header thread
) thread
))))
9496 ;; We have to really fetch the header to this article.
9498 (set-buffer nntp-server-buffer
)
9499 (when (setq where
(gnus-request-head id group
))
9500 (nnheader-fold-continuation-lines)
9501 (goto-char (point-max))
9503 (goto-char (point-min))
9507 ((cdr where
) (cdr where
))
9508 (header (mail-header-number header
))
9509 (t gnus-reffed-article-number
))
9511 (insert " Article retrieved.\n"))
9513 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
9514 () ; Malformed head.
9515 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
9516 (when (and (stringp id
)
9517 (not (string= (gnus-group-real-name group
)
9519 ;; If we fetched by Message-ID and the article came
9520 ;; from a different group, we fudge some bogus article
9521 ;; numbers for this article.
9522 (mail-header-set-number header gnus-reffed-article-number
))
9524 (set-buffer gnus-summary-buffer
)
9525 (decf gnus-reffed-article-number
)
9526 (gnus-remove-header (mail-header-number header
))
9527 (push header gnus-newsgroup-headers
)
9528 (setq gnus-current-headers header
)
9529 (push (mail-header-number header
) gnus-newsgroup-limit
)))
9532 (defun gnus-remove-header (number)
9533 "Remove header NUMBER from `gnus-newsgroup-headers'."
9534 (if (and gnus-newsgroup-headers
9535 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
9536 (pop gnus-newsgroup-headers
)
9537 (let ((headers gnus-newsgroup-headers
))
9538 (while (and (cdr headers
)
9539 (not (= number
(mail-header-number (cadr headers
)))))
9542 (setcdr headers
(cddr headers
))))))
9545 ;;; summary highlights
9548 (defun gnus-highlight-selected-summary ()
9549 "Highlight selected article in summary buffer."
9550 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9551 (when gnus-summary-selected-face
9553 (let* ((beg (progn (beginning-of-line) (point)))
9554 (end (progn (end-of-line) (point)))
9555 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9556 (from (if (get-text-property beg gnus-mouse-face-prop
)
9558 (or (next-single-property-change
9559 beg gnus-mouse-face-prop nil end
)
9564 (or (next-single-property-change
9565 from gnus-mouse-face-prop nil end
)
9567 ;; If no mouse-face prop on line we will have to = from = end,
9568 ;; so we highlight the entire line instead.
9569 (when (= (+ to
2) from
)
9572 (if gnus-newsgroup-selected-overlay
9573 ;; Move old overlay.
9575 gnus-newsgroup-selected-overlay from to
(current-buffer))
9576 ;; Create new overlay.
9578 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
9579 'face gnus-summary-selected-face
))))))
9581 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9582 (defun gnus-summary-highlight-line ()
9583 "Highlight current line according to `gnus-summary-highlight'."
9584 (let* ((list gnus-summary-highlight
)
9586 (end (progn (end-of-line) (point)))
9587 ;; now find out where the line starts and leave point there.
9588 (beg (progn (beginning-of-line) (point)))
9589 (article (gnus-summary-article-number))
9590 (score (or (cdr (assq (or article gnus-current-article
)
9591 gnus-newsgroup-scored
))
9592 gnus-summary-default-score
0))
9593 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
9594 (inhibit-read-only t
))
9595 ;; Eval the cars of the lists until we find a match.
9596 (let ((default gnus-summary-default-score
))
9598 (not (eval (caar list
))))
9599 (setq list
(cdr list
))))
9600 (let ((face (cdar list
)))
9601 (unless (eq face
(get-text-property beg
'face
))
9602 (gnus-put-text-property-excluding-characters-with-faces
9604 (setq face
(if (boundp face
) (symbol-value face
) face
)))
9605 (when gnus-summary-highlight-line-function
9606 (funcall gnus-summary-highlight-line-function article face
))))
9609 (defun gnus-update-read-articles (group unread
&optional compute
)
9610 "Update the list of read articles in GROUP."
9611 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
9612 (entry (gnus-gethash group gnus-newsrc-hashtb
))
9613 (info (nth 2 entry
))
9615 (unread (sort (copy-sequence unread
) '<))
9617 (if (or (not info
) (not active
))
9618 ;; There is no info on this group if it was, in fact,
9619 ;; killed. Gnus stores no information on killed groups, so
9620 ;; there's nothing to be done.
9621 ;; One could store the information somewhere temporarily,
9622 ;; perhaps... Hmmm...
9624 ;; Remove any negative articles numbers.
9625 (while (and unread
(< (car unread
) 0))
9626 (setq unread
(cdr unread
)))
9627 ;; Remove any expired article numbers
9628 (while (and unread
(< (car unread
) (car active
)))
9629 (setq unread
(cdr unread
)))
9630 ;; Compute the ranges of read articles by looking at the list of
9633 (when (/= (car unread
) prev
)
9634 (push (if (= prev
(1- (car unread
))) prev
9635 (cons prev
(1- (car unread
))))
9637 (setq prev
(1+ (car unread
)))
9638 (setq unread
(cdr unread
)))
9639 (when (<= prev
(cdr active
))
9640 (push (cons prev
(cdr active
)) read
))
9641 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
9646 ;; Propagate the read marks to the backend.
9647 (when (gnus-check-backend-function 'request-set-mark group
)
9648 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
9649 (add (gnus-remove-from-range read
(gnus-info-read info
))))
9651 (unless (gnus-check-group group
)
9652 (error "Can't open server for %s" group
))
9653 (gnus-request-set-mark
9654 group
(delq nil
(list (if add
(list add
'add
'(read)))
9655 (if del
(list del
'del
'(read))))))
9657 `(gnus-request-set-mark
9660 (if del
(list del
'add
'(read)))
9661 (if add
(list add
'del
'(read))))))))))
9662 (set-buffer gnus-group-buffer
)
9665 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
9666 (gnus-info-set-read ',info
',(gnus-info-read info
))
9667 (gnus-get-unread-articles-in-group ',info
9668 (gnus-active ,group
))
9669 (gnus-group-update-group ,group t
)
9671 ;; Enter this list into the group info.
9672 (gnus-info-set-read info read
)
9673 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9674 (gnus-get-unread-articles-in-group info
(gnus-active group
))
9677 (defun gnus-offer-save-summaries ()
9678 "Offer to save all active summary buffers."
9680 (let ((buflist (buffer-list))
9682 ;; Go through all buffers and find all summaries.
9684 (and (setq bufname
(buffer-name (car buflist
)))
9685 (string-match "Summary" bufname
)
9687 (set-buffer bufname
)
9688 ;; We check that this is, indeed, a summary buffer.
9689 (and (eq major-mode
'gnus-summary-mode
)
9690 ;; Also make sure this isn't bogus.
9691 gnus-newsgroup-prepared
9692 ;; Also make sure that this isn't a dead summary buffer.
9693 (not gnus-dead-summary-mode
)))
9694 (push bufname buffers
))
9695 (setq buflist
(cdr buflist
)))
9696 ;; Go through all these summary buffers and offer to save them.
9699 "Update summary buffer %s? "
9701 (switch-to-buffer buf
)
9702 (gnus-summary-exit))
9705 (defun gnus-summary-setup-default-charset ()
9706 "Setup newsgroup default charset."
9707 (if (equal gnus-newsgroup-name
"nndraft:drafts")
9708 (setq gnus-newsgroup-charset nil
)
9709 (let* ((name (and gnus-newsgroup-name
9710 (gnus-group-real-name gnus-newsgroup-name
)))
9712 (or gnus-newsgroup-ephemeral-ignored-charsets
9714 (and gnus-newsgroup-name
9715 (or (gnus-group-find-parameter gnus-newsgroup-name
9716 'ignored-charsets t
)
9717 (let ((alist gnus-group-ignored-charsets-alist
)
9718 elem
(charsets nil
))
9719 (while (setq elem
(pop alist
))
9721 (string-match (car elem
) name
))
9723 charsets
(cdr elem
))))
9725 gnus-newsgroup-ignored-charsets
))))
9726 (setq gnus-newsgroup-charset
9727 (or gnus-newsgroup-ephemeral-charset
9728 (and gnus-newsgroup-name
9729 (or (gnus-group-find-parameter gnus-newsgroup-name
'charset
)
9730 (let ((alist gnus-group-charset-alist
)
9732 (while (setq elem
(pop alist
))
9734 (string-match (car elem
) name
))
9736 charset
(cadr elem
))))
9738 gnus-default-charset
))
9739 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
9740 ignored-charsets
))))
9746 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
9747 "Display the current article buffer fully MIME-buttonized.
9748 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9749 treated as multipart/mixed."
9752 (let ((gnus-unbuttonized-mime-types nil
)
9753 (gnus-mime-display-multipart-as-mixed show-all-parts
))
9754 (gnus-summary-show-article)))
9756 (defun gnus-summary-repair-multipart (article)
9757 "Add a Content-Type header to a multipart article without one."
9758 (interactive (list (gnus-summary-article-number)))
9759 (gnus-with-article article
9760 (message-narrow-to-head)
9761 (goto-char (point-max))
9763 (when (search-forward "\n--" nil t
)
9764 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9765 (message-narrow-to-head)
9766 (message-remove-header "Mime-Version")
9767 (message-remove-header "Content-Type")
9768 (goto-char (point-max))
9769 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9771 (insert "Mime-Version: 1.0\n")
9773 (let (gnus-mark-article-hook)
9774 (gnus-summary-select-article t t nil article
)))
9776 (defun gnus-summary-toggle-display-buttonized ()
9777 "Toggle the buttonizing of the article buffer."
9780 (if (setq gnus-inhibit-mime-unbuttonizing
9781 (not gnus-inhibit-mime-unbuttonizing
))
9782 (let ((gnus-unbuttonized-mime-types nil
))
9783 (gnus-summary-show-article))
9784 (gnus-summary-show-article)))
9787 ;;; Generic summary marking commands
9790 (defvar gnus-summary-marking-alist
9791 '((read gnus-del-mark
"d")
9792 (unread gnus-unread-mark
"u")
9793 (ticked gnus-ticked-mark
"!")
9794 (dormant gnus-dormant-mark
"?")
9795 (expirable gnus-expirable-mark
"e"))
9796 "An alist of names/marks/keystrokes.")
9798 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
9799 (defvar gnus-summary-mark-map
)
9801 (defun gnus-summary-make-all-marking-commands ()
9802 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
9803 (dolist (elem gnus-summary-marking-alist
)
9804 (apply 'gnus-summary-make-marking-command elem
)))
9806 (defun gnus-summary-make-marking-command (name mark keystroke
)
9807 (let ((map (make-sparse-keymap)))
9808 (define-key gnus-summary-generic-mark-map keystroke map
)
9809 (dolist (lway `((next "next" next nil
"n")
9810 (next-unread "next unread" next t
"N")
9811 (prev "previous" prev nil
"p")
9812 (prev-unread "previous unread" prev t
"P")
9813 (nomove "" nil nil
,keystroke
)))
9814 (let ((func (gnus-summary-make-marking-command-1
9815 mark
(car lway
) lway name
)))
9816 (setq func
(eval func
))
9817 (define-key map
(nth 4 lway
) func
)))))
9819 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
9821 (format "gnus-summary-put-mark-as-%s%s"
9822 name
(if (eq way
'nomove
)
9824 (concat "-" (symbol-name way
)))))
9827 "Mark the current article as %s%s.
9828 If N, the prefix, then repeat N times.
9829 If N is negative, move in reverse order.
9830 The difference between N and the actual number of articles marked is
9834 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
9836 (defun gnus-summary-generic-mark (n mark move unread
)
9837 "Mark N articles with MARK."
9838 (unless (eq major-mode
'gnus-summary-mode
)
9839 (error "This command can only be used in the summary buffer"))
9840 (gnus-summary-show-thread)
9844 ((eq move
'prev
) -
1)
9850 nummove
(* -
1 nummove
))))
9852 (gnus-summary-mark-article nil mark
)
9853 (zerop (gnus-summary-next-subject nummove unread t
)))
9856 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
9857 (gnus-summary-recenter)
9858 (gnus-summary-position-point)
9859 (gnus-set-mode-line 'summary
)
9862 (gnus-summary-make-all-marking-commands)
9868 (run-hooks 'gnus-sum-load-hook
)
9870 ;;; gnus-sum.el ends here