1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl
))
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."
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
)
1319 ;; Non-orthogonal keys
1321 (gnus-define-keys gnus-summary-mode-map
1322 " " gnus-summary-next-page
1323 "\177" gnus-summary-prev-page
1324 [delete] gnus-summary-prev-page
1325 [backspace] gnus-summary-prev-page
1326 "\r" gnus-summary-scroll-up
1327 "\M-\r" gnus-summary-scroll-down
1328 "n" gnus-summary-next-unread-article
1329 "p" gnus-summary-prev-unread-article
1330 "N" gnus-summary-next-article
1331 "P" gnus-summary-prev-article
1332 "\M-\C-n" gnus-summary-next-same-subject
1333 "\M-\C-p" gnus-summary-prev-same-subject
1334 "\M-n" gnus-summary-next-unread-subject
1335 "\M-p" gnus-summary-prev-unread-subject
1336 "." gnus-summary-first-unread-article
1337 "," gnus-summary-best-unread-article
1338 "\M-s" gnus-summary-search-article-forward
1339 "\M-r" gnus-summary-search-article-backward
1340 "<" gnus-summary-beginning-of-article
1341 ">" gnus-summary-end-of-article
1342 "j" gnus-summary-goto-article
1343 "^" gnus-summary-refer-parent-article
1344 "\M-^" gnus-summary-refer-article
1345 "u" gnus-summary-tick-article-forward
1346 "!" gnus-summary-tick-article-forward
1347 "U" gnus-summary-tick-article-backward
1348 "d" gnus-summary-mark-as-read-forward
1349 "D" gnus-summary-mark-as-read-backward
1350 "E" gnus-summary-mark-as-expirable
1351 "\M-u" gnus-summary-clear-mark-forward
1352 "\M-U" gnus-summary-clear-mark-backward
1353 "k" gnus-summary-kill-same-subject-and-select
1354 "\C-k" gnus-summary-kill-same-subject
1355 "\M-\C-k" gnus-summary-kill-thread
1356 "\M-\C-l" gnus-summary-lower-thread
1357 "e" gnus-summary-edit-article
1358 "#" gnus-summary-mark-as-processable
1359 "\M-#" gnus-summary-unmark-as-processable
1360 "\M-\C-t" gnus-summary-toggle-threads
1361 "\M-\C-s" gnus-summary-show-thread
1362 "\M-\C-h" gnus-summary-hide-thread
1363 "\M-\C-f" gnus-summary-next-thread
1364 "\M-\C-b" gnus-summary-prev-thread
1365 [(meta down)] gnus-summary-next-thread
1366 [(meta up)] gnus-summary-prev-thread
1367 "\M-\C-u" gnus-summary-up-thread
1368 "\M-\C-d" gnus-summary-down-thread
1369 "&" gnus-summary-execute-command
1370 "c" gnus-summary-catchup-and-exit
1371 "\C-w" gnus-summary-mark-region-as-read
1372 "\C-t" gnus-summary-toggle-truncation
1373 "?" gnus-summary-mark-as-dormant
1374 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1375 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1376 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1377 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1378 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1379 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1380 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1381 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1382 "=" gnus-summary-expand-window
1383 "\C-x\C-s" gnus-summary-reselect-current-group
1384 "\M-g" gnus-summary-rescan-group
1385 "w" gnus-summary-stop-page-breaking
1386 "\C-c\C-r" gnus-summary-caesar-message
1387 "f" gnus-summary-followup
1388 "F" gnus-summary-followup-with-original
1389 "C" gnus-summary-cancel-article
1390 "r" gnus-summary-reply
1391 "R" gnus-summary-reply-with-original
1392 "\C-c\C-f" gnus-summary-mail-forward
1393 "o" gnus-summary-save-article
1394 "\C-o" gnus-summary-save-article-mail
1395 "|" gnus-summary-pipe-output
1396 "\M-k" gnus-summary-edit-local-kill
1397 "\M-K" gnus-summary-edit-global-kill
1399 "\C-c\C-d" gnus-summary-describe-group
1400 "q" gnus-summary-exit
1401 "Q" gnus-summary-exit-no-update
1402 "\C-c\C-i" gnus-info-find-node
1403 gnus-mouse-2 gnus-mouse-pick-article
1404 "m" gnus-summary-mail-other-window
1405 "a" gnus-summary-post-news
1406 "x" gnus-summary-limit-to-unread
1407 "s" gnus-summary-isearch-article
1408 "t" gnus-summary-toggle-header
1409 "g" gnus-summary-show-article
1410 "l" gnus-summary-goto-last-article
1411 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1412 "\C-d" gnus-summary-enter-digest-group
1413 "\M-\C-d" gnus-summary-read-document
1414 "\M-\C-e" gnus-summary-edit-parameters
1415 "\M-\C-a" gnus-summary-customize-parameters
1417 "*" gnus-cache-enter-article
1418 "\M-*" gnus-cache-remove-article
1419 "\M-&" gnus-summary-universal-argument
1420 "\C-l" gnus-recenter
1421 "I" gnus-summary-increase-score
1422 "L" gnus-summary-lower-score
1423 "\M-i" gnus-symbolic-argument
1424 "h" gnus-summary-select-article-buffer
1426 "b" gnus-article-view-part
1427 "\M-t" gnus-summary-toggle-display-buttonized
1429 "V" gnus-summary-score-map
1430 "X" gnus-uu-extract-map
1431 "S" gnus-summary-send-map)
1433 ;; Sort of orthogonal keymap
1434 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1435 "t" gnus-summary-tick-article-forward
1436 "!" gnus-summary-tick-article-forward
1437 "d" gnus-summary-mark-as-read-forward
1438 "r" gnus-summary-mark-as-read-forward
1439 "c" gnus-summary-clear-mark-forward
1440 " " gnus-summary-clear-mark-forward
1441 "e" gnus-summary-mark-as-expirable
1442 "x" gnus-summary-mark-as-expirable
1443 "?" gnus-summary-mark-as-dormant
1444 "b" gnus-summary-set-bookmark
1445 "B" gnus-summary-remove-bookmark
1446 "#" gnus-summary-mark-as-processable
1447 "\M-#" gnus-summary-unmark-as-processable
1448 "S" gnus-summary-limit-include-expunged
1449 "C" gnus-summary-catchup
1450 "H" gnus-summary-catchup-to-here
1451 "\C-c" gnus-summary-catchup-all
1452 "k" gnus-summary-kill-same-subject-and-select
1453 "K" gnus-summary-kill-same-subject
1454 "P" gnus-uu-mark-map)
1456 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1457 "c" gnus-summary-clear-above
1458 "u" gnus-summary-tick-above
1459 "m" gnus-summary-mark-above
1460 "k" gnus-summary-kill-below)
1462 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1463 "/" gnus-summary-limit-to-subject
1464 "n" gnus-summary-limit-to-articles
1465 "w" gnus-summary-pop-limit
1466 "s" gnus-summary-limit-to-subject
1467 "a" gnus-summary-limit-to-author
1468 "u" gnus-summary-limit-to-unread
1469 "m" gnus-summary-limit-to-marks
1470 "M" gnus-summary-limit-exclude-marks
1471 "v" gnus-summary-limit-to-score
1472 "*" gnus-summary-limit-include-cached
1473 "D" gnus-summary-limit-include-dormant
1474 "T" gnus-summary-limit-include-thread
1475 "d" gnus-summary-limit-exclude-dormant
1476 "t" gnus-summary-limit-to-age
1477 "x" gnus-summary-limit-to-extra
1478 "E" gnus-summary-limit-include-expunged
1479 "c" gnus-summary-limit-exclude-childless-dormant
1480 "C" gnus-summary-limit-mark-excluded-as-read)
1482 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1483 "n" gnus-summary-next-unread-article
1484 "p" gnus-summary-prev-unread-article
1485 "N" gnus-summary-next-article
1486 "P" gnus-summary-prev-article
1487 "\C-n" gnus-summary-next-same-subject
1488 "\C-p" gnus-summary-prev-same-subject
1489 "\M-n" gnus-summary-next-unread-subject
1490 "\M-p" gnus-summary-prev-unread-subject
1491 "f" gnus-summary-first-unread-article
1492 "b" gnus-summary-best-unread-article
1493 "j" gnus-summary-goto-article
1494 "g" gnus-summary-goto-subject
1495 "l" gnus-summary-goto-last-article
1496 "o" gnus-summary-pop-article)
1498 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1499 "k" gnus-summary-kill-thread
1500 "l" gnus-summary-lower-thread
1501 "i" gnus-summary-raise-thread
1502 "T" gnus-summary-toggle-threads
1503 "t" gnus-summary-rethread-current
1504 "^" gnus-summary-reparent-thread
1505 "s" gnus-summary-show-thread
1506 "S" gnus-summary-show-all-threads
1507 "h" gnus-summary-hide-thread
1508 "H" gnus-summary-hide-all-threads
1509 "n" gnus-summary-next-thread
1510 "p" gnus-summary-prev-thread
1511 "u" gnus-summary-up-thread
1512 "o" gnus-summary-top-thread
1513 "d" gnus-summary-down-thread
1514 "#" gnus-uu-mark-thread
1515 "\M-#" gnus-uu-unmark-thread)
1517 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1518 "g" gnus-summary-prepare
1519 "c" gnus-summary-insert-cached-articles)
1521 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1522 "c" gnus-summary-catchup-and-exit
1523 "C" gnus-summary-catchup-all-and-exit
1524 "E" gnus-summary-exit-no-update
1525 "Q" gnus-summary-exit
1526 "Z" gnus-summary-exit
1527 "n" gnus-summary-catchup-and-goto-next-group
1528 "R" gnus-summary-reselect-current-group
1529 "G" gnus-summary-rescan-group
1530 "N" gnus-summary-next-group
1531 "s" gnus-summary-save-newsrc
1532 "P" gnus-summary-prev-group)
1534 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1535 " " gnus-summary-next-page
1536 "n" gnus-summary-next-page
1537 "\177" gnus-summary-prev-page
1538 [delete] gnus-summary-prev-page
1539 "p" gnus-summary-prev-page
1540 "\r" gnus-summary-scroll-up
1541 "\M-\r" gnus-summary-scroll-down
1542 "<" gnus-summary-beginning-of-article
1543 ">" gnus-summary-end-of-article
1544 "b" gnus-summary-beginning-of-article
1545 "e" gnus-summary-end-of-article
1546 "^" gnus-summary-refer-parent-article
1547 "r" gnus-summary-refer-parent-article
1548 "D" gnus-summary-enter-digest-group
1549 "R" gnus-summary-refer-references
1550 "T" gnus-summary-refer-thread
1551 "g" gnus-summary-show-article
1552 "s" gnus-summary-isearch-article
1553 "P" gnus-summary-print-article
1554 "t" gnus-article-babel
)
1556 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1557 "b" gnus-article-add-buttons
1558 "B" gnus-article-add-buttons-to-head
1559 "o" gnus-article-treat-overstrike
1560 "e" gnus-article-emphasize
1561 "w" gnus-article-fill-cited-article
1562 "Q" gnus-article-fill-long-lines
1563 "C" gnus-article-capitalize-sentences
1564 "c" gnus-article-remove-cr
1565 "q" gnus-article-de-quoted-unreadable
1566 "6" gnus-article-de-base64-unreadable
1567 "Z" gnus-article-decode-HZ
1568 "h" gnus-article-wash-html
1569 "f" gnus-article-display-x-face
1570 "l" gnus-summary-stop-page-breaking
1571 "r" gnus-summary-caesar-message
1572 "t" gnus-summary-toggle-header
1573 "v" gnus-summary-verbose-headers
1574 "H" gnus-article-strip-headers-in-body
1575 "d" gnus-article-treat-dumbquotes
)
1577 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1578 "a" gnus-article-hide
1579 "h" gnus-article-hide-headers
1580 "b" gnus-article-hide-boring-headers
1581 "s" gnus-article-hide-signature
1582 "c" gnus-article-hide-citation
1583 "C" gnus-article-hide-citation-in-followups
1584 "l" gnus-article-hide-list-identifiers
1585 "p" gnus-article-hide-pgp
1586 "B" gnus-article-strip-banner
1587 "P" gnus-article-hide-pem
1588 "\C-c" gnus-article-hide-citation-maybe
)
1590 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1591 "a" gnus-article-highlight
1592 "h" gnus-article-highlight-headers
1593 "c" gnus-article-highlight-citation
1594 "s" gnus-article-highlight-signature
)
1596 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1597 "w" gnus-article-decode-mime-words
1598 "c" gnus-article-decode-charset
1599 "v" gnus-mime-view-all-parts
1600 "b" gnus-article-view-part
)
1602 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1603 "z" gnus-article-date-ut
1604 "u" gnus-article-date-ut
1605 "l" gnus-article-date-local
1606 "e" gnus-article-date-lapsed
1607 "o" gnus-article-date-original
1608 "i" gnus-article-date-iso8601
1609 "s" gnus-article-date-user
)
1611 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1612 "t" gnus-article-remove-trailing-blank-lines
1613 "l" gnus-article-strip-leading-blank-lines
1614 "m" gnus-article-strip-multiple-blank-lines
1615 "a" gnus-article-strip-blank-lines
1616 "A" gnus-article-strip-all-blank-lines
1617 "s" gnus-article-strip-leading-space
1618 "e" gnus-article-strip-trailing-space
)
1620 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1622 "f" gnus-summary-fetch-faq
1623 "d" gnus-summary-describe-group
1624 "h" gnus-summary-describe-briefly
1625 "i" gnus-info-find-node
)
1627 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1628 "e" gnus-summary-expire-articles
1629 "\M-\C-e" gnus-summary-expire-articles-now
1630 "\177" gnus-summary-delete-article
1631 [delete] gnus-summary-delete-article
1632 [backspace] gnus-summary-delete-article
1633 "m" gnus-summary-move-article
1634 "r" gnus-summary-respool-article
1635 "w" gnus-summary-edit-article
1636 "c" gnus-summary-copy-article
1637 "B" gnus-summary-crosspost-article
1638 "q" gnus-summary-respool-query
1639 "t" gnus-summary-respool-trace
1640 "i" gnus-summary-import-article
1641 "p" gnus-summary-article-posted-p)
1643 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1644 "o" gnus-summary-save-article
1645 "m" gnus-summary-save-article-mail
1646 "F" gnus-summary-write-article-file
1647 "r" gnus-summary-save-article-rmail
1648 "f" gnus-summary-save-article-file
1649 "b" gnus-summary-save-article-body-file
1650 "h" gnus-summary-save-article-folder
1651 "v" gnus-summary-save-article-vm
1652 "p" gnus-summary-pipe-output
1653 "s" gnus-soup-add-article)
1655 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1656 "b" gnus-summary-display-buttonized
1657 "m" gnus-summary-repair-multipart
1658 "v" gnus-article-view-part
1659 "o" gnus-article-save-part
1660 "c" gnus-article-copy-part
1661 "e" gnus-article-externalize-part
1662 "i" gnus-article-inline-part
1663 "|" gnus-article-pipe-part))
1665 (defun gnus-summary-make-menu-bar ()
1666 (gnus-turn-off-edit-menu 'summary)
1668 (unless (boundp 'gnus-summary-misc-menu)
1671 gnus-summary-kill-menu gnus-summary-mode-map ""
1676 ["Enter score..." gnus-summary-score-entry t]
1677 ["Customize" gnus-score-customize t])
1678 (gnus-make-score-map 'increase)
1679 (gnus-make-score-map 'lower)
1681 ["Kill below" gnus-summary-kill-below t]
1682 ["Mark above" gnus-summary-mark-above t]
1683 ["Tick above" gnus-summary-tick-above t]
1684 ["Clear above" gnus-summary-clear-above t])
1685 ["Current score" gnus-summary-current-score t]
1686 ["Set score" gnus-summary-set-score t]
1687 ["Switch current score file..." gnus-score-change-score-file t]
1688 ["Set mark below..." gnus-score-set-mark-below t]
1689 ["Set expunge below..." gnus-score-set-expunge-below t]
1690 ["Edit current score file" gnus-score-edit-current-scores t]
1691 ["Edit score file" gnus-score-edit-file t]
1692 ["Trace score" gnus-score-find-trace t]
1693 ["Find words" gnus-score-find-favourite-words t]
1694 ["Rescore buffer" gnus-summary-rescore t]
1695 ["Increase score..." gnus-summary-increase-score t]
1696 ["Lower score..." gnus-summary-lower-score t]))))
1698 ;; Define both the Article menu in the summary buffer and the equivalent
1699 ;; Commands menu in the article buffer here for consistency.
1702 ["All" gnus-article-hide t]
1703 ["Headers" gnus-article-hide-headers t]
1704 ["Signature" gnus-article-hide-signature t]
1705 ["Citation" gnus-article-hide-citation t]
1706 ["List identifiers" gnus-article-hide-list-identifiers t]
1707 ["PGP" gnus-article-hide-pgp t]
1708 ["Banner" gnus-article-strip-banner t]
1709 ["Boring headers" gnus-article-hide-boring-headers t])
1711 ["All" gnus-article-highlight t]
1712 ["Headers" gnus-article-highlight-headers t]
1713 ["Signature" gnus-article-highlight-signature t]
1714 ["Citation" gnus-article-highlight-citation t])
1716 ["Words" gnus-article-decode-mime-words t]
1717 ["Charset" gnus-article-decode-charset t]
1718 ["QP" gnus-article-de-quoted-unreadable t]
1719 ["Base64" gnus-article-de-base64-unreadable t]
1720 ["View all" gnus-mime-view-all-parts t])
1722 ["Local" gnus-article-date-local t]
1723 ["ISO8601" gnus-article-date-iso8601 t]
1724 ["UT" gnus-article-date-ut t]
1725 ["Original" gnus-article-date-original t]
1726 ["Lapsed" gnus-article-date-lapsed t]
1727 ["User-defined" gnus-article-date-user t])
1730 ["Leading" gnus-article-strip-leading-blank-lines t]
1731 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1732 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1733 ["All of the above" gnus-article-strip-blank-lines t]
1734 ["All" gnus-article-strip-all-blank-lines t]
1735 ["Leading space" gnus-article-strip-leading-space t]
1736 ["Trailing space" gnus-article-strip-trailing-space t])
1737 ["Overstrike" gnus-article-treat-overstrike t]
1738 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1739 ["Emphasis" gnus-article-emphasize t]
1740 ["Word wrap" gnus-article-fill-cited-article t]
1741 ["Fill long lines" gnus-article-fill-long-lines t]
1742 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1743 ["CR" gnus-article-remove-cr t]
1744 ["Show X-Face" gnus-article-display-x-face t]
1745 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1746 ["Base64" gnus-article-de-base64-unreadable t]
1747 ["Rot 13" gnus-summary-caesar-message
1748 :help "\"Caesar rotate\" article by 13"]
1749 ["Unix pipe" gnus-summary-pipe-message t]
1750 ["Add buttons" gnus-article-add-buttons t]
1751 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1752 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1753 ["Verbose header" gnus-summary-verbose-headers t]
1754 ["Toggle header" gnus-summary-toggle-header t]
1755 ["Html" gnus-article-wash-html t]
1756 ["HZ" gnus-article-decode-HZ t])
1758 ["Save in default format" gnus-summary-save-article
1759 :help "Save article using default method"]
1760 ["Save in file" gnus-summary-save-article-file
1761 :help "Save article in file"]
1762 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1763 ["Save in MH folder" gnus-summary-save-article-folder t]
1764 ["Save in VM folder" gnus-summary-save-article-vm t]
1765 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1766 ["Save body in file" gnus-summary-save-article-body-file t]
1767 ["Pipe through a filter" gnus-summary-pipe-output t]
1768 ["Add to SOUP packet" gnus-soup-add-article t]
1769 ["Print" gnus-summary-print-article t])
1771 ["Respool article..." gnus-summary-respool-article t]
1772 ["Move article..." gnus-summary-move-article
1773 (gnus-check-backend-function
1774 'request-move-article gnus-newsgroup-name)]
1775 ["Copy article..." gnus-summary-copy-article t]
1776 ["Crosspost article..." gnus-summary-crosspost-article
1777 (gnus-check-backend-function
1778 'request-replace-article gnus-newsgroup-name)]
1779 ["Import file..." gnus-summary-import-article t]
1780 ["Check if posted" gnus-summary-article-posted-p t]
1781 ["Edit article" gnus-summary-edit-article
1782 (not (gnus-group-read-only-p))]
1783 ["Delete article" gnus-summary-delete-article
1784 (gnus-check-backend-function
1785 'request-expire-articles gnus-newsgroup-name)]
1786 ["Query respool" gnus-summary-respool-query t]
1787 ["Trace respool" gnus-summary-respool-trace t]
1788 ["Delete expirable articles" gnus-summary-expire-articles-now
1789 (gnus-check-backend-function
1790 'request-expire-articles gnus-newsgroup-name)])
1792 ["Uudecode" gnus-uu-decode-uu
1793 :help "Decode uuencoded article(s)"]
1794 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1795 ["Unshar" gnus-uu-decode-unshar t]
1796 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1797 ["Save" gnus-uu-decode-save t]
1798 ["Binhex" gnus-uu-decode-binhex t]
1799 ["Postscript" gnus-uu-decode-postscript t])
1801 ["Enter article" gnus-cache-enter-article t]
1802 ["Remove article" gnus-cache-remove-article t])
1803 ["Translate" gnus-article-babel t]
1804 ["Select article buffer" gnus-summary-select-article-buffer t]
1805 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1806 ["Isearch article..." gnus-summary-isearch-article t]
1807 ["Beginning of the article" gnus-summary-beginning-of-article t]
1808 ["End of the article" gnus-summary-end-of-article t]
1809 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1810 ["Fetch referenced articles" gnus-summary-refer-references t]
1811 ["Fetch current thread" gnus-summary-refer-thread t]
1812 ["Fetch article with id..." gnus-summary-refer-article t]
1813 ["Redisplay" gnus-summary-show-article t])))
1815 gnus-summary-article-menu gnus-summary-mode-map ""
1816 (cons "Article" innards))
1819 gnus-article-commands-menu gnus-article-mode-map ""
1820 (cons "Commands" innards)))
1823 gnus-summary-thread-menu gnus-summary-mode-map ""
1825 ["Toggle threading" gnus-summary-toggle-threads t]
1826 ["Hide threads" gnus-summary-hide-all-threads t]
1827 ["Show threads" gnus-summary-show-all-threads t]
1828 ["Hide thread" gnus-summary-hide-thread t]
1829 ["Show thread" gnus-summary-show-thread t]
1830 ["Go to next thread" gnus-summary-next-thread t]
1831 ["Go to previous thread" gnus-summary-prev-thread t]
1832 ["Go down thread" gnus-summary-down-thread t]
1833 ["Go up thread" gnus-summary-up-thread t]
1834 ["Top of thread" gnus-summary-top-thread t]
1835 ["Mark thread as read" gnus-summary-kill-thread t]
1836 ["Lower thread score" gnus-summary-lower-thread t]
1837 ["Raise thread score" gnus-summary-raise-thread t]
1838 ["Rethread current" gnus-summary-rethread-current t]))
1841 gnus-summary-post-menu gnus-summary-mode-map ""
1843 ["Post an article" gnus-summary-post-news
1844 :help "Post an article"]
1845 ["Followup" gnus-summary-followup
1846 :help "Post followup to this article"]
1847 ["Followup and yank" gnus-summary-followup-with-original
1848 :help "Post followup to this article, quoting its contents"]
1849 ["Supersede article" gnus-summary-supersede-article t]
1850 ["Cancel article" gnus-summary-cancel-article
1851 :help "Cancel an article you posted"]
1852 ["Reply" gnus-summary-reply t]
1853 ["Reply and yank" gnus-summary-reply-with-original t]
1854 ["Wide reply" gnus-summary-wide-reply t]
1855 ["Wide reply and yank" gnus-summary-wide-reply-with-original
1856 :help "Mail a reply, quoting this article"]
1857 ["Mail forward" gnus-summary-mail-forward t]
1858 ["Post forward" gnus-summary-post-forward t]
1859 ["Digest and mail" gnus-uu-digest-mail-forward t]
1860 ["Digest and post" gnus-uu-digest-post-forward t]
1861 ["Resend message" gnus-summary-resend-message t]
1862 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1863 ["Send a mail" gnus-summary-mail-other-window t]
1864 ["Uuencode and post" gnus-uu-post-news
1865 :help "Post a uuencoded article"]
1866 ["Followup via news" gnus-summary-followup-to-mail t]
1867 ["Followup via news and yank"
1868 gnus-summary-followup-to-mail-with-original t]
1870 ;;["Send" gnus-summary-send-draft t]
1871 ;;["Send bounced" gnus-resend-bounced-mail t])
1875 gnus-summary-misc-menu gnus-summary-mode-map ""
1878 ["Mark as read" gnus-summary-mark-as-read-forward t]
1879 ["Mark same subject and select"
1880 gnus-summary-kill-same-subject-and-select t]
1881 ["Mark same subject" gnus-summary-kill-same-subject t]
1882 ["Catchup" gnus-summary-catchup
1883 :help "Mark unread articles in this group as read"]
1884 ["Catchup all" gnus-summary-catchup-all t]
1885 ["Catchup to here" gnus-summary-catchup-to-here t]
1886 ["Catchup region" gnus-summary-mark-region-as-read t]
1887 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1889 ["Tick" gnus-summary-tick-article-forward t]
1890 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1891 ["Remove marks" gnus-summary-clear-mark-forward t]
1892 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1893 ["Set bookmark" gnus-summary-set-bookmark t]
1894 ["Remove bookmark" gnus-summary-remove-bookmark t])
1896 ["Marks..." gnus-summary-limit-to-marks t]
1897 ["Subject..." gnus-summary-limit-to-subject t]
1898 ["Author..." gnus-summary-limit-to-author t]
1899 ["Age..." gnus-summary-limit-to-age t]
1900 ["Extra..." gnus-summary-limit-to-extra t]
1901 ["Score" gnus-summary-limit-to-score t]
1902 ["Unread" gnus-summary-limit-to-unread t]
1903 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1904 ["Articles" gnus-summary-limit-to-articles t]
1905 ["Pop limit" gnus-summary-pop-limit t]
1906 ["Show dormant" gnus-summary-limit-include-dormant t]
1907 ["Hide childless dormant"
1908 gnus-summary-limit-exclude-childless-dormant t]
1909 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1910 ["Hide marked" gnus-summary-limit-exclude-marks t]
1911 ["Show expunged" gnus-summary-show-all-expunged t])
1913 ["Set mark" gnus-summary-mark-as-processable t]
1914 ["Remove mark" gnus-summary-unmark-as-processable t]
1915 ["Remove all marks" gnus-summary-unmark-all-processable t]
1916 ["Mark above" gnus-uu-mark-over t]
1917 ["Mark series" gnus-uu-mark-series t]
1918 ["Mark region" gnus-uu-mark-region t]
1919 ["Unmark region" gnus-uu-unmark-region t]
1920 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1921 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1922 ["Mark all" gnus-uu-mark-all t]
1923 ["Mark buffer" gnus-uu-mark-buffer t]
1924 ["Mark sparse" gnus-uu-mark-sparse t]
1925 ["Mark thread" gnus-uu-mark-thread t]
1926 ["Unmark thread" gnus-uu-unmark-thread t]
1927 ("Process Mark Sets"
1928 ["Kill" gnus-summary-kill-process-mark t]
1929 ["Yank" gnus-summary-yank-process-mark
1930 gnus-newsgroup-process-stack]
1931 ["Save" gnus-summary-save-process-mark t]))
1933 ["Page forward" gnus-summary-next-page
1934 :help "Show next page of article"]
1935 ["Page backward" gnus-summary-prev-page
1936 :help "Show previous page of article"]
1937 ["Line forward" gnus-summary-scroll-up t])
1939 ["Next unread article" gnus-summary-next-unread-article t]
1940 ["Previous unread article" gnus-summary-prev-unread-article t]
1941 ["Next article" gnus-summary-next-article t]
1942 ["Previous article" gnus-summary-prev-article t]
1943 ["Next unread subject" gnus-summary-next-unread-subject t]
1944 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1945 ["Next article same subject" gnus-summary-next-same-subject t]
1946 ["Previous article same subject" gnus-summary-prev-same-subject t]
1947 ["First unread article" gnus-summary-first-unread-article t]
1948 ["Best unread article" gnus-summary-best-unread-article t]
1949 ["Go to subject number..." gnus-summary-goto-subject t]
1950 ["Go to article number..." gnus-summary-goto-article t]
1951 ["Go to the last article" gnus-summary-goto-last-article t]
1952 ["Pop article off history" gnus-summary-pop-article t])
1954 ["Sort by number" gnus-summary-sort-by-number t]
1955 ["Sort by author" gnus-summary-sort-by-author t]
1956 ["Sort by subject" gnus-summary-sort-by-subject t]
1957 ["Sort by date" gnus-summary-sort-by-date t]
1958 ["Sort by score" gnus-summary-sort-by-score t]
1959 ["Sort by lines" gnus-summary-sort-by-lines t]
1960 ["Sort by characters" gnus-summary-sort-by-chars t])
1962 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1963 ["Describe group" gnus-summary-describe-group t]
1964 ["Read manual" gnus-info-find-node t])
1966 ["Pick and read" gnus-pick-mode t]
1967 ["Binary" gnus-binary-mode t])
1969 ["Regenerate" gnus-summary-prepare t]
1970 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1971 ["Toggle threading" gnus-summary-toggle-threads t])
1972 ["Filter articles..." gnus-summary-execute-command t]
1973 ["Run command on subjects..." gnus-summary-universal-argument t]
1974 ["Search articles forward..." gnus-summary-search-article-forward t]
1975 ["Search articles backward..." gnus-summary-search-article-backward t]
1976 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1977 ["Expand window" gnus-summary-expand-window t]
1978 ["Expire expirable articles" gnus-summary-expire-articles
1979 (gnus-check-backend-function
1980 'request-expire-articles gnus-newsgroup-name)]
1981 ["Edit local kill file" gnus-summary-edit-local-kill t]
1982 ["Edit main kill file" gnus-summary-edit-global-kill t]
1983 ["Edit group parameters" gnus-summary-edit-parameters t]
1984 ["Customize group parameters" gnus-summary-customize-parameters t]
1985 ["Send a bug report" gnus-bug t]
1987 ["Catchup and exit" gnus-summary-catchup-and-exit
1988 :help "Mark unread articles in this group as read, then exit"]
1989 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1990 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1991 ["Exit group" gnus-summary-exit
1992 :help "Exit current group, return to group selection mode"]
1993 ["Exit group without updating" gnus-summary-exit-no-update t]
1994 ["Exit and goto next group" gnus-summary-next-group t]
1995 ["Exit and goto prev group" gnus-summary-prev-group t]
1996 ["Reselect group" gnus-summary-reselect-current-group t]
1997 ["Rescan group" gnus-summary-rescan-group t]
1998 ["Update dribble" gnus-summary-save-newsrc t])))
2000 (gnus-run-hooks 'gnus-summary-menu-hook)))
2002 (defvar gnus-summary-tool-bar-map nil)
2004 ;; Emacs 21 tool bar. Should be no-op otherwise.
2005 (defun gnus-summary-make-tool-bar ()
2006 (if (and (fboundp 'tool-bar-add-item-from-menu)
2007 (default-value 'tool-bar-mode)
2008 (not gnus-summary-tool-bar-map))
2009 (setq gnus-summary-tool-bar-map
2010 (let ((tool-bar-map (make-sparse-keymap)))
2011 (tool-bar-add-item-from-menu
2012 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2013 (tool-bar-add-item-from-menu
2014 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2015 (tool-bar-add-item-from-menu
2016 'gnus-summary-post-news "post" gnus-summary-mode-map)
2017 (tool-bar-add-item-from-menu
2018 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2019 (tool-bar-add-item-from-menu
2020 'gnus-summary-followup "followup" gnus-summary-mode-map)
2021 (tool-bar-add-item-from-menu
2022 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2023 (tool-bar-add-item-from-menu
2024 'gnus-summary-reply "reply" gnus-summary-mode-map)
2025 (tool-bar-add-item-from-menu
2026 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2027 (tool-bar-add-item-from-menu
2028 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2029 (tool-bar-add-item-from-menu
2030 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2031 (tool-bar-add-item-from-menu
2032 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2033 (tool-bar-add-item-from-menu
2034 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2035 (tool-bar-add-item-from-menu
2036 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2037 (tool-bar-add-item-from-menu
2038 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2039 (tool-bar-add-item-from-menu
2040 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2042 (if gnus-summary-tool-bar-map
2043 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2045 (defun gnus-score-set-default (var value)
2046 "A version of set that updates the GNU Emacs menu-bar."
2048 ;; It is the message that forces the active status to be updated.
2051 (defun gnus-make-score-map (type)
2052 "Make a summary score map of type TYPE."
2055 (let ((headers '(("author" "from" string)
2056 ("subject" "subject" string)
2057 ("article body" "body" string)
2058 ("article head" "head" string)
2059 ("xref" "xref" string)
2060 ("extra header" "extra" string)
2061 ("lines" "lines" number)
2062 ("followups to author" "followup" string)))
2063 (types '((number ("less than" <)
2066 (string ("substring" s)
2070 (perms '(("temporary" (current-time-string))
2078 (if (eq type 'lower)
2083 (setq header (car headers))
2089 (let ((ts (cdr (assoc (nth 2 header) types)))
2105 'gnus-summary-score-entry
2107 (if (or (string= (nth 1 header)
2109 (string= (nth 1 header)
2112 (list 'gnus-summary-header
2114 (list 'quote (nth 1 (car ts)))
2115 (list 'gnus-score-delta-default
2122 (list (nreverse outp))))
2125 (list (nreverse outt))))
2127 (setq headers (cdr headers)))
2128 (list (nreverse outh))))))))
2132 (defun gnus-summary-mode (&optional group)
2133 "Major mode for reading articles.
2135 All normal editing commands are switched off.
2136 \\<gnus-summary-mode-map>
2137 Each line in this buffer represents one article. To read an
2138 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2139 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2142 You can also post articles and send mail from this buffer. To
2143 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2144 of an article, type `\\[gnus-summary-reply]'.
2146 There are approx. one gazillion commands you can execute in this
2147 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2149 The following commands are available:
2151 \\{gnus-summary-mode-map}"
2153 (kill-all-local-variables)
2154 (when (gnus-visual-p 'summary-menu 'menu)
2155 (gnus-summary-make-menu-bar)
2156 (gnus-summary-make-tool-bar))
2157 (gnus-summary-make-local-variables)
2158 (gnus-make-thread-indent-array)
2159 (gnus-simplify-mode-line)
2160 (setq major-mode 'gnus-summary-mode)
2161 (setq mode-name "Summary")
2162 (make-local-variable 'minor-mode-alist)
2163 (use-local-map gnus-summary-mode-map)
2164 (buffer-disable-undo)
2165 (setq buffer-read-only t) ;Disable modification
2166 (setq truncate-lines t)
2167 (setq selective-display t)
2168 (setq selective-display-ellipses t) ;Display `...'
2169 (gnus-summary-set-display-table)
2170 (gnus-set-default-directory)
2171 (setq gnus-newsgroup-name group)
2172 (make-local-variable 'gnus-summary-line-format)
2173 (make-local-variable 'gnus-summary-line-format-spec)
2174 (make-local-variable 'gnus-summary-dummy-line-format)
2175 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2176 (make-local-variable 'gnus-summary-mark-positions)
2177 (make-local-hook 'pre-command-hook)
2178 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2179 (gnus-run-hooks 'gnus-summary-mode-hook)
2180 (mm-enable-multibyte-mule4)
2181 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2182 (gnus-update-summary-mark-positions))
2184 (defun gnus-summary-make-local-variables ()
2185 "Make all the local summary buffer variables."
2187 (dolist (local gnus-summary-local-variables)
2190 (if (eq (cdr local) 'global)
2191 ;; Copy the global value of the variable.
2192 (setq global (symbol-value (car local)))
2193 ;; Use the value from the list.
2194 (setq global (eval (cdr local))))
2195 (set (make-local-variable (car local)) global))
2196 ;; Simple nil-valued local variable.
2197 (set (make-local-variable local) nil)))))
2199 (defun gnus-summary-clear-local-variables ()
2200 (let ((locals gnus-summary-local-variables))
2202 (if (consp (car locals))
2203 (and (vectorp (caar locals))
2204 (set (caar locals) nil))
2205 (and (vectorp (car locals))
2206 (set (car locals) nil)))
2207 (setq locals (cdr locals)))))
2209 ;; Summary data functions.
2211 (defmacro gnus-data-number (data)
2214 (defmacro gnus-data-set-number (data number)
2215 `(setcar ,data ,number))
2217 (defmacro gnus-data-mark (data)
2220 (defmacro gnus-data-set-mark (data mark)
2221 `(setcar (nthcdr 1 ,data) ,mark))
2223 (defmacro gnus-data-pos (data)
2226 (defmacro gnus-data-set-pos (data pos)
2227 `(setcar (nthcdr 2 ,data) ,pos))
2229 (defmacro gnus-data-header (data)
2232 (defmacro gnus-data-set-header (data header)
2233 `(setf (nth 3 ,data) ,header))
2235 (defmacro gnus-data-level (data)
2238 (defmacro gnus-data-unread-p (data)
2239 `(= (nth 1 ,data) gnus-unread-mark))
2241 (defmacro gnus-data-read-p (data)
2242 `(/= (nth 1 ,data) gnus-unread-mark))
2244 (defmacro gnus-data-pseudo-p (data)
2245 `(consp (nth 3 ,data)))
2247 (defmacro gnus-data-find (number)
2248 `(assq ,number gnus-newsgroup-data))
2250 (defmacro gnus-data-find-list (number &optional data)
2251 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2252 (memq (assq ,number bdata)
2255 (defmacro gnus-data-make (number mark pos header level)
2256 `(list ,number ,mark ,pos ,header ,level))
2258 (defun gnus-data-enter (after-article number mark pos header level offset)
2259 (let ((data (gnus-data-find-list after-article)))
2261 (error "No such article: %d" after-article))
2262 (setcdr data (cons (gnus-data-make number mark pos header level)
2264 (setq gnus-newsgroup-data-reverse nil)
2265 (gnus-data-update-list (cddr data) offset)))
2267 (defun gnus-data-enter-list (after-article list &optional offset)
2269 (let ((data (and after-article (gnus-data-find-list after-article)))
2273 (let ((odata gnus-newsgroup-data))
2274 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2276 (gnus-data-update-list odata offset)))
2277 ;; Find the last element in the list to be spliced into the main
2280 (setq list (cdr list)))
2283 (setcdr list gnus-newsgroup-data)
2284 (setq gnus-newsgroup-data ilist)
2286 (gnus-data-update-list (cdr list) offset)))
2287 (setcdr list (cdr data))
2290 (gnus-data-update-list (cdr list) offset))))
2291 (setq gnus-newsgroup-data-reverse nil))))
2293 (defun gnus-data-remove (article &optional offset)
2294 (let ((data gnus-newsgroup-data))
2295 (if (= (gnus-data-number (car data)) article)
2297 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2298 gnus-newsgroup-data-reverse nil)
2300 (gnus-data-update-list gnus-newsgroup-data offset)))
2302 (when (= (gnus-data-number (cadr data)) article)
2303 (setcdr data (cddr data))
2305 (gnus-data-update-list (cdr data) offset))
2307 gnus-newsgroup-data-reverse nil))
2308 (setq data (cdr data))))))
2310 (defmacro gnus-data-list (backward)
2312 (or gnus-newsgroup-data-reverse
2313 (setq gnus-newsgroup-data-reverse
2314 (reverse gnus-newsgroup-data)))
2315 gnus-newsgroup-data))
2317 (defun gnus-data-update-list (data offset)
2318 "Add OFFSET to the POS of all data entries in DATA."
2319 (setq gnus-newsgroup-data-reverse nil)
2321 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2322 (setq data (cdr data))))
2324 (defun gnus-summary-article-pseudo-p (article)
2325 "Say whether this article is a pseudo article or not."
2326 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2328 (defmacro gnus-summary-article-sparse-p (article)
2329 "Say whether this article is a sparse article or not."
2330 `(memq ,article gnus-newsgroup-sparse))
2332 (defmacro gnus-summary-article-ancient-p (article)
2333 "Say whether this article is a sparse article or not."
2334 `(memq ,article gnus-newsgroup-ancient))
2336 (defun gnus-article-parent-p (number)
2337 "Say whether this article is a parent or not."
2338 (let ((data (gnus-data-find-list number)))
2339 (and (cdr data) ; There has to be an article after...
2340 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2341 (gnus-data-level (nth 1 data))))))
2343 (defun gnus-article-children (number)
2344 "Return a list of all children to NUMBER."
2345 (let* ((data (gnus-data-find-list number))
2346 (level (gnus-data-level (car data)))
2348 (setq data (cdr data))
2350 (= (gnus-data-level (car data)) (1+ level)))
2351 (push (gnus-data-number (car data)) children)
2352 (setq data (cdr data)))
2355 (defmacro gnus-summary-skip-intangible ()
2356 "If the current article is intangible, then jump to a different article."
2357 '(let ((to (get-text-property (point) 'gnus-intangible)))
2358 (and to (gnus-summary-goto-subject to))))
2360 (defmacro gnus-summary-article-intangible-p ()
2361 "Say whether this article is intangible or not."
2362 '(get-text-property (point) 'gnus-intangible))
2364 (defun gnus-article-read-p (article)
2365 "Say whether ARTICLE is read or not."
2366 (not (or (memq article gnus-newsgroup-marked)
2367 (memq article gnus-newsgroup-unreads)
2368 (memq article gnus-newsgroup-unselected)
2369 (memq article gnus-newsgroup-dormant))))
2371 ;; Some summary mode macros.
2373 (defmacro gnus-summary-article-number ()
2374 "The article number of the article on the current line.
2375 If there isn's an article number here, then we return the current
2378 (gnus-summary-skip-intangible)
2379 (or (get-text-property (point) 'gnus-number)
2380 (gnus-summary-last-subject))))
2382 (defmacro gnus-summary-article-header (&optional number)
2383 "Return the header of article NUMBER."
2384 `(gnus-data-header (gnus-data-find
2385 ,(or number '(gnus-summary-article-number)))))
2387 (defmacro gnus-summary-thread-level (&optional number)
2388 "Return the level of thread that starts with article NUMBER."
2389 `(if (and (eq gnus-summary-make-false-root 'dummy)
2390 (get-text-property (point) 'gnus-intangible))
2392 (gnus-data-level (gnus-data-find
2393 ,(or number '(gnus-summary-article-number))))))
2395 (defmacro gnus-summary-article-mark (&optional number)
2396 "Return the mark of article NUMBER."
2397 `(gnus-data-mark (gnus-data-find
2398 ,(or number '(gnus-summary-article-number)))))
2400 (defmacro gnus-summary-article-pos (&optional number)
2401 "Return the position of the line of article NUMBER."
2402 `(gnus-data-pos (gnus-data-find
2403 ,(or number '(gnus-summary-article-number)))))
2405 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2406 (defmacro gnus-summary-article-subject (&optional number)
2407 "Return current subject string or nil if nothing."
2410 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2411 '(gnus-data-header (assq (gnus-summary-article-number)
2412 gnus-newsgroup-data)))))
2415 (mail-header-subject headers))))
2417 (defmacro gnus-summary-article-score (&optional number)
2418 "Return current article score."
2419 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2420 gnus-newsgroup-scored))
2421 gnus-summary-default-score 0))
2423 (defun gnus-summary-article-children (&optional number)
2424 "Return a list of article numbers that are children of article NUMBER."
2425 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2426 (level (gnus-data-level (car data)))
2428 (while (and (setq data (cdr data))
2429 (> (setq l (gnus-data-level (car data))) level))
2430 (and (= (1+ level) l)
2431 (push (gnus-data-number (car data))
2433 (nreverse children)))
2435 (defun gnus-summary-article-parent (&optional number)
2436 "Return the article number of the parent of article NUMBER."
2437 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2438 (gnus-data-list t)))
2439 (level (gnus-data-level (car data))))
2441 () ; This is a root.
2442 ;; We search until we find an article with a level less than
2443 ;; this one. That function has to be the parent.
2444 (while (and (setq data (cdr data))
2445 (not (< (gnus-data-level (car data)) level))))
2446 (and data (gnus-data-number (car data))))))
2448 (defun gnus-unread-mark-p (mark)
2449 "Say whether MARK is the unread mark."
2450 (= mark gnus-unread-mark))
2452 (defun gnus-read-mark-p (mark)
2453 "Say whether MARK is one of the marks that mark as read.
2454 This is all marks except unread, ticked, dormant, and expirable."
2455 (not (or (= mark gnus-unread-mark)
2456 (= mark gnus-ticked-mark)
2457 (= mark gnus-dormant-mark)
2458 (= mark gnus-expirable-mark))))
2460 (defmacro gnus-article-mark (number)
2461 "Return the MARK of article NUMBER.
2462 This macro should only be used when computing the mark the \"first\"
2463 time; i.e., when generating the summary lines. After that,
2464 `gnus-summary-article-mark' should be used to examine the
2467 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2468 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2469 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2470 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2471 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2472 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2473 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2474 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2475 gnus-ancient-mark))))
2477 ;; Saving hidden threads.
2479 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2480 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2482 (defmacro gnus-save-hidden-threads (&rest forms)
2483 "Save hidden threads, eval FORMS, and restore the hidden threads."
2484 (let ((config (make-symbol "config")))
2485 `(let ((,config (gnus-hidden-threads-configuration)))
2489 (gnus-restore-hidden-threads-configuration ,config)))))
2491 (defun gnus-data-compute-positions ()
2492 "Compute the positions of all articles."
2493 (setq gnus-newsgroup-data-reverse nil)
2494 (let ((data gnus-newsgroup-data))
2496 (gnus-save-hidden-threads
2497 (gnus-summary-show-all-threads)
2498 (goto-char (point-min))
2500 (while (get-text-property (point) 'gnus-intangible)
2502 (gnus-data-set-pos (car data) (+ (point) 3))
2503 (setq data (cdr data))
2504 (forward-line 1))))))
2506 (defun gnus-hidden-threads-configuration ()
2507 "Return the current hidden threads configuration."
2510 (goto-char (point-min))
2511 (while (search-forward "\r" nil t)
2512 (push (1- (point)) config))
2515 (defun gnus-restore-hidden-threads-configuration (config)
2516 "Restore hidden threads configuration from CONFIG."
2518 (let (point buffer-read-only)
2519 (while (setq point (pop config))
2520 (when (and (< point (point-max))
2522 (eq (char-after) ?\n))
2523 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2525 ;; Various summary mode internalish functions.
2527 (defun gnus-mouse-pick-article (e)
2530 (gnus-summary-next-page nil t))
2532 (defun gnus-summary-set-display-table ()
2533 "Change the display table.
2534 Odd characters have a tendency to mess
2535 up nicely formatted displays - we make all possible glyphs
2536 display only a single character."
2538 ;; We start from the standard display table, if any.
2539 (let ((table (or (copy-sequence standard-display-table)
2540 (make-display-table)))
2542 ;; Nix out all the control chars...
2543 (while (>= (setq i (1- i)) 0)
2544 (aset table i [??]))
2545 ;; ... but not newline and cr, of course. (cr is necessary for the
2546 ;; selective display).
2547 (aset table ?\n nil)
2548 (aset table ?\r nil)
2549 ;; We keep TAB as well.
2550 (aset table ?\t nil)
2551 ;; We nix out any glyphs over 126 that are not set already.
2553 (while (>= (setq i (1- i)) 127)
2554 ;; Only modify if the entry is nil.
2555 (unless (aref table i)
2556 (aset table i [??]))))
2557 (setq buffer-display-table table)))
2559 (defun gnus-summary-setup-buffer (group)
2560 "Initialize summary buffer."
2561 (let ((buffer (concat "*Summary " group "*")))
2562 (if (get-buffer buffer)
2565 (setq gnus-summary-buffer (current-buffer))
2566 (not gnus-newsgroup-prepared))
2567 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2568 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2569 (gnus-summary-mode group)
2571 (gnus-carpal-setup-buffer 'summary))
2572 (unless gnus-single-article-buffer
2573 (make-local-variable 'gnus-article-buffer)
2574 (make-local-variable 'gnus-article-current)
2575 (make-local-variable 'gnus-original-article-buffer))
2576 (setq gnus-newsgroup-name group)
2579 (defun gnus-set-global-variables ()
2580 "Set the global equivalents of the buffer-local variables.
2581 They are set to the latest values they had. These reflect the summary
2582 buffer that was in action when the last article was fetched."
2583 (when (eq major-mode 'gnus-summary-mode)
2584 (setq gnus-summary-buffer (current-buffer))
2585 (let ((name gnus-newsgroup-name)
2586 (marked gnus-newsgroup-marked)
2587 (unread gnus-newsgroup-unreads)
2588 (headers gnus-current-headers)
2589 (data gnus-newsgroup-data)
2590 (summary gnus-summary-buffer)
2591 (article-buffer gnus-article-buffer)
2592 (original gnus-original-article-buffer)
2593 (gac gnus-article-current)
2594 (reffed gnus-reffed-article-number)
2595 (score-file gnus-current-score-file)
2596 (default-charset gnus-newsgroup-charset))
2598 (set-buffer gnus-group-buffer)
2599 (setq gnus-newsgroup-name name
2600 gnus-newsgroup-marked marked
2601 gnus-newsgroup-unreads unread
2602 gnus-current-headers headers
2603 gnus-newsgroup-data data
2604 gnus-article-current gac
2605 gnus-summary-buffer summary
2606 gnus-article-buffer article-buffer
2607 gnus-original-article-buffer original
2608 gnus-reffed-article-number reffed
2609 gnus-current-score-file score-file
2610 gnus-newsgroup-charset default-charset)
2611 ;; The article buffer also has local variables.
2612 (when (gnus-buffer-live-p gnus-article-buffer)
2613 (set-buffer gnus-article-buffer)
2614 (setq gnus-summary-buffer summary))))))
2616 (defun gnus-summary-article-unread-p (article)
2617 "Say whether ARTICLE is unread or not."
2618 (memq article gnus-newsgroup-unreads))
2620 (defun gnus-summary-first-article-p (&optional article)
2621 "Return whether ARTICLE is the first article in the buffer."
2622 (if (not (setq article (or article (gnus-summary-article-number))))
2624 (eq article (caar gnus-newsgroup-data))))
2626 (defun gnus-summary-last-article-p (&optional article)
2627 "Return whether ARTICLE is the last article in the buffer."
2628 (if (not (setq article (or article (gnus-summary-article-number))))
2629 ;; All non-existent numbers are the last article. :-)
2631 (not (cdr (gnus-data-find-list article)))))
2633 (defun gnus-make-thread-indent-array ()
2635 (unless (and gnus-thread-indent-array
2636 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2637 (setq gnus-thread-indent-array (make-vector 201 "")
2638 gnus-thread-indent-array-level gnus-thread-indent-level)
2640 (aset gnus-thread-indent-array n
2641 (make-string (* n gnus-thread-indent-level) ? ))
2644 (defun gnus-update-summary-mark-positions ()
2645 "Compute where the summary marks are to go."
2647 (when (gnus-buffer-exists-p gnus-summary-buffer)
2648 (set-buffer gnus-summary-buffer))
2649 (let ((gnus-replied-mark 129)
2650 (gnus-score-below-mark 130)
2651 (gnus-score-over-mark 130)
2652 (gnus-download-mark 131)
2653 (spec gnus-summary-line-format-spec)
2656 (gnus-set-work-buffer)
2657 (let ((gnus-summary-line-format-spec spec)
2658 (gnus-newsgroup-downloadable '((0 . t))))
2659 (gnus-summary-insert-line
2660 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2661 (goto-char (point-min))
2662 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2664 (goto-char (point-min))
2665 (push (cons 'replied (and (search-forward "\201" nil t)
2668 (goto-char (point-min))
2669 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2671 (goto-char (point-min))
2672 (push (cons 'download
2673 (and (search-forward "\203" nil t) (- (point) 2)))
2675 (setq gnus-summary-mark-positions pos))))
2677 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2678 "Insert a dummy root in the summary buffer."
2680 (gnus-add-text-properties
2681 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2682 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2684 (defun gnus-summary-from-or-to-or-newsgroups (header)
2685 (let ((to (cdr (assq 'To (mail-header-extra header))))
2686 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2687 (mail-parse-charset gnus-newsgroup-charset)
2688 (mail-parse-ignored-charsets
2689 (save-excursion (set-buffer gnus-summary-buffer)
2690 gnus-newsgroup-ignored-charsets)))
2693 gnus-ignored-from-addresses
2694 (string-match gnus-ignored-from-addresses
2695 (mail-header-from header)))
2697 (or (car (funcall gnus-extract-address-components
2699 gnus-decode-encoded-word-function to)))
2700 (funcall gnus-decode-encoded-word-function to))))
2702 gnus-ignored-from-addresses
2703 (string-match gnus-ignored-from-addresses
2704 (mail-header-from header)))
2705 (concat "=> " newsgroups))
2707 (or (car (funcall gnus-extract-address-components
2708 (mail-header-from header)))
2709 (mail-header-from header))))))
2711 (defun gnus-summary-insert-line (gnus-tmp-header
2712 gnus-tmp-level gnus-tmp-current
2713 gnus-tmp-unread gnus-tmp-replied
2714 gnus-tmp-expirable gnus-tmp-subject-or-nil
2715 &optional gnus-tmp-dummy gnus-tmp-score
2717 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2718 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2719 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2720 (gnus-tmp-score-char
2721 (if (or (null gnus-summary-default-score)
2722 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2723 gnus-summary-zcore-fuzz))
2725 (if (< gnus-tmp-score gnus-summary-default-score)
2726 gnus-score-below-mark gnus-score-over-mark)))
2728 (cond (gnus-tmp-process gnus-process-mark)
2729 ((memq gnus-tmp-current gnus-newsgroup-cached)
2731 (gnus-tmp-replied gnus-replied-mark)
2732 ((memq gnus-tmp-current gnus-newsgroup-saved)
2734 (t gnus-unread-mark)))
2735 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2738 ((string-match "<[^>]+> *$" gnus-tmp-from)
2739 (let ((beg (match-beginning 0)))
2740 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2741 (substring gnus-tmp-from (1+ (match-beginning 0))
2742 (1- (match-end 0))))
2743 (substring gnus-tmp-from 0 beg))))
2744 ((string-match "(.+)" gnus-tmp-from)
2745 (substring gnus-tmp-from
2746 (1+ (match-beginning 0)) (1- (match-end 0))))
2748 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2749 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2750 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2751 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2752 (buffer-read-only nil))
2753 (when (string= gnus-tmp-name "")
2754 (setq gnus-tmp-name gnus-tmp-from))
2755 (unless (numberp gnus-tmp-lines)
2756 (setq gnus-tmp-lines 0))
2757 (gnus-put-text-property
2759 (progn (eval gnus-summary-line-format-spec) (point))
2760 'gnus-number gnus-tmp-number)
2761 (when (gnus-visual-p 'summary-highlight 'highlight)
2763 (gnus-run-hooks 'gnus-summary-update-hook)
2766 (defun gnus-summary-update-line (&optional dont-update)
2767 "Update summary line after change."
2768 (when (and gnus-summary-default-score
2769 (not gnus-summary-inhibit-highlight))
2770 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2771 (article (gnus-summary-article-number))
2772 (score (gnus-summary-article-score article)))
2774 (if (and gnus-summary-mark-below
2775 (< (gnus-summary-article-score)
2776 gnus-summary-mark-below))
2777 ;; This article has a low score, so we mark it as read.
2778 (when (memq article gnus-newsgroup-unreads)
2779 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2780 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2781 ;; This article was previously marked as read on account
2782 ;; of a low score, but now it has risen, so we mark it as
2784 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2785 (gnus-summary-update-mark
2786 (if (or (null gnus-summary-default-score)
2787 (<= (abs (- score gnus-summary-default-score))
2788 gnus-summary-zcore-fuzz))
2790 (if (< score gnus-summary-default-score)
2791 gnus-score-below-mark gnus-score-over-mark))
2793 ;; Do visual highlighting.
2794 (when (gnus-visual-p 'summary-highlight 'highlight)
2795 (gnus-run-hooks 'gnus-summary-update-hook)))))
2797 (defvar gnus-tmp-new-adopts nil)
2799 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2800 "Return the number of articles in THREAD.
2801 This may be 0 in some cases -- if none of the articles in
2802 the thread are to be displayed."
2804 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2806 ((not (listp thread))
2808 ((and (consp thread) (cdr thread))
2811 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2814 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2817 (when (and level (zerop level) gnus-tmp-new-adopts)
2820 'gnus-summary-number-of-articles-in-thread
2821 gnus-tmp-new-adopts))))
2823 (if (> number 1) gnus-not-empty-thread-mark
2824 gnus-empty-thread-mark)
2827 (defun gnus-summary-set-local-parameters (group)
2828 "Go through the local params of GROUP and set all variable specs in that list."
2829 (let ((params (gnus-group-find-parameter group))
2832 (setq elem (car params)
2833 params (cdr params))
2834 (and (consp elem) ; Has to be a cons.
2835 (consp (cdr elem)) ; The cdr has to be a list.
2836 (symbolp (car elem)) ; Has to be a symbol in there.
2837 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2838 (ignore-errors ; So we set it.
2839 (make-local-variable (car elem))
2840 (set (car elem) (eval (nth 1 elem))))))))
2842 (defun gnus-summary-read-group (group &optional show-all no-article
2843 kill-buffer no-display backward
2845 "Start reading news in newsgroup GROUP.
2846 If SHOW-ALL is non-nil, already read articles are also listed.
2847 If NO-ARTICLE is non-nil, no article is selected initially.
2848 If NO-DISPLAY, don't generate a summary buffer."
2852 (let ((gnus-auto-select-next nil))
2853 (or (gnus-summary-read-group-1
2854 group show-all no-article
2855 kill-buffer no-display
2858 select-articles nil)))))
2859 (eq gnus-auto-select-next 'quietly))
2860 (set-buffer gnus-group-buffer)
2861 ;; The entry function called above goes to the next
2862 ;; group automatically, so we go two groups back
2863 ;; if we are searching for the previous group.
2865 (gnus-group-prev-unread-group 2))
2866 (if (not (equal group (gnus-group-group-name)))
2867 (setq group (gnus-group-group-name))
2871 (defun gnus-summary-read-group-1 (group show-all no-article
2872 kill-buffer no-display
2873 &optional select-articles)
2874 ;; Killed foreign groups can't be entered.
2875 (when (and (not (gnus-group-native-p group))
2876 (not (gnus-gethash group gnus-newsrc-hashtb)))
2877 (error "Dead non-native groups can't be entered"))
2878 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2879 (let* ((new-group (gnus-summary-setup-buffer group))
2880 (quit-config (gnus-group-quit-config group))
2881 (did-select (and new-group (gnus-select-newsgroup
2882 group show-all select-articles))))
2884 ;; This summary buffer exists already, so we just select it.
2886 (gnus-set-global-variables)
2888 (gnus-kill-or-deaden-summary kill-buffer))
2889 (gnus-configure-windows 'summary 'force)
2890 (gnus-set-mode-line 'summary)
2891 (gnus-summary-position-point)
2894 ;; We couldn't select this group.
2896 (when (and (eq major-mode 'gnus-summary-mode)
2897 (not (equal (current-buffer) kill-buffer)))
2898 (kill-buffer (current-buffer))
2899 (if (not quit-config)
2901 ;; Update the info -- marks might need to be removed,
2903 (gnus-summary-update-info)
2904 (set-buffer gnus-group-buffer)
2905 (gnus-group-jump-to-group group)
2906 (gnus-group-next-unread-group 1))
2907 (gnus-handle-ephemeral-exit quit-config)))
2908 (gnus-message 3 "Can't select group")
2910 ;; The user did a `C-g' while prompting for number of articles,
2911 ;; so we exit this group.
2912 ((eq did-select 'quit)
2913 (and (eq major-mode 'gnus-summary-mode)
2914 (not (equal (current-buffer) kill-buffer))
2915 (kill-buffer (current-buffer)))
2917 (gnus-kill-or-deaden-summary kill-buffer))
2918 (if (not quit-config)
2920 (set-buffer gnus-group-buffer)
2921 (gnus-group-jump-to-group group)
2922 (gnus-group-next-unread-group 1)
2923 (gnus-configure-windows 'group 'force))
2924 (gnus-handle-ephemeral-exit quit-config))
2925 ;; Finally signal the quit.
2927 ;; The group was successfully selected.
2929 (gnus-set-global-variables)
2930 ;; Save the active value in effect when the group was entered.
2931 (setq gnus-newsgroup-active
2933 (gnus-active gnus-newsgroup-name)))
2934 ;; You can change the summary buffer in some way with this hook.
2935 (gnus-run-hooks 'gnus-select-group-hook)
2936 ;; Set any local variables in the group parameters.
2937 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2938 (gnus-update-format-specifications
2939 nil 'summary 'summary-mode 'summary-dummy)
2940 (gnus-update-summary-mark-positions)
2941 ;; Do score processing.
2942 (when gnus-use-scoring
2943 (gnus-possibly-score-headers))
2944 ;; Check whether to fill in the gaps in the threads.
2945 (when gnus-build-sparse-threads
2946 (gnus-build-sparse-threads))
2947 ;; Find the initial limit.
2948 (if gnus-show-threads
2950 (let ((gnus-newsgroup-dormant nil))
2951 (gnus-summary-initial-limit show-all))
2952 (gnus-summary-initial-limit show-all))
2953 ;; When untreaded, all articles are always shown.
2954 (setq gnus-newsgroup-limit
2956 (lambda (header) (mail-header-number header))
2957 gnus-newsgroup-headers)))
2958 ;; Generate the summary buffer.
2960 (gnus-summary-prepare))
2961 (when gnus-use-trees
2962 (gnus-tree-open group)
2963 (setq gnus-summary-highlight-line-function
2964 'gnus-tree-highlight-article))
2965 ;; If the summary buffer is empty, but there are some low-scored
2966 ;; articles or some excluded dormants, we include these in the
2968 (when (and (zerop (buffer-size))
2970 (cond (gnus-newsgroup-dormant
2971 (gnus-summary-limit-include-dormant))
2972 ((and gnus-newsgroup-scored show-all)
2973 (gnus-summary-limit-include-expunged t))))
2974 ;; Function `gnus-apply-kill-file' must be called in this hook.
2975 (gnus-run-hooks 'gnus-apply-kill-hook)
2976 (if (and (zerop (buffer-size))
2979 ;; This newsgroup is empty.
2980 (gnus-summary-catchup-and-exit nil t)
2981 (gnus-message 6 "No unread news")
2983 (gnus-kill-or-deaden-summary kill-buffer))
2984 ;; Return nil from this function.
2986 ;; Hide conversation thread subtrees. We cannot do this in
2987 ;; gnus-summary-prepare-hook since kill processing may not
2988 ;; work with hidden articles.
2989 (and gnus-show-threads
2990 gnus-thread-hide-subtree
2991 (gnus-summary-hide-all-threads))
2993 (gnus-kill-or-deaden-summary kill-buffer))
2994 ;; Show first unread article if requested.
2995 (if (and (not no-article)
2997 gnus-newsgroup-unreads
2998 gnus-auto-select-first)
3000 (gnus-configure-windows 'summary)
3002 ((eq gnus-auto-select-first 'best)
3003 (gnus-summary-best-unread-article))
3004 ((eq gnus-auto-select-first t)
3005 (gnus-summary-first-unread-article))
3006 ((gnus-functionp gnus-auto-select-first)
3007 (funcall gnus-auto-select-first))))
3008 ;; Don't select any articles, just move point to the first
3009 ;; article in the group.
3010 (goto-char (point-min))
3011 (gnus-summary-position-point)
3012 (gnus-configure-windows 'summary 'force)
3013 (gnus-set-mode-line 'summary))
3014 (when (get-buffer-window gnus-group-buffer t)
3015 ;; Gotta use windows, because recenter does weird stuff if
3016 ;; the current buffer ain't the displayed window.
3017 (let ((owin (selected-window)))
3018 (select-window (get-buffer-window gnus-group-buffer t))
3019 (when (gnus-group-goto-group group)
3021 (select-window owin)))
3022 ;; Mark this buffer as "prepared".
3023 (setq gnus-newsgroup-prepared t)
3024 (gnus-run-hooks 'gnus-summary-prepared-hook)
3027 (defun gnus-summary-prepare ()
3028 "Generate the summary buffer."
3030 (let ((buffer-read-only nil))
3032 (setq gnus-newsgroup-data nil
3033 gnus-newsgroup-data-reverse nil)
3034 (gnus-run-hooks 'gnus-summary-generate-hook)
3035 ;; Generate the buffer, either with threads or without.
3036 (when gnus-newsgroup-headers
3037 (gnus-summary-prepare-threads
3038 (if gnus-show-threads
3039 (gnus-sort-gathered-threads
3040 (funcall gnus-summary-thread-gathering-function
3042 (gnus-cut-threads (gnus-make-threads)))))
3043 ;; Unthreaded display.
3044 (gnus-sort-articles gnus-newsgroup-headers))))
3045 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3046 ;; Call hooks for modifying summary buffer.
3047 (goto-char (point-min))
3048 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3050 (defsubst gnus-general-simplify-subject (subject)
3051 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3054 ;; Truncate the subject.
3055 (gnus-simplify-subject-functions
3056 (gnus-map-function gnus-simplify-subject-functions subject))
3057 ((numberp gnus-summary-gather-subject-limit)
3058 (setq subject (gnus-simplify-subject-re subject))
3059 (if (> (length subject) gnus-summary-gather-subject-limit)
3060 (substring subject 0 gnus-summary-gather-subject-limit)
3062 ;; Fuzzily simplify it.
3063 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3064 (gnus-simplify-subject-fuzzy subject))
3065 ;; Just remove the leading "Re:".
3067 (gnus-simplify-subject-re subject))))
3069 (if (and gnus-summary-gather-exclude-subject
3070 (string-match gnus-summary-gather-exclude-subject subject))
3071 nil ; This article shouldn't be gathered
3074 (defun gnus-summary-simplify-subject-query ()
3075 "Query where the respool algorithm would put this article."
3077 (gnus-summary-select-article)
3078 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3080 (defun gnus-gather-threads-by-subject (threads)
3081 "Gather threads by looking at Subject headers."
3082 (if (not gnus-summary-make-false-root)
3084 (let ((hashtb (gnus-make-hashtable 1024))
3087 subject hthread whole-subject)
3089 (setq subject (gnus-general-simplify-subject
3090 (setq whole-subject (mail-header-subject
3093 (if (setq hthread (gnus-gethash subject hashtb))
3095 ;; We enter a dummy root into the thread, if we
3096 ;; haven't done that already.
3097 (unless (stringp (caar hthread))
3098 (setcar hthread (list whole-subject (car hthread))))
3099 ;; We add this new gathered thread to this gathered
3101 (setcdr (car hthread)
3102 (nconc (cdar hthread) (list (car threads))))
3103 ;; Remove it from the list of threads.
3104 (setcdr prev (cdr threads))
3105 (setq threads prev))
3106 ;; Enter this thread into the hash table.
3107 (gnus-sethash subject threads hashtb)))
3109 (setq threads (cdr threads)))
3112 (defun gnus-gather-threads-by-references (threads)
3113 "Gather threads by looking at References headers."
3114 (let ((idhashtb (gnus-make-hashtable 1024))
3115 (thhashtb (gnus-make-hashtable 1024))
3118 ids references id gthread gid entered ref)
3120 (when (setq references (mail-header-references (caar threads)))
3121 (setq id (mail-header-id (caar threads))
3122 ids (gnus-split-references references)
3124 (while (setq ref (pop ids))
3125 (setq ids (delete ref ids))
3126 (if (not (setq gid (gnus-gethash ref idhashtb)))
3128 (gnus-sethash ref id idhashtb)
3129 (gnus-sethash id threads thhashtb))
3130 (setq gthread (gnus-gethash gid thhashtb))
3132 ;; We enter a dummy root into the thread, if we
3133 ;; haven't done that already.
3134 (unless (stringp (caar gthread))
3135 (setcar gthread (list (mail-header-subject (caar gthread))
3137 ;; We add this new gathered thread to this gathered
3139 (setcdr (car gthread)
3140 (nconc (cdar gthread) (list (car threads)))))
3141 ;; Add it into the thread hash table.
3142 (gnus-sethash id gthread thhashtb)
3144 ;; Remove it from the list of threads.
3145 (setcdr prev (cdr threads))
3146 (setq threads prev))))
3148 (setq threads (cdr threads)))
3151 (defun gnus-sort-gathered-threads (threads)
3152 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3153 (let ((result threads))
3155 (when (stringp (caar threads))
3156 (setcdr (car threads)
3157 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3158 (setq threads (cdr threads)))
3161 (defun gnus-thread-loop-p (root thread)
3162 "Say whether ROOT is in THREAD."
3163 (let ((stack (list thread))
3166 (while (setq thread (pop stack))
3167 (setq th (cdr thread))
3169 (not (eq (caar th) root)))
3172 ;; We have found a loop.
3174 (setcdr thread (delq (car th) (cdr thread)))
3175 (if (boundp (setq ref-dep (intern "none"
3176 gnus-newsgroup-dependencies)))
3177 (setcdr (symbol-value ref-dep)
3178 (nconc (cdr (symbol-value ref-dep))
3180 (set ref-dep (list nil (car th))))
3183 ;; Push all the subthreads onto the stack.
3184 (push (cdr thread) stack)))
3187 (defun gnus-make-threads ()
3188 "Go through the dependency hashtb and find the roots. Return all threads."
3190 (while (catch 'infloop
3193 ;; Deal with self-referencing References loops.
3194 (when (and (car (symbol-value refs))
3201 (car (symbol-value refs)) thread))
3202 (cdr (symbol-value refs)))))))
3205 (unless (car (symbol-value refs))
3206 ;; These threads do not refer back to any other articles,
3207 ;; so they're roots.
3208 (setq threads (append (cdr (symbol-value refs)) threads))))
3209 gnus-newsgroup-dependencies)))
3212 ;; Build the thread tree.
3213 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3214 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3216 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3217 if it was already present.
3219 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3220 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3221 Message-IDs will be renamed be renamed to a unique Message-ID before
3224 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3225 (let* ((id (mail-header-id header))
3226 (id-dep (and id (intern id dependencies)))
3227 ref ref-dep ref-header)
3228 ;; Enter this `header' in the `dependencies' table.
3232 ;; The first two cases do the normal part: enter a new `header'
3233 ;; in the `dependencies' table.
3234 ((not (boundp id-dep))
3235 (set id-dep (list header)))
3236 ((null (car (symbol-value id-dep)))
3237 (setcar (symbol-value id-dep) header))
3239 ;; From here the `header' was already present in the
3240 ;; `dependencies' table.
3242 ;; Overrides an existing entry;
3243 ;; just set the header part of the entry.
3244 (setcar (symbol-value id-dep) header))
3246 ;; Renames the existing `header' to a unique Message-ID.
3247 ((not gnus-summary-ignore-duplicates)
3248 ;; An article with this Message-ID has already been seen.
3249 ;; We rename the Message-ID.
3250 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3252 (mail-header-set-id header id))
3254 ;; The last case ignores an existing entry, except it adds any
3255 ;; additional Xrefs (in case the two articles came from different
3257 ;; Also sets `header' to `nil' meaning that the `dependencies'
3258 ;; table was *not* modified.
3260 (mail-header-set-xref
3261 (car (symbol-value id-dep))
3262 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3264 (or (mail-header-xref header) "")))
3268 ;; First check if that we are not creating a References loop.
3269 (setq ref (gnus-parent-id (mail-header-references header)))
3271 (setq ref-dep (intern-soft ref dependencies))
3273 (setq ref-header (car (symbol-value ref-dep))))
3274 (if (string= id ref)
3275 ;; Yuk! This is a reference loop. Make the article be a
3278 (mail-header-set-references (car (symbol-value id-dep)) "none")
3280 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3281 (setq ref (gnus-parent-id (mail-header-references header)))
3282 (setq ref-dep (intern (or ref "none") dependencies))
3283 (if (boundp ref-dep)
3284 (setcdr (symbol-value ref-dep)
3285 (nconc (cdr (symbol-value ref-dep))
3286 (list (symbol-value id-dep))))
3287 (set ref-dep (list nil (symbol-value id-dep)))))
3290 (defun gnus-build-sparse-threads ()
3291 (let ((headers gnus-newsgroup-headers)
3292 (mail-parse-charset gnus-newsgroup-charset)
3293 (gnus-summary-ignore-duplicates t)
3294 header references generation relations
3295 subject child end new-child date)
3296 ;; First we create an alist of generations/relations, where
3297 ;; generations is how much we trust the relation, and the relation
3299 (gnus-message 7 "Making sparse threads...")
3301 (nnheader-set-temp-buffer " *gnus sparse threads*")
3302 (while (setq header (pop headers))
3303 (when (and (setq references (mail-header-references header))
3304 (not (string= references "")))
3306 (setq child (mail-header-id header)
3307 subject (mail-header-subject header)
3308 date (mail-header-date header)
3310 (while (search-backward ">" nil t)
3311 (setq end (1+ (point)))
3312 (when (search-backward "<" nil t)
3313 (setq new-child (buffer-substring (point) end))
3314 (push (list (incf generation)
3315 child (setq child new-child)
3319 (push (list (1+ generation) child nil subject) relations))
3321 (kill-buffer (current-buffer)))
3322 ;; Sort over trustworthiness.
3325 (when (gnus-dependencies-add-header
3326 (make-full-mail-header
3327 gnus-reffed-article-number
3328 (nth 3 relation) "" (or (nth 4 relation) "")
3330 (or (nth 2 relation) "") 0 0 "")
3331 gnus-newsgroup-dependencies nil)
3332 (push gnus-reffed-article-number gnus-newsgroup-limit)
3333 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3334 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3335 gnus-newsgroup-reads)
3336 (decf gnus-reffed-article-number)))
3337 (sort relations 'car-less-than-car))
3338 (gnus-message 7 "Making sparse threads...done")))
3340 (defun gnus-build-old-threads ()
3341 ;; Look at all the articles that refer back to old articles, and
3342 ;; fetch the headers for the articles that aren't there. This will
3343 ;; build complete threads - if the roots haven't been expired by the
3345 (let ((mail-parse-charset gnus-newsgroup-charset)
3349 (when (not (car (symbol-value refs)))
3350 (setq heads (cdr (symbol-value refs)))
3352 (if (memq (mail-header-number (caar heads))
3353 gnus-newsgroup-dormant)
3354 (setq heads (cdr heads))
3355 (setq id (symbol-name refs))
3356 (while (and (setq id (gnus-build-get-header id))
3357 (not (car (gnus-id-to-thread id)))))
3358 (setq heads nil)))))
3359 gnus-newsgroup-dependencies)))
3361 ;; This function has to be called with point after the article number
3362 ;; on the beginning of the line.
3363 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3364 (let ((eol (gnus-point-at-eol))
3365 (buffer (current-buffer))
3368 ;; overview: [num subject from date id refs chars lines misc]
3371 (narrow-to-region (point) eol)
3376 (make-full-mail-header
3378 (funcall gnus-decode-encoded-word-function
3379 (nnheader-nov-field)) ; subject
3380 (funcall gnus-decode-encoded-word-function
3381 (nnheader-nov-field)) ; from
3382 (nnheader-nov-field) ; date
3383 (nnheader-nov-read-message-id) ; id
3384 (nnheader-nov-field) ; refs
3385 (nnheader-nov-read-integer) ; chars
3386 (nnheader-nov-read-integer) ; lines
3388 (if (looking-at "Xref: ")
3389 (goto-char (match-end 0)))
3390 (nnheader-nov-field)) ; Xref
3391 (nnheader-nov-parse-extra)))) ; extra
3395 (when gnus-alter-header-function
3396 (funcall gnus-alter-header-function header))
3397 (gnus-dependencies-add-header header dependencies force-new)))
3399 (defun gnus-build-get-header (id)
3400 "Look through the buffer of NOV lines and find the header to ID.
3401 Enter this line into the dependencies hash table, and return
3402 the id of the parent article (if any)."
3403 (let ((deps gnus-newsgroup-dependencies)
3407 (set-buffer nntp-server-buffer)
3408 (let ((case-fold-search nil))
3409 (goto-char (point-min))
3410 (while (and (not found)
3411 (search-forward id nil t))
3413 (setq found (looking-at
3414 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3415 (regexp-quote id))))
3416 (or found (beginning-of-line 2)))
3420 (setq header (gnus-nov-parse-line
3421 (read (current-buffer)) deps))
3422 (gnus-parent-id (mail-header-references header))))))
3424 (let ((number (mail-header-number header)))
3425 (push number gnus-newsgroup-limit)
3426 (push header gnus-newsgroup-headers)
3427 (if (memq number gnus-newsgroup-unselected)
3429 (push number gnus-newsgroup-unreads)
3430 (setq gnus-newsgroup-unselected
3431 (delq number gnus-newsgroup-unselected)))
3432 (push number gnus-newsgroup-ancient)))))))
3434 (defun gnus-build-all-threads ()
3435 "Read all the headers."
3436 (let ((gnus-summary-ignore-duplicates t)
3437 (mail-parse-charset gnus-newsgroup-charset)
3438 (dependencies gnus-newsgroup-dependencies)
3441 (set-buffer nntp-server-buffer)
3442 (let ((case-fold-search nil))
3443 (goto-char (point-min))
3446 (setq article (read (current-buffer))
3447 header (gnus-nov-parse-line article dependencies)))
3450 (set-buffer gnus-summary-buffer)
3451 (push header gnus-newsgroup-headers)
3452 (if (memq (setq article (mail-header-number header))
3453 gnus-newsgroup-unselected)
3455 (push article gnus-newsgroup-unreads)
3456 (setq gnus-newsgroup-unselected
3457 (delq article gnus-newsgroup-unselected)))
3458 (push article gnus-newsgroup-ancient)))
3459 (forward-line 1)))))))
3461 (defun gnus-summary-update-article-line (article header)
3462 "Update the line for ARTICLE using HEADERS."
3463 (let* ((id (mail-header-id header))
3464 (thread (gnus-id-to-thread id)))
3466 (error "Article in no thread"))
3467 ;; Update the thread.
3468 (setcar thread header)
3469 (gnus-summary-goto-subject article)
3470 (let* ((datal (gnus-data-find-list article))
3472 (length (when (cdr datal)
3473 (- (gnus-data-pos data)
3474 (gnus-data-pos (cadr datal)))))
3475 (buffer-read-only nil)
3476 (level (gnus-summary-thread-level)))
3478 (gnus-summary-insert-line
3479 header level nil (gnus-article-mark article)
3480 (memq article gnus-newsgroup-replied)
3481 (memq article gnus-newsgroup-expirable)
3482 ;; Only insert the Subject string when it's different
3483 ;; from the previous Subject string.
3488 (mail-header-subject
3491 (gnus-data-find-list
3493 (gnus-data-list t)))))
3494 ;; Error on the side of excessive subjects.
3496 (mail-header-subject header)))
3498 (mail-header-subject header))
3499 nil (cdr (assq article gnus-newsgroup-scored))
3500 (memq article gnus-newsgroup-processable))
3502 (gnus-data-update-list
3503 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3505 (defun gnus-summary-update-article (article &optional iheader)
3506 "Update ARTICLE in the summary buffer."
3507 (set-buffer gnus-summary-buffer)
3508 (let* ((header (gnus-summary-article-header article))
3509 (id (mail-header-id header))
3510 (data (gnus-data-find article))
3511 (thread (gnus-id-to-thread id))
3512 (references (mail-header-references header))
3516 (when (and references
3517 (not (equal "" references)))
3520 (buffer-read-only nil)
3526 (delq thread parent)))
3527 (if (gnus-summary-insert-subject id header)
3528 ;; Set the (possibly) new article number in the data structure.
3529 (gnus-data-set-number data (gnus-id-to-article id))
3533 (defun gnus-rebuild-thread (id &optional line)
3534 "Rebuild the thread containing ID.
3535 If LINE, insert the rebuilt thread starting on line LINE."
3536 (let ((buffer-read-only nil)
3537 old-pos current thread data)
3538 (if (not gnus-show-threads)
3539 (setq thread (list (car (gnus-id-to-thread id))))
3540 ;; Get the thread this article is part of.
3541 (setq thread (gnus-remove-thread id)))
3542 (setq old-pos (gnus-point-at-bol))
3543 (setq current (save-excursion
3544 (and (zerop (forward-line -1))
3545 (gnus-summary-article-number))))
3546 ;; If this is a gathered thread, we have to go some re-gathering.
3547 (when (stringp (car thread))
3548 (let ((subject (car thread))
3550 (setq thread (cdr thread))
3552 (unless (memq (setq thr (gnus-id-to-thread
3554 (mail-header-id (caar thread)))))
3557 (setq thread (cdr thread)))
3558 ;; We now have all (unique) roots.
3559 (if (= (length roots) 1)
3560 ;; All the loose roots are now one solid root.
3561 (setq thread (car roots))
3562 (setq thread (cons subject (gnus-sort-threads roots))))))
3564 ;; We then insert this thread into the summary buffer.
3566 (goto-char (point-min))
3567 (forward-line (1- line)))
3568 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3569 (if gnus-show-threads
3570 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3571 (gnus-summary-prepare-unthreaded thread))
3572 (setq data (nreverse gnus-newsgroup-data))
3573 (setq threads gnus-newsgroup-threads))
3574 ;; We splice the new data into the data structure.
3575 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3576 ;;!!! then we want to insert at the beginning of the buffer.
3577 ;;!!! That happens to be true with Gnus now, but that may
3578 ;;!!! change in the future. Perhaps.
3579 (gnus-data-enter-list
3580 (if line nil current) data (- (point) old-pos))
3581 (setq gnus-newsgroup-threads
3582 (nconc threads gnus-newsgroup-threads))
3583 (gnus-data-compute-positions))))
3585 (defun gnus-number-to-header (number)
3586 "Return the header for article NUMBER."
3587 (let ((headers gnus-newsgroup-headers))
3589 (not (= number (mail-header-number (car headers)))))
3594 (defun gnus-parent-headers (in-headers &optional generation)
3595 "Return the headers of the GENERATIONeth parent of HEADERS."
3597 (setq generation 1))
3599 (headers in-headers)
3602 (not (zerop generation))
3603 (setq references (mail-header-references headers)))
3604 (setq headers (if (and references
3605 (setq parent (gnus-parent-id references)))
3606 (car (gnus-id-to-thread parent))
3609 (and (not (eq headers in-headers))
3612 (defun gnus-id-to-thread (id)
3613 "Return the (sub-)thread where ID appears."
3614 (gnus-gethash id gnus-newsgroup-dependencies))
3616 (defun gnus-id-to-article (id)
3617 "Return the article number of ID."
3618 (let ((thread (gnus-id-to-thread id)))
3621 (mail-header-number (car thread)))))
3623 (defun gnus-id-to-header (id)
3624 "Return the article headers of ID."
3625 (car (gnus-id-to-thread id)))
3627 (defun gnus-article-displayed-root-p (article)
3628 "Say whether ARTICLE is a root(ish) article."
3629 (let ((level (gnus-summary-thread-level article))
3630 (refs (mail-header-references (gnus-summary-article-header article)))
3636 ((null (gnus-parent-id refs)) t)
3638 (null (setq particle (gnus-id-to-article
3639 (gnus-parent-id refs))))
3640 (null (gnus-summary-thread-level particle)))))))
3642 (defun gnus-root-id (id)
3643 "Return the id of the root of the thread where ID appears."
3645 (while (and id (setq prev (car (gnus-id-to-thread id))))
3647 id (gnus-parent-id (mail-header-references prev))))
3650 (defun gnus-articles-in-thread (thread)
3651 "Return the list of articles in THREAD."
3652 (cons (mail-header-number (car thread))
3653 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3655 (defun gnus-remove-thread (id &optional dont-remove)
3656 "Remove the thread that has ID in it."
3657 (let (headers thread last-id)
3658 ;; First go up in this thread until we find the root.
3659 (setq last-id (gnus-root-id id)
3660 headers (message-flatten-list (gnus-id-to-thread last-id)))
3661 ;; We have now found the real root of this thread. It might have
3662 ;; been gathered into some loose thread, so we have to search
3663 ;; through the threads to find the thread we wanted.
3664 (let ((threads gnus-newsgroup-threads)
3667 (setq sub (car threads))
3668 (if (stringp (car sub))
3669 ;; This is a gathered thread, so we look at the roots
3670 ;; below it to find whether this article is in this
3673 (setq sub (cdr sub))
3675 (when (member (caar sub) headers)
3676 (setq thread (car threads)
3679 (setq sub (cdr sub))))
3680 ;; It's an ordinary thread, so we check it.
3681 (when (eq (car sub) (car headers))
3684 (setq threads (cdr threads)))
3685 ;; If this article is in no thread, then it's a root.
3688 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3689 (setq thread (gnus-id-to-thread last-id)))
3692 thread ; We return this thread.
3694 (if (stringp (car thread))
3696 ;; If we use dummy roots, then we have to remove the
3697 ;; dummy root as well.
3698 (when (eq gnus-summary-make-false-root 'dummy)
3699 ;; We go to the dummy root by going to
3700 ;; the first sub-"thread", and then one line up.
3701 (gnus-summary-goto-article
3702 (mail-header-number (caadr thread)))
3705 (gnus-data-compute-positions))
3706 (setq thread (cdr thread))
3708 (gnus-remove-thread-1 (car thread))
3709 (setq thread (cdr thread))))
3710 (gnus-remove-thread-1 thread))))))))
3712 (defun gnus-remove-thread-1 (thread)
3713 "Remove the thread THREAD recursively."
3714 (let ((number (mail-header-number (pop thread)))
3716 (setq thread (reverse thread))
3718 (gnus-remove-thread-1 (pop thread)))
3719 (when (setq d (gnus-data-find number))
3720 (goto-char (gnus-data-pos d))
3721 (gnus-summary-show-thread)
3724 (- (gnus-point-at-bol)
3726 (1+ (gnus-point-at-eol))
3727 (gnus-delete-line)))))))
3729 (defun gnus-sort-threads-1 (threads func)
3730 (sort (mapcar (lambda (thread)
3733 (gnus-sort-threads-1 (cdr thread) func))))
3736 (defun gnus-sort-threads (threads)
3738 (if (not gnus-thread-sort-functions)
3740 (gnus-message 8 "Sorting threads...")
3742 (gnus-sort-threads-1
3744 (gnus-make-sort-function gnus-thread-sort-functions))
3745 (gnus-message 8 "Sorting threads...done"))))
3747 (defun gnus-sort-articles (articles)
3749 (when gnus-article-sort-functions
3750 (gnus-message 7 "Sorting articles...")
3752 (setq gnus-newsgroup-headers
3753 (sort articles (gnus-make-sort-function
3754 gnus-article-sort-functions)))
3755 (gnus-message 7 "Sorting articles...done"))))
3757 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3758 (defmacro gnus-thread-header (thread)
3759 "Return header of first article in THREAD.
3760 Note that THREAD must never, ever be anything else than a variable -
3761 using some other form will lead to serious barfage."
3762 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3763 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3764 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
3767 (defsubst gnus-article-sort-by-number (h1 h2)
3768 "Sort articles by article number."
3769 (< (mail-header-number h1)
3770 (mail-header-number h2)))
3772 (defun gnus-thread-sort-by-number (h1 h2)
3773 "Sort threads by root article number."
3774 (gnus-article-sort-by-number
3775 (gnus-thread-header h1) (gnus-thread-header h2)))
3777 (defsubst gnus-article-sort-by-lines (h1 h2)
3778 "Sort articles by article Lines header."
3779 (< (mail-header-lines h1)
3780 (mail-header-lines h2)))
3782 (defun gnus-thread-sort-by-lines (h1 h2)
3783 "Sort threads by root article Lines header."
3784 (gnus-article-sort-by-lines
3785 (gnus-thread-header h1) (gnus-thread-header h2)))
3787 (defsubst gnus-article-sort-by-chars (h1 h2)
3788 "Sort articles by octet length."
3789 (< (mail-header-chars h1)
3790 (mail-header-chars h2)))
3792 (defun gnus-thread-sort-by-chars (h1 h2)
3793 "Sort threads by root article octet length."
3794 (gnus-article-sort-by-chars
3795 (gnus-thread-header h1) (gnus-thread-header h2)))
3797 (defsubst gnus-article-sort-by-author (h1 h2)
3798 "Sort articles by root author."
3800 (let ((extract (funcall
3801 gnus-extract-address-components
3802 (mail-header-from h1))))
3803 (or (car extract) (cadr extract) ""))
3804 (let ((extract (funcall
3805 gnus-extract-address-components
3806 (mail-header-from h2))))
3807 (or (car extract) (cadr extract) ""))))
3809 (defun gnus-thread-sort-by-author (h1 h2)
3810 "Sort threads by root author."
3811 (gnus-article-sort-by-author
3812 (gnus-thread-header h1) (gnus-thread-header h2)))
3814 (defsubst gnus-article-sort-by-subject (h1 h2)
3815 "Sort articles by root subject."
3817 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3818 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3820 (defun gnus-thread-sort-by-subject (h1 h2)
3821 "Sort threads by root subject."
3822 (gnus-article-sort-by-subject
3823 (gnus-thread-header h1) (gnus-thread-header h2)))
3825 (defsubst gnus-article-sort-by-date (h1 h2)
3826 "Sort articles by root article date."
3828 (gnus-date-get-time (mail-header-date h1))
3829 (gnus-date-get-time (mail-header-date h2))))
3831 (defun gnus-thread-sort-by-date (h1 h2)
3832 "Sort threads by root article date."
3833 (gnus-article-sort-by-date
3834 (gnus-thread-header h1) (gnus-thread-header h2)))
3836 (defsubst gnus-article-sort-by-score (h1 h2)
3837 "Sort articles by root article score.
3838 Unscored articles will be counted as having a score of zero."
3839 (> (or (cdr (assq (mail-header-number h1)
3840 gnus-newsgroup-scored))
3841 gnus-summary-default-score 0)
3842 (or (cdr (assq (mail-header-number h2)
3843 gnus-newsgroup-scored))
3844 gnus-summary-default-score 0)))
3846 (defun gnus-thread-sort-by-score (h1 h2)
3847 "Sort threads by root article score."
3848 (gnus-article-sort-by-score
3849 (gnus-thread-header h1) (gnus-thread-header h2)))
3851 (defun gnus-thread-sort-by-total-score (h1 h2)
3852 "Sort threads by the sum of all scores in the thread.
3853 Unscored articles will be counted as having a score of zero."
3854 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3856 (defun gnus-thread-total-score (thread)
3857 ;; This function find the total score of THREAD.
3858 (cond ((null thread)
3861 (if (stringp (car thread))
3862 (apply gnus-thread-score-function 0
3863 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3864 (gnus-thread-total-score-1 thread)))
3866 (gnus-thread-total-score-1 (list thread)))))
3868 (defun gnus-thread-total-score-1 (root)
3869 ;; This function find the total score of the thread below ROOT.
3870 (setq root (car root))
3871 (apply gnus-thread-score-function
3873 (mapcar 'gnus-thread-total-score
3874 (cdr (gnus-id-to-thread (mail-header-id root))))
3875 (when (> (mail-header-number root) 0)
3876 (list (or (cdr (assq (mail-header-number root)
3877 gnus-newsgroup-scored))
3878 gnus-summary-default-score 0))))
3879 (list gnus-summary-default-score)
3882 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3883 (defvar gnus-tmp-prev-subject nil)
3884 (defvar gnus-tmp-false-parent nil)
3885 (defvar gnus-tmp-root-expunged nil)
3886 (defvar gnus-tmp-dummy-line nil)
3888 (eval-when-compile (defvar gnus-tmp-header))
3889 (defun gnus-extra-header (type &optional header)
3890 "Return the extra header of TYPE."
3891 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3894 (defun gnus-summary-prepare-threads (threads)
3895 "Prepare summary buffer from THREADS and indentation LEVEL.
3896 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3897 or a straight list of headers."
3898 (gnus-message 7 "Generating summary...")
3900 (setq gnus-newsgroup-threads threads)
3903 (let ((gnus-tmp-level 0)
3904 (default-score (or gnus-summary-default-score 0))
3905 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3906 thread number subject stack state gnus-tmp-gathered beg-match
3907 new-roots gnus-tmp-new-adopts thread-end
3908 gnus-tmp-header gnus-tmp-unread
3909 gnus-tmp-replied gnus-tmp-subject-or-nil
3910 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3911 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3912 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3914 (setq gnus-tmp-prev-subject nil)
3916 (if (vectorp (car threads))
3917 ;; If this is a straight (sic) list of headers, then a
3918 ;; threaded summary display isn't required, so we just create
3919 ;; an unthreaded one.
3920 (gnus-summary-prepare-unthreaded threads)
3922 ;; Do the threaded display.
3924 (while (or threads stack gnus-tmp-new-adopts new-roots)
3926 (if (and (= gnus-tmp-level 0)
3929 (not gnus-tmp-false-parent)
3930 (or gnus-tmp-new-adopts new-roots))
3931 (if gnus-tmp-new-adopts
3932 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3933 thread (list (car gnus-tmp-new-adopts))
3934 gnus-tmp-header (caar thread)
3935 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3937 (setq thread (list (car new-roots))
3938 gnus-tmp-header (caar thread)
3939 new-roots (cdr new-roots))))
3942 ;; If there are some threads, we do them before the
3943 ;; threads on the stack.
3944 (setq thread threads
3945 gnus-tmp-header (caar thread))
3946 ;; There were no current threads, so we pop something off
3948 (setq state (car stack)
3949 gnus-tmp-level (car state)
3952 gnus-tmp-header (caar thread))))
3954 (setq gnus-tmp-false-parent nil)
3955 (setq gnus-tmp-root-expunged nil)
3956 (setq thread-end nil)
3958 (if (stringp gnus-tmp-header)
3959 ;; The header is a dummy root.
3961 ((eq gnus-summary-make-false-root 'adopt)
3962 ;; We let the first article adopt the rest.
3963 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3965 (setq gnus-tmp-gathered
3967 (lambda (h) (mail-header-number (car h)))
3970 (setq thread (cons (list (caar thread)
3973 (setq gnus-tmp-level -1
3974 gnus-tmp-false-parent t))
3975 ((eq gnus-summary-make-false-root 'empty)
3976 ;; We print adopted articles with empty subject fields.
3977 (setq gnus-tmp-gathered
3979 (lambda (h) (mail-header-number (car h)))
3982 (setq gnus-tmp-level -1))
3983 ((eq gnus-summary-make-false-root 'dummy)
3984 ;; We remember that we probably want to output a dummy
3986 (setq gnus-tmp-dummy-line gnus-tmp-header)
3987 (setq gnus-tmp-prev-subject gnus-tmp-header))
3989 ;; We do not make a root for the gathered
3990 ;; sub-threads at all.
3991 (setq gnus-tmp-level -1)))
3993 (setq number (mail-header-number gnus-tmp-header)
3994 subject (mail-header-subject gnus-tmp-header))
3997 ;; If the thread has changed subject, we might want to make
3998 ;; this subthread into a root.
3999 ((and (null gnus-thread-ignore-subject)
4000 (not (zerop gnus-tmp-level))
4001 gnus-tmp-prev-subject
4003 (gnus-subject-equal gnus-tmp-prev-subject subject))))
4004 (setq new-roots (nconc new-roots (list (car thread)))
4006 gnus-tmp-header nil))
4007 ;; If the article lies outside the current limit,
4008 ;; then we do not display it.
4009 ((not (memq number gnus-newsgroup-limit))
4010 (setq gnus-tmp-gathered
4012 (lambda (h) (mail-header-number (car h)))
4015 (setq gnus-tmp-new-adopts (if (cdar thread)
4016 (append gnus-tmp-new-adopts
4018 gnus-tmp-new-adopts)
4020 gnus-tmp-header nil)
4021 (when (zerop gnus-tmp-level)
4022 (setq gnus-tmp-root-expunged t)))
4023 ;; Perhaps this article is to be marked as read?
4024 ((and gnus-summary-mark-below
4025 (< (or (cdr (assq number gnus-newsgroup-scored))
4027 gnus-summary-mark-below)
4028 ;; Don't touch sparse articles.
4029 (not (gnus-summary-article-sparse-p number))
4030 (not (gnus-summary-article-ancient-p number)))
4031 (setq gnus-newsgroup-unreads
4032 (delq number gnus-newsgroup-unreads))
4033 (if gnus-newsgroup-auto-expire
4034 (push number gnus-newsgroup-expirable)
4035 (push (cons number gnus-low-score-mark)
4036 gnus-newsgroup-reads))))
4038 (when gnus-tmp-header
4039 ;; We may have an old dummy line to output before this
4041 (when (and gnus-tmp-dummy-line
4044 (mail-header-subject gnus-tmp-header)))
4045 (gnus-summary-insert-dummy-line
4046 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4047 (setq gnus-tmp-dummy-line nil))
4049 ;; Compute the mark.
4050 (setq gnus-tmp-unread (gnus-article-mark number))
4052 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4053 gnus-tmp-header gnus-tmp-level)
4054 gnus-newsgroup-data)
4056 ;; Actually insert the line.
4058 gnus-tmp-subject-or-nil
4060 ((and gnus-thread-ignore-subject
4061 gnus-tmp-prev-subject
4062 (not (inline (gnus-subject-equal
4063 gnus-tmp-prev-subject subject))))
4065 ((zerop gnus-tmp-level)
4066 (if (and (eq gnus-summary-make-false-root 'empty)
4067 (memq number gnus-tmp-gathered)
4068 gnus-tmp-prev-subject
4069 (inline (gnus-subject-equal
4070 gnus-tmp-prev-subject subject)))
4071 gnus-summary-same-subject
4073 (t gnus-summary-same-subject)))
4074 (if (and (eq gnus-summary-make-false-root 'adopt)
4075 (= gnus-tmp-level 1)
4076 (memq number gnus-tmp-gathered))
4077 (setq gnus-tmp-opening-bracket ?\<
4078 gnus-tmp-closing-bracket ?\>)
4079 (setq gnus-tmp-opening-bracket ?\[
4080 gnus-tmp-closing-bracket ?\]))
4082 gnus-tmp-indentation
4083 (aref gnus-thread-indent-array gnus-tmp-level)
4084 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4085 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4086 gnus-summary-default-score 0)
4088 (if (or (null gnus-summary-default-score)
4089 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4090 gnus-summary-zcore-fuzz))
4092 (if (< gnus-tmp-score gnus-summary-default-score)
4093 gnus-score-below-mark gnus-score-over-mark))
4095 (cond ((memq number gnus-newsgroup-processable)
4097 ((memq number gnus-newsgroup-cached)
4099 ((memq number gnus-newsgroup-replied)
4101 ((memq number gnus-newsgroup-saved)
4103 (t gnus-unread-mark))
4104 gnus-tmp-from (mail-header-from gnus-tmp-header)
4107 ((string-match "<[^>]+> *$" gnus-tmp-from)
4108 (setq beg-match (match-beginning 0))
4109 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
4110 (substring gnus-tmp-from (1+ (match-beginning 0))
4111 (1- (match-end 0))))
4112 (substring gnus-tmp-from 0 beg-match)))
4113 ((string-match "(.+)" gnus-tmp-from)
4114 (substring gnus-tmp-from
4115 (1+ (match-beginning 0)) (1- (match-end 0))))
4117 (when (string= gnus-tmp-name "")
4118 (setq gnus-tmp-name gnus-tmp-from))
4119 (unless (numberp gnus-tmp-lines)
4120 (setq gnus-tmp-lines 0))
4121 (gnus-put-text-property
4123 (progn (eval gnus-summary-line-format-spec) (point))
4124 'gnus-number number)
4127 (gnus-run-hooks 'gnus-summary-update-hook)
4130 (setq gnus-tmp-prev-subject subject)))
4132 (when (nth 1 thread)
4133 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4134 (incf gnus-tmp-level)
4135 (setq threads (if thread-end nil (cdar thread)))
4137 (setq gnus-tmp-level 0)))))
4138 (gnus-message 7 "Generating summary...done"))
4140 (defun gnus-summary-prepare-unthreaded (headers)
4141 "Generate an unthreaded summary buffer based on HEADERS."
4142 (let (header number mark)
4147 ;; We may have to root out some bad articles...
4148 (when (memq (setq number (mail-header-number
4149 (setq header (pop headers))))
4150 gnus-newsgroup-limit)
4151 ;; Mark article as read when it has a low score.
4152 (when (and gnus-summary-mark-below
4153 (< (or (cdr (assq number gnus-newsgroup-scored))
4154 gnus-summary-default-score 0)
4155 gnus-summary-mark-below)
4156 (not (gnus-summary-article-ancient-p number)))
4157 (setq gnus-newsgroup-unreads
4158 (delq number gnus-newsgroup-unreads))
4159 (if gnus-newsgroup-auto-expire
4160 (push number gnus-newsgroup-expirable)
4161 (push (cons number gnus-low-score-mark)
4162 gnus-newsgroup-reads)))
4164 (setq mark (gnus-article-mark number))
4165 (push (gnus-data-make number mark (1+ (point)) header 0)
4166 gnus-newsgroup-data)
4167 (gnus-summary-insert-line
4169 mark (memq number gnus-newsgroup-replied)
4170 (memq number gnus-newsgroup-expirable)
4171 (mail-header-subject header) nil
4172 (cdr (assq number gnus-newsgroup-scored))
4173 (memq number gnus-newsgroup-processable))))))
4175 (defun gnus-summary-remove-list-identifiers ()
4176 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4177 (let ((regexp (if (stringp gnus-list-identifiers)
4178 gnus-list-identifiers
4179 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4180 (dolist (header gnus-newsgroup-headers)
4181 (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
4182 " *\\)\\)+\\(Re: +\\)?\\)")
4183 (mail-header-subject header))
4184 (mail-header-set-subject
4185 header (concat (substring (mail-header-subject header)
4186 0 (match-beginning 1))
4188 (match-string 3 (mail-header-subject header))
4189 (match-string 5 (mail-header-subject header)))
4190 (substring (mail-header-subject header)
4191 (match-end 1))))))))
4193 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4194 "Select newsgroup GROUP.
4195 If READ-ALL is non-nil, all articles in the group are selected.
4196 If SELECT-ARTICLES, only select those articles from GROUP."
4197 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4198 ;;!!! Dirty hack; should be removed.
4199 (gnus-summary-ignore-duplicates
4200 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4202 gnus-summary-ignore-duplicates))
4203 (info (nth 2 entry))
4204 articles fetched-articles cached)
4206 (unless (gnus-check-server
4207 (setq gnus-current-select-method
4208 (gnus-find-method-for-group group)))
4209 (error "Couldn't open server"))
4211 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4212 (gnus-activate-group group) ; Or we can activate it...
4213 (progn ; Or we bug out.
4214 (when (equal major-mode 'gnus-summary-mode)
4215 (kill-buffer (current-buffer)))
4216 (error "Couldn't request group %s: %s"
4217 group (gnus-status-message group))))
4219 (unless (gnus-request-group group t)
4220 (when (equal major-mode 'gnus-summary-mode)
4221 (kill-buffer (current-buffer)))
4222 (error "Couldn't request group %s: %s"
4223 group (gnus-status-message group)))
4225 (setq gnus-newsgroup-name group)
4226 (setq gnus-newsgroup-unselected nil)
4227 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4228 (gnus-summary-setup-default-charset)
4230 ;; Adjust and set lists of article marks.
4232 (gnus-adjust-marked-articles info))
4234 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4235 (when (gnus-virtual-group-p group)
4236 (setq cached gnus-newsgroup-cached))
4238 (setq gnus-newsgroup-unreads
4239 (gnus-set-difference
4240 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4241 gnus-newsgroup-dormant))
4243 (setq gnus-newsgroup-processable nil)
4245 (gnus-update-read-articles group gnus-newsgroup-unreads)
4247 (if (setq articles select-articles)
4248 (setq gnus-newsgroup-unselected
4249 (gnus-sorted-intersection
4250 gnus-newsgroup-unreads
4251 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4252 (setq articles (gnus-articles-to-read group read-all)))
4256 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4258 ((eq articles 0) nil)
4260 ;; Init the dependencies hash table.
4261 (setq gnus-newsgroup-dependencies
4262 (gnus-make-hashtable (length articles)))
4263 (gnus-set-global-variables)
4264 ;; Retrieve the headers and read them in.
4265 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4266 (setq gnus-newsgroup-headers
4268 (setq gnus-headers-retrieved-by
4269 (gnus-retrieve-headers
4270 articles gnus-newsgroup-name
4271 ;; We might want to fetch old headers, but
4272 ;; not if there is only 1 article.
4274 (not (eq gnus-fetch-old-headers 'some))
4275 (not (numberp gnus-fetch-old-headers)))
4276 (> (length articles) 1))
4277 gnus-fetch-old-headers))))
4278 (gnus-get-newsgroup-headers-xover
4279 articles nil nil gnus-newsgroup-name t)
4280 (gnus-get-newsgroup-headers)))
4281 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4283 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4285 (setq gnus-newsgroup-cached cached))
4287 ;; Suppress duplicates?
4288 (when gnus-suppress-duplicates
4289 (gnus-dup-suppress-articles))
4291 ;; Set the initial limit.
4292 (setq gnus-newsgroup-limit (copy-sequence articles))
4293 ;; Remove canceled articles from the list of unread articles.
4294 (setq gnus-newsgroup-unreads
4295 (gnus-set-sorted-intersection
4296 gnus-newsgroup-unreads
4297 (setq fetched-articles
4298 (mapcar (lambda (headers) (mail-header-number headers))
4299 gnus-newsgroup-headers))))
4300 ;; Removed marked articles that do not exist.
4301 (gnus-update-missing-marks
4302 (gnus-sorted-complement fetched-articles articles))
4303 ;; We might want to build some more threads first.
4304 (when (and gnus-fetch-old-headers
4305 (eq gnus-headers-retrieved-by 'nov))
4306 (if (eq gnus-fetch-old-headers 'invisible)
4307 (gnus-build-all-threads)
4308 (gnus-build-old-threads)))
4309 ;; Let the Gnus agent mark articles as read.
4311 (gnus-agent-get-undownloaded-list))
4312 ;; Remove list identifiers from subject
4313 (when gnus-list-identifiers
4314 (gnus-summary-remove-list-identifiers))
4315 ;; Check whether auto-expire is to be done in this group.
4316 (setq gnus-newsgroup-auto-expire
4317 (gnus-group-auto-expirable-p group))
4318 ;; Set up the article buffer now, if necessary.
4319 (unless gnus-single-article-buffer
4320 (gnus-article-setup-buffer))
4321 ;; First and last article in this newsgroup.
4322 (when gnus-newsgroup-headers
4323 (setq gnus-newsgroup-begin
4324 (mail-header-number (car gnus-newsgroup-headers))
4327 (gnus-last-element gnus-newsgroup-headers))))
4328 ;; GROUP is successfully selected.
4329 (or gnus-newsgroup-headers t)))))
4331 (defun gnus-articles-to-read (group &optional read-all)
4332 "Find out what articles the user wants to read."
4334 ;; Select all articles if `read-all' is non-nil, or if there
4335 ;; are no unread articles.
4337 (and (zerop (length gnus-newsgroup-marked))
4338 (zerop (length gnus-newsgroup-unreads)))
4339 (eq (gnus-group-find-parameter group 'display)
4342 (gnus-uncompress-range (gnus-active group))
4343 (gnus-cache-articles-in-group group))
4344 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4345 (copy-sequence gnus-newsgroup-unreads))
4347 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4348 (scored (length scored-list))
4349 (number (length articles))
4350 (marked (+ (length gnus-newsgroup-marked)
4351 (length gnus-newsgroup-dormant)))
4359 ((and (or (<= scored marked) (= scored number))
4360 (numberp gnus-large-newsgroup)
4361 (> number gnus-large-newsgroup))
4365 "How many articles from %s (default %d): "
4366 (gnus-limit-string gnus-newsgroup-name 35)
4368 (if (string-match "^[ \t]*$" input) number input)))
4369 ((and (> scored marked) (< scored number)
4370 (> (- scored number) 20))
4373 (format "%s %s (%d scored, %d total): "
4374 "How many articles from"
4375 group scored number))))
4376 (if (string-match "^[ \t]*$" input)
4380 (message "Quit getting the articles to read")
4382 (setq select (if (stringp select) (string-to-number select) select))
4383 (if (or (null select) (zerop select))
4385 (if (and (not (zerop scored)) (<= (abs select) scored))
4387 (setq articles (sort scored-list '<))
4388 (setq number (length articles)))
4389 (setq articles (copy-sequence articles)))
4391 (when (< (abs select) number)
4393 ;; Select the N oldest articles.
4394 (setcdr (nthcdr (1- (abs select)) articles) nil)
4395 ;; Select the N most recent articles.
4396 (setq articles (nthcdr (- number select) articles))))
4397 (setq gnus-newsgroup-unselected
4398 (gnus-sorted-intersection
4399 gnus-newsgroup-unreads
4400 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4401 (when gnus-alter-articles-to-read-function
4402 (setq gnus-newsgroup-unreads
4404 (funcall gnus-alter-articles-to-read-function
4405 gnus-newsgroup-name gnus-newsgroup-unreads)
4409 (defun gnus-killed-articles (killed articles)
4412 (when (inline (gnus-member-of-range (car articles) killed))
4413 (push (car articles) out))
4414 (setq articles (cdr articles)))
4417 (defun gnus-uncompress-marks (marks)
4418 "Uncompress the mark ranges in MARKS."
4419 (let ((uncompressed '(score bookmark))
4422 (if (memq (caar marks) uncompressed)
4423 (push (car marks) out)
4424 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4425 (setq marks (cdr marks)))
4428 (defun gnus-adjust-marked-articles (info)
4429 "Set all article lists and remove all marks that are no longer valid."
4430 (let* ((marked-lists (gnus-info-marks info))
4431 (active (gnus-active (gnus-info-group info)))
4434 (types gnus-article-mark-lists)
4435 (uncompressed '(score bookmark killed))
4436 marks var articles article mark)
4439 (setq marks (pop marked-lists))
4440 (set (setq var (intern (format "gnus-newsgroup-%s"
4441 (car (rassq (setq mark (car marks))
4443 (if (memq (car marks) uncompressed) (cdr marks)
4444 (gnus-uncompress-range (cdr marks))))
4446 (setq articles (symbol-value var))
4448 ;; All articles have to be subsets of the active articles.
4450 ;; Adjust "simple" lists.
4451 ((memq mark '(tick dormant expire reply save))
4453 (when (or (< (setq article (pop articles)) min) (> article max))
4454 (set var (delq article (symbol-value var))))))
4456 ((memq mark uncompressed)
4457 (when (not (listp (cdr (symbol-value var))))
4458 (set var (list (symbol-value var))))
4459 (when (not (listp (cdr articles)))
4460 (setq articles (list articles)))
4462 (when (or (not (consp (setq article (pop articles))))
4463 (< (car article) min)
4464 (> (car article) max))
4465 (set var (delq article (symbol-value var))))))))))
4467 (defun gnus-update-missing-marks (missing)
4468 "Go through the list of MISSING articles and remove them from the mark lists."
4470 (let ((types gnus-article-mark-lists)
4472 ;; Go through all types.
4474 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4475 (when (symbol-value var)
4476 ;; This list has articles. So we delete all missing articles
4480 (set var (delq (pop m) (symbol-value var)))))))))
4482 (defun gnus-update-marks ()
4483 "Enter the various lists of marked articles into the newsgroup info list."
4484 (let ((types gnus-article-mark-lists)
4485 (info (gnus-get-info gnus-newsgroup-name))
4486 (uncompressed '(score bookmark killed))
4487 type list newmarked symbol delta-marks)
4489 ;; Add all marks lists to the list of marks lists.
4490 (while (setq type (pop types))
4491 (setq list (symbol-value
4493 (intern (format "gnus-newsgroup-%s"
4497 ;; Get rid of the entries of the articles that have the
4499 (when (and (eq (cdr type) 'score)
4503 (prev (cons nil list))
4506 (if (or (not (consp (car arts)))
4507 (= (cdar arts) gnus-summary-default-score))
4508 (setcdr prev (cdr arts))
4510 (setq arts (cdr arts)))
4511 (setq list (cdr all)))))
4513 (unless (memq (cdr type) uncompressed)
4514 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4516 (when (gnus-check-backend-function
4517 'request-set-mark gnus-newsgroup-name)
4518 ;; propagate flags to server, with the following exceptions:
4519 ;; uncompressed:s are not proper flags (they are cons cells)
4520 ;; cache is a internal gnus flag
4521 ;; download are local to one gnus installation (well)
4522 ;; unsend are for nndraft groups only
4523 ;; xxx: generality of this? this suits nnimap anyway
4524 (unless (memq (cdr type) (append '(cache download unsend)
4526 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4527 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4528 (add (gnus-remove-from-range
4529 (gnus-copy-sequence list) old)))
4531 (push (list add 'add (list (cdr type))) delta-marks))
4533 (push (list del 'del (list (cdr type))) delta-marks)))))
4536 (push (cons (cdr type) list) newmarked)))
4539 (unless (gnus-check-group gnus-newsgroup-name)
4540 (error "Can't open server for %s" gnus-newsgroup-name))
4541 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4543 ;; Enter these new marks into the info of the group.
4545 (setcar (nthcdr 3 info) newmarked)
4546 ;; Add the marks lists to the end of the info.
4548 (setcdr (nthcdr 2 info) (list newmarked))))
4550 ;; Cut off the end of the info if there's nothing else there.
4554 (when (nthcdr (decf i) info)
4555 (setcdr (nthcdr i info) nil)))))))
4557 (defun gnus-set-mode-line (where)
4558 "Set the mode line of the article or summary buffers.
4559 If WHERE is `summary', the summary mode line format will be used."
4560 ;; Is this mode line one we keep updated?
4561 (when (and (memq where gnus-updated-mode-lines)
4563 (intern (format "gnus-%s-mode-line-format-spec" where))))
4566 ;; We evaluate this in the summary buffer since these
4567 ;; variables are buffer-local to that buffer.
4568 (set-buffer gnus-summary-buffer)
4569 ;; We bind all these variables that are used in the `eval' form
4571 (let* ((mformat (symbol-value
4573 (format "gnus-%s-mode-line-format-spec" where))))
4574 (gnus-tmp-group-name (gnus-group-name-decode
4576 (gnus-group-name-charset
4578 gnus-newsgroup-name)))
4579 (gnus-tmp-article-number (or gnus-current-article 0))
4580 (gnus-tmp-unread gnus-newsgroup-unreads)
4581 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4582 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4583 (gnus-tmp-unread-and-unselected
4584 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4585 (zerop gnus-tmp-unselected))
4587 ((zerop gnus-tmp-unselected)
4588 (format "{%d more}" gnus-tmp-unread-and-unticked))
4589 (t (format "{%d(+%d) more}"
4590 gnus-tmp-unread-and-unticked
4591 gnus-tmp-unselected))))
4593 (if (and gnus-current-headers
4594 (vectorp gnus-current-headers))
4595 (gnus-mode-string-quote
4596 (mail-header-subject gnus-current-headers))
4598 bufname-length max-len
4599 gnus-tmp-header);; passed as argument to any user-format-funcs
4600 (setq mode-string (eval mformat))
4601 (setq bufname-length (if (string-match "%b" mode-string)
4604 (if (eq where 'summary)
4606 (get-buffer gnus-article-buffer))))
4609 (setq max-len (max 4 (if gnus-mode-non-string-length
4611 gnus-mode-non-string-length
4613 (length mode-string))))
4614 ;; We might have to chop a bit of the string off...
4615 (when (> (length mode-string) max-len)
4617 (concat (truncate-string-to-width mode-string (- max-len 3))
4619 ;; Pad the mode string a bit.
4620 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4621 ;; Update the mode line.
4622 (setq mode-line-buffer-identification
4623 (gnus-mode-line-buffer-identification (list mode-string)))
4624 (set-buffer-modified-p t))))
4626 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4627 "Go through the HEADERS list and add all Xrefs to a hash table.
4628 The resulting hash table is returned, or nil if no Xrefs were found."
4629 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4630 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4631 (xref-hashtb (gnus-make-hashtable))
4632 start group entry number xrefs header)
4634 (setq header (pop headers))
4635 (when (and (setq xrefs (mail-header-xref header))
4636 (not (memq (setq number (mail-header-number header))
4639 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4640 (setq start (match-end 0))
4641 (setq group (if prefix
4642 (concat prefix (substring xrefs (match-beginning 1)
4644 (substring xrefs (match-beginning 1) (match-end 1))))
4646 (string-to-int (substring xrefs (match-beginning 2)
4648 (if (setq entry (gnus-gethash group xref-hashtb))
4649 (setcdr entry (cons number (cdr entry)))
4650 (gnus-sethash group (cons number nil) xref-hashtb)))))
4651 (and start xref-hashtb)))
4653 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4654 "Look through all the headers and mark the Xrefs as read."
4655 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4656 name entry info xref-hashtb idlist method nth4)
4658 (set-buffer gnus-group-buffer)
4659 (when (setq xref-hashtb
4660 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4663 (unless (string= from-newsgroup (setq name (symbol-name group)))
4664 (setq idlist (symbol-value group))
4665 ;; Dead groups are not updated.
4667 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4669 (when (stringp (setq nth4 (gnus-info-method info)))
4670 (setq nth4 (gnus-server-to-method nth4))))
4671 ;; Only do the xrefs if the group has the same
4672 ;; select method as the group we have just read.
4673 (or (gnus-methods-equal-p
4674 nth4 (gnus-find-method-for-group from-newsgroup))
4676 (equal nth4 (setq method (gnus-find-method-for-group
4678 (and (equal (car nth4) (car method))
4679 (equal (nth 1 nth4) (nth 1 method))))
4680 gnus-use-cross-reference
4681 (or (not (eq gnus-use-cross-reference t))
4683 ;; Only do cross-references on subscribed
4684 ;; groups, if that is what is wanted.
4685 (<= (gnus-info-level info) gnus-level-subscribed))
4686 (gnus-group-make-articles-read name idlist))))
4689 (defun gnus-compute-read-articles (group articles)
4690 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4691 (info (nth 2 entry))
4692 (active (gnus-active group))
4695 ;; First peel off all invalid article numbers.
4697 (let ((ids articles)
4699 (while (setq id (pop ids))
4700 (when (and first (> id (cdr active)))
4701 ;; We'll end up in this situation in one particular
4702 ;; obscure situation. If you re-scan a group and get
4703 ;; a new article that is cross-posted to a different
4704 ;; group that has not been re-scanned, you might get
4705 ;; crossposted article that has a higher number than
4706 ;; Gnus believes possible. So we re-activate this
4707 ;; group as well. This might mean doing the
4708 ;; crossposting thingy will *increase* the number
4709 ;; of articles in some groups. Tsk, tsk.
4710 (setq active (or (gnus-activate-group group) active)))
4711 (when (or (> id (cdr active))
4712 (< id (car active)))
4713 (setq articles (delq id articles))))))
4714 ;; If the read list is nil, we init it.
4716 (null (gnus-info-read info))
4718 (setq ninfo (cons 1 (1- (car active))))
4719 (setq ninfo (gnus-info-read info)))
4720 ;; Then we add the read articles to the range.
4722 ninfo (setq articles (sort articles '<))))))
4724 (defun gnus-group-make-articles-read (group articles)
4725 "Update the info of GROUP to say that ARTICLES are read."
4727 (entry (gnus-gethash group gnus-newsrc-hashtb))
4728 (info (nth 2 entry))
4729 (active (gnus-active group))
4732 (setq range (gnus-compute-read-articles group articles))
4734 (set-buffer gnus-group-buffer)
4737 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4738 (gnus-info-set-read ',info ',(gnus-info-read info))
4739 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4740 (gnus-group-update-group ,group t))))
4741 ;; Add the read articles to the range.
4742 (gnus-info-set-read info range)
4743 ;; Then we have to re-compute how many unread
4744 ;; articles there are in this group.
4748 (setq num (- (1+ (cdr active)) (car active))))
4749 ((not (listp (cdr range)))
4750 (setq num (- (cdr active) (- (1+ (cdr range))
4754 (if (numberp (car range))
4756 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4757 (setq range (cdr range)))
4758 (setq num (- (cdr active) num))))
4759 ;; Update the number of unread articles.
4761 ;; Update the group buffer.
4762 (gnus-group-update-group group t)))))
4764 (defvar gnus-newsgroup-none-id 0)
4766 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4767 (let ((cur nntp-server-buffer)
4770 (save-excursion (set-buffer gnus-summary-buffer)
4771 gnus-newsgroup-dependencies)))
4773 (mail-parse-charset gnus-newsgroup-charset)
4774 (mail-parse-ignored-charsets
4775 (save-excursion (condition-case nil
4776 (set-buffer gnus-summary-buffer)
4778 gnus-newsgroup-ignored-charsets)))
4780 (set-buffer nntp-server-buffer)
4781 ;; Translate all TAB characters into SPACE characters.
4782 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4783 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4784 (gnus-run-hooks 'gnus-parse-headers-hook)
4785 (let ((case-fold-search t)
4786 in-reply-to header p lines chars)
4787 (goto-char (point-min))
4788 ;; Search to the beginning of the next header. Error messages
4789 ;; do not begin with 2 or 3.
4790 (while (re-search-forward "^[23][0-9]+ " nil t)
4793 ;; This implementation of this function, with nine
4794 ;; search-forwards instead of the one re-search-forward and
4795 ;; a case (which basically was the old function) is actually
4796 ;; about twice as fast, even though it looks messier. You
4797 ;; can't have everything, I guess. Speed and elegance
4798 ;; doesn't always go hand in hand.
4807 (narrow-to-region (point)
4808 (or (and (search-forward "\n.\n" nil t)
4814 (if (search-forward "\nsubject: " nil t)
4815 (funcall gnus-decode-encoded-word-function
4816 (nnheader-header-value))
4821 (if (or (search-forward "\nfrom: " nil t)
4822 (search-forward "\nfrom:" nil t))
4823 (funcall gnus-decode-encoded-word-function
4824 (nnheader-header-value))
4829 (if (search-forward "\ndate: " nil t)
4830 (nnheader-header-value) ""))
4834 (setq id (if (re-search-forward
4835 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4836 ;; We do it this way to make sure the Message-ID
4837 ;; is (somewhat) syntactically valid.
4838 (buffer-substring (match-beginning 1)
4840 ;; If there was no message-id, we just fake one
4841 ;; to make subsequent routines simpler.
4842 (nnheader-generate-fake-message-id))))
4846 (if (search-forward "\nreferences: " nil t)
4850 (nnheader-header-value)
4855 (search-backward ">" end t)
4858 (search-backward "<" end t)
4860 ;; Get the references from the in-reply-to header if there
4861 ;; were no references and the in-reply-to header looks
4863 (if (and (search-forward "\nin-reply-to: " nil t)
4864 (setq in-reply-to (nnheader-header-value))
4865 (string-match "<[^>]+>" in-reply-to))
4867 (setq ref (substring in-reply-to (match-beginning 0)
4869 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4870 (setq ref2 (substring in-reply-to (match-beginning 0)
4872 (when (> (length ref2) (length ref))
4879 (if (search-forward "\nchars: " nil t)
4880 (if (numberp (setq chars (ignore-errors (read cur))))
4886 (if (search-forward "\nlines: " nil t)
4887 (if (numberp (setq lines (ignore-errors (read cur))))
4893 (and (search-forward "\nxref: " nil t)
4894 (nnheader-header-value)))
4896 (when gnus-extra-headers
4897 (let ((extra gnus-extra-headers)
4901 (when (search-forward
4902 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4903 (push (cons (car extra) (nnheader-header-value))
4907 (when (equal id ref)
4910 (when gnus-alter-header-function
4911 (funcall gnus-alter-header-function header)
4912 (setq id (mail-header-id header)
4913 ref (gnus-parent-id (mail-header-references header))))
4916 (gnus-dependencies-add-header
4917 header dependencies force-new))
4918 (push header headers))
4919 (goto-char (point-max))
4921 (nreverse headers)))))
4923 ;; Goes through the xover lines and returns a list of vectors
4924 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4925 force-new dependencies
4926 group also-fetch-heads)
4927 "Parse the news overview data in the server buffer.
4928 Return a list of headers that match SEQUENCE (see
4929 `nntp-retrieve-headers')."
4930 ;; Get the Xref when the users reads the articles since most/some
4931 ;; NNTP servers do not include Xrefs when using XOVER.
4932 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4933 (let ((mail-parse-charset gnus-newsgroup-charset)
4934 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4935 (cur nntp-server-buffer)
4936 (dependencies (or dependencies gnus-newsgroup-dependencies))
4937 number headers header)
4939 (set-buffer nntp-server-buffer)
4940 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4941 ;; Allow the user to mangle the headers before parsing them.
4942 (gnus-run-hooks 'gnus-parse-headers-hook)
4943 (goto-char (point-min))
4946 (while (and sequence (not (eobp)))
4947 (setq number (read cur))
4948 (while (and sequence
4949 (< (car sequence) number))
4950 (setq sequence (cdr sequence)))
4952 (eq number (car sequence))
4954 (setq sequence (cdr sequence))
4955 (setq header (inline
4956 (gnus-nov-parse-line
4957 number dependencies force-new))))
4958 (push header headers))
4961 (gnus-error 4 "Strange nov line (%d)"
4962 (count-lines (point-min) (point)))))
4964 ;; A common bug in inn is that if you have posted an article and
4965 ;; then retrieves the active file, it will answer correctly --
4966 ;; the new article is included. However, a NOV entry for the
4967 ;; article may not have been generated yet, so this may fail.
4968 ;; We work around this problem by retrieving the last few
4969 ;; headers using HEAD.
4970 (if (or (not also-fetch-heads)
4972 ;; We (probably) got all the headers.
4974 (let ((gnus-nov-is-evil t))
4977 (when (gnus-retrieve-headers sequence group)
4978 (gnus-get-newsgroup-headers))))))))
4980 (defun gnus-article-get-xrefs ()
4981 "Fill in the Xref value in `gnus-current-headers', if necessary.
4982 This is meant to be called in `gnus-article-internal-prepare-hook'."
4983 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4984 gnus-current-headers)))
4985 (or (not gnus-use-cross-reference)
4987 (and (mail-header-xref headers)
4988 (not (string= (mail-header-xref headers) "")))
4989 (let ((case-fold-search t)
4992 (nnheader-narrow-to-headers)
4993 (goto-char (point-min))
4994 (when (or (and (not (eobp))
4995 (eq (downcase (char-after)) ?x)
4996 (looking-at "Xref:"))
4997 (search-forward "\nXref:" nil t))
4998 (goto-char (1+ (match-end 0)))
4999 (setq xref (buffer-substring (point)
5000 (progn (end-of-line) (point))))
5001 (mail-header-set-xref headers xref)))))))
5003 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5004 "Find article ID and insert the summary line for that article.
5005 OLD-HEADER can either be a header or a line number to insert
5006 the subject line on."
5007 (let* ((line (and (numberp old-header) old-header))
5008 (old-header (and (vectorp old-header) old-header))
5009 (header (cond ((and old-header use-old-header)
5012 (gnus-number-to-header id))
5013 (gnus-number-to-header id))
5015 (gnus-read-header id))))
5016 (number (and (numberp id) id))
5019 ;; Rebuild the thread that this article is part of and go to the
5020 ;; article we have fetched.
5021 (when (and (not gnus-show-threads)
5024 (setq d (gnus-data-find (mail-header-number old-header))))
5025 (goto-char (gnus-data-pos d))
5028 (- (gnus-point-at-bol)
5030 (1+ (gnus-point-at-eol))
5031 (gnus-delete-line))))))
5033 (mail-header-set-number header (mail-header-number old-header)))
5034 (setq gnus-newsgroup-sparse
5035 (delq (setq number (mail-header-number header))
5036 gnus-newsgroup-sparse))
5037 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5038 (push number gnus-newsgroup-limit)
5039 (gnus-rebuild-thread (mail-header-id header) line)
5040 (gnus-summary-goto-subject number nil t))
5041 (when (and (numberp number)
5043 ;; We have to update the boundaries even if we can't fetch the
5044 ;; article if ID is a number -- so that the next `P' or `N'
5045 ;; command will fetch the previous (or next) article even
5046 ;; if the one we tried to fetch this time has been canceled.
5047 (when (> number gnus-newsgroup-end)
5048 (setq gnus-newsgroup-end number))
5049 (when (< number gnus-newsgroup-begin)
5050 (setq gnus-newsgroup-begin number))
5051 (setq gnus-newsgroup-unselected
5052 (delq number gnus-newsgroup-unselected)))
5053 ;; Report back a success?
5054 (and header (mail-header-number header))))
5056 ;;; Process/prefix in the summary buffer
5058 (defun gnus-summary-work-articles (n)
5059 "Return a list of articles to be worked upon.
5060 The prefix argument, the list of process marked articles, and the
5061 current article will be taken into consideration."
5063 (set-buffer gnus-summary-buffer)
5066 ;; A numerical prefix has been given.
5067 (setq n (prefix-numeric-value n))
5068 (let ((backward (< n 0))
5069 (n (abs (prefix-numeric-value n)))
5074 (push (setq article (gnus-summary-article-number))
5077 (gnus-summary-find-prev nil article)
5078 (gnus-summary-find-next nil article)))
5080 (nreverse articles)))
5081 ((and (gnus-region-active-p) (mark))
5082 (message "region active")
5083 ;; Work on the region between point and mark.
5084 (let ((max (max (point) (mark)))
5087 (goto-char (min (min (point) (mark))))
5090 (push (setq article (gnus-summary-article-number)) articles)
5091 (gnus-summary-find-next nil article)
5093 (nreverse articles))))
5094 (gnus-newsgroup-processable
5095 ;; There are process-marked articles present.
5096 ;; Save current state.
5097 (gnus-summary-save-process-mark)
5099 (reverse gnus-newsgroup-processable))
5101 ;; Just return the current article.
5102 (list (gnus-summary-article-number))))))
5104 (defmacro gnus-summary-iterate (arg &rest forms)
5105 "Iterate over the process/prefixed articles and do FORMS.
5106 ARG is the interactive prefix given to the command. FORMS will be
5107 executed with point over the summary line of the articles."
5108 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5109 `(let ((,articles (gnus-summary-work-articles ,arg)))
5111 (gnus-summary-goto-subject (car ,articles))
5115 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5116 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5118 (defun gnus-summary-save-process-mark ()
5119 "Push the current set of process marked articles on the stack."
5121 (push (copy-sequence gnus-newsgroup-processable)
5122 gnus-newsgroup-process-stack))
5124 (defun gnus-summary-kill-process-mark ()
5125 "Push the current set of process marked articles on the stack and unmark."
5127 (gnus-summary-save-process-mark)
5128 (gnus-summary-unmark-all-processable))
5130 (defun gnus-summary-yank-process-mark ()
5131 "Pop the last process mark state off the stack and restore it."
5133 (unless gnus-newsgroup-process-stack
5134 (error "Empty mark stack"))
5135 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5137 (defun gnus-summary-process-mark-set (set)
5138 "Make SET into the current process marked articles."
5139 (gnus-summary-unmark-all-processable)
5141 (gnus-summary-set-process-mark (pop set))))
5143 ;;; Searching and stuff
5145 (defun gnus-summary-search-group (&optional backward use-level)
5146 "Search for next unread newsgroup.
5147 If optional argument BACKWARD is non-nil, search backward instead."
5149 (set-buffer gnus-group-buffer)
5150 (when (gnus-group-search-forward
5151 backward nil (if use-level (gnus-group-group-level) nil))
5152 (gnus-group-group-name))))
5154 (defun gnus-summary-best-group (&optional exclude-group)
5155 "Find the name of the best unread group.
5156 If EXCLUDE-GROUP, do not go to this group."
5158 (set-buffer gnus-group-buffer)
5160 (gnus-group-best-unread-group exclude-group))))
5162 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5163 (if backward (gnus-summary-find-prev)
5164 (let* ((dummy (gnus-summary-article-intangible-p))
5165 (article (or article (gnus-summary-article-number)))
5166 (arts (gnus-data-find-list article))
5168 (when (and (not dummy)
5169 (or (not gnus-summary-check-current)
5171 (not (gnus-data-unread-p (car arts)))))
5172 (setq arts (cdr arts)))
5177 (when (or (and undownloaded
5178 (eq gnus-undownloaded-mark
5179 (gnus-data-mark (car arts))))
5180 (gnus-data-unread-p (car arts)))
5181 (setq result (car arts)
5183 (setq arts (cdr arts)))
5186 (goto-char (gnus-data-pos result))
5187 (gnus-data-number result)))))
5189 (defun gnus-summary-find-prev (&optional unread article)
5190 (let* ((eobp (eobp))
5191 (article (or article (gnus-summary-article-number)))
5192 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5194 (when (and (not eobp)
5195 (or (not gnus-summary-check-current)
5197 (not (gnus-data-unread-p (car arts)))))
5198 (setq arts (cdr arts)))
5203 (when (gnus-data-unread-p (car arts))
5204 (setq result (car arts)
5206 (setq arts (cdr arts)))
5209 (goto-char (gnus-data-pos result))
5210 (gnus-data-number result))))
5212 (defun gnus-summary-find-subject (subject &optional unread backward article)
5213 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5214 (article (or article (gnus-summary-article-number)))
5215 (articles (gnus-data-list backward))
5216 (arts (gnus-data-find-list article articles))
5218 (when (or (not gnus-summary-check-current)
5220 (not (gnus-data-unread-p (car arts))))
5221 (setq arts (cdr arts)))
5223 (and (or (not unread)
5224 (gnus-data-unread-p (car arts)))
5225 (vectorp (gnus-data-header (car arts)))
5227 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5228 (setq result (car arts)
5230 (setq arts (cdr arts)))
5232 (goto-char (gnus-data-pos result))
5233 (gnus-data-number result))))
5235 (defun gnus-summary-search-forward (&optional unread subject backward)
5236 "Search forward for an article.
5237 If UNREAD, look for unread articles. If SUBJECT, look for
5238 articles with that subject. If BACKWARD, search backward instead."
5239 (cond (subject (gnus-summary-find-subject subject unread backward))
5240 (backward (gnus-summary-find-prev unread))
5241 (t (gnus-summary-find-next unread))))
5243 (defun gnus-recenter (&optional n)
5244 "Center point in window and redisplay frame.
5245 Also do horizontal recentering."
5247 (when (and gnus-auto-center-summary
5248 (not (eq gnus-auto-center-summary 'vertical)))
5249 (gnus-horizontal-recenter))
5252 (defun gnus-summary-recenter ()
5253 "Center point in the summary window.
5254 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5255 displayed, no centering will be performed."
5256 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5257 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5259 (let* ((top (cond ((< (window-height) 4) 0)
5260 ((< (window-height) 7) 1)
5261 (t (if (numberp gnus-auto-center-summary)
5262 gnus-auto-center-summary
5264 (height (1- (window-height)))
5265 (bottom (save-excursion (goto-char (point-max))
5266 (forward-line (- height))
5268 (window (get-buffer-window (current-buffer))))
5269 ;; The user has to want it.
5270 (when gnus-auto-center-summary
5271 (when (get-buffer-window gnus-article-buffer)
5272 ;; Only do recentering when the article buffer is displayed,
5273 ;; Set the window start to either `bottom', which is the biggest
5274 ;; possible valid number, or the second line from the top,
5275 ;; whichever is the least.
5276 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
5277 (if (> bottom top-pos)
5278 ;; Keep the second line from the top visible
5279 (set-window-start window top-pos t)
5280 ;; Try to keep the bottom line visible; if it's partially
5281 ;; obscured, either scroll one more line to make it fully
5282 ;; visible, or revert to using TOP-POS.
5284 (goto-char (point-max))
5286 (let ((last-line-start (point)))
5288 (set-window-start window (point) t)
5289 (when (not (pos-visible-in-window-p last-line-start window))
5291 (set-window-start window (min (point) top-pos) t)))))))
5292 ;; Do horizontal recentering while we're at it.
5293 (when (and (get-buffer-window (current-buffer) t)
5294 (not (eq gnus-auto-center-summary 'vertical)))
5295 (let ((selected (selected-window)))
5296 (select-window (get-buffer-window (current-buffer) t))
5297 (gnus-summary-position-point)
5298 (gnus-horizontal-recenter)
5299 (select-window selected))))))
5301 (defun gnus-summary-jump-to-group (newsgroup)
5302 "Move point to NEWSGROUP in group mode buffer."
5303 ;; Keep update point of group mode buffer if visible.
5304 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5305 (save-window-excursion
5306 ;; Take care of tree window mode.
5307 (when (get-buffer-window gnus-group-buffer)
5308 (pop-to-buffer gnus-group-buffer))
5309 (gnus-group-jump-to-group newsgroup))
5311 ;; Take care of tree window mode.
5312 (if (get-buffer-window gnus-group-buffer)
5313 (pop-to-buffer gnus-group-buffer)
5314 (set-buffer gnus-group-buffer))
5315 (gnus-group-jump-to-group newsgroup))))
5317 ;; This function returns a list of article numbers based on the
5318 ;; difference between the ranges of read articles in this group and
5319 ;; the range of active articles.
5320 (defun gnus-list-of-unread-articles (group)
5321 (let* ((read (gnus-info-read (gnus-get-info group)))
5322 (active (or (gnus-active group) (gnus-activate-group group)))
5325 ;; If none are read, then all are unread.
5327 (setq first (car active))
5328 ;; If the range of read articles is a single range, then the
5329 ;; first unread article is the article after the last read
5330 ;; article. Sounds logical, doesn't it?
5331 (if (and (not (listp (cdr read)))
5332 (or (< (car read) (car active))
5333 (progn (setq read (list read))
5335 (setq first (max (car active) (1+ (cdr read))))
5336 ;; `read' is a list of ranges.
5337 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5340 (setq first (car active)))
5343 (while (< first nlast)
5345 (setq first (1+ first))))
5346 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5347 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5348 (setq read (cdr read)))))
5349 ;; And add the last unread articles.
5350 (while (<= first last)
5352 (setq first (1+ first)))
5353 ;; Return the list of unread articles.
5354 (delq 0 (nreverse unread))))
5356 (defun gnus-list-of-read-articles (group)
5357 "Return a list of unread, unticked and non-dormant articles."
5358 (let* ((info (gnus-get-info group))
5359 (marked (gnus-info-marks info))
5360 (active (gnus-active group)))
5362 (gnus-set-difference
5363 (gnus-sorted-complement
5364 (gnus-uncompress-range active)
5365 (gnus-list-of-unread-articles group))
5367 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5368 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5370 ;; Various summary commands
5372 (defun gnus-summary-select-article-buffer ()
5373 "Reconfigure windows to show article buffer."
5375 (if (not (gnus-buffer-live-p gnus-article-buffer))
5376 (error "There is no article buffer for this summary buffer")
5377 (gnus-configure-windows 'article)
5378 (select-window (get-buffer-window gnus-article-buffer))))
5380 (defun gnus-summary-universal-argument (arg)
5381 "Perform any operation on all articles that are process/prefixed."
5383 (let ((articles (gnus-summary-work-articles arg))
5390 (substitute-command-keys
5391 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
5393 (gnus-error 1 "Undefined key")
5396 (gnus-summary-goto-subject (setq article (pop articles)))
5397 (let (gnus-newsgroup-processable)
5398 (command-execute func))
5399 (gnus-summary-remove-process-mark article)))))
5400 (gnus-summary-position-point))
5402 (defun gnus-summary-toggle-truncation (&optional arg)
5403 "Toggle truncation of summary lines.
5404 With arg, turn line truncation on iff arg is positive."
5406 (setq truncate-lines
5407 (if (null arg) (not truncate-lines)
5408 (> (prefix-numeric-value arg) 0)))
5411 (defun gnus-summary-reselect-current-group (&optional all rescan)
5412 "Exit and then reselect the current newsgroup.
5413 The prefix argument ALL means to select all articles."
5415 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5416 (error "Ephemeral groups can't be reselected"))
5417 (let ((current-subject (gnus-summary-article-number))
5418 (group gnus-newsgroup-name))
5419 (setq gnus-newsgroup-begin nil)
5421 ;; We have to adjust the point of group mode buffer because
5422 ;; point was moved to the next unread newsgroup by exiting.
5423 (gnus-summary-jump-to-group group)
5426 (gnus-group-get-new-news-this-group 1)))
5427 (gnus-group-read-group all t)
5428 (gnus-summary-goto-subject current-subject nil t)))
5430 (defun gnus-summary-rescan-group (&optional all)
5431 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5433 (gnus-summary-reselect-current-group all t))
5435 (defun gnus-summary-update-info (&optional non-destructive)
5437 (let ((group gnus-newsgroup-name))
5439 (when gnus-newsgroup-kill-headers
5440 (setq gnus-newsgroup-killed
5441 (gnus-compress-sequence
5443 (gnus-set-sorted-intersection
5444 (gnus-uncompress-range gnus-newsgroup-killed)
5445 (setq gnus-newsgroup-unselected
5446 (sort gnus-newsgroup-unselected '<)))
5447 (setq gnus-newsgroup-unreads
5448 (sort gnus-newsgroup-unreads '<)))
5450 (unless (listp (cdr gnus-newsgroup-killed))
5451 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5452 (let ((headers gnus-newsgroup-headers))
5453 ;; Set the new ranges of read articles.
5455 (set-buffer gnus-group-buffer)
5456 (gnus-undo-force-boundary))
5457 (gnus-update-read-articles
5458 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5459 ;; Set the current article marks.
5460 (let ((gnus-newsgroup-scored
5461 (if (and (not gnus-save-score)
5462 (not non-destructive))
5464 gnus-newsgroup-scored)))
5466 (gnus-update-marks)))
5467 ;; Do the cross-ref thing.
5468 (when gnus-use-cross-reference
5469 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5470 ;; Do not switch windows but change the buffer to work.
5471 (set-buffer gnus-group-buffer)
5472 (unless (gnus-ephemeral-group-p group)
5473 (gnus-group-update-group group)))))))
5475 (defun gnus-summary-save-newsrc (&optional force)
5476 "Save the current number of read/marked articles in the dribble buffer.
5477 The dribble buffer will then be saved.
5478 If FORCE (the prefix), also save the .newsrc file(s)."
5480 (gnus-summary-update-info t)
5482 (gnus-save-newsrc-file)
5483 (gnus-dribble-save)))
5485 (defun gnus-summary-exit (&optional temporary)
5486 "Exit reading current newsgroup, and then return to group selection mode.
5487 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
5489 (gnus-set-global-variables)
5490 (when (gnus-buffer-live-p gnus-article-buffer)
5492 (set-buffer gnus-article-buffer)
5493 (mm-destroy-parts gnus-article-mime-handles)
5494 ;; Set it to nil for safety reason.
5495 (setq gnus-article-mime-handle-alist nil)
5496 (setq gnus-article-mime-handles nil)))
5497 (gnus-kill-save-kill-buffer)
5498 (gnus-async-halt-prefetch)
5499 (let* ((group gnus-newsgroup-name)
5500 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5503 (buf (current-buffer)))
5505 ;; Do adaptive scoring, and possibly save score files.
5506 (when gnus-newsgroup-adaptive
5507 (gnus-score-adaptive))
5508 (when gnus-use-scoring
5510 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5511 ;; If we have several article buffers, we kill them at exit.
5512 (unless gnus-single-article-buffer
5513 (gnus-kill-buffer gnus-original-article-buffer)
5514 (setq gnus-article-current nil))
5515 (when gnus-use-cache
5516 (gnus-cache-possibly-remove-articles)
5517 (gnus-cache-save-buffers))
5518 (gnus-async-prefetch-remove-group group)
5519 (when gnus-suppress-duplicates
5520 (gnus-dup-enter-articles))
5521 (when gnus-use-trees
5522 (gnus-tree-close group))
5523 (when gnus-use-cache
5524 (gnus-cache-write-active))
5525 ;; Remove entries for this group.
5526 (nnmail-purge-split-history (gnus-group-real-name group))
5527 ;; Make all changes in this group permanent.
5529 (gnus-run-hooks 'gnus-exit-group-hook)
5530 (gnus-summary-update-info))
5531 (gnus-close-group group)
5532 ;; Make sure where we were, and go to next newsgroup.
5533 (set-buffer gnus-group-buffer)
5535 (gnus-group-jump-to-group group))
5536 (gnus-run-hooks 'gnus-summary-exit-hook)
5537 (unless (or quit-config
5538 ;; If this group has disappeared from the summary
5539 ;; buffer, don't skip forwards.
5540 (not (string= group (gnus-group-group-name))))
5541 (gnus-group-next-unread-group 1))
5542 (setq group-point (point))
5545 ;; If we have several article buffers, we kill them at exit.
5546 (unless gnus-single-article-buffer
5547 (gnus-kill-buffer gnus-article-buffer)
5548 (gnus-kill-buffer gnus-original-article-buffer)
5549 (setq gnus-article-current nil))
5551 (if (not gnus-kill-summary-on-exit)
5552 (gnus-deaden-summary)
5553 ;; We set all buffer-local variables to nil. It is unclear why
5554 ;; this is needed, but if we don't, buffer-local variables are
5555 ;; not garbage-collected, it seems. This would the lead to en
5556 ;; ever-growing Emacs.
5557 (gnus-summary-clear-local-variables)
5558 (when (get-buffer gnus-article-buffer)
5559 (bury-buffer gnus-article-buffer))
5560 ;; We clear the global counterparts of the buffer-local
5561 ;; variables as well, just to be on the safe side.
5562 (set-buffer gnus-group-buffer)
5563 (gnus-summary-clear-local-variables)
5564 ;; Return to group mode buffer.
5565 (when (eq mode 'gnus-summary-mode)
5566 (gnus-kill-buffer buf)))
5567 (setq gnus-current-select-method gnus-select-method)
5568 (pop-to-buffer gnus-group-buffer)
5569 (if (not quit-config)
5571 (goto-char group-point)
5572 (gnus-configure-windows 'group 'force))
5573 (gnus-handle-ephemeral-exit quit-config))
5574 ;; Clear the current group name.
5576 (setq gnus-newsgroup-name nil)))))
5578 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5579 (defun gnus-summary-exit-no-update (&optional no-questions)
5580 "Quit reading current newsgroup without updating read article info."
5582 (let* ((group gnus-newsgroup-name)
5583 (quit-config (gnus-group-quit-config group)))
5584 (when (or no-questions
5586 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5587 (gnus-async-halt-prefetch)
5589 (delq 'gnus-summary-expire-articles
5590 (copy-sequence gnus-summary-prepare-exit-hook)))
5591 (when (gnus-buffer-live-p gnus-article-buffer)
5593 (set-buffer gnus-article-buffer)
5594 (mm-destroy-parts gnus-article-mime-handles)
5595 ;; Set it to nil for safety reason.
5596 (setq gnus-article-mime-handle-alist nil)
5597 (setq gnus-article-mime-handles nil)))
5598 ;; If we have several article buffers, we kill them at exit.
5599 (unless gnus-single-article-buffer
5600 (gnus-kill-buffer gnus-article-buffer)
5601 (gnus-kill-buffer gnus-original-article-buffer)
5602 (setq gnus-article-current nil))
5603 (if (not gnus-kill-summary-on-exit)
5604 (gnus-deaden-summary)
5605 (gnus-close-group group)
5606 (gnus-summary-clear-local-variables)
5607 (set-buffer gnus-group-buffer)
5608 (gnus-summary-clear-local-variables)
5609 (when (get-buffer gnus-summary-buffer)
5610 (kill-buffer gnus-summary-buffer)))
5611 (unless gnus-single-article-buffer
5612 (setq gnus-article-current nil))
5613 (when gnus-use-trees
5614 (gnus-tree-close group))
5615 (gnus-async-prefetch-remove-group group)
5616 (when (get-buffer gnus-article-buffer)
5617 (bury-buffer gnus-article-buffer))
5618 ;; Return to the group buffer.
5619 (gnus-configure-windows 'group 'force)
5620 ;; Clear the current group name.
5621 (setq gnus-newsgroup-name nil)
5622 (when (equal (gnus-group-group-name) group)
5623 (gnus-group-next-unread-group 1))
5625 (gnus-handle-ephemeral-exit quit-config)))))
5627 (defun gnus-handle-ephemeral-exit (quit-config)
5628 "Handle movement when leaving an ephemeral group.
5629 The state which existed when entering the ephemeral is reset."
5630 (if (not (buffer-name (car quit-config)))
5631 (gnus-configure-windows 'group 'force)
5632 (set-buffer (car quit-config))
5633 (cond ((eq major-mode 'gnus-summary-mode)
5634 (gnus-set-global-variables))
5635 ((eq major-mode 'gnus-article-mode)
5637 ;; The `gnus-summary-buffer' variable may point
5638 ;; to the old summary buffer when using a single
5640 (unless (gnus-buffer-live-p gnus-summary-buffer)
5641 (set-buffer gnus-group-buffer))
5642 (set-buffer gnus-summary-buffer)
5643 (gnus-set-global-variables))))
5644 (if (or (eq (cdr quit-config) 'article)
5645 (eq (cdr quit-config) 'pick))
5647 ;; The current article may be from the ephemeral group
5648 ;; thus it is best that we reload this article
5649 (gnus-summary-show-article)
5650 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5651 (gnus-configure-windows 'pick 'force)
5652 (gnus-configure-windows (cdr quit-config) 'force)))
5653 (gnus-configure-windows (cdr quit-config) 'force))
5654 (when (eq major-mode 'gnus-summary-mode)
5655 (gnus-summary-next-subject 1 nil t)
5656 (gnus-summary-recenter)
5657 (gnus-summary-position-point))))
5661 (defvar gnus-dead-summary-mode-map nil)
5663 (unless gnus-dead-summary-mode-map
5664 (setq gnus-dead-summary-mode-map (make-keymap))
5665 (suppress-keymap gnus-dead-summary-mode-map)
5666 (substitute-key-definition
5667 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5668 (let ((keys '("\C-d" "\r" "\177" [delete])))
5670 (define-key gnus-dead-summary-mode-map
5671 (pop keys
) 'gnus-summary-wake-up-the-dead
))))
5673 (defvar gnus-dead-summary-mode nil
5674 "Minor mode for Gnus summary buffers.")
5676 (defun gnus-dead-summary-mode (&optional arg
)
5677 "Minor mode for Gnus summary buffers."
5679 (when (eq major-mode
'gnus-summary-mode
)
5680 (make-local-variable 'gnus-dead-summary-mode
)
5681 (setq gnus-dead-summary-mode
5682 (if (null arg
) (not gnus-dead-summary-mode
)
5683 (> (prefix-numeric-value arg
) 0)))
5684 (when gnus-dead-summary-mode
5685 (gnus-add-minor-mode
5686 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
5688 (defun gnus-deaden-summary ()
5689 "Make the current summary buffer into a dead summary buffer."
5690 ;; Kill any previous dead summary buffer.
5691 (when (and gnus-dead-summary
5692 (buffer-name gnus-dead-summary
))
5694 (set-buffer gnus-dead-summary
)
5695 (when gnus-dead-summary-mode
5696 (kill-buffer (current-buffer)))))
5697 ;; Make this the current dead summary.
5698 (setq gnus-dead-summary
(current-buffer))
5699 (gnus-dead-summary-mode 1)
5700 (let ((name (buffer-name)))
5701 (when (string-match "Summary" name
)
5703 (concat (substring name
0 (match-beginning 0)) "Dead "
5704 (substring name
(match-beginning 0)))
5708 (defun gnus-kill-or-deaden-summary (buffer)
5709 "Kill or deaden the summary BUFFER."
5711 (when (and (buffer-name buffer
)
5712 (not gnus-single-article-buffer
))
5715 (gnus-kill-buffer gnus-article-buffer
)
5716 (gnus-kill-buffer gnus-original-article-buffer
)))
5717 (cond (gnus-kill-summary-on-exit
5718 (when (and gnus-use-trees
5719 (gnus-buffer-exists-p buffer
))
5722 (gnus-tree-close gnus-newsgroup-name
)))
5723 (gnus-kill-buffer buffer
))
5724 ((gnus-buffer-exists-p buffer
)
5727 (gnus-deaden-summary))))))
5729 (defun gnus-summary-wake-up-the-dead (&rest args
)
5730 "Wake up the dead summary buffer."
5732 (gnus-dead-summary-mode -
1)
5733 (let ((name (buffer-name)))
5734 (when (string-match "Dead " name
)
5736 (concat (substring name
0 (match-beginning 0))
5737 (substring name
(match-end 0)))
5739 (gnus-message 3 "This dead summary is now alive again"))
5741 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5742 (defun gnus-summary-fetch-faq (&optional faq-dir
)
5743 "Fetch the FAQ for the current group.
5744 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5748 (when current-prefix-arg
5750 "Faq dir: " (and (listp gnus-group-faq-directory
)
5751 (mapcar (lambda (file) (list file
))
5752 gnus-group-faq-directory
))))))
5753 (let (gnus-faq-buffer)
5754 (when (setq gnus-faq-buffer
5755 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
5756 (gnus-configure-windows 'summary-faq
))))
5758 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5759 (defun gnus-summary-describe-group (&optional force
)
5760 "Describe the current newsgroup."
5762 (gnus-group-describe-group force gnus-newsgroup-name
))
5764 (defun gnus-summary-describe-briefly ()
5765 "Describe summary mode commands briefly."
5767 (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")))
5769 ;; Walking around group mode buffer from summary mode.
5771 (defun gnus-summary-next-group (&optional no-article target-group backward
)
5772 "Exit current newsgroup and then select next unread newsgroup.
5773 If prefix argument NO-ARTICLE is non-nil, no article is selected
5774 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5775 previous group instead."
5777 ;; Stop pre-fetching.
5778 (gnus-async-halt-prefetch)
5779 (let ((current-group gnus-newsgroup-name
)
5780 (current-buffer (current-buffer))
5782 ;; First we semi-exit this group to update Xrefs and all variables.
5783 ;; We can't do a real exit, because the window conf must remain
5784 ;; the same in case the user is prompted for info, and we don't
5785 ;; want the window conf to change before that...
5786 (gnus-summary-exit t
)
5787 (while (not entered
)
5788 ;; Then we find what group we are supposed to enter.
5789 (set-buffer gnus-group-buffer
)
5790 (gnus-group-jump-to-group current-group
)
5793 (if (eq gnus-keep-same-level
'best
)
5794 (gnus-summary-best-group gnus-newsgroup-name
)
5795 (gnus-summary-search-group backward gnus-keep-same-level
))))
5796 (if (not target-group
)
5797 ;; There are no further groups, so we return to the group
5800 (gnus-message 5 "Returning to the group buffer")
5802 (when (gnus-buffer-live-p current-buffer
)
5803 (set-buffer current-buffer
)
5804 (gnus-summary-exit))
5805 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
5806 ;; We try to enter the target group.
5807 (gnus-group-jump-to-group target-group
)
5808 (let ((unreads (gnus-group-group-unread)))
5809 (if (and (or (eq t unreads
)
5810 (and unreads
(not (zerop unreads
))))
5811 (gnus-summary-read-group
5812 target-group nil no-article
5813 (and (buffer-name current-buffer
) current-buffer
)
5816 (setq current-group target-group
5817 target-group nil
)))))))
5819 (defun gnus-summary-prev-group (&optional no-article
)
5820 "Exit current newsgroup and then select previous unread newsgroup.
5821 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5823 (gnus-summary-next-group no-article nil t
))
5825 ;; Walking around summary lines.
5827 (defun gnus-summary-first-subject (&optional unread undownloaded
)
5828 "Go to the first unread subject.
5829 If UNREAD is non-nil, go to the first unread article.
5830 Returns the article selected or nil if there are no unread articles."
5835 ((null gnus-newsgroup-data
)
5836 (gnus-message 3 "No articles in the group")
5838 ;; Pick the first article.
5840 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
5841 (gnus-data-number (car gnus-newsgroup-data
)))
5842 ;; No unread articles.
5843 ((null gnus-newsgroup-unreads
)
5844 (gnus-message 3 "No more unread articles")
5846 ;; Find the first unread article.
5848 (let ((data gnus-newsgroup-data
))
5850 (and (not (and undownloaded
5851 (eq gnus-undownloaded-mark
5852 (gnus-data-mark (car data
)))))
5853 (not (gnus-data-unread-p (car data
)))))
5854 (setq data
(cdr data
)))
5856 (goto-char (gnus-data-pos (car data
)))
5857 (gnus-data-number (car data
))))))
5858 (gnus-summary-position-point)))
5860 (defun gnus-summary-next-subject (n &optional unread dont-display
)
5861 "Go to next N'th summary line.
5862 If N is negative, go to the previous N'th subject line.
5863 If UNREAD is non-nil, only unread articles are selected.
5864 The difference between N and the actual number of steps taken is
5867 (let ((backward (< n
0))
5871 (gnus-summary-find-prev unread
)
5872 (gnus-summary-find-next unread
)))
5873 (unless (zerop (setq n
(1- n
)))
5874 (gnus-summary-show-thread)))
5876 (gnus-message 7 "No more%s articles"
5877 (if unread
" unread" "")))
5878 (unless dont-display
5879 (gnus-summary-recenter)
5880 (gnus-summary-position-point))
5883 (defun gnus-summary-next-unread-subject (n)
5884 "Go to next N'th unread summary line."
5886 (gnus-summary-next-subject n t
))
5888 (defun gnus-summary-prev-subject (n &optional unread
)
5889 "Go to previous N'th summary line.
5890 If optional argument UNREAD is non-nil, only unread article is selected."
5892 (gnus-summary-next-subject (- n
) unread
))
5894 (defun gnus-summary-prev-unread-subject (n)
5895 "Go to previous N'th unread summary line."
5897 (gnus-summary-next-subject (- n
) t
))
5899 (defun gnus-summary-goto-subject (article &optional force silent
)
5900 "Go the subject line of ARTICLE.
5901 If FORCE, also allow jumping to articles not currently shown."
5902 (interactive "nArticle number: ")
5904 (data (gnus-data-find article
)))
5905 ;; We read in the article if we have to.
5908 (gnus-summary-insert-subject
5910 (if (or (numberp force
) (vectorp force
)) force
)
5912 (setq data
(gnus-data-find article
)))
5917 (gnus-message 3 "Can't find article %d" article
))
5919 (goto-char (gnus-data-pos data
))
5920 (gnus-summary-position-point)
5923 ;; Walking around summary lines with displaying articles.
5925 (defun gnus-summary-expand-window (&optional arg
)
5926 "Make the summary buffer take up the entire Emacs frame.
5927 Given a prefix, will force an `article' buffer configuration."
5930 (gnus-configure-windows 'article
'force
)
5931 (gnus-configure-windows 'summary
'force
)))
5933 (defun gnus-summary-display-article (article &optional all-header
)
5934 "Display ARTICLE in article buffer."
5935 (when (gnus-buffer-live-p gnus-article-buffer
)
5936 (with-current-buffer gnus-article-buffer
5937 (mm-enable-multibyte-mule4)))
5938 (gnus-set-global-variables)
5942 (if gnus-summary-display-article-function
5943 (funcall gnus-summary-display-article-function article all-header
)
5944 (gnus-article-prepare article all-header
))
5945 (gnus-run-hooks 'gnus-select-article-hook
)
5946 (when (and gnus-current-article
5947 (not (zerop gnus-current-article
)))
5948 (gnus-summary-goto-subject gnus-current-article
))
5949 (gnus-summary-recenter)
5950 (when (and gnus-use-trees gnus-show-threads
)
5951 (gnus-possibly-generate-tree article
)
5952 (gnus-highlight-selected-tree article
))
5953 ;; Successfully display article.
5954 (gnus-article-set-window-start
5955 (cdr (assq article gnus-newsgroup-bookmarks
))))))
5957 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
5958 "Select the current article.
5959 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5960 non-nil, the article will be re-fetched even if it already present in
5961 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5963 ;; Make sure we are in the summary buffer to work around bbdb bug.
5964 (unless (eq major-mode
'gnus-summary-mode
)
5965 (set-buffer gnus-summary-buffer
))
5966 (let ((article (or article
(gnus-summary-article-number)))
5967 (all-headers (not (not all-headers
))) ;Must be T or NIL.
5968 gnus-summary-display-article-function
)
5970 (gnus-summary-article-pseudo-p article
)
5971 (error "This is a pseudo-article"))
5973 (set-buffer gnus-summary-buffer
)
5974 (if (or (and gnus-single-article-buffer
5975 (or (null gnus-current-article
)
5976 (null gnus-article-current
)
5977 (null (get-buffer gnus-article-buffer
))
5978 (not (eq article
(cdr gnus-article-current
)))
5979 (not (equal (car gnus-article-current
)
5980 gnus-newsgroup-name
))))
5981 (and (not gnus-single-article-buffer
)
5982 (or (null gnus-current-article
)
5983 (not (eq gnus-current-article article
))))
5985 ;; The requested article is different from the current article.
5987 (gnus-summary-display-article article all-headers
)
5988 (when (gnus-buffer-live-p gnus-article-buffer
)
5989 (with-current-buffer gnus-article-buffer
5990 (if (not gnus-article-decoded-p
) ;; a local variable
5991 (mm-disable-multibyte-mule4))))
5992 (when (or all-headers gnus-show-all-headers
)
5993 (gnus-article-show-all-headers))
5994 (gnus-article-set-window-start
5995 (cdr (assq article gnus-newsgroup-bookmarks
)))
5997 (when (or all-headers gnus-show-all-headers
)
5998 (gnus-article-show-all-headers))
6001 (defun gnus-summary-set-current-mark (&optional current-mark
)
6002 "Obsolete function."
6005 (defun gnus-summary-next-article (&optional unread subject backward push
)
6006 "Select the next article.
6007 If UNREAD, only unread articles are selected.
6008 If SUBJECT, only articles with SUBJECT are selected.
6009 If BACKWARD, the previous article is selected instead of the next."
6012 ;; Is there such an article?
6013 ((and (gnus-summary-search-forward unread subject backward
)
6014 (or (gnus-summary-display-article (gnus-summary-article-number))
6015 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
6016 (gnus-summary-position-point))
6017 ;; If not, we try the first unread, if that is wanted.
6019 gnus-auto-select-same
6020 (gnus-summary-first-unread-article))
6021 (gnus-summary-position-point)
6022 (gnus-message 6 "Wrapped"))
6023 ;; Try to get next/previous article not displayed in this group.
6024 ((and gnus-auto-extend-newsgroup
6025 (not unread
) (not subject
))
6026 (gnus-summary-goto-article
6027 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
6028 nil
(count-lines (point-min) (point))))
6029 ;; Go to next/previous group.
6031 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
6032 (gnus-summary-jump-to-group gnus-newsgroup-name
))
6033 (let ((cmd last-command-char
)
6036 (set-buffer gnus-group-buffer
)
6039 (if (eq gnus-keep-same-level
'best
)
6040 (gnus-summary-best-group gnus-newsgroup-name
)
6041 (gnus-summary-search-group backward gnus-keep-same-level
))))
6042 ;; For some reason, the group window gets selected. We change
6044 (select-window (get-buffer-window (current-buffer)))
6045 ;; Select next unread newsgroup automagically.
6047 ((or (not gnus-auto-select-next
)
6049 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
6050 ((or (eq gnus-auto-select-next
'quietly
)
6051 (and (eq gnus-auto-select-next
'slightly-quietly
)
6053 (and (eq gnus-auto-select-next
'almost-quietly
)
6054 (gnus-summary-last-article-p)))
6056 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
6058 (gnus-message 7 "No more%s articles (%s)..."
6059 (if unread
" unread" "")
6060 (if group
(concat "selecting " group
)
6062 (gnus-summary-next-group nil group backward
)))
6064 (when (gnus-key-press-event-p last-input-event
)
6065 (gnus-summary-walk-group-buffer
6066 gnus-newsgroup-name cmd unread backward point
))))))))
6068 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
6069 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
6070 (?\C-p
(gnus-group-prev-unread-group 1))))
6071 (cursor-in-echo-area t
)
6072 keve key group ended
)
6074 (set-buffer gnus-group-buffer
)
6077 (if (eq gnus-keep-same-level
'best
)
6078 (gnus-summary-best-group gnus-newsgroup-name
)
6079 (gnus-summary-search-group backward gnus-keep-same-level
))))
6082 5 "No more%s articles%s" (if unread
" unread" "")
6084 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
6085 (format " (Type %s for %s [%s])"
6086 (single-key-description cmd
) group
6087 (car (gnus-gethash group gnus-newsrc-hashtb
)))
6088 (format " (Type %s to exit %s)"
6089 (single-key-description cmd
)
6090 gnus-newsgroup-name
)))
6091 ;; Confirm auto selection.
6092 (setq key
(car (setq keve
(gnus-read-event-char))))
6095 ((assq key keystrokes
)
6096 (let ((obuf (current-buffer)))
6097 (switch-to-buffer gnus-group-buffer
)
6099 (gnus-group-jump-to-group group
))
6100 (eval (cadr (assq key keystrokes
)))
6101 (setq group
(gnus-group-group-name))
6102 (switch-to-buffer obuf
))
6106 (gnus-ephemeral-group-p gnus-newsgroup-name
))
6108 (gnus-summary-next-group nil group backward
)))
6110 (push (cdr keve
) unread-command-events
))))))
6112 (defun gnus-summary-next-unread-article ()
6113 "Select unread article after current one."
6115 (gnus-summary-next-article
6116 (or (not (eq gnus-summary-goto-unread
'never
))
6117 (gnus-summary-last-article-p (gnus-summary-article-number)))
6118 (and gnus-auto-select-same
6119 (gnus-summary-article-subject))))
6121 (defun gnus-summary-prev-article (&optional unread subject
)
6122 "Select the article after the current one.
6123 If UNREAD is non-nil, only unread articles are selected."
6125 (gnus-summary-next-article unread subject t
))
6127 (defun gnus-summary-prev-unread-article ()
6128 "Select unread article before current one."
6130 (gnus-summary-prev-article
6131 (or (not (eq gnus-summary-goto-unread
'never
))
6132 (gnus-summary-first-article-p (gnus-summary-article-number)))
6133 (and gnus-auto-select-same
6134 (gnus-summary-article-subject))))
6136 (defun gnus-summary-next-page (&optional lines circular
)
6137 "Show next page of the selected article.
6138 If at the end of the current article, select the next article.
6139 LINES says how many lines should be scrolled up.
6141 If CIRCULAR is non-nil, go to the start of the article instead of
6142 selecting the next article when reaching the end of the current
6145 (setq gnus-summary-buffer
(current-buffer))
6146 (gnus-set-global-variables)
6147 (let ((article (gnus-summary-article-number))
6148 (article-window (get-buffer-window gnus-article-buffer t
))
6150 ;; If the buffer is empty, we have no article.
6152 (error "No article to select"))
6153 (gnus-configure-windows 'article
)
6154 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
6155 (if (and (eq gnus-summary-goto-unread
'never
)
6156 (not (gnus-summary-last-article-p article
)))
6157 (gnus-summary-next-article)
6158 (gnus-summary-next-unread-article))
6159 (if (or (null gnus-current-article
)
6160 (null gnus-article-current
)
6161 (/= article
(cdr gnus-article-current
))
6162 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6163 ;; Selected subject is different from current article's.
6164 (gnus-summary-display-article article
)
6165 (when article-window
6166 (gnus-eval-in-buffer-window gnus-article-buffer
6167 (setq endp
(gnus-article-next-page lines
)))
6170 (gnus-summary-beginning-of-article))
6172 (gnus-message 3 "End of message"))
6174 (if (and (eq gnus-summary-goto-unread
'never
)
6175 (not (gnus-summary-last-article-p article
)))
6176 (gnus-summary-next-article)
6177 (gnus-summary-next-unread-article))))))))
6178 (gnus-summary-recenter)
6179 (gnus-summary-position-point)))
6181 (defun gnus-summary-prev-page (&optional lines move
)
6182 "Show previous page of selected article.
6183 Argument LINES specifies lines to be scrolled down.
6184 If MOVE, move to the previous unread article if point is at
6185 the beginning of the buffer."
6187 (let ((article (gnus-summary-article-number))
6188 (article-window (get-buffer-window gnus-article-buffer t
))
6190 (gnus-configure-windows 'article
)
6191 (if (or (null gnus-current-article
)
6192 (null gnus-article-current
)
6193 (/= article
(cdr gnus-article-current
))
6194 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6195 ;; Selected subject is different from current article's.
6196 (gnus-summary-display-article article
)
6197 (gnus-summary-recenter)
6198 (when article-window
6199 (gnus-eval-in-buffer-window gnus-article-buffer
6200 (setq endp
(gnus-article-prev-page lines
)))
6201 (when (and move endp
)
6203 (gnus-message 3 "Beginning of message"))
6205 (if (and (eq gnus-summary-goto-unread
'never
)
6206 (not (gnus-summary-first-article-p article
)))
6207 (gnus-summary-prev-article)
6208 (gnus-summary-prev-unread-article))))))))
6209 (gnus-summary-position-point))
6211 (defun gnus-summary-prev-page-or-article (&optional lines
)
6212 "Show previous page of selected article.
6213 Argument LINES specifies lines to be scrolled down.
6214 If at the beginning of the article, go to the next article."
6216 (gnus-summary-prev-page lines t
))
6218 (defun gnus-summary-scroll-up (lines)
6219 "Scroll up (or down) one line current article.
6220 Argument LINES specifies lines to be scrolled up (or down if negative)."
6222 (gnus-configure-windows 'article
)
6223 (gnus-summary-show-thread)
6224 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
6225 (gnus-eval-in-buffer-window gnus-article-buffer
6227 (when (gnus-article-next-page lines
)
6228 (gnus-message 3 "End of message")))
6230 (gnus-article-prev-page (- lines
))))))
6231 (gnus-summary-recenter)
6232 (gnus-summary-position-point))
6234 (defun gnus-summary-scroll-down (lines)
6235 "Scroll down (or up) one line current article.
6236 Argument LINES specifies lines to be scrolled down (or up if negative)."
6238 (gnus-summary-scroll-up (- lines
)))
6240 (defun gnus-summary-next-same-subject ()
6241 "Select next article which has the same subject as current one."
6243 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
6245 (defun gnus-summary-prev-same-subject ()
6246 "Select previous article which has the same subject as current one."
6248 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
6250 (defun gnus-summary-next-unread-same-subject ()
6251 "Select next unread article which has the same subject as current one."
6253 (gnus-summary-next-article t
(gnus-summary-article-subject)))
6255 (defun gnus-summary-prev-unread-same-subject ()
6256 "Select previous unread article which has the same subject as current one."
6258 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
6260 (defun gnus-summary-first-unread-article ()
6261 "Select the first unread article.
6262 Return nil if there are no unread articles."
6265 (when (gnus-summary-first-subject t
)
6266 (gnus-summary-show-thread)
6267 (gnus-summary-first-subject t
)
6268 (gnus-summary-display-article (gnus-summary-article-number)))
6269 (gnus-summary-position-point)))
6271 (defun gnus-summary-first-unread-subject ()
6272 "Place the point on the subject line of the first unread article.
6273 Return nil if there are no unread articles."
6276 (when (gnus-summary-first-subject t
)
6277 (gnus-summary-show-thread)
6278 (gnus-summary-first-subject t
))
6279 (gnus-summary-position-point)))
6281 (defun gnus-summary-first-article ()
6282 "Select the first article.
6283 Return nil if there are no articles."
6286 (when (gnus-summary-first-subject)
6287 (gnus-summary-show-thread)
6288 (gnus-summary-first-subject)
6289 (gnus-summary-display-article (gnus-summary-article-number)))
6290 (gnus-summary-position-point)))
6292 (defun gnus-summary-best-unread-article ()
6293 "Select the unread article with the highest score."
6295 (let ((best -
1000000)
6296 (data gnus-newsgroup-data
)
6299 (and (gnus-data-unread-p (car data
))
6301 (gnus-summary-article-score (gnus-data-number (car data
))))
6304 article
(gnus-data-number (car data
))))
6305 (setq data
(cdr data
)))
6308 (gnus-summary-goto-article article
)
6309 (error "No unread articles"))
6310 (gnus-summary-position-point))))
6312 (defun gnus-summary-last-subject ()
6313 "Go to the last displayed subject line in the group."
6314 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
6316 (gnus-summary-goto-subject article
))))
6318 (defun gnus-summary-goto-article (article &optional all-headers force
)
6319 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6320 If ALL-HEADERS is non-nil, no header lines are hidden.
6321 If FORCE, go to the article even if it isn't displayed. If FORCE
6322 is a number, it is the line the article is to be displayed on."
6326 "Article number or Message-ID: "
6327 (mapcar (lambda (number) (list (int-to-string number
)))
6328 gnus-newsgroup-limit
))
6332 (if (and (stringp article
)
6333 (string-match "@" article
))
6334 (gnus-summary-refer-article article
)
6335 (when (stringp article
)
6336 (setq article
(string-to-number article
)))
6337 (if (gnus-summary-goto-subject article force
)
6338 (gnus-summary-display-article article all-headers
)
6339 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
6340 (gnus-summary-position-point)))
6342 (defun gnus-summary-goto-last-article ()
6343 "Go to the previously read article."
6346 (when gnus-last-article
6347 (gnus-summary-goto-article gnus-last-article nil t
))
6348 (gnus-summary-position-point)))
6350 (defun gnus-summary-pop-article (number)
6351 "Pop one article off the history and go to the previous.
6352 NUMBER articles will be popped off."
6355 (setq gnus-newsgroup-history
6356 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
6358 (gnus-summary-goto-article (car to
) nil t
)
6359 (error "Article history empty")))
6360 (gnus-summary-position-point))
6362 ;; Summary commands and functions for limiting the summary buffer.
6364 (defun gnus-summary-limit-to-articles (n)
6365 "Limit the summary buffer to the next N articles.
6366 If not given a prefix, use the process marked articles instead."
6369 (let ((articles (gnus-summary-work-articles n
)))
6370 (setq gnus-newsgroup-processable nil
)
6371 (gnus-summary-limit articles
))
6372 (gnus-summary-position-point)))
6374 (defun gnus-summary-pop-limit (&optional total
)
6375 "Restore the previous limit.
6376 If given a prefix, remove all limits."
6379 (setq gnus-newsgroup-limits
6380 (list (mapcar (lambda (h) (mail-header-number h
))
6381 gnus-newsgroup-headers
))))
6382 (unless gnus-newsgroup-limits
6383 (error "No limit to pop"))
6385 (gnus-summary-limit nil
'pop
)
6386 (gnus-summary-position-point)))
6388 (defun gnus-summary-limit-to-subject (subject &optional header
)
6389 "Limit the summary buffer to articles that have subjects that match a regexp."
6390 (interactive "sLimit to subject (regexp): ")
6392 (setq header
"subject"))
6393 (when (not (equal "" subject
))
6395 (let ((articles (gnus-summary-find-matching
6396 (or header
"subject") subject
'all
)))
6398 (error "Found no matches for \"%s\"" subject
))
6399 (gnus-summary-limit articles
))
6400 (gnus-summary-position-point))))
6402 (defun gnus-summary-limit-to-author (from)
6403 "Limit the summary buffer to articles that have authors that match a regexp."
6404 (interactive "sLimit to author (regexp): ")
6405 (gnus-summary-limit-to-subject from
"from"))
6407 (defun gnus-summary-limit-to-age (age &optional younger-p
)
6408 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6409 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6410 articles that are younger than AGE days."
6412 (let ((younger current-prefix-arg
)
6415 (while (not days-got
)
6416 (setq days
(if younger
6417 (read-string "Limit to articles within (in days): ")
6418 (read-string "Limit to articles old than (in days): ")))
6419 (when (> (length days
) 0)
6420 (setq days
(read days
)))
6423 (message "Please enter a number.")
6425 (list days younger
)))
6427 (let ((data gnus-newsgroup-data
)
6428 (cutoff (days-to-time age
))
6429 articles d date is-younger
)
6430 (while (setq d
(pop data
))
6431 (when (and (vectorp (gnus-data-header d
))
6432 (setq date
(mail-header-date (gnus-data-header d
))))
6433 (setq is-younger
(time-less-p
6434 (time-since (condition-case ()
6441 (push (gnus-data-number d
) articles
))))
6442 (gnus-summary-limit (nreverse articles
)))
6443 (gnus-summary-position-point)))
6445 (defun gnus-summary-limit-to-extra (header regexp
)
6446 "Limit the summary buffer to articles that match an 'extra' header."
6450 (gnus-completing-read
6451 (symbol-name (car gnus-extra-headers
))
6452 "Limit extra header:"
6454 (cons (symbol-name x
) x
))
6459 (read-string (format "Limit to header %s (regexp): " header
)))))
6460 (when (not (equal "" regexp
))
6462 (let ((articles (gnus-summary-find-matching
6463 (cons 'extra header
) regexp
'all
)))
6465 (error "Found no matches for \"%s\"" regexp
))
6466 (gnus-summary-limit articles
))
6467 (gnus-summary-position-point))))
6469 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6471 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6473 (defun gnus-summary-limit-to-unread (&optional all
)
6474 "Limit the summary buffer to articles that are not marked as read.
6475 If ALL is non-nil, limit strictly to unread articles."
6478 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
6479 (gnus-summary-limit-to-marks
6480 ;; Concat all the marks that say that an article is read and have
6482 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6483 gnus-killed-mark gnus-kill-file-mark
6484 gnus-low-score-mark gnus-expirable-mark
6485 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6486 gnus-duplicate-mark gnus-souped-mark
)
6489 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
6490 (make-obsolete 'gnus-summary-delete-marked-with
6491 'gnus-summary-limit-exlude-marks
)
6493 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
6494 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6495 If REVERSE, limit the summary buffer to articles that are marked
6496 with MARKS. MARKS can either be a string of marks or a list of marks.
6497 Returns how many articles were removed."
6498 (interactive "sMarks: ")
6499 (gnus-summary-limit-to-marks marks t
))
6501 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
6502 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6503 If REVERSE (the prefix), limit the summary buffer to articles that are
6504 not marked with MARKS. MARKS can either be a string of marks or a
6506 Returns how many articles were removed."
6507 (interactive "sMarks: \nP")
6509 (let ((data gnus-newsgroup-data
)
6510 (marks (if (listp marks
) marks
6511 (append marks nil
))) ; Transform to list.
6514 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
6515 (memq (gnus-data-mark (car data
)) marks
))
6516 (push (gnus-data-number (car data
)) articles
))
6517 (setq data
(cdr data
)))
6518 (gnus-summary-limit articles
))
6519 (gnus-summary-position-point)))
6521 (defun gnus-summary-limit-to-score (&optional score
)
6522 "Limit to articles with score at or above SCORE."
6524 (setq score
(if score
6525 (prefix-numeric-value score
)
6526 (or gnus-summary-default-score
0)))
6527 (let ((data gnus-newsgroup-data
)
6530 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
6532 (push (gnus-data-number (car data
)) articles
))
6533 (setq data
(cdr data
)))
6535 (gnus-summary-limit articles
)
6536 (gnus-summary-position-point))))
6538 (defun gnus-summary-limit-include-thread (id)
6539 "Display all the hidden articles that in the current thread."
6540 (interactive (list (mail-header-id (gnus-summary-article-header))))
6541 (let ((articles (gnus-articles-in-thread
6542 (gnus-id-to-thread (gnus-root-id id
)))))
6544 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
6545 (gnus-summary-position-point))))
6547 (defun gnus-summary-limit-include-dormant ()
6548 "Display all the hidden articles that are marked as dormant.
6549 Note that this command only works on a subset of the articles currently
6550 fetched for this group."
6552 (unless gnus-newsgroup-dormant
6553 (error "There are no dormant articles in this group"))
6555 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
6556 (gnus-summary-position-point)))
6558 (defun gnus-summary-limit-exclude-dormant ()
6559 "Hide all dormant articles."
6562 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
6563 (gnus-summary-position-point)))
6565 (defun gnus-summary-limit-exclude-childless-dormant ()
6566 "Hide all dormant articles that have no children."
6568 (let ((data (gnus-data-list t
))
6569 articles d children
)
6570 ;; Find all articles that are either not dormant or have
6572 (while (setq d
(pop data
))
6573 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
6575 (gnus-article-children (gnus-data-number d
)))
6578 (when (memq (car children
) articles
)
6583 (push (gnus-data-number d
) articles
)))
6586 (gnus-summary-limit articles
)
6587 (gnus-summary-position-point))))
6589 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
6590 "Mark all unread excluded articles as read.
6591 If ALL, mark even excluded ticked and dormants as read."
6593 (let ((articles (gnus-sorted-complement
6595 (mapcar (lambda (h) (mail-header-number h
))
6596 gnus-newsgroup-headers
)
6598 (sort gnus-newsgroup-limit
'<)))
6600 (setq gnus-newsgroup-unreads
6601 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit
))
6603 (setq gnus-newsgroup-dormant nil
6604 gnus-newsgroup-marked nil
6605 gnus-newsgroup-reads
6607 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
6608 gnus-newsgroup-reads
))
6609 (while (setq article
(pop articles
))
6610 (unless (or (memq article gnus-newsgroup-dormant
)
6611 (memq article gnus-newsgroup-marked
))
6612 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
6614 (defun gnus-summary-limit (articles &optional pop
)
6616 ;; We pop the previous limit off the stack and use that.
6617 (setq articles
(car gnus-newsgroup-limits
)
6618 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
6619 ;; We use the new limit, so we push the old limit on the stack.
6620 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
6622 (setq gnus-newsgroup-limit articles
)
6623 (let ((total (length gnus-newsgroup-data
))
6624 (data (gnus-data-find-list (gnus-summary-article-number)))
6625 (gnus-summary-mark-below nil
) ; Inhibit this.
6627 ;; This will do all the work of generating the new summary buffer
6628 ;; according to the new limit.
6629 (gnus-summary-prepare)
6630 ;; Hide any threads, possibly.
6631 (and gnus-show-threads
6632 gnus-thread-hide-subtree
6633 (gnus-summary-hide-all-threads))
6634 ;; Try to return to the article you were at, or one in the
6637 ;; We try to find some article after the current one.
6639 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
6642 (setq data
(cdr data
))))
6644 ;; If there is no data, that means that we were after the last
6645 ;; article. The same goes when we can't find any articles
6646 ;; after the current one.
6647 (goto-char (point-max))
6648 (gnus-summary-find-prev))
6649 (gnus-set-mode-line 'summary
)
6650 ;; We return how many articles were removed from the summary
6651 ;; buffer as a result of the new limit.
6652 (- total
(length gnus-newsgroup-data
))))
6654 (defsubst gnus-invisible-cut-children
(threads)
6657 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
6662 (defsubst gnus-cut-thread
(thread)
6663 "Go forwards in the thread until we find an article that we want to display."
6664 (when (or (eq gnus-fetch-old-headers
'some
)
6665 (eq gnus-fetch-old-headers
'invisible
)
6666 (numberp gnus-fetch-old-headers
)
6667 (eq gnus-build-sparse-threads
'some
)
6668 (eq gnus-build-sparse-threads
'more
))
6669 ;; Deal with old-fetched headers and sparse threads.
6673 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
6674 (gnus-summary-article-ancient-p
6675 (mail-header-number (car thread
))))
6676 (if (or (<= (length (cdr thread
)) 1)
6677 (eq gnus-fetch-old-headers
'invisible
))
6678 (setq gnus-newsgroup-limit
6679 (delq (mail-header-number (car thread
))
6680 gnus-newsgroup-limit
)
6681 thread
(cadr thread
))
6682 (when (gnus-invisible-cut-children (cdr thread
))
6683 (let ((th (cdr thread
)))
6685 (if (memq (mail-header-number (caar th
))
6686 gnus-newsgroup-limit
)
6687 (setq thread
(car th
)
6689 (setq th
(cdr th
))))))))))
6692 (defun gnus-cut-threads (threads)
6693 "Cut off all uninteresting articles from the beginning of threads."
6694 (when (or (eq gnus-fetch-old-headers
'some
)
6695 (eq gnus-fetch-old-headers
'invisible
)
6696 (numberp gnus-fetch-old-headers
)
6697 (eq gnus-build-sparse-threads
'some
)
6698 (eq gnus-build-sparse-threads
'more
))
6701 (setcar th
(gnus-cut-thread (car th
)))
6702 (setq th
(cdr th
)))))
6703 ;; Remove nixed out threads.
6706 (defun gnus-summary-initial-limit (&optional show-if-empty
)
6707 "Figure out what the initial limit is supposed to be on group entry.
6708 This entails weeding out unwanted dormants, low-scored articles,
6709 fetch-old-headers verbiage, and so on."
6710 ;; Most groups have nothing to remove.
6711 (if (or gnus-inhibit-limiting
6712 (and (null gnus-newsgroup-dormant
)
6713 (not (eq gnus-fetch-old-headers
'some
))
6714 (not (numberp gnus-fetch-old-headers
))
6715 (not (eq gnus-fetch-old-headers
'invisible
))
6716 (null gnus-summary-expunge-below
)
6717 (not (eq gnus-build-sparse-threads
'some
))
6718 (not (eq gnus-build-sparse-threads
'more
))
6719 (null gnus-thread-expunge-below
)
6720 (not gnus-use-nocem
)))
6722 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
6723 (setq gnus-newsgroup-limit nil
)
6726 (unless (car (symbol-value node
))
6727 ;; These threads have no parents -- they are roots.
6728 (let ((nodes (cdr (symbol-value node
)))
6731 (if (and gnus-thread-expunge-below
6732 (< (gnus-thread-total-score (car nodes
))
6733 gnus-thread-expunge-below
))
6734 (gnus-expunge-thread (pop nodes
))
6735 (setq thread
(pop nodes
))
6736 (gnus-summary-limit-children thread
))))))
6737 gnus-newsgroup-dependencies
)
6738 ;; If this limitation resulted in an empty group, we might
6739 ;; pop the previous limit and use it instead.
6740 (when (and (not gnus-newsgroup-limit
)
6742 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
6743 gnus-newsgroup-limit
))
6745 (defun gnus-summary-limit-children (thread)
6746 "Return 1 if this subthread is visible and 0 if it is not."
6747 ;; First we get the number of visible children to this thread. This
6748 ;; is done by recursing down the thread using this function, so this
6749 ;; will really go down to a leaf article first, before slowly
6750 ;; working its way up towards the root.
6754 (apply '+ (mapcar 'gnus-summary-limit-children
6757 (number (mail-header-number (car thread
)))
6760 (not (memq number gnus-newsgroup-marked
))
6762 ;; If this article is dormant and has absolutely no visible
6763 ;; children, then this article isn't visible.
6764 (and (memq number gnus-newsgroup-dormant
)
6766 ;; If this is "fetch-old-headered" and there is no
6767 ;; visible children, then we don't want this article.
6768 (and (or (eq gnus-fetch-old-headers
'some
)
6769 (numberp gnus-fetch-old-headers
))
6770 (gnus-summary-article-ancient-p number
)
6772 ;; If this is "fetch-old-headered" and `invisible', then
6773 ;; we don't want this article.
6774 (and (eq gnus-fetch-old-headers
'invisible
)
6775 (gnus-summary-article-ancient-p number
))
6776 ;; If this is a sparsely inserted article with no children,
6777 ;; we don't want it.
6778 (and (eq gnus-build-sparse-threads
'some
)
6779 (gnus-summary-article-sparse-p number
)
6781 ;; If we use expunging, and this article is really
6782 ;; low-scored, then we don't want this article.
6783 (when (and gnus-summary-expunge-below
6785 (or (cdr (assq number gnus-newsgroup-scored
))
6786 gnus-summary-default-score
))
6787 gnus-summary-expunge-below
))
6788 ;; We increase the expunge-tally here, but that has
6789 ;; nothing to do with the limits, really.
6790 (incf gnus-newsgroup-expunged-tally
)
6791 ;; We also mark as read here, if that's wanted.
6792 (when (and gnus-summary-mark-below
6793 (< score gnus-summary-mark-below
))
6794 (setq gnus-newsgroup-unreads
6795 (delq number gnus-newsgroup-unreads
))
6796 (if gnus-newsgroup-auto-expire
6797 (push number gnus-newsgroup-expirable
)
6798 (push (cons number gnus-low-score-mark
)
6799 gnus-newsgroup-reads
)))
6801 ;; Check NoCeM things.
6802 (if (and gnus-use-nocem
6803 (gnus-nocem-unwanted-article-p
6804 (mail-header-id (car thread
))))
6806 (setq gnus-newsgroup-unreads
6807 (delq number gnus-newsgroup-unreads
))
6809 ;; Nope, invisible article.
6811 ;; Ok, this article is to be visible, so we add it to the limit
6813 (push number gnus-newsgroup-limit
)
6816 (defun gnus-expunge-thread (thread)
6817 "Mark all articles in THREAD as read."
6818 (let* ((number (mail-header-number (car thread
))))
6819 (incf gnus-newsgroup-expunged-tally
)
6820 ;; We also mark as read here, if that's wanted.
6821 (setq gnus-newsgroup-unreads
6822 (delq number gnus-newsgroup-unreads
))
6823 (if gnus-newsgroup-auto-expire
6824 (push number gnus-newsgroup-expirable
)
6825 (push (cons number gnus-low-score-mark
)
6826 gnus-newsgroup-reads
)))
6827 ;; Go recursively through all subthreads.
6828 (mapcar 'gnus-expunge-thread
(cdr thread
)))
6830 ;; Summary article oriented commands
6832 (defun gnus-summary-refer-parent-article (n)
6833 "Refer parent article N times.
6834 If N is negative, go to ancestor -N instead.
6835 The difference between N and the number of articles fetched is returned."
6839 (when (not (natnump n
))
6844 (setq header
(gnus-summary-article-header))
6845 (if (and (eq (mail-header-number header
)
6846 (cdr gnus-article-current
))
6847 (equal gnus-newsgroup-name
6848 (car gnus-article-current
)))
6849 ;; If we try to find the parent of the currently
6850 ;; displayed article, then we take a look at the actual
6851 ;; References header, since this is slightly more
6852 ;; reliable than the References field we got from the
6855 (set-buffer gnus-original-article-buffer
)
6856 (nnheader-narrow-to-headers)
6857 (unless (setq ref
(message-fetch-field "references"))
6858 (setq ref
(message-fetch-field "in-reply-to")))
6861 ;; It's not the current article, so we take a bet on
6862 ;; the value we got from the server.
6863 (mail-header-references header
)))
6865 (not (equal ref
"")))
6866 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
6867 (gnus-message 1 "Couldn't find parent"))
6868 (gnus-message 1 "No references in article %d"
6869 (gnus-summary-article-number))
6872 (gnus-summary-position-point)
6875 (defun gnus-summary-refer-references ()
6876 "Fetch all articles mentioned in the References header.
6877 Return the number of articles fetched."
6879 (let ((ref (mail-header-references (gnus-summary-article-header)))
6880 (current (gnus-summary-article-number))
6884 (error "No References in the current article")
6885 ;; For each Message-ID in the References header...
6886 (while (string-match "<[^>]*>" ref
)
6888 ;; ... fetch that article.
6889 (gnus-summary-refer-article
6890 (prog1 (match-string 0 ref
)
6891 (setq ref
(substring ref
(match-end 0))))))
6892 (gnus-summary-goto-subject current
)
6893 (gnus-summary-position-point)
6896 (defun gnus-summary-refer-thread (&optional limit
)
6897 "Fetch all articles in the current thread.
6898 If LIMIT (the numerical prefix), fetch that many old headers instead
6899 of what's specified by the `gnus-refer-thread-limit' variable."
6901 (let ((id (mail-header-id (gnus-summary-article-header)))
6902 (limit (if limit
(prefix-numeric-value limit
)
6903 gnus-refer-thread-limit
)))
6904 ;; We want to fetch LIMIT *old* headers, but we also have to
6905 ;; re-fetch all the headers in the current buffer, because many of
6906 ;; them may be undisplayed. So we adjust LIMIT.
6907 (when (numberp limit
)
6908 (incf limit
(- gnus-newsgroup-end gnus-newsgroup-begin
)))
6909 (unless (eq gnus-fetch-old-headers
'invisible
)
6910 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
6911 ;; Retrieve the headers and read them in.
6912 (if (eq (gnus-retrieve-headers
6913 (list gnus-newsgroup-end
) gnus-newsgroup-name limit
)
6915 (gnus-build-all-threads)
6916 (error "Can't fetch thread from backends that don't support NOV"))
6917 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
6918 (gnus-summary-limit-include-thread id
)))
6920 (defun gnus-summary-refer-article (message-id)
6921 "Fetch an article specified by MESSAGE-ID."
6922 (interactive "sMessage-ID: ")
6923 (when (and (stringp message-id
)
6924 (not (zerop (length message-id
))))
6925 ;; Construct the correct Message-ID if necessary.
6926 ;; Suggested by tale@pawl.rpi.edu.
6927 (unless (string-match "^<" message-id
)
6928 (setq message-id
(concat "<" message-id
)))
6929 (unless (string-match ">$" message-id
)
6930 (setq message-id
(concat message-id
">")))
6931 (let* ((header (gnus-id-to-header message-id
))
6933 (gnus-summary-article-sparse-p
6934 (mail-header-number header
))
6935 (memq (mail-header-number header
)
6936 gnus-newsgroup-limit
)))
6939 ;; If the article is present in the buffer we just go to it.
6941 (or (not (gnus-summary-article-sparse-p
6942 (mail-header-number header
)))
6945 (gnus-summary-goto-article
6946 (mail-header-number header
) nil t
)
6948 (gnus-summary-update-article (mail-header-number header
)))))
6950 ;; We fetch the article.
6952 (dolist (gnus-override-method (gnus-refer-article-methods))
6953 (gnus-check-server gnus-override-method
)
6954 ;; Fetch the header, and display the article.
6955 (when (setq number
(gnus-summary-insert-subject message-id
))
6956 (gnus-summary-select-article nil nil nil number
)
6958 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
6960 (defun gnus-refer-article-methods ()
6961 "Return a list of referrable methods."
6963 ;; No method, so we default to current and native.
6964 ((null gnus-refer-article-method
)
6965 (list gnus-current-select-method gnus-select-method
))
6967 ((eq 'current gnus-refer-article-method
)
6968 (list gnus-current-select-method
))
6969 ;; List of select methods.
6970 ((not (and (symbolp (car gnus-refer-article-method
))
6971 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
6973 (dolist (method gnus-refer-article-method
)
6974 (push (if (eq 'current method
)
6975 gnus-current-select-method
6979 ;; One single select method.
6981 (list gnus-refer-article-method
))))
6983 (defun gnus-summary-edit-parameters ()
6984 "Edit the group parameters of the current group."
6986 (gnus-group-edit-group gnus-newsgroup-name
'params
))
6988 (defun gnus-summary-customize-parameters ()
6989 "Customize the group parameters of the current group."
6991 (gnus-group-customize gnus-newsgroup-name
))
6993 (defun gnus-summary-enter-digest-group (&optional force
)
6994 "Enter an nndoc group based on the current article.
6995 If FORCE, force a digest interpretation. If not, try
6996 to guess what the document format is."
6998 (let ((conf gnus-current-window-configuration
))
7000 (gnus-summary-select-article))
7001 (setq gnus-current-window-configuration conf
)
7002 (let* ((name (format "%s-%d"
7003 (gnus-group-prefixed-name
7004 gnus-newsgroup-name
(list 'nndoc
""))
7006 (set-buffer gnus-summary-buffer
)
7007 gnus-current-article
)))
7008 (ogroup gnus-newsgroup-name
)
7009 (params (append (gnus-info-params (gnus-get-info ogroup
))
7010 (list (cons 'to-group ogroup
))
7011 (list (cons 'save-article-group ogroup
))))
7012 (case-fold-search t
)
7013 (buf (current-buffer))
7016 (set-buffer gnus-original-article-buffer
)
7017 ;; Have the digest group inherit the main mail address of
7018 ;; the parent article.
7019 (when (setq to-address
(or (message-fetch-field "reply-to")
7020 (message-fetch-field "from")))
7021 (setq params
(append
7022 (list (cons 'to-address
7023 (funcall gnus-decode-encoded-word-function
7025 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
7026 (insert-buffer-substring gnus-original-article-buffer
)
7027 ;; Remove lines that may lead nndoc to misinterpret the
7030 (goto-char (point-min))
7031 (or (search-forward "\n\n" nil t
) (point)))
7032 (goto-char (point-min))
7033 (delete-matching-lines "^Path:\\|^From ")
7036 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
7037 (gnus-newsgroup-ephemeral-ignored-charsets
7038 gnus-newsgroup-ignored-charsets
))
7039 (gnus-group-read-ephemeral-group
7040 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
7042 ,(if force
'mbox
'guess
))) t
))
7043 ;; Make all postings to this group go to the parent group.
7044 (nconc (gnus-info-params (gnus-get-info name
))
7046 ;; Couldn't select this doc group.
7047 (switch-to-buffer buf
)
7048 (gnus-set-global-variables)
7049 (gnus-configure-windows 'summary
)
7050 (gnus-message 3 "Article couldn't be entered?"))
7051 (kill-buffer dig
)))))
7053 (defun gnus-summary-read-document (n)
7054 "Open a new group based on the current article(s).
7055 This will allow you to read digests and other similar
7056 documents as newsgroups.
7057 Obeys the standard process/prefix convention."
7059 (let* ((articles (gnus-summary-work-articles n
))
7060 (ogroup gnus-newsgroup-name
)
7061 (params (append (gnus-info-params (gnus-get-info ogroup
))
7062 (list (cons 'to-group ogroup
))))
7063 article group egroup groups vgroup
)
7064 (while (setq article
(pop articles
))
7065 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
7066 (gnus-summary-remove-process-mark article
)
7067 (when (gnus-summary-display-article article
)
7070 (insert-buffer-substring gnus-original-article-buffer
)
7071 ;; Remove some headers that may lead nndoc to make
7073 (message-narrow-to-head)
7074 (goto-char (point-min))
7075 (delete-matching-lines "^\\(Path\\):\\|^From ")
7078 (gnus-group-read-ephemeral-group
7079 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
7080 (nndoc-article-type guess
))
7083 ;; Make all postings to this group go to the parent group.
7084 (nconc (gnus-info-params (gnus-get-info egroup
))
7086 (push egroup groups
))
7087 ;; Couldn't select this doc group.
7088 (gnus-error 3 "Article couldn't be entered"))))))
7089 ;; Now we have selected all the documents.
7092 (error "None of the articles could be interpreted as documents"))
7093 ((gnus-group-read-ephemeral-group
7094 (setq vgroup
(format
7095 "nnvirtual:%s-%s" gnus-newsgroup-name
7096 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7097 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
7099 (cons (current-buffer) 'summary
)))
7101 (error "Couldn't select virtual nndoc group")))))
7103 (defun gnus-summary-isearch-article (&optional regexp-p
)
7104 "Do incremental search forward on the current article.
7105 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7107 (gnus-summary-select-article)
7108 (gnus-configure-windows 'article
)
7109 (gnus-eval-in-buffer-window gnus-article-buffer
7112 (isearch-forward regexp-p
))))
7114 (defun gnus-summary-search-article-forward (regexp &optional backward
)
7115 "Search for an article containing REGEXP forward.
7116 If BACKWARD, search backward instead."
7119 (format "Search article %s (regexp%s): "
7120 (if current-prefix-arg
"backward" "forward")
7121 (if gnus-last-search-regexp
7122 (concat ", default " gnus-last-search-regexp
)
7124 current-prefix-arg
))
7125 (if (string-equal regexp
"")
7126 (setq regexp
(or gnus-last-search-regexp
""))
7127 (setq gnus-last-search-regexp regexp
))
7128 (if (gnus-summary-search-article regexp backward
)
7129 (gnus-summary-show-thread)
7130 (error "Search failed: \"%s\"" regexp
)))
7132 (defun gnus-summary-search-article-backward (regexp)
7133 "Search for an article containing REGEXP backward."
7136 (format "Search article backward (regexp%s): "
7137 (if gnus-last-search-regexp
7138 (concat ", default " gnus-last-search-regexp
)
7140 (gnus-summary-search-article-forward regexp
'backward
))
7142 (defun gnus-summary-search-article (regexp &optional backward
)
7143 "Search for an article containing REGEXP.
7144 Optional argument BACKWARD means do search for backward.
7145 `gnus-select-article-hook' is not called during the search."
7146 ;; We have to require this here to make sure that the following
7147 ;; dynamic binding isn't shadowed by autoloading.
7148 (require 'gnus-async
)
7150 (let ((gnus-select-article-hook nil
) ;Disable hook.
7151 (gnus-article-prepare-hook nil
)
7152 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
7153 (gnus-use-article-prefetch nil
)
7154 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
7155 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
7156 (sum (current-buffer))
7157 (gnus-display-mime-function nil
)
7160 (gnus-save-hidden-threads
7161 (gnus-summary-select-article)
7162 (set-buffer gnus-article-buffer
)
7163 (goto-char (window-point (get-buffer-window (current-buffer))))
7167 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
7169 (re-search-backward regexp nil t
)
7170 (re-search-forward regexp nil t
))
7171 ;; We found the regexp.
7176 (get-buffer-window (current-buffer))
7180 (get-buffer-window (current-buffer))
7183 (setq point
(point)))
7184 ;; We didn't find it, so we go to the next article.
7187 (while (eq found
'not
)
7188 (if (not (if backward
(gnus-summary-find-prev)
7189 (gnus-summary-find-next)))
7190 ;; No more articles.
7192 ;; Select the next article and adjust point.
7193 (unless (gnus-summary-article-sparse-p
7194 (gnus-summary-article-number))
7196 (gnus-summary-select-article)
7197 (set-buffer gnus-article-buffer
)
7199 (goto-char (if backward
(point-max) (point-min))))))))
7200 (gnus-message 7 ""))
7201 ;; Return whether we found the regexp.
7202 (when (eq found
'found
)
7204 (gnus-summary-show-thread)
7205 (gnus-summary-goto-subject gnus-current-article
)
7206 (gnus-summary-position-point)
7209 (defun gnus-summary-find-matching (header regexp
&optional backward unread
7211 "Return a list of all articles that match REGEXP on HEADER.
7212 The search stars on the current article and goes forwards unless
7213 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7214 If UNREAD is non-nil, only unread articles will
7215 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7216 in the comparisons."
7217 (let ((data (if (eq backward
'all
) gnus-newsgroup-data
7218 (gnus-data-find-list
7219 (gnus-summary-article-number) (gnus-data-list backward
))))
7220 (case-fold-search (not not-case-fold
))
7223 (if (eq (car header
) 'extra
)
7226 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
7228 (error "%s is an invalid header" header
))
7229 (unless (fboundp (intern (concat "mail-header-" header
)))
7230 (error "%s is not a valid header" header
))
7231 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
7234 (and (or (not unread
) ; We want all articles...
7235 (gnus-data-unread-p d
)) ; Or just unreads.
7236 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
7237 (string-match regexp
(funcall func
(gnus-data-header d
))) ; Match.
7238 (push (gnus-data-number d
) articles
)) ; Success!
7239 (setq data
(cdr data
)))
7240 (nreverse articles
)))
7242 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
7243 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7244 If HEADER is an empty string (or nil), the match is done on the entire
7245 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7247 (list (let ((completion-ignore-case t
))
7250 (mapcar (lambda (string) (list string
))
7251 '("Number" "Subject" "From" "Lines" "Date"
7252 "Message-ID" "Xref" "References" "Body"))
7253 nil
'require-match
))
7254 (read-string "Regexp: ")
7255 (read-key-sequence "Command: ")
7256 current-prefix-arg
))
7257 (when (equal header
"Body")
7259 ;; Hidden thread subtrees must be searched as well.
7260 (gnus-summary-show-all-threads)
7261 ;; We don't want to change current point nor window configuration.
7263 (save-window-excursion
7264 (gnus-message 6 "Executing %s..." (key-description command
))
7265 ;; We'd like to execute COMMAND interactively so as to give arguments.
7266 (gnus-execute header regexp
7267 `(call-interactively ',(key-binding command
))
7269 (gnus-message 6 "Executing %s...done" (key-description command
)))))
7271 (defun gnus-summary-beginning-of-article ()
7272 "Scroll the article back to the beginning."
7274 (gnus-summary-select-article)
7275 (gnus-configure-windows 'article
)
7276 (gnus-eval-in-buffer-window gnus-article-buffer
7278 (goto-char (point-min))
7279 (when gnus-page-broken
7280 (gnus-narrow-to-page))))
7282 (defun gnus-summary-end-of-article ()
7283 "Scroll to the end of the article."
7285 (gnus-summary-select-article)
7286 (gnus-configure-windows 'article
)
7287 (gnus-eval-in-buffer-window gnus-article-buffer
7289 (goto-char (point-max))
7291 (when gnus-page-broken
7292 (gnus-narrow-to-page))))
7294 (defun gnus-summary-print-article (&optional filename n
)
7295 "Generate and print a PostScript image of the N next (mail) articles.
7297 If N is negative, print the N previous articles. If N is nil and articles
7298 have been marked with the process mark, print these instead.
7300 If the optional first argument FILENAME is nil, send the image to the
7301 printer. If FILENAME is a string, save the PostScript image in a file with
7302 that name. If FILENAME is a number, prompt the user for the name of the file
7304 (interactive (list (ps-print-preprint current-prefix-arg
)
7305 current-prefix-arg
))
7306 (dolist (article (gnus-summary-work-articles n
))
7307 (gnus-summary-select-article nil nil
'pseudo article
)
7308 (gnus-eval-in-buffer-window gnus-article-buffer
7309 (let ((buffer (generate-new-buffer " *print*")))
7312 (copy-to-buffer buffer
(point-min) (point-max))
7314 (gnus-article-delete-invisible-text)
7315 (let ((ps-left-header
7318 (mail-header-subject gnus-current-headers
) ")")
7320 (mail-header-from gnus-current-headers
) ")")))
7323 "/pagenumberstring load"
7325 (mail-header-date gnus-current-headers
) ")"))))
7326 (gnus-run-hooks 'gnus-ps-print-hook
)
7328 (ps-print-buffer-with-faces filename
))))
7329 (kill-buffer buffer
))))))
7331 (defun gnus-summary-show-article (&optional arg
)
7332 "Force re-fetching of the current article.
7333 If ARG (the prefix) is a number, show the article with the charset
7334 defined in `gnus-summary-show-article-charset-alist', or the charset
7336 If ARG (the prefix) is non-nil and not a number, show the raw article
7337 without any article massaging functions being run."
7341 (let ((gnus-newsgroup-charset
7342 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
7343 (read-coding-system "Charset: ")))
7344 (gnus-newsgroup-ignored-charsets 'gnus-all
))
7345 (gnus-summary-select-article nil
'force
)))
7347 ;; Select the article the normal way.
7348 (gnus-summary-select-article nil
'force
))
7350 ;; We have to require this here to make sure that the following
7351 ;; dynamic binding isn't shadowed by autoloading.
7352 (require 'gnus-async
)
7354 ;; Bind the article treatment functions to nil.
7355 (let ((gnus-have-all-headers t
)
7356 gnus-article-prepare-hook
7357 gnus-article-decode-hook
7358 gnus-display-mime-function
7360 ;; Destroy any MIME parts.
7361 (when (gnus-buffer-live-p gnus-article-buffer
)
7363 (set-buffer gnus-article-buffer
)
7364 (mm-destroy-parts gnus-article-mime-handles
)
7365 ;; Set it to nil for safety reason.
7366 (setq gnus-article-mime-handle-alist nil
)
7367 (setq gnus-article-mime-handles nil
)))
7368 (gnus-summary-select-article nil
'force
))))
7369 (gnus-summary-goto-subject gnus-current-article
)
7370 (gnus-summary-position-point))
7372 (defun gnus-summary-verbose-headers (&optional arg
)
7373 "Toggle permanent full header display.
7374 If ARG is a positive number, turn header display on.
7375 If ARG is a negative number, turn header display off."
7377 (setq gnus-show-all-headers
7378 (cond ((or (not (numberp arg
))
7380 (not gnus-show-all-headers
))
7383 (gnus-summary-show-article))
7385 (defun gnus-summary-toggle-header (&optional arg
)
7386 "Show the headers if they are hidden, or hide them if they are shown.
7387 If ARG is a positive number, show the entire header.
7388 If ARG is a negative number, hide the unwanted header lines."
7391 (set-buffer gnus-article-buffer
)
7393 (let* ((buffer-read-only nil
)
7394 (inhibit-point-motion-hooks t
)
7400 (article-narrow-to-head)
7401 (gnus-article-hidden-text-p 'headers
))))
7402 (goto-char (point-min))
7403 (when (search-forward "\n\n" nil t
)
7404 (delete-region (point-min) (1- (point))))
7405 (goto-char (point-min))
7407 (set-buffer gnus-original-article-buffer
)
7408 (goto-char (point-min))
7409 (setq e
(1- (or (search-forward "\n\n" nil t
) (point-max)))))
7410 (insert-buffer-substring gnus-original-article-buffer
1 e
)
7412 (narrow-to-region (point-min) (point))
7413 (article-decode-encoded-words)
7415 (let ((gnus-treat-hide-headers nil
)
7416 (gnus-treat-hide-boring-headers nil
))
7417 (setq gnus-article-wash-types
7418 (delq 'headers gnus-article-wash-types
))
7419 (gnus-treat-article 'head
))
7420 (gnus-treat-article 'head
)))
7421 (gnus-set-mode-line 'article
)))))
7423 (defun gnus-summary-show-all-headers ()
7424 "Make all header lines visible."
7426 (gnus-article-show-all-headers))
7428 (defun gnus-summary-caesar-message (&optional arg
)
7429 "Caesar rotate the current article by 13.
7430 The numerical prefix specifies how many places to rotate each letter
7433 (gnus-summary-select-article)
7434 (let ((mail-header-separator ""))
7435 (gnus-eval-in-buffer-window gnus-article-buffer
7438 (let ((start (window-start))
7440 (message-caesar-buffer-body arg
)
7441 (set-window-start (get-buffer-window (current-buffer)) start
))))))
7443 (defun gnus-summary-stop-page-breaking ()
7444 "Stop page breaking in the current article."
7446 (gnus-summary-select-article)
7447 (gnus-eval-in-buffer-window gnus-article-buffer
7449 (when (gnus-visual-p 'page-marker
)
7450 (let ((buffer-read-only nil
))
7451 (gnus-remove-text-with-property 'gnus-prev
)
7452 (gnus-remove-text-with-property 'gnus-next
))
7453 (setq gnus-page-broken nil
))))
7455 (defun gnus-summary-move-article (&optional n to-newsgroup
7456 select-method action
)
7457 "Move the current article to a different newsgroup.
7458 If N is a positive number, move the N next articles.
7459 If N is a negative number, move the N previous articles.
7460 If N is nil and any articles have been marked with the process mark,
7461 move those articles instead.
7462 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7463 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7464 re-spool using this method.
7466 For this function to work, both the current newsgroup and the
7467 newsgroup that you want to move to have to support the `request-move'
7468 and `request-accept' functions.
7470 ACTION can be either `move' (the default), `crosspost' or `copy'."
7473 (setq action
'move
))
7474 ;; Disable marking as read.
7475 (let (gnus-mark-article-hook)
7476 (save-window-excursion
7477 (gnus-summary-select-article)))
7478 ;; Check whether the source group supports the required functions.
7479 (cond ((and (eq action
'move
)
7480 (not (gnus-check-backend-function
7481 'request-move-article gnus-newsgroup-name
)))
7482 (error "The current group does not support article moving"))
7483 ((and (eq action
'crosspost
)
7484 (not (gnus-check-backend-function
7485 'request-replace-article gnus-newsgroup-name
)))
7486 (error "The current group does not support article editing")))
7487 (let ((articles (gnus-summary-work-articles n
))
7488 (prefix (if (gnus-check-backend-function
7489 'request-move-article gnus-newsgroup-name
)
7490 (gnus-group-real-prefix gnus-newsgroup-name
)
7492 (names '((move "Move" "Moving")
7493 (copy "Copy" "Copying")
7494 (crosspost "Crosspost" "Crossposting")))
7495 (copy-buf (save-excursion
7496 (nnheader-set-temp-buffer " *copy article*")))
7497 art-group to-method new-xref article to-groups
)
7498 (unless (assq action names
)
7499 (error "Unknown action %s" action
))
7500 ;; Read the newsgroup name.
7501 (when (and (not to-newsgroup
)
7502 (not select-method
))
7504 (gnus-read-move-group-name
7505 (cadr (assq action names
))
7506 (symbol-value (intern (format "gnus-current-%s-group" action
)))
7508 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
7509 (setq to-method
(or select-method
7510 (gnus-server-to-method
7511 (gnus-group-method to-newsgroup
))))
7512 ;; Check the method we are to move this article to...
7513 (unless (gnus-check-backend-function
7514 'request-accept-article
(car to-method
))
7515 (error "%s does not support article copying" (car to-method
)))
7516 (unless (gnus-check-server to-method
)
7517 (error "Can't open server %s" (car to-method
)))
7518 (gnus-message 6 "%s to %s: %s..."
7519 (caddr (assq action names
))
7520 (or (car select-method
) to-newsgroup
) articles
)
7522 (setq article
(pop articles
))
7526 ;; Move the article.
7528 ;; Remove this article from future suppression.
7529 (gnus-dup-unsuppress-article article
)
7530 (gnus-request-move-article
7531 article
; Article to move
7532 gnus-newsgroup-name
; From newsgroup
7533 (nth 1 (gnus-find-method-for-group
7534 gnus-newsgroup-name
)) ; Server
7535 (list 'gnus-request-accept-article
7536 to-newsgroup
(list 'quote select-method
)
7537 (not articles
) t
) ; Accept form
7538 (not articles
))) ; Only save nov last time
7539 ;; Copy the article.
7542 (set-buffer copy-buf
)
7543 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7544 (gnus-request-accept-article
7545 to-newsgroup select-method
(not articles
) t
))))
7546 ;; Crosspost the article.
7547 ((eq action
'crosspost
)
7548 (let ((xref (message-tokenize-header
7549 (mail-header-xref (gnus-summary-article-header article
))
7551 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
7554 (setq xref
(list (system-name))))
7557 (mapconcat 'identity
7558 (delete "Xref:" (delete new-xref xref
))
7562 (set-buffer copy-buf
)
7563 ;; First put the article in the destination group.
7564 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7565 (when (consp (setq art-group
7566 (gnus-request-accept-article
7567 to-newsgroup select-method
(not articles
))))
7568 (setq new-xref
(concat new-xref
" " (car art-group
)
7569 ":" (cdr art-group
)))
7570 ;; Now we have the new Xrefs header, so we insert
7571 ;; it and replace the new article.
7572 (nnheader-replace-header "Xref" new-xref
)
7573 (gnus-request-replace-article
7574 (cdr art-group
) to-newsgroup
(current-buffer))
7578 (gnus-message 1 "Couldn't %s article %s: %s"
7579 (cadr (assq action names
)) article
7580 (nnheader-get-report (car to-method
))))
7581 ((eq art-group
'junk
)
7582 (when (eq action
'move
)
7583 (gnus-summary-mark-article article gnus-canceled-mark
)
7584 (gnus-message 4 "Deleted article %s" article
)))
7586 (let* ((pto-group (gnus-group-prefixed-name
7587 (car art-group
) to-method
))
7589 (gnus-gethash pto-group gnus-newsrc-hashtb
))
7590 (info (nth 2 entry
))
7591 (to-group (gnus-info-group info
))
7593 ;; Update the group that has been moved to.
7595 (memq action
'(move copy
)))
7596 (unless (member to-group to-groups
)
7597 (push to-group to-groups
))
7599 (unless (memq article gnus-newsgroup-unreads
)
7600 (push 'read to-marks
)
7602 info
(gnus-add-to-range (gnus-info-read info
)
7603 (list (cdr art-group
)))))
7605 ;; See whether the article is to be put in the cache.
7606 (let ((marks gnus-article-mark-lists
)
7607 (to-article (cdr art-group
)))
7609 ;; Enter the article into the cache in the new group,
7610 ;; if that is required.
7611 (when gnus-use-cache
7612 (gnus-cache-possibly-enter-article
7614 (memq article gnus-newsgroup-marked
)
7615 (memq article gnus-newsgroup-dormant
)
7616 (memq article gnus-newsgroup-unreads
)))
7618 (when gnus-preserve-marks
7619 ;; Copy any marks over to the new group.
7620 (when (and (equal to-group gnus-newsgroup-name
)
7621 (not (memq article gnus-newsgroup-unreads
)))
7622 ;; Mark this article as read in this group.
7623 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
7624 (setcdr (gnus-active to-group
) to-article
)
7625 (setcdr gnus-newsgroup-active to-article
))
7628 (when (memq article
(symbol-value
7629 (intern (format "gnus-newsgroup-%s"
7631 (push (cdar marks
) to-marks
)
7632 ;; If the other group is the same as this group,
7633 ;; then we have to add the mark to the list.
7634 (when (equal to-group gnus-newsgroup-name
)
7635 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
7638 (intern (format "gnus-newsgroup-%s"
7640 ;; Copy the marks to other group.
7641 (gnus-add-marked-articles
7642 to-group
(cdar marks
) (list to-article
) info
))
7643 (setq marks
(cdr marks
)))
7645 (gnus-request-set-mark to-group
(list (list (list to-article
)
7650 (concat "(gnus-group-set-info '"
7651 (gnus-prin1-to-string (gnus-get-info to-group
))
7654 ;; Update the Xref header in this article to point to
7655 ;; the new crossposted article we have just created.
7656 (when (eq action
'crosspost
)
7658 (set-buffer copy-buf
)
7659 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7660 (nnheader-replace-header "Xref" new-xref
)
7661 (gnus-request-replace-article
7662 article gnus-newsgroup-name
(current-buffer)))))
7664 ;;;!!!Why is this necessary?
7665 (set-buffer gnus-summary-buffer
)
7667 (gnus-summary-goto-subject article
)
7668 (when (eq action
'move
)
7669 (gnus-summary-mark-article article gnus-canceled-mark
))))
7670 (gnus-summary-remove-process-mark article
))
7671 ;; Re-activate all groups that have been moved to.
7674 (set-buffer gnus-group-buffer
)
7675 (when (gnus-group-goto-group (car to-groups
) t
)
7676 (gnus-group-get-new-news-this-group 1 t
))
7679 (gnus-kill-buffer copy-buf
)
7680 (gnus-summary-position-point)
7681 (gnus-set-mode-line 'summary
)))
7683 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
7684 "Move the current article to a different newsgroup.
7685 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7686 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7687 re-spool using this method."
7689 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
7691 (defun gnus-summary-crosspost-article (&optional n
)
7692 "Crosspost the current article to some other group."
7694 (gnus-summary-move-article n nil nil
'crosspost
))
7696 (defcustom gnus-summary-respool-default-method nil
7697 "Default method for respooling an article.
7698 If nil, use to the current newsgroup method."
7699 :type
'(choice (gnus-select-method :value
(nnml ""))
7701 :group
'gnus-summary-mail
)
7703 (defun gnus-summary-respool-article (&optional n method
)
7704 "Respool the current article.
7705 The article will be squeezed through the mail spooling process again,
7706 which means that it will be put in some mail newsgroup or other
7707 depending on `nnmail-split-methods'.
7708 If N is a positive number, respool the N next articles.
7709 If N is a negative number, respool the N previous articles.
7710 If N is nil and any articles have been marked with the process mark,
7711 respool those articles instead.
7713 Respooling can be done both from mail groups and \"real\" newsgroups.
7714 In the former case, the articles in question will be moved from the
7715 current group into whatever groups they are destined to. In the
7716 latter case, they will be copied into the relevant groups."
7718 (list current-prefix-arg
7719 (let* ((methods (gnus-methods-using 'respool
))
7721 (symbol-name (or gnus-summary-respool-default-method
7722 (car (gnus-find-method-for-group
7723 gnus-newsgroup-name
)))))
7725 (gnus-completing-read
7726 methname
"What backend do you want to use when respooling?"
7727 methods nil t nil
'gnus-mail-method-history
))
7730 ((zerop (length (setq ms
(gnus-servers-using-backend
7732 (list (intern method
) ""))
7736 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
7737 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
7740 (error "No method given for respooling"))
7741 (if (assoc (symbol-name
7742 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
7743 (gnus-methods-using 'respool
))
7744 (gnus-summary-move-article n nil method
)
7745 (gnus-summary-copy-article n nil method
)))
7747 (defun gnus-summary-import-article (file)
7748 "Import an arbitrary file into a mail newsgroup."
7749 (interactive "fImport file: ")
7750 (let ((group gnus-newsgroup-name
)
7751 (now (current-time))
7753 (unless (gnus-check-backend-function 'request-accept-article group
)
7754 (error "%s does not support article importing" group
))
7755 (or (file-readable-p file
)
7756 (not (file-regular-p file
))
7757 (error "Can't read %s" file
))
7759 (set-buffer (gnus-get-buffer-create " *import file*"))
7761 (nnheader-insert-file-contents file
)
7762 (goto-char (point-min))
7763 (unless (nnheader-article-p)
7764 ;; This doesn't look like an article, so we fudge some headers.
7765 (setq atts
(file-attributes file
)
7766 lines
(count-lines (point-min) (point-max)))
7767 (insert "From: " (read-string "From: ") "\n"
7768 "Subject: " (read-string "Subject: ") "\n"
7769 "Date: " (message-make-date (nth 5 atts
))
7771 "Message-ID: " (message-make-message-id) "\n"
7772 "Lines: " (int-to-string lines
) "\n"
7773 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
7774 (gnus-request-accept-article group nil t
)
7775 (kill-buffer (current-buffer)))))
7777 (defun gnus-summary-article-posted-p ()
7778 "Say whether the current (mail) article is available from news as well.
7779 This will be the case if the article has both been mailed and posted."
7781 (let ((id (mail-header-references (gnus-summary-article-header)))
7782 (gnus-override-method (car (gnus-refer-article-methods))))
7783 (if (gnus-request-head id
"")
7784 (gnus-message 2 "The current message was found on %s"
7785 gnus-override-method
)
7786 (gnus-message 2 "The current message couldn't be found on %s"
7787 gnus-override-method
)
7790 (defun gnus-summary-expire-articles (&optional now
)
7791 "Expire all articles that are marked as expirable in the current group."
7793 (when (gnus-check-backend-function
7794 'request-expire-articles gnus-newsgroup-name
)
7795 ;; This backend supports expiry.
7796 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
7797 (expirable (if total
7799 ;; We need to update the info for
7800 ;; this group for `gnus-list-of-read-articles'
7801 ;; to give us the right answer.
7802 (gnus-run-hooks 'gnus-exit-group-hook
)
7803 (gnus-summary-update-info)
7804 (gnus-list-of-read-articles gnus-newsgroup-name
))
7805 (setq gnus-newsgroup-expirable
7806 (sort gnus-newsgroup-expirable
'<))))
7807 (expiry-wait (if now
'immediate
7808 (gnus-group-find-parameter
7809 gnus-newsgroup-name
'expiry-wait
)))
7810 (nnmail-expiry-target
7811 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
7812 nnmail-expiry-target
))
7815 ;; There are expirable articles in this group, so we run them
7816 ;; through the expiry process.
7817 (gnus-message 6 "Expiring articles...")
7818 (unless (gnus-check-group gnus-newsgroup-name
)
7819 (error "Can't open server for %s" gnus-newsgroup-name
))
7820 ;; The list of articles that weren't expired is returned.
7823 (let ((nnmail-expiry-wait-function nil
)
7824 (nnmail-expiry-wait expiry-wait
))
7825 (setq es
(gnus-request-expire-articles
7826 expirable gnus-newsgroup-name
)))
7827 (setq es
(gnus-request-expire-articles
7828 expirable gnus-newsgroup-name
))))
7830 (setq gnus-newsgroup-expirable es
))
7831 ;; We go through the old list of expirable, and mark all
7832 ;; really expired articles as nonexistent.
7833 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
7834 (let ((gnus-use-cache nil
))
7836 (unless (memq (car expirable
) es
)
7837 (when (gnus-data-find (car expirable
))
7838 (gnus-summary-mark-article
7839 (car expirable
) gnus-canceled-mark
)))
7840 (setq expirable
(cdr expirable
)))))
7841 (gnus-message 6 "Expiring articles...done")))))
7843 (defun gnus-summary-expire-articles-now ()
7844 "Expunge all expirable articles in the current group.
7845 This means that *all* articles that are marked as expirable will be
7846 deleted forever, right now."
7848 (or gnus-expert-user
7850 "Are you really, really, really sure you want to delete all these messages? ")
7852 (gnus-summary-expire-articles t
))
7854 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7855 (defun gnus-summary-delete-article (&optional n
)
7856 "Delete the N next (mail) articles.
7857 This command actually deletes articles. This is not a marking
7858 command. The article will disappear forever from your life, never to
7860 If N is negative, delete backwards.
7861 If N is nil and articles have been marked with the process mark,
7862 delete these instead."
7864 (unless (gnus-check-backend-function 'request-expire-articles
7865 gnus-newsgroup-name
)
7866 (error "The current newsgroup does not support article deletion"))
7867 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
7868 (error "Couldn't open server"))
7869 ;; Compute the list of articles to delete.
7870 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
7872 (if (and gnus-novice-user
7873 (not (gnus-yes-or-no-p
7874 (format "Do you really want to delete %s forever? "
7875 (if (> (length articles
) 1)
7876 (format "these %s articles" (length articles
))
7879 ;; Delete the articles.
7880 (setq not-deleted
(gnus-request-expire-articles
7881 articles gnus-newsgroup-name
'force
))
7883 (gnus-summary-remove-process-mark (car articles
))
7884 ;; The backend might not have been able to delete the article
7886 (unless (memq (car articles
) not-deleted
)
7887 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
7888 (setq articles
(cdr articles
)))
7890 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
7891 (gnus-summary-position-point)
7892 (gnus-set-mode-line 'summary
)
7895 (defun gnus-summary-edit-article (&optional arg
)
7896 "Edit the current article.
7897 This will have permanent effect only in mail groups.
7898 If ARG is nil, edit the decoded articles.
7899 If ARG is 1, edit the raw articles.
7900 If ARG is 2, edit the raw articles even in read-only groups.
7901 Otherwise, allow editing of articles even in read-only
7907 ((eq arg
1) (setq raw t
))
7908 ((eq arg
2) (setq raw t
7911 (if (and raw
(not force
) (equal gnus-newsgroup-name
"nndraft:drafts"))
7912 (error "Can't edit the raw article in group nndraft:drafts."))
7914 (set-buffer gnus-summary-buffer
)
7915 (let ((mail-parse-charset gnus-newsgroup-charset
)
7916 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
7917 (gnus-set-global-variables)
7918 (when (and (not force
)
7919 (gnus-group-read-only-p))
7920 (error "The current newsgroup does not support article editing"))
7921 (gnus-summary-show-article t
)
7922 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
7923 (with-current-buffer gnus-article-buffer
7924 (mm-enable-multibyte-mule4)))
7925 (if (equal gnus-newsgroup-name
"nndraft:drafts")
7927 (gnus-article-edit-article
7930 (let ((mbl mml-buffer-list
))
7931 (setq mml-buffer-list nil
)
7933 (make-local-hook 'kill-buffer-hook
)
7934 (let ((mml-buffer-list mml-buffer-list
))
7935 (setq mml-buffer-list mbl
)
7936 (make-local-variable 'mml-buffer-list
))
7937 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
7938 `(lambda (no-highlight)
7939 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
7940 (mail-parse-ignored-charsets
7941 ',gnus-newsgroup-ignored-charsets
))
7942 ,(if (not raw
) '(progn
7944 (mml-destroy-buffers)
7945 (remove-hook 'kill-buffer-hook
7946 'mml-destroy-buffers t
)
7947 (kill-local-variable 'mml-buffer-list
)))
7948 (gnus-summary-edit-article-done
7949 ,(or (mail-header-references gnus-current-headers
) "")
7950 ,(gnus-group-read-only-p)
7951 ,gnus-summary-buffer no-highlight
))))))))
7953 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
7955 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7957 "Make edits to the current article permanent."
7959 ;; Replace the article.
7960 (let ((buf (current-buffer)))
7962 (insert-buffer-substring buf
)
7963 (if (and (not read-only
)
7964 (not (gnus-request-replace-article
7965 (cdr gnus-article-current
) (car gnus-article-current
)
7966 (current-buffer) t
)))
7967 (error "Couldn't replace article")
7968 ;; Update the summary buffer.
7970 (equal (message-tokenize-header references
" ")
7971 (message-tokenize-header
7972 (or (message-fetch-field "references") "") " ")))
7973 ;; We only have to update this line.
7976 (message-narrow-to-head)
7977 (let ((head (buffer-string))
7980 (insert (format "211 %d Article retrieved.\n"
7981 (cdr gnus-article-current
)))
7984 (let ((nntp-server-buffer (current-buffer)))
7985 (setq header
(car (gnus-get-newsgroup-headers
7987 (set-buffer gnus-summary-buffer
)
7988 gnus-newsgroup-dependencies
)
7991 (set-buffer gnus-summary-buffer
)
7992 (gnus-data-set-header
7993 (gnus-data-find (cdr gnus-article-current
))
7995 (gnus-summary-update-article-line
7996 (cdr gnus-article-current
) header
))))))
7998 (set-buffer (or buffer gnus-summary-buffer
))
7999 (gnus-summary-update-article (cdr gnus-article-current
)))
8000 ;; Prettify the article buffer again.
8001 (unless no-highlight
8003 (set-buffer gnus-article-buffer
)
8004 ;;;!!! Fix this -- article should be rehighlighted.
8005 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8006 (set-buffer gnus-original-article-buffer
)
8007 (gnus-request-article
8008 (cdr gnus-article-current
)
8009 (car gnus-article-current
) (current-buffer))))
8010 ;; Prettify the summary buffer line.
8011 (when (gnus-visual-p 'summary-highlight
'highlight
)
8012 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
8014 (defun gnus-summary-edit-wash (key)
8015 "Perform editing command KEY in the article buffer."
8019 (message "%s" (concat (this-command-keys) "- "))
8022 (gnus-summary-edit-article)
8023 (execute-kbd-macro (concat (this-command-keys) key
))
8024 (gnus-article-edit-done))
8028 (defun gnus-summary-respool-query (&optional silent trace
)
8029 "Query where the respool algorithm would put this article."
8031 (let (gnus-mark-article-hook)
8032 (gnus-summary-select-article)
8034 (set-buffer gnus-original-article-buffer
)
8036 (message-narrow-to-head)
8037 (let ((groups (nnmail-article-group 'identity trace
)))
8040 (message "This message would go to %s"
8041 (mapconcat 'car groups
", "))
8042 (message "This message would go to no groups"))
8045 (defun gnus-summary-respool-trace ()
8046 "Trace where the respool algorithm would put this article.
8047 Display a buffer showing all fancy splitting patterns which matched."
8049 (gnus-summary-respool-query nil t
))
8051 ;; Summary marking commands.
8053 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
8054 "Mark articles which has the same subject as read, and then select the next.
8055 If UNMARK is positive, remove any kind of mark.
8056 If UNMARK is negative, tick articles."
8059 (setq unmark
(prefix-numeric-value unmark
)))
8061 (gnus-summary-mark-same-subject
8062 (gnus-summary-article-subject) unmark
)))
8063 ;; Select next unread article. If auto-select-same mode, should
8064 ;; select the first unread article.
8065 (gnus-summary-next-article t
(and gnus-auto-select-same
8066 (gnus-summary-article-subject)))
8067 (gnus-message 7 "%d article%s marked as %s"
8068 count
(if (= count
1) " is" "s are")
8069 (if unmark
"unread" "read"))))
8071 (defun gnus-summary-kill-same-subject (&optional unmark
)
8072 "Mark articles which has the same subject as read.
8073 If UNMARK is positive, remove any kind of mark.
8074 If UNMARK is negative, tick articles."
8077 (setq unmark
(prefix-numeric-value unmark
)))
8079 (gnus-summary-mark-same-subject
8080 (gnus-summary-article-subject) unmark
)))
8081 ;; If marked as read, go to next unread subject.
8083 ;; Go to next unread subject.
8084 (gnus-summary-next-subject 1 t
))
8085 (gnus-message 7 "%d articles are marked as %s"
8086 count
(if unmark
"unread" "read"))))
8088 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
8089 "Mark articles with same SUBJECT as read, and return marked number.
8090 If optional argument UNMARK is positive, remove any kinds of marks.
8091 If optional argument UNMARK is negative, mark articles as unread instead."
8095 ((null unmark
) ; Mark as read.
8098 (gnus-summary-mark-article-as-read gnus-killed-mark
)
8099 (gnus-summary-show-thread) t
)
8100 (gnus-summary-find-subject subject
))
8101 (setq count
(1+ count
))))
8102 ((> unmark
0) ; Tick.
8105 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
8106 (gnus-summary-show-thread) t
)
8107 (gnus-summary-find-subject subject
))
8108 (setq count
(1+ count
))))
8109 (t ; Mark as unread.
8112 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
8113 (gnus-summary-show-thread) t
)
8114 (gnus-summary-find-subject subject
))
8115 (setq count
(1+ count
)))))
8116 (gnus-set-mode-line 'summary
)
8117 ;; Return the number of marked articles.
8120 (defun gnus-summary-mark-as-processable (n &optional unmark
)
8121 "Set the process mark on the next N articles.
8122 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8123 the process mark instead. The difference between N and the actual
8124 number of articles marked is returned."
8126 (let ((backward (< n
0))
8131 (gnus-summary-remove-process-mark
8132 (gnus-summary-article-number))
8133 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8134 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
8137 (gnus-message 7 "No more articles"))
8138 (gnus-summary-recenter)
8139 (gnus-summary-position-point)
8142 (defun gnus-summary-unmark-as-processable (n)
8143 "Remove the process mark from the next N articles.
8144 If N is negative, unmark backward instead. The difference between N and
8145 the actual number of articles unmarked is returned."
8147 (gnus-summary-mark-as-processable n t
))
8149 (defun gnus-summary-unmark-all-processable ()
8150 "Remove the process mark from all articles."
8153 (while gnus-newsgroup-processable
8154 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
8155 (gnus-summary-position-point))
8157 (defun gnus-summary-mark-as-expirable (n)
8158 "Mark N articles forward as expirable.
8159 If N is negative, mark backward instead. The difference between N and
8160 the actual number of articles marked is returned."
8162 (gnus-summary-mark-forward n gnus-expirable-mark
))
8164 (defun gnus-summary-mark-article-as-replied (article)
8165 "Mark ARTICLE replied and update the summary line."
8166 (push article gnus-newsgroup-replied
)
8167 (let ((buffer-read-only nil
))
8168 (when (gnus-summary-goto-subject article nil t
)
8169 (gnus-summary-update-secondary-mark article
))))
8171 (defun gnus-summary-set-bookmark (article)
8172 "Set a bookmark in current article."
8173 (interactive (list (gnus-summary-article-number)))
8174 (when (or (not (get-buffer gnus-article-buffer
))
8175 (not gnus-current-article
)
8176 (not gnus-article-current
)
8177 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
8178 (error "No current article selected"))
8179 ;; Remove old bookmark, if one exists.
8180 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8182 (setq gnus-newsgroup-bookmarks
8183 (delq old gnus-newsgroup-bookmarks
))))
8184 ;; Set the new bookmark, which is on the form
8185 ;; (article-number . line-number-in-body).
8189 (set-buffer gnus-article-buffer
)
8193 (goto-char (point-min))
8194 (search-forward "\n\n" nil t
)
8197 gnus-newsgroup-bookmarks
)
8198 (gnus-message 6 "A bookmark has been added to the current article."))
8200 (defun gnus-summary-remove-bookmark (article)
8201 "Remove the bookmark from the current article."
8202 (interactive (list (gnus-summary-article-number)))
8203 ;; Remove old bookmark, if one exists.
8204 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8207 (setq gnus-newsgroup-bookmarks
8208 (delq old gnus-newsgroup-bookmarks
))
8209 (gnus-message 6 "Removed bookmark."))
8210 (gnus-message 6 "No bookmark in current article."))))
8212 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8213 (defun gnus-summary-mark-as-dormant (n)
8214 "Mark N articles forward as dormant.
8215 If N is negative, mark backward instead. The difference between N and
8216 the actual number of articles marked is returned."
8218 (gnus-summary-mark-forward n gnus-dormant-mark
))
8220 (defun gnus-summary-set-process-mark (article)
8221 "Set the process mark on ARTICLE and update the summary line."
8222 (setq gnus-newsgroup-processable
8224 (delq article gnus-newsgroup-processable
)))
8225 (when (gnus-summary-goto-subject article
)
8226 (gnus-summary-show-thread)
8227 (gnus-summary-goto-subject article
)
8228 (gnus-summary-update-secondary-mark article
)))
8230 (defun gnus-summary-remove-process-mark (article)
8231 "Remove the process mark from ARTICLE and update the summary line."
8232 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
8233 (when (gnus-summary-goto-subject article
)
8234 (gnus-summary-show-thread)
8235 (gnus-summary-goto-subject article
)
8236 (gnus-summary-update-secondary-mark article
)))
8238 (defun gnus-summary-set-saved-mark (article)
8239 "Set the process mark on ARTICLE and update the summary line."
8240 (push article gnus-newsgroup-saved
)
8241 (when (gnus-summary-goto-subject article
)
8242 (gnus-summary-update-secondary-mark article
)))
8244 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
8245 "Mark N articles as read forwards.
8246 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8247 The difference between N and the actual number of articles marked is
8249 Iff NO-EXPIRE, auto-expiry will be inhibited."
8251 (gnus-summary-show-thread)
8252 (let ((backward (< n
0))
8253 (gnus-summary-goto-unread
8254 (and gnus-summary-goto-unread
8255 (not (eq gnus-summary-goto-unread
'never
))
8256 (not (memq mark
(list gnus-unread-mark
8257 gnus-ticked-mark gnus-dormant-mark
)))))
8259 (mark (or mark gnus-del-mark
)))
8261 (gnus-summary-mark-article nil mark no-expire
)
8262 (zerop (gnus-summary-next-subject
8264 (and gnus-summary-goto-unread
8265 (not (eq gnus-summary-goto-unread
'never
)))
8269 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
8270 (gnus-summary-recenter)
8271 (gnus-summary-position-point)
8272 (gnus-set-mode-line 'summary
)
8275 (defun gnus-summary-mark-article-as-read (mark)
8276 "Mark the current article quickly as read with MARK."
8277 (let ((article (gnus-summary-article-number)))
8278 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8279 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8280 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8281 (push (cons article mark
) gnus-newsgroup-reads
)
8282 ;; Possibly remove from cache, if that is used.
8283 (when gnus-use-cache
8284 (gnus-cache-enter-remove-article article
))
8285 ;; Allow the backend to change the mark.
8286 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8287 ;; Check for auto-expiry.
8288 (when (and gnus-newsgroup-auto-expire
8289 (memq mark gnus-auto-expirable-marks
))
8290 (setq mark gnus-expirable-mark
)
8291 ;; Let the backend know about the mark change.
8292 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8293 (push article gnus-newsgroup-expirable
))
8294 ;; Set the mark in the buffer.
8295 (gnus-summary-update-mark mark
'unread
)
8298 (defun gnus-summary-mark-article-as-unread (mark)
8299 "Mark the current article quickly as unread with MARK."
8300 (let* ((article (gnus-summary-article-number))
8301 (old-mark (gnus-summary-article-mark article
)))
8302 ;; Allow the backend to change the mark.
8303 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8304 (if (eq mark old-mark
)
8308 (gnus-error 1 "Can't mark negative article numbers")
8310 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8311 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8312 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
8313 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
8314 (cond ((= mark gnus-ticked-mark
)
8315 (push article gnus-newsgroup-marked
))
8316 ((= mark gnus-dormant-mark
)
8317 (push article gnus-newsgroup-dormant
))
8319 (push article gnus-newsgroup-unreads
)))
8320 (gnus-pull article gnus-newsgroup-reads
)
8322 ;; See whether the article is to be put in the cache.
8324 (vectorp (gnus-summary-article-header article
))
8326 (gnus-cache-possibly-enter-article
8327 gnus-newsgroup-name article
8328 (= mark gnus-ticked-mark
)
8329 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8332 (gnus-summary-update-mark mark
'unread
)
8335 (defun gnus-summary-mark-article (&optional article mark no-expire
)
8336 "Mark ARTICLE with MARK. MARK can be any character.
8337 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8338 `??' (dormant) and `?E' (expirable).
8339 If MARK is nil, then the default character `?r' is used.
8340 If ARTICLE is nil, then the article on the current line will be
8342 Iff NO-EXPIRE, auto-expiry will be inhibited."
8343 ;; The mark might be a string.
8344 (when (stringp mark
)
8345 (setq mark
(aref mark
0)))
8346 ;; If no mark is given, then we check auto-expiring.
8348 (setq mark gnus-del-mark
))
8349 (when (and (not no-expire
)
8350 gnus-newsgroup-auto-expire
8351 (memq mark gnus-auto-expirable-marks
))
8352 (setq mark gnus-expirable-mark
))
8353 (let ((article (or article
(gnus-summary-article-number)))
8354 (old-mark (gnus-summary-article-mark article
)))
8355 ;; Allow the backend to change the mark.
8356 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8357 (if (eq mark old-mark
)
8360 (error "No article on current line"))
8361 (if (not (if (or (= mark gnus-unread-mark
)
8362 (= mark gnus-ticked-mark
)
8363 (= mark gnus-dormant-mark
))
8364 (gnus-mark-article-as-unread article mark
)
8365 (gnus-mark-article-as-read article mark
)))
8367 ;; See whether the article is to be put in the cache.
8369 (not (= mark gnus-canceled-mark
))
8370 (vectorp (gnus-summary-article-header article
))
8372 (gnus-cache-possibly-enter-article
8373 gnus-newsgroup-name article
8374 (= mark gnus-ticked-mark
)
8375 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8377 (when (gnus-summary-goto-subject article nil t
)
8378 (let ((buffer-read-only nil
))
8379 (gnus-summary-show-thread)
8381 (gnus-summary-update-mark mark
'unread
)
8384 (defun gnus-summary-update-secondary-mark (article)
8385 "Update the secondary (read, process, cache) mark."
8386 (gnus-summary-update-mark
8387 (cond ((memq article gnus-newsgroup-processable
)
8389 ((memq article gnus-newsgroup-cached
)
8391 ((memq article gnus-newsgroup-replied
)
8393 ((memq article gnus-newsgroup-saved
)
8395 (t gnus-unread-mark
))
8397 (when (gnus-visual-p 'summary-highlight
'highlight
)
8398 (gnus-run-hooks 'gnus-summary-update-hook
))
8401 (defun gnus-summary-update-mark (mark type
)
8402 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
8403 (buffer-read-only nil
))
8404 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
8406 (when (looking-at "\r")
8408 (when (<= (+ forward
(point)) (point-max))
8409 ;; Go to the right position on the line.
8410 (goto-char (+ forward
(point)))
8411 ;; Replace the old mark with the new mark.
8412 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
8413 ;; Optionally update the marks by some user rule.
8414 (when (eq type
'unread
)
8416 (gnus-data-find (gnus-summary-article-number)) mark
)
8417 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
8419 (defun gnus-mark-article-as-read (article &optional mark
)
8420 "Enter ARTICLE in the pertinent lists and remove it from others."
8421 ;; Make the article expirable.
8422 (let ((mark (or mark gnus-del-mark
)))
8423 (if (= mark gnus-expirable-mark
)
8424 (push article gnus-newsgroup-expirable
)
8425 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)))
8426 ;; Remove from unread and marked lists.
8427 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8428 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8429 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8430 (push (cons article mark
) gnus-newsgroup-reads
)
8431 ;; Possibly remove from cache, if that is used.
8432 (when gnus-use-cache
8433 (gnus-cache-enter-remove-article article
))
8436 (defun gnus-mark-article-as-unread (article &optional mark
)
8437 "Enter ARTICLE in the pertinent lists and remove it from others."
8438 (let ((mark (or mark gnus-ticked-mark
)))
8441 (gnus-error 1 "Can't mark negative article numbers")
8443 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
8444 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
8445 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
8446 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8448 ;; Unsuppress duplicates?
8449 (when gnus-suppress-duplicates
8450 (gnus-dup-unsuppress-article article
))
8452 (cond ((= mark gnus-ticked-mark
)
8453 (push article gnus-newsgroup-marked
))
8454 ((= mark gnus-dormant-mark
)
8455 (push article gnus-newsgroup-dormant
))
8457 (push article gnus-newsgroup-unreads
)))
8458 (gnus-pull article gnus-newsgroup-reads
)
8461 (defalias 'gnus-summary-mark-as-unread-forward
8462 'gnus-summary-tick-article-forward
)
8463 (make-obsolete 'gnus-summary-mark-as-unread-forward
8464 'gnus-summary-tick-article-forward
)
8465 (defun gnus-summary-tick-article-forward (n)
8466 "Tick N articles forwards.
8467 If N is negative, tick backwards instead.
8468 The difference between N and the number of articles ticked is returned."
8470 (gnus-summary-mark-forward n gnus-ticked-mark
))
8472 (defalias 'gnus-summary-mark-as-unread-backward
8473 'gnus-summary-tick-article-backward
)
8474 (make-obsolete 'gnus-summary-mark-as-unread-backward
8475 'gnus-summary-tick-article-backward
)
8476 (defun gnus-summary-tick-article-backward (n)
8477 "Tick N articles backwards.
8478 The difference between N and the number of articles ticked is returned."
8480 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
8482 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8483 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8484 (defun gnus-summary-tick-article (&optional article clear-mark
)
8485 "Mark current article as unread.
8486 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8487 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8489 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
8492 (defun gnus-summary-mark-as-read-forward (n)
8493 "Mark N articles as read forwards.
8494 If N is negative, mark backwards instead.
8495 The difference between N and the actual number of articles marked is
8498 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
8500 (defun gnus-summary-mark-as-read-backward (n)
8501 "Mark the N articles as read backwards.
8502 The difference between N and the actual number of articles marked is
8505 (gnus-summary-mark-forward
8506 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
8508 (defun gnus-summary-mark-as-read (&optional article mark
)
8509 "Mark current article as read.
8510 ARTICLE specifies the article to be marked as read.
8511 MARK specifies a string to be inserted at the beginning of the line."
8512 (gnus-summary-mark-article article mark
))
8514 (defun gnus-summary-clear-mark-forward (n)
8515 "Clear marks from N articles forward.
8516 If N is negative, clear backward instead.
8517 The difference between N and the number of marks cleared is returned."
8519 (gnus-summary-mark-forward n gnus-unread-mark
))
8521 (defun gnus-summary-clear-mark-backward (n)
8522 "Clear marks from N articles backward.
8523 The difference between N and the number of marks cleared is returned."
8525 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
8527 (defun gnus-summary-mark-unread-as-read ()
8528 "Intended to be used by `gnus-summary-mark-article-hook'."
8529 (when (memq gnus-current-article gnus-newsgroup-unreads
)
8530 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
8532 (defun gnus-summary-mark-read-and-unread-as-read ()
8533 "Intended to be used by `gnus-summary-mark-article-hook'."
8534 (let ((mark (gnus-summary-article-mark)))
8535 (when (or (gnus-unread-mark-p mark
)
8536 (gnus-read-mark-p mark
))
8537 (gnus-summary-mark-article gnus-current-article gnus-read-mark
))))
8539 (defun gnus-summary-mark-region-as-read (point mark all
)
8540 "Mark all unread articles between point and mark as read.
8541 If given a prefix, mark all articles between point and mark as read,
8542 even ticked and dormant ones."
8543 (interactive "r\nP")
8552 (memq (setq article
(gnus-summary-article-number))
8553 gnus-newsgroup-unreads
))
8554 (gnus-summary-mark-article article gnus-del-mark
))
8556 (gnus-summary-find-next))))))
8558 (defun gnus-summary-mark-below (score mark
)
8559 "Mark articles with score less than SCORE with MARK."
8560 (interactive "P\ncMark: ")
8561 (setq score
(if score
8562 (prefix-numeric-value score
)
8563 (or gnus-summary-default-score
0)))
8565 (set-buffer gnus-summary-buffer
)
8566 (goto-char (point-min))
8569 (and (< (gnus-summary-article-score) score
)
8570 (gnus-summary-mark-article nil mark
))
8571 (gnus-summary-find-next)))))
8573 (defun gnus-summary-kill-below (&optional score
)
8574 "Mark articles with score below SCORE as read."
8576 (gnus-summary-mark-below score gnus-killed-mark
))
8578 (defun gnus-summary-clear-above (&optional score
)
8579 "Clear all marks from articles with score above SCORE."
8581 (gnus-summary-mark-above score gnus-unread-mark
))
8583 (defun gnus-summary-tick-above (&optional score
)
8584 "Tick all articles with score above SCORE."
8586 (gnus-summary-mark-above score gnus-ticked-mark
))
8588 (defun gnus-summary-mark-above (score mark
)
8589 "Mark articles with score over SCORE with MARK."
8590 (interactive "P\ncMark: ")
8591 (setq score
(if score
8592 (prefix-numeric-value score
)
8593 (or gnus-summary-default-score
0)))
8595 (set-buffer gnus-summary-buffer
)
8596 (goto-char (point-min))
8598 (when (> (gnus-summary-article-score) score
)
8599 (gnus-summary-mark-article nil mark
))
8601 (gnus-summary-find-next)))))
8603 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8604 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
8605 (defun gnus-summary-limit-include-expunged (&optional no-error
)
8606 "Display all the hidden articles that were expunged for low scores."
8608 (let ((buffer-read-only nil
))
8609 (let ((scored gnus-newsgroup-scored
)
8612 (unless (gnus-summary-goto-subject (caar scored
))
8613 (and (setq h
(gnus-summary-article-header (caar scored
)))
8614 (< (cdar scored
) gnus-summary-expunge-below
)
8616 (setq scored
(cdr scored
)))
8618 (when (not no-error
)
8619 (error "No expunged articles hidden"))
8620 (goto-char (point-min))
8621 (gnus-summary-prepare-unthreaded (nreverse headers
))
8622 (goto-char (point-min))
8623 (gnus-summary-position-point)
8626 (defun gnus-summary-catchup (&optional all quietly to-here not-mark
)
8627 "Mark all unread articles in this newsgroup as read.
8628 If prefix argument ALL is non-nil, ticked and dormant articles will
8629 also be marked as read.
8630 If QUIETLY is non-nil, no questions will be asked.
8631 If TO-HERE is non-nil, it should be a point in the buffer. All
8632 articles before this point will be marked as read.
8633 Note that this function will only catch up the unread article
8634 in the current summary buffer limitation.
8635 The number of articles marked as read is returned."
8640 (not gnus-interactive-catchup
) ;Without confirmation?
8644 "Mark absolutely all articles as read? "
8645 "Mark all unread articles as read? ")))
8647 (not gnus-newsgroup-adaptive
)
8648 (not gnus-newsgroup-auto-expire
)
8649 (not gnus-suppress-duplicates
)
8650 (or (not gnus-use-cache
)
8651 (eq gnus-use-cache
'passive
)))
8654 (setq gnus-newsgroup-marked nil
8655 gnus-newsgroup-dormant nil
))
8656 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable
))
8657 ;; We actually mark all articles as canceled, which we
8658 ;; have to do when using auto-expiry or adaptive scoring.
8659 (gnus-summary-show-all-threads)
8660 (when (gnus-summary-first-subject (not all
) t
)
8662 (if to-here
(< (point) to-here
) t
)
8663 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
8664 (gnus-summary-find-next (not all
) nil nil t
))))
8665 (gnus-set-mode-line 'summary
))
8667 (gnus-summary-position-point)))
8669 (defun gnus-summary-catchup-to-here (&optional all
)
8670 "Mark all unticked articles before the current one as read.
8671 If ALL is non-nil, also mark ticked and dormant articles as read."
8674 (gnus-save-hidden-threads
8675 (let ((beg (point)))
8676 ;; We check that there are unread articles.
8677 (when (or all
(gnus-summary-find-prev))
8678 (gnus-summary-catchup all t beg
)))))
8679 (gnus-summary-position-point))
8681 (defun gnus-summary-catchup-all (&optional quietly
)
8682 "Mark all articles in this newsgroup as read."
8684 (gnus-summary-catchup t quietly
))
8686 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
8687 "Mark all unread articles in this group as read, then exit.
8688 If prefix argument ALL is non-nil, all articles are marked as read."
8690 (when (gnus-summary-catchup all quietly nil
'fast
)
8691 ;; Select next newsgroup or exit.
8692 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
8693 (eq gnus-auto-select-next
'quietly
))
8694 (gnus-summary-next-group nil
)
8695 (gnus-summary-exit))))
8697 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
8698 "Mark all articles in this newsgroup as read, and then exit."
8700 (gnus-summary-catchup-and-exit t quietly
))
8702 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
8703 "Mark all articles in this group as read and select the next group.
8704 If given a prefix, mark all articles, unread as well as ticked, as
8708 (gnus-summary-catchup all
))
8709 (gnus-summary-next-group))
8715 (defmacro gnus-with-article
(article &rest forms
)
8716 "Select ARTICLE and perform FORMS in the original article buffer.
8717 Then replace the article with the result."
8719 ;; We don't want the article to be marked as read.
8720 (let (gnus-mark-article-hook)
8721 (gnus-summary-select-article t t nil
,article
))
8722 (set-buffer gnus-original-article-buffer
)
8724 (if (not (gnus-check-backend-function
8725 'request-replace-article
(car gnus-article-current
)))
8726 (gnus-message 5 "Read-only group; not replacing")
8727 (unless (gnus-request-replace-article
8728 ,article
(car gnus-article-current
)
8730 (error "Couldn't replace article")))
8731 ;; The cache and backlog have to be flushed somewhat.
8732 (when gnus-keep-backlog
8733 (gnus-backlog-remove-article
8734 (car gnus-article-current
) (cdr gnus-article-current
)))
8735 (when gnus-use-cache
8736 (gnus-cache-update-article
8737 (car gnus-article-current
) (cdr gnus-article-current
)))))
8739 (put 'gnus-with-article
'lisp-indent-function
1)
8740 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
8742 ;; Thread-based commands.
8744 (defun gnus-summary-articles-in-thread (&optional article
)
8745 "Return a list of all articles in the current thread.
8746 If ARTICLE is non-nil, return all articles in the thread that starts
8748 (let* ((article (or article
(gnus-summary-article-number)))
8749 (data (gnus-data-find-list article
))
8750 (top-level (gnus-data-level (car data
)))
8752 (cond ((null gnus-thread-operation-ignore-subject
)
8753 (gnus-simplify-subject-re
8754 (mail-header-subject (gnus-data-header (car data
)))))
8755 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
8756 (gnus-simplify-subject-fuzzy
8757 (mail-header-subject (gnus-data-header (car data
)))))
8759 (end-point (save-excursion
8760 (if (gnus-summary-go-to-next-thread)
8761 (point) (point-max))))
8764 (< (gnus-data-pos (car data
)) end-point
))
8765 (when (or (not top-subject
)
8766 (string= top-subject
8767 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
8768 (gnus-simplify-subject-fuzzy
8769 (mail-header-subject
8770 (gnus-data-header (car data
))))
8771 (gnus-simplify-subject-re
8772 (mail-header-subject
8773 (gnus-data-header (car data
)))))))
8774 (push (gnus-data-number (car data
)) articles
))
8775 (unless (and (setq data
(cdr data
))
8776 (> (gnus-data-level (car data
)) top-level
))
8778 ;; Return the list of articles.
8779 (nreverse articles
)))
8781 (defun gnus-summary-rethread-current ()
8782 "Rethread the thread the current article is part of."
8784 (let* ((gnus-show-threads t
)
8785 (article (gnus-summary-article-number))
8786 (id (mail-header-id (gnus-summary-article-header)))
8787 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
8789 (error "No article on the current line"))
8790 (gnus-rebuild-thread id
)
8791 (gnus-summary-goto-subject article
)))
8793 (defun gnus-summary-reparent-thread ()
8794 "Make the current article child of the marked (or previous) article.
8796 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8797 is non-nil or the Subject: of both articles are the same."
8799 (unless (not (gnus-group-read-only-p))
8800 (error "The current newsgroup does not support article editing"))
8801 (unless (<= (length gnus-newsgroup-processable
) 1)
8802 (error "No more than one article may be marked"))
8803 (save-window-excursion
8804 (let ((gnus-article-buffer " *reparent*")
8805 (current-article (gnus-summary-article-number))
8806 ;; First grab the marked article, otherwise one line up.
8807 (parent-article (if (not (null gnus-newsgroup-processable
))
8808 (car gnus-newsgroup-processable
)
8810 (if (eq (forward-line -
1) 0)
8811 (gnus-summary-article-number)
8812 (error "Beginning of summary buffer"))))))
8813 (unless (not (eq current-article parent-article
))
8814 (error "An article may not be self-referential"))
8815 (let ((message-id (mail-header-id
8816 (gnus-summary-article-header parent-article
))))
8817 (unless (and message-id
(not (equal message-id
"")))
8818 (error "No message-id in desired parent"))
8819 (gnus-with-article current-article
8821 (goto-char (point-min))
8822 (message-narrow-to-head)
8823 (if (re-search-forward "^References: " nil t
)
8825 (re-search-forward "^[^ \t]" nil t
)
8828 (insert " " message-id
))
8829 (insert "References: " message-id
"\n"))))
8830 (set-buffer gnus-summary-buffer
)
8831 (gnus-summary-unmark-all-processable)
8832 (gnus-summary-update-article current-article
)
8833 (gnus-summary-rethread-current)
8834 (gnus-message 3 "Article %d is now the child of article %d"
8835 current-article parent-article
)))))
8837 (defun gnus-summary-toggle-threads (&optional arg
)
8838 "Toggle showing conversation threads.
8839 If ARG is positive number, turn showing conversation threads on."
8841 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
8842 (setq gnus-show-threads
8843 (if (null arg
) (not gnus-show-threads
)
8844 (> (prefix-numeric-value arg
) 0)))
8845 (gnus-summary-prepare)
8846 (gnus-summary-goto-subject current
)
8847 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
8848 (gnus-summary-position-point)))
8850 (defun gnus-summary-show-all-threads ()
8854 (let ((buffer-read-only nil
))
8855 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
8856 (gnus-summary-position-point))
8858 (defun gnus-summary-show-thread ()
8859 "Show thread subtrees.
8860 Returns nil if no thread was there to be shown."
8862 (let ((buffer-read-only nil
)
8864 ;; first goto end then to beg, to have point at beg after let
8865 (end (progn (end-of-line) (point)))
8866 (beg (progn (beginning-of-line) (point))))
8868 ;; Any hidden lines here?
8869 (search-forward "\r" end t
)
8870 (subst-char-in-region beg end ?\^M ?
\n t
)
8872 (gnus-summary-position-point))))
8874 (defun gnus-summary-hide-all-threads ()
8875 "Hide all thread subtrees."
8878 (goto-char (point-min))
8879 (gnus-summary-hide-thread)
8880 (while (zerop (gnus-summary-next-thread 1 t
))
8881 (gnus-summary-hide-thread)))
8882 (gnus-summary-position-point))
8884 (defun gnus-summary-hide-thread ()
8885 "Hide thread subtrees.
8886 Returns nil if no threads were there to be hidden."
8888 (let ((buffer-read-only nil
)
8890 (article (gnus-summary-article-number)))
8892 ;; Go forward until either the buffer ends or the subthread
8894 (when (and (not (eobp))
8895 (or (zerop (gnus-summary-next-thread 1 t
))
8896 (goto-char (point-max))))
8898 (if (and (> (point) start
)
8899 (search-backward "\n" start t
))
8901 (subst-char-in-region start
(point) ?
\n ?\^M
)
8902 (gnus-summary-goto-subject article
))
8906 (defun gnus-summary-go-to-next-thread (&optional previous
)
8907 "Go to the same level (or less) next thread.
8908 If PREVIOUS is non-nil, go to previous thread instead.
8909 Return the article number moved to, or nil if moving was impossible."
8910 (let ((level (gnus-summary-thread-level))
8911 (way (if previous -
1 1))
8914 (while (and (not (eobp))
8915 (< level
(gnus-summary-thread-level)))
8923 (gnus-summary-article-number)
8926 (defun gnus-summary-next-thread (n &optional silent
)
8927 "Go to the same level next N'th thread.
8928 If N is negative, search backward instead.
8929 Returns the difference between N and the number of skips actually
8932 If SILENT, don't output messages."
8934 (let ((backward (< n
0))
8937 (gnus-summary-go-to-next-thread backward
))
8940 (gnus-summary-position-point))
8941 (when (and (not silent
) (/= 0 n
))
8942 (gnus-message 7 "No more threads"))
8945 (defun gnus-summary-prev-thread (n)
8946 "Go to the same level previous N'th thread.
8947 Returns the difference between N and the number of skips actually
8950 (gnus-summary-next-thread (- n
)))
8952 (defun gnus-summary-go-down-thread ()
8953 "Go down one level in the current thread."
8954 (let ((children (gnus-summary-article-children)))
8956 (gnus-summary-goto-subject (car children
)))))
8958 (defun gnus-summary-go-up-thread ()
8959 "Go up one level in the current thread."
8960 (let ((parent (gnus-summary-article-parent)))
8962 (gnus-summary-goto-subject parent
))))
8964 (defun gnus-summary-down-thread (n)
8965 "Go down thread N steps.
8966 If N is negative, go up instead.
8967 Returns the difference between N and how many steps down that were
8973 (if up
(gnus-summary-go-up-thread)
8974 (gnus-summary-go-down-thread)))
8976 (gnus-summary-position-point)
8978 (gnus-message 7 "Can't go further"))
8981 (defun gnus-summary-up-thread (n)
8982 "Go up thread N steps.
8983 If N is negative, go up instead.
8984 Returns the difference between N and how many steps down that were
8987 (gnus-summary-down-thread (- n
)))
8989 (defun gnus-summary-top-thread ()
8990 "Go to the top of the thread."
8992 (while (gnus-summary-go-up-thread))
8993 (gnus-summary-article-number))
8995 (defun gnus-summary-kill-thread (&optional unmark
)
8996 "Mark articles under current thread as read.
8997 If the prefix argument is positive, remove any kinds of marks.
8998 If the prefix argument is negative, tick articles instead."
9001 (setq unmark
(prefix-numeric-value unmark
)))
9002 (let ((articles (gnus-summary-articles-in-thread)))
9004 ;; Expand the thread.
9005 (gnus-summary-show-thread)
9006 ;; Mark all the articles.
9008 (gnus-summary-goto-subject (car articles
))
9009 (cond ((null unmark
)
9010 (gnus-summary-mark-article-as-read gnus-killed-mark
))
9012 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
9014 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
9015 (setq articles
(cdr articles
))))
9016 ;; Hide killed subtrees.
9018 gnus-thread-hide-killed
9019 (gnus-summary-hide-thread))
9020 ;; If marked as read, go to next unread subject.
9022 ;; Go to next unread subject.
9023 (gnus-summary-next-subject 1 t
)))
9024 (gnus-set-mode-line 'summary
))
9026 ;; Summary sorting commands
9028 (defun gnus-summary-sort-by-number (&optional reverse
)
9029 "Sort the summary buffer by article number.
9030 Argument REVERSE means reverse order."
9032 (gnus-summary-sort 'number reverse
))
9034 (defun gnus-summary-sort-by-author (&optional reverse
)
9035 "Sort the summary buffer by author name alphabetically.
9036 If `case-fold-search' is non-nil, case of letters is ignored.
9037 Argument REVERSE means reverse order."
9039 (gnus-summary-sort 'author reverse
))
9041 (defun gnus-summary-sort-by-subject (&optional reverse
)
9042 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
9043 If `case-fold-search' is non-nil, case of letters is ignored.
9044 Argument REVERSE means reverse order."
9046 (gnus-summary-sort 'subject reverse
))
9048 (defun gnus-summary-sort-by-date (&optional reverse
)
9049 "Sort the summary buffer by date.
9050 Argument REVERSE means reverse order."
9052 (gnus-summary-sort 'date reverse
))
9054 (defun gnus-summary-sort-by-score (&optional reverse
)
9055 "Sort the summary buffer by score.
9056 Argument REVERSE means reverse order."
9058 (gnus-summary-sort 'score reverse
))
9060 (defun gnus-summary-sort-by-lines (&optional reverse
)
9061 "Sort the summary buffer by the number of lines.
9062 Argument REVERSE means reverse order."
9064 (gnus-summary-sort 'lines reverse
))
9066 (defun gnus-summary-sort-by-chars (&optional reverse
)
9067 "Sort the summary buffer by article length.
9068 Argument REVERSE means reverse order."
9070 (gnus-summary-sort 'chars reverse
))
9072 (defun gnus-summary-sort (predicate reverse
)
9073 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
9074 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
9075 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
9076 (gnus-thread-sort-functions
9081 (gnus-sort-gathered-threads-function
9082 gnus-thread-sort-functions
)
9083 (gnus-article-sort-functions
9089 (gnus-summary-prepare-hook nil
))
9090 ;; We do the sorting by regenerating the threads.
9091 (gnus-summary-prepare)
9092 ;; Hide subthreads if needed.
9093 (when (and gnus-show-threads gnus-thread-hide-subtree
)
9094 (gnus-summary-hide-all-threads))))
9096 ;; Summary saving commands.
9098 (defun gnus-summary-save-article (&optional n not-saved
)
9099 "Save the current article using the default saver function.
9100 If N is a positive number, save the N next articles.
9101 If N is a negative number, save the N previous articles.
9102 If N is nil and any articles have been marked with the process mark,
9103 save those articles instead.
9104 The variable `gnus-default-article-saver' specifies the saver function."
9106 (let* ((articles (gnus-summary-work-articles n
))
9107 (save-buffer (save-excursion
9108 (nnheader-set-temp-buffer " *Gnus Save*")))
9109 (num (length articles
))
9111 (dolist (article articles
)
9112 (setq header
(gnus-summary-article-header article
))
9113 (if (not (vectorp header
))
9114 ;; This is a pseudo-article.
9115 (if (assq 'name header
)
9116 (gnus-copy-file (cdr (assq 'name header
)))
9117 (gnus-message 1 "Article %d is unsaveable" article
))
9118 ;; This is a real article.
9119 (save-window-excursion
9120 (gnus-summary-select-article t nil nil article
))
9122 (set-buffer save-buffer
)
9124 (insert-buffer-substring gnus-original-article-buffer
))
9125 (setq file
(gnus-article-save save-buffer file num
))
9126 (gnus-summary-remove-process-mark article
)
9128 (gnus-summary-set-saved-mark article
))))
9129 (gnus-kill-buffer save-buffer
)
9130 (gnus-summary-position-point)
9131 (gnus-set-mode-line 'summary
)
9134 (defun gnus-summary-pipe-output (&optional arg
)
9135 "Pipe the current article to a subprocess.
9136 If N is a positive number, pipe the N next articles.
9137 If N is a negative number, pipe the N previous articles.
9138 If N is nil and any articles have been marked with the process mark,
9139 pipe those articles instead."
9141 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
))
9142 (gnus-summary-save-article arg t
))
9143 (gnus-configure-windows 'pipe
))
9145 (defun gnus-summary-save-article-mail (&optional arg
)
9146 "Append the current article to an mail file.
9147 If N is a positive number, save the N next articles.
9148 If N is a negative number, save the N previous articles.
9149 If N is nil and any articles have been marked with the process mark,
9150 save those articles instead."
9152 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
9153 (gnus-summary-save-article arg
)))
9155 (defun gnus-summary-save-article-rmail (&optional arg
)
9156 "Append the current article to an rmail 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."
9162 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
9163 (gnus-summary-save-article arg
)))
9165 (defun gnus-summary-save-article-file (&optional arg
)
9166 "Append the current article to a file.
9167 If N is a positive number, save the N next articles.
9168 If N is a negative number, save the N previous articles.
9169 If N is nil and any articles have been marked with the process mark,
9170 save those articles instead."
9172 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
9173 (gnus-summary-save-article arg
)))
9175 (defun gnus-summary-write-article-file (&optional arg
)
9176 "Write the current article to a file, deleting the previous file.
9177 If N is a positive number, save the N next articles.
9178 If N is a negative number, save the N previous articles.
9179 If N is nil and any articles have been marked with the process mark,
9180 save those articles instead."
9182 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
9183 (gnus-summary-save-article arg
)))
9185 (defun gnus-summary-save-article-body-file (&optional arg
)
9186 "Append the current article body to a file.
9187 If N is a positive number, save the N next articles.
9188 If N is a negative number, save the N previous articles.
9189 If N is nil and any articles have been marked with the process mark,
9190 save those articles instead."
9192 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
9193 (gnus-summary-save-article arg
)))
9195 (defun gnus-summary-pipe-message (program)
9196 "Pipe the current article through PROGRAM."
9197 (interactive "sProgram: ")
9198 (gnus-summary-select-article)
9199 (let ((mail-header-separator ""))
9200 (gnus-eval-in-buffer-window gnus-article-buffer
9203 (let ((start (window-start))
9205 (message-pipe-buffer-body program
)
9206 (set-window-start (get-buffer-window (current-buffer)) start
))))))
9208 (defun gnus-get-split-value (methods)
9209 "Return a value based on the split METHODS."
9210 (let (split-name method result match
)
9213 (set-buffer gnus-original-article-buffer
)
9215 (nnheader-narrow-to-headers)
9216 (while (and methods
(not split-name
))
9217 (goto-char (point-min))
9218 (setq method
(pop methods
))
9219 (setq match
(car method
))
9222 ;; Regular expression.
9224 (re-search-forward match nil t
)))
9225 ((gnus-functionp match
)
9229 (setq result
(funcall match gnus-newsgroup-name
))))
9234 (setq result
(eval match
)))))
9235 (setq split-name
(cdr method
))
9236 (cond ((stringp result
)
9237 (push (expand-file-name
9238 result gnus-article-save-directory
)
9241 (setq split-name
(append result split-name
)))))))))
9242 (nreverse split-name
)))
9244 (defun gnus-valid-move-group-p (group)
9247 (symbol-value group
)
9248 (gnus-get-function (gnus-find-method-for-group
9249 (symbol-name group
)) 'request-accept-article t
)))
9251 (defun gnus-read-move-group-name (prompt default articles prefix
)
9252 "Read a group name."
9253 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
9254 (minibuffer-confirm-incomplete nil
) ; XEmacs
9258 (if (> (length articles
) 1)
9259 (format "these %d articles" (length articles
))
9264 (gnus-completing-read default prom
9266 'gnus-valid-move-group-p
9268 'gnus-group-history
))
9269 ((= 1 (length split-name
))
9270 (gnus-completing-read (car split-name
) prom
9272 'gnus-valid-move-group-p
9274 'gnus-group-history
))
9276 (gnus-completing-read nil prom
9277 (mapcar (lambda (el) (list el
))
9278 (nreverse split-name
))
9280 'gnus-group-history
))))
9281 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
9283 (if (or (string= to-newsgroup
"")
9284 (string= to-newsgroup prefix
))
9285 (setq to-newsgroup default
))
9286 (unless to-newsgroup
9287 (error "No group name entered"))
9288 (or (gnus-active to-newsgroup
)
9289 (gnus-activate-group to-newsgroup nil nil to-method
)
9290 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9292 (or (and (gnus-request-create-group to-newsgroup to-method
)
9293 (gnus-activate-group
9294 to-newsgroup nil nil to-method
)
9295 (gnus-subscribe-group to-newsgroup
))
9296 (error "Couldn't create group %s" to-newsgroup
)))
9297 (error "No such group: %s" to-newsgroup
)))
9300 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
9301 "Save parts matching TYPE to DIR.
9302 If REVERSE, save parts that do not match TYPE."
9304 (list (read-string "Save parts of type: "
9305 (or (car gnus-summary-save-parts-type-history
)
9306 gnus-summary-save-parts-default-mime
)
9307 'gnus-summary-save-parts-type-history
)
9308 (setq gnus-summary-save-parts-last-directory
9309 (read-file-name "Save to directory: "
9310 gnus-summary-save-parts-last-directory
9312 current-prefix-arg
))
9313 (gnus-summary-iterate n
9314 (let ((gnus-display-mime-function nil
)
9315 (gnus-inhibit-treatment t
))
9316 (gnus-summary-select-article))
9318 (set-buffer gnus-article-buffer
)
9319 (let ((handles (or gnus-article-mime-handles
9320 (mm-dissect-buffer) (mm-uu-dissect))))
9322 (gnus-summary-save-parts-1 type dir handles reverse
)
9323 (unless gnus-article-mime-handles
;; Don't destroy this case.
9324 (mm-destroy-parts handles
)))))))
9326 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
9327 (if (stringp (car handle
))
9328 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
9331 (not (string-match type
(mm-handle-media-type handle
)))
9332 (string-match type
(mm-handle-media-type handle
)))
9333 (let ((file (expand-file-name
9334 (file-name-nondirectory
9336 (mail-content-type-get
9337 (mm-handle-disposition handle
) 'filename
)
9338 (concat gnus-newsgroup-name
9339 "." (number-to-string
9340 (cdr gnus-article-current
)))))
9342 (unless (file-exists-p file
)
9343 (mm-save-part-to-file handle file
))))))
9345 ;; Summary extract commands
9347 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
9348 (let ((buffer-read-only nil
)
9349 (article (gnus-summary-article-number))
9351 (unless (gnus-summary-goto-subject article
)
9352 (error "No such article: %d" article
))
9353 (gnus-summary-position-point)
9354 ;; If all commands are to be bunched up on one line, we collect
9356 (unless gnus-view-pseudos-separately
9357 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
9360 (setq action
(cdr (assq 'action
(car ps
))))
9361 (setq files
(list (cdr (assq 'name
(car ps
)))))
9362 (while (and ps
(cdr ps
)
9363 (string= (or action
"1")
9364 (or (cdr (assq 'action
(cadr ps
))) "2")))
9365 (push (cdr (assq 'name
(cadr ps
))) files
)
9366 (setcdr ps
(cddr ps
)))
9368 (when (not (string-match "%s" action
))
9371 (when (assq 'execute
(car ps
))
9372 (setcdr (assq 'execute
(car ps
))
9373 (funcall (if (string-match "%s" action
)
9382 (setq ps
(cdr ps
)))))
9383 (if (and gnus-view-pseudos
(not not-view
))
9385 (when (assq 'execute
(car pslist
))
9386 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
9387 (eq gnus-view-pseudos
'not-confirm
)))
9388 (setq pslist
(cdr pslist
)))
9391 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
9392 (gnus-summary-article-number)))
9393 (gnus-summary-goto-subject after-article
)
9396 (insert " " (file-name-nondirectory
9397 (cdr (assq 'name
(car pslist
))))
9398 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
9400 (forward-line -
1) ; back to `b'
9401 (gnus-add-text-properties
9402 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
9403 gnus-mouse-face-prop gnus-mouse-face
))
9405 after-article gnus-reffed-article-number
9406 gnus-unread-mark b
(car pslist
) 0 (- e b
))
9407 (push gnus-reffed-article-number gnus-newsgroup-unreads
)
9408 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
9409 (setq pslist
(cdr pslist
)))))))
9411 (defun gnus-pseudos< (p1 p2
)
9412 (let ((c1 (cdr (assq 'action p1
)))
9413 (c2 (cdr (assq 'action p2
))))
9414 (and c1 c2
(string< c1 c2
))))
9416 (defun gnus-request-pseudo-article (props)
9417 (cond ((assq 'execute props
)
9418 (gnus-execute-command (cdr (assq 'execute props
)))))
9419 (let ((gnus-current-article (gnus-summary-article-number)))
9420 (gnus-run-hooks 'gnus-mark-article-hook
)))
9422 (defun gnus-execute-command (command &optional automatic
)
9424 (gnus-article-setup-buffer)
9425 (set-buffer gnus-article-buffer
)
9426 (setq buffer-read-only nil
)
9427 (let ((command (if automatic command
9428 (read-string "Command: " (cons command
0)))))
9430 (insert "$ " command
"\n\n")
9431 (if gnus-view-pseudo-asynchronously
9432 (start-process "gnus-execute" (current-buffer) shell-file-name
9433 shell-command-switch command
)
9434 (call-process shell-file-name nil t nil
9435 shell-command-switch command
)))))
9437 ;; Summary kill commands.
9439 (defun gnus-summary-edit-global-kill (article)
9440 "Edit the \"global\" kill file."
9441 (interactive (list (gnus-summary-article-number)))
9442 (gnus-group-edit-global-kill article
))
9444 (defun gnus-summary-edit-local-kill ()
9445 "Edit a local kill file applied to the current newsgroup."
9447 (setq gnus-current-headers
(gnus-summary-article-header))
9448 (gnus-group-edit-local-kill
9449 (gnus-summary-article-number) gnus-newsgroup-name
))
9453 (defun gnus-read-header (id &optional header
)
9454 "Read the headers of article ID and enter them into the Gnus system."
9455 (let ((group gnus-newsgroup-name
)
9456 (gnus-override-method
9458 gnus-override-method
9459 (and (gnus-news-group-p gnus-newsgroup-name
)
9460 (car (gnus-refer-article-methods)))))
9462 ;; First we check to see whether the header in question is already
9465 ;; This is a Message-ID.
9466 (setq header
(or header
(gnus-id-to-header id
)))
9467 ;; This is an article number.
9468 (setq header
(or header
(gnus-summary-article-header id
))))
9470 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
9471 ;; We have found the header.
9473 ;; If this is a sparse article, we have to nix out its
9474 ;; previous entry in the thread hashtb.
9476 (gnus-summary-article-sparse-p (mail-header-number header
)))
9477 (let* ((parent (gnus-parent-id (mail-header-references header
)))
9478 (thread (and parent
(gnus-id-to-thread parent
))))
9480 (delq (assq header thread
) thread
))))
9481 ;; We have to really fetch the header to this article.
9483 (set-buffer nntp-server-buffer
)
9484 (when (setq where
(gnus-request-head id group
))
9485 (nnheader-fold-continuation-lines)
9486 (goto-char (point-max))
9488 (goto-char (point-min))
9492 ((cdr where
) (cdr where
))
9493 (header (mail-header-number header
))
9494 (t gnus-reffed-article-number
))
9496 (insert " Article retrieved.\n"))
9498 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
9499 () ; Malformed head.
9500 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
9501 (when (and (stringp id
)
9502 (not (string= (gnus-group-real-name group
)
9504 ;; If we fetched by Message-ID and the article came
9505 ;; from a different group, we fudge some bogus article
9506 ;; numbers for this article.
9507 (mail-header-set-number header gnus-reffed-article-number
))
9509 (set-buffer gnus-summary-buffer
)
9510 (decf gnus-reffed-article-number
)
9511 (gnus-remove-header (mail-header-number header
))
9512 (push header gnus-newsgroup-headers
)
9513 (setq gnus-current-headers header
)
9514 (push (mail-header-number header
) gnus-newsgroup-limit
)))
9517 (defun gnus-remove-header (number)
9518 "Remove header NUMBER from `gnus-newsgroup-headers'."
9519 (if (and gnus-newsgroup-headers
9520 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
9521 (pop gnus-newsgroup-headers
)
9522 (let ((headers gnus-newsgroup-headers
))
9523 (while (and (cdr headers
)
9524 (not (= number
(mail-header-number (cadr headers
)))))
9527 (setcdr headers
(cddr headers
))))))
9530 ;;; summary highlights
9533 (defun gnus-highlight-selected-summary ()
9534 "Highlight selected article in summary buffer."
9535 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9536 (when gnus-summary-selected-face
9538 (let* ((beg (progn (beginning-of-line) (point)))
9539 (end (progn (end-of-line) (point)))
9540 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9541 (from (if (get-text-property beg gnus-mouse-face-prop
)
9543 (or (next-single-property-change
9544 beg gnus-mouse-face-prop nil end
)
9549 (or (next-single-property-change
9550 from gnus-mouse-face-prop nil end
)
9552 ;; If no mouse-face prop on line we will have to = from = end,
9553 ;; so we highlight the entire line instead.
9554 (when (= (+ to
2) from
)
9557 (if gnus-newsgroup-selected-overlay
9558 ;; Move old overlay.
9560 gnus-newsgroup-selected-overlay from to
(current-buffer))
9561 ;; Create new overlay.
9563 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
9564 'face gnus-summary-selected-face
))))))
9566 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9567 (defun gnus-summary-highlight-line ()
9568 "Highlight current line according to `gnus-summary-highlight'."
9569 (let* ((list gnus-summary-highlight
)
9571 (end (progn (end-of-line) (point)))
9572 ;; now find out where the line starts and leave point there.
9573 (beg (progn (beginning-of-line) (point)))
9574 (article (gnus-summary-article-number))
9575 (score (or (cdr (assq (or article gnus-current-article
)
9576 gnus-newsgroup-scored
))
9577 gnus-summary-default-score
0))
9578 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
9579 (inhibit-read-only t
))
9580 ;; Eval the cars of the lists until we find a match.
9581 (let ((default gnus-summary-default-score
))
9583 (not (eval (caar list
))))
9584 (setq list
(cdr list
))))
9585 (let ((face (cdar list
)))
9586 (unless (eq face
(get-text-property beg
'face
))
9587 (gnus-put-text-property-excluding-characters-with-faces
9589 (setq face
(if (boundp face
) (symbol-value face
) face
)))
9590 (when gnus-summary-highlight-line-function
9591 (funcall gnus-summary-highlight-line-function article face
))))
9594 (defun gnus-update-read-articles (group unread
&optional compute
)
9595 "Update the list of read articles in GROUP."
9596 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
9597 (entry (gnus-gethash group gnus-newsrc-hashtb
))
9598 (info (nth 2 entry
))
9600 (unread (sort (copy-sequence unread
) '<))
9602 (if (or (not info
) (not active
))
9603 ;; There is no info on this group if it was, in fact,
9604 ;; killed. Gnus stores no information on killed groups, so
9605 ;; there's nothing to be done.
9606 ;; One could store the information somewhere temporarily,
9607 ;; perhaps... Hmmm...
9609 ;; Remove any negative articles numbers.
9610 (while (and unread
(< (car unread
) 0))
9611 (setq unread
(cdr unread
)))
9612 ;; Remove any expired article numbers
9613 (while (and unread
(< (car unread
) (car active
)))
9614 (setq unread
(cdr unread
)))
9615 ;; Compute the ranges of read articles by looking at the list of
9618 (when (/= (car unread
) prev
)
9619 (push (if (= prev
(1- (car unread
))) prev
9620 (cons prev
(1- (car unread
))))
9622 (setq prev
(1+ (car unread
)))
9623 (setq unread
(cdr unread
)))
9624 (when (<= prev
(cdr active
))
9625 (push (cons prev
(cdr active
)) read
))
9626 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
9631 ;; Propagate the read marks to the backend.
9632 (when (gnus-check-backend-function 'request-set-mark group
)
9633 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
9634 (add (gnus-remove-from-range read
(gnus-info-read info
))))
9636 (unless (gnus-check-group group
)
9637 (error "Can't open server for %s" group
))
9638 (gnus-request-set-mark
9639 group
(delq nil
(list (if add
(list add
'add
'(read)))
9640 (if del
(list del
'del
'(read))))))
9642 `(gnus-request-set-mark
9645 (if del
(list del
'add
'(read)))
9646 (if add
(list add
'del
'(read))))))))))
9647 (set-buffer gnus-group-buffer
)
9650 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
9651 (gnus-info-set-read ',info
',(gnus-info-read info
))
9652 (gnus-get-unread-articles-in-group ',info
9653 (gnus-active ,group
))
9654 (gnus-group-update-group ,group t
)
9656 ;; Enter this list into the group info.
9657 (gnus-info-set-read info read
)
9658 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9659 (gnus-get-unread-articles-in-group info
(gnus-active group
))
9662 (defun gnus-offer-save-summaries ()
9663 "Offer to save all active summary buffers."
9665 (let ((buflist (buffer-list))
9667 ;; Go through all buffers and find all summaries.
9669 (and (setq bufname
(buffer-name (car buflist
)))
9670 (string-match "Summary" bufname
)
9672 (set-buffer bufname
)
9673 ;; We check that this is, indeed, a summary buffer.
9674 (and (eq major-mode
'gnus-summary-mode
)
9675 ;; Also make sure this isn't bogus.
9676 gnus-newsgroup-prepared
9677 ;; Also make sure that this isn't a dead summary buffer.
9678 (not gnus-dead-summary-mode
)))
9679 (push bufname buffers
))
9680 (setq buflist
(cdr buflist
)))
9681 ;; Go through all these summary buffers and offer to save them.
9684 "Update summary buffer %s? "
9686 (switch-to-buffer buf
)
9687 (gnus-summary-exit))
9690 (defun gnus-summary-setup-default-charset ()
9691 "Setup newsgroup default charset."
9692 (if (equal gnus-newsgroup-name
"nndraft:drafts")
9693 (setq gnus-newsgroup-charset nil
)
9694 (let* ((name (and gnus-newsgroup-name
9695 (gnus-group-real-name gnus-newsgroup-name
)))
9697 (or gnus-newsgroup-ephemeral-ignored-charsets
9699 (and gnus-newsgroup-name
9700 (or (gnus-group-find-parameter gnus-newsgroup-name
9701 'ignored-charsets t
)
9702 (let ((alist gnus-group-ignored-charsets-alist
)
9703 elem
(charsets nil
))
9704 (while (setq elem
(pop alist
))
9706 (string-match (car elem
) name
))
9708 charsets
(cdr elem
))))
9710 gnus-newsgroup-ignored-charsets
))))
9711 (setq gnus-newsgroup-charset
9712 (or gnus-newsgroup-ephemeral-charset
9713 (and gnus-newsgroup-name
9714 (or (gnus-group-find-parameter gnus-newsgroup-name
'charset
)
9715 (let ((alist gnus-group-charset-alist
)
9717 (while (setq elem
(pop alist
))
9719 (string-match (car elem
) name
))
9721 charset
(cadr elem
))))
9723 gnus-default-charset
))
9724 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
9725 ignored-charsets
))))
9731 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
9732 "Display the current article buffer fully MIME-buttonized.
9733 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9734 treated as multipart/mixed."
9737 (let ((gnus-unbuttonized-mime-types nil
)
9738 (gnus-mime-display-multipart-as-mixed show-all-parts
))
9739 (gnus-summary-show-article)))
9741 (defun gnus-summary-repair-multipart (article)
9742 "Add a Content-Type header to a multipart article without one."
9743 (interactive (list (gnus-summary-article-number)))
9744 (gnus-with-article article
9745 (message-narrow-to-head)
9746 (goto-char (point-max))
9748 (when (search-forward "\n--" nil t
)
9749 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9750 (message-narrow-to-head)
9751 (message-remove-header "Mime-Version")
9752 (message-remove-header "Content-Type")
9753 (goto-char (point-max))
9754 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9756 (insert "Mime-Version: 1.0\n")
9758 (let (gnus-mark-article-hook)
9759 (gnus-summary-select-article t t nil article
)))
9761 (defun gnus-summary-toggle-display-buttonized ()
9762 "Toggle the buttonizing of the article buffer."
9765 (if (setq gnus-inhibit-mime-unbuttonizing
9766 (not gnus-inhibit-mime-unbuttonizing
))
9767 (let ((gnus-unbuttonized-mime-types nil
))
9768 (gnus-summary-show-article))
9769 (gnus-summary-show-article)))
9772 ;;; Generic summary marking commands
9775 (defvar gnus-summary-marking-alist
9776 '((read gnus-del-mark
"d")
9777 (unread gnus-unread-mark
"u")
9778 (ticked gnus-ticked-mark
"!")
9779 (dormant gnus-dormant-mark
"?")
9780 (expirable gnus-expirable-mark
"e"))
9781 "An alist of names/marks/keystrokes.")
9783 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
9784 (defvar gnus-summary-mark-map
)
9786 (defun gnus-summary-make-all-marking-commands ()
9787 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
9788 (dolist (elem gnus-summary-marking-alist
)
9789 (apply 'gnus-summary-make-marking-command elem
)))
9791 (defun gnus-summary-make-marking-command (name mark keystroke
)
9792 (let ((map (make-sparse-keymap)))
9793 (define-key gnus-summary-generic-mark-map keystroke map
)
9794 (dolist (lway `((next "next" next nil
"n")
9795 (next-unread "next unread" next t
"N")
9796 (prev "previous" prev nil
"p")
9797 (prev-unread "previous unread" prev t
"P")
9798 (nomove "" nil nil
,keystroke
)))
9799 (let ((func (gnus-summary-make-marking-command-1
9800 mark
(car lway
) lway name
)))
9801 (setq func
(eval func
))
9802 (define-key map
(nth 4 lway
) func
)))))
9804 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
9806 (format "gnus-summary-put-mark-as-%s%s"
9807 name
(if (eq way
'nomove
)
9809 (concat "-" (symbol-name way
)))))
9812 "Mark the current article as %s%s.
9813 If N, the prefix, then repeat N times.
9814 If N is negative, move in reverse order.
9815 The difference between N and the actual number of articles marked is
9819 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
9821 (defun gnus-summary-generic-mark (n mark move unread
)
9822 "Mark N articles with MARK."
9823 (unless (eq major-mode
'gnus-summary-mode
)
9824 (error "This command can only be used in the summary buffer"))
9825 (gnus-summary-show-thread)
9829 ((eq move
'prev
) -
1)
9835 nummove
(* -
1 nummove
))))
9837 (gnus-summary-mark-article nil mark
)
9838 (zerop (gnus-summary-next-subject nummove unread t
)))
9841 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
9842 (gnus-summary-recenter)
9843 (gnus-summary-position-point)
9844 (gnus-set-mode-line 'summary
)
9847 (gnus-summary-make-all-marking-commands)
9853 (run-hooks 'gnus-sum-load-hook
)
9855 ;;; gnus-sum.el ends here