1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl
))
40 ;; (require 'gnus-art)
42 (autoload 'gnus-summary-limit-include-cached
"gnus-cache" nil t
)
43 (autoload 'gnus-cache-write-active
"gnus-cache")
44 (autoload 'mm-uu-dissect
"mm-uu")
46 (defcustom gnus-kill-summary-on-exit t
47 "*If non-nil, kill the summary buffer when you exit from it.
48 If nil, the summary will become a \"*Dead Summary*\" buffer, and
49 it will be killed sometime later."
50 :group
'gnus-summary-exit
53 (defcustom gnus-fetch-old-headers nil
54 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
55 If an unread article in the group refers to an older, already read (or
56 just marked as read) article, the old article will not normally be
57 displayed in the Summary buffer. If this variable is non-nil, Gnus
58 will attempt to grab the headers to the old articles, and thereby
59 build complete threads. If it has the value `some', only enough
60 headers to connect otherwise loose threads will be displayed. This
61 variable can also be a number. In that case, no more than that number
62 of old headers will be fetched. If it has the value `invisible', all
63 old headers will be fetched, but none will be displayed.
65 The server has to support NOV for any of this to work."
67 :type
'(choice (const :tag
"off" nil
)
70 (sexp :menu-tag
"other" t
)))
72 (defcustom gnus-refer-thread-limit
200
73 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
74 If t, fetch all the available old headers."
77 (sexp :menu-tag
"other" t
)))
79 (defcustom gnus-summary-make-false-root
'adopt
80 "*nil means that Gnus won't gather loose threads.
81 If the root of a thread has expired or been read in a previous
82 session, the information necessary to build a complete thread has been
83 lost. Instead of having many small sub-threads from this original thread
84 scattered all over the summary buffer, Gnus can gather them.
86 If non-nil, Gnus will try to gather all loose sub-threads from an
87 original thread into one large thread.
89 If this variable is non-nil, it should be one of `none', `adopt',
92 If this variable is `none', Gnus will not make a false root, but just
93 present the sub-threads after another.
94 If this variable is `dummy', Gnus will create a dummy root that will
95 have all the sub-threads as children.
96 If this variable is `adopt', Gnus will make one of the \"children\"
97 the parent and mark all the step-children as such.
98 If this variable is `empty', the \"children\" are printed with empty
99 subject fields. (Or rather, they will be printed with a string
100 given by the `gnus-summary-same-subject' variable.)"
102 :type
'(choice (const :tag
"off" nil
)
108 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
109 "*A regexp to match subjects to be excluded from loose thread gathering.
110 As loose thread gathering is done on subjects only, that means that
111 there can be many false gatherings performed. By rooting out certain
112 common subjects, gathering might become saner."
116 (defcustom gnus-summary-gather-subject-limit nil
117 "*Maximum length of subject comparisons when gathering loose threads.
118 Use nil to compare full subjects. Setting this variable to a low
119 number will help gather threads that have been corrupted by
120 newsreaders chopping off subject lines, but it might also mean that
121 unrelated articles that have subject that happen to begin with the
122 same few characters will be incorrectly gathered.
124 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
127 :type
'(choice (const :tag
"off" nil
)
129 (sexp :menu-tag
"on" t
)))
131 (defcustom gnus-simplify-subject-functions nil
132 "List of functions taking a string argument that simplify subjects.
133 The functions are applied recursively.
135 Useful functions to put in this list include: `gnus-simplify-subject-re',
136 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
138 :type
'(repeat function
))
140 (defcustom gnus-simplify-ignored-prefixes nil
141 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
143 :type
'(choice (const :tag
"off" nil
)
146 (defcustom gnus-build-sparse-threads nil
147 "*If non-nil, fill in the gaps in threads.
148 If `some', only fill in the gaps that are needed to tie loose threads
149 together. If `more', fill in all leaf nodes that Gnus can find. If
150 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
152 :type
'(choice (const :tag
"off" nil
)
155 (sexp :menu-tag
"all" t
)))
157 (defcustom gnus-summary-thread-gathering-function
158 'gnus-gather-threads-by-subject
159 "*Function used for gathering loose threads.
160 There are two pre-defined functions: `gnus-gather-threads-by-subject',
161 which only takes Subjects into consideration; and
162 `gnus-gather-threads-by-references', which compared the References
163 headers of the articles to find matches."
165 :type
'(radio (function-item gnus-gather-threads-by-subject
)
166 (function-item gnus-gather-threads-by-references
)
167 (function :tag
"other")))
169 (defcustom gnus-summary-same-subject
""
170 "*String indicating that the current article has the same subject as the previous.
171 This variable will only be used if the value of
172 `gnus-summary-make-false-root' is `empty'."
173 :group
'gnus-summary-format
176 (defcustom gnus-summary-goto-unread t
177 "*If t, many commands will go to the next unread article.
178 This applies to marking commands as well as other commands that
179 \"naturally\" select the next article, like, for instance, `SPC' at
180 the end of an article.
182 If nil, the marking commands do NOT go to the next unread article
183 (they go to the next article instead). If `never', commands that
184 usually go to the next unread article, will go to the next article,
185 whether it is read or not."
186 :group
'gnus-summary-marks
187 :link
'(custom-manual "(gnus)Setting Marks")
188 :type
'(choice (const :tag
"off" nil
)
190 (sexp :menu-tag
"on" t
)))
192 (defcustom gnus-summary-default-score
0
193 "*Default article score level.
194 All scores generated by the score files will be added to this score.
195 If this variable is nil, scoring will be disabled."
196 :group
'gnus-score-default
197 :type
'(choice (const :tag
"disable")
200 (defcustom gnus-summary-zcore-fuzz
0
201 "*Fuzziness factor for the zcore in the summary buffer.
202 Articles with scores closer than this to `gnus-summary-default-score'
204 :group
'gnus-summary-format
207 (defcustom gnus-simplify-subject-fuzzy-regexp nil
208 "*Strings to be removed when doing fuzzy matches.
209 This can either be a regular expression or list of regular expressions
210 that will be removed from subject strings if fuzzy subject
211 simplification is selected."
213 :type
'(repeat regexp
))
215 (defcustom gnus-show-threads t
216 "*If non-nil, display threads in summary mode."
220 (defcustom gnus-thread-hide-subtree nil
221 "*If non-nil, hide all threads initially.
222 If threads are hidden, you have to run the command
223 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
224 to expose hidden threads."
228 (defcustom gnus-thread-hide-killed t
229 "*If non-nil, hide killed threads automatically."
233 (defcustom gnus-thread-ignore-subject t
234 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
235 If nil, articles that have different subjects from their parents will
236 start separate threads."
240 (defcustom gnus-thread-operation-ignore-subject t
241 "*If non-nil, subjects will be ignored when doing thread commands.
242 This affects commands like `gnus-summary-kill-thread' and
243 `gnus-summary-lower-thread'.
245 If this variable is nil, articles in the same thread with different
246 subjects will not be included in the operation in question. If this
247 variable is `fuzzy', only articles that have subjects that are fuzzily
248 equal will be included."
250 :type
'(choice (const :tag
"off" nil
)
254 (defcustom gnus-thread-indent-level
4
255 "*Number that says how much each sub-thread should be indented."
259 (defcustom gnus-auto-extend-newsgroup t
260 "*If non-nil, extend newsgroup forward and backward when requested."
261 :group
'gnus-summary-choose
264 (defcustom gnus-auto-select-first t
265 "*If nil, don't select the first unread article when entering a group.
266 If this variable is `best', select the highest-scored unread article
267 in the group. If t, select the first unread article.
269 This variable can also be a function to place point on a likely
270 subject line. Useful values include `gnus-summary-first-unread-subject',
271 `gnus-summary-first-unread-article' and
272 `gnus-summary-best-unread-article'.
274 If you want to prevent automatic selection of the first unread article
275 in some newsgroups, set the variable to nil in
276 `gnus-select-group-hook'."
277 :group
'gnus-group-select
278 :type
'(choice (const :tag
"none" nil
)
280 (sexp :menu-tag
"first" t
)
281 (function-item gnus-summary-first-unread-subject
)
282 (function-item gnus-summary-first-unread-article
)
283 (function-item gnus-summary-best-unread-article
)))
285 (defcustom gnus-auto-select-next t
286 "*If non-nil, offer to go to the next group from the end of the previous.
287 If the value is t and the next newsgroup is empty, Gnus will exit
288 summary mode and go back to group mode. If the value is neither nil
289 nor t, Gnus will select the following unread newsgroup. In
290 particular, if the value is the symbol `quietly', the next unread
291 newsgroup will be selected without any confirmation, and if it is
292 `almost-quietly', the next group will be selected without any
293 confirmation if you are located on the last article in the group.
294 Finally, if this variable is `slightly-quietly', the `Z n' command
295 will go to the next group without confirmation."
296 :group
'gnus-summary-maneuvering
297 :type
'(choice (const :tag
"off" nil
)
299 (const almost-quietly
)
300 (const slightly-quietly
)
301 (sexp :menu-tag
"on" t
)))
303 (defcustom gnus-auto-select-same nil
304 "*If non-nil, select the next article with the same subject.
305 If there are no more articles with the same subject, go to
306 the first unread article."
307 :group
'gnus-summary-maneuvering
310 (defcustom gnus-summary-check-current nil
311 "*If non-nil, consider the current article when moving.
312 The \"unread\" movement commands will stay on the same line if the
313 current article is unread."
314 :group
'gnus-summary-maneuvering
317 (defcustom gnus-auto-center-summary t
318 "*If non-nil, always center the current summary buffer.
319 In particular, if `vertical' do only vertical recentering. If non-nil
320 and non-`vertical', do both horizontal and vertical recentering."
321 :group
'gnus-summary-maneuvering
322 :type
'(choice (const :tag
"none" nil
)
324 (integer :tag
"height")
325 (sexp :menu-tag
"both" t
)))
327 (defcustom gnus-show-all-headers nil
328 "*If non-nil, don't hide any headers."
329 :group
'gnus-article-hiding
330 :group
'gnus-article-headers
333 (defcustom gnus-summary-ignore-duplicates nil
334 "*If non-nil, ignore articles with identical Message-ID headers."
338 (defcustom gnus-single-article-buffer t
339 "*If non-nil, display all articles in the same buffer.
340 If nil, each group will get its own article buffer."
341 :group
'gnus-article-various
344 (defcustom gnus-break-pages t
345 "*If non-nil, do page breaking on articles.
346 The page delimiter is specified by the `gnus-page-delimiter'
348 :group
'gnus-article-various
351 (defcustom gnus-move-split-methods nil
352 "*Variable used to suggest where articles are to be moved to.
353 It uses the same syntax as the `gnus-split-methods' variable."
354 :group
'gnus-summary-mail
355 :type
'(repeat (choice (list :value
(fun) function
)
356 (cons :value
("" "") regexp
(repeat string
))
359 (defcustom gnus-unread-mark ?
;Whitespace
360 "*Mark used for unread articles."
361 :group
'gnus-summary-marks
364 (defcustom gnus-ticked-mark ?
!
365 "*Mark used for ticked articles."
366 :group
'gnus-summary-marks
369 (defcustom gnus-dormant-mark ??
370 "*Mark used for dormant articles."
371 :group
'gnus-summary-marks
374 (defcustom gnus-del-mark ?r
375 "*Mark used for del'd articles."
376 :group
'gnus-summary-marks
379 (defcustom gnus-read-mark ?R
380 "*Mark used for read articles."
381 :group
'gnus-summary-marks
384 (defcustom gnus-expirable-mark ?E
385 "*Mark used for expirable articles."
386 :group
'gnus-summary-marks
389 (defcustom gnus-killed-mark ?K
390 "*Mark used for killed articles."
391 :group
'gnus-summary-marks
394 (defcustom gnus-souped-mark ?F
395 "*Mark used for killed articles."
396 :group
'gnus-summary-marks
399 (defcustom gnus-kill-file-mark ?X
400 "*Mark used for articles killed by kill files."
401 :group
'gnus-summary-marks
404 (defcustom gnus-low-score-mark ?Y
405 "*Mark used for articles with a low score."
406 :group
'gnus-summary-marks
409 (defcustom gnus-catchup-mark ?C
410 "*Mark used for articles that are caught up."
411 :group
'gnus-summary-marks
414 (defcustom gnus-replied-mark ?A
415 "*Mark used for articles that have been replied to."
416 :group
'gnus-summary-marks
419 (defcustom gnus-cached-mark ?
*
420 "*Mark used for articles that are in the cache."
421 :group
'gnus-summary-marks
424 (defcustom gnus-saved-mark ?S
425 "*Mark used for articles that have been saved to."
426 :group
'gnus-summary-marks
429 (defcustom gnus-ancient-mark ?O
430 "*Mark used for ancient articles."
431 :group
'gnus-summary-marks
434 (defcustom gnus-sparse-mark ?Q
435 "*Mark used for sparsely reffed articles."
436 :group
'gnus-summary-marks
439 (defcustom gnus-canceled-mark ?G
440 "*Mark used for canceled articles."
441 :group
'gnus-summary-marks
444 (defcustom gnus-duplicate-mark ?M
445 "*Mark used for duplicate articles."
446 :group
'gnus-summary-marks
449 (defcustom gnus-undownloaded-mark ?
@
450 "*Mark used for articles that weren't downloaded."
451 :group
'gnus-summary-marks
454 (defcustom gnus-downloadable-mark ?%
455 "*Mark used for articles that are to be downloaded."
456 :group
'gnus-summary-marks
459 (defcustom gnus-unsendable-mark ?
=
460 "*Mark used for articles that won't be sent."
461 :group
'gnus-summary-marks
464 (defcustom gnus-score-over-mark ?
+
465 "*Score mark used for articles with high scores."
466 :group
'gnus-summary-marks
469 (defcustom gnus-score-below-mark ?-
470 "*Score mark used for articles with low scores."
471 :group
'gnus-summary-marks
474 (defcustom gnus-empty-thread-mark ?
;Whitespace
475 "*There is no thread under the article."
476 :group
'gnus-summary-marks
479 (defcustom gnus-not-empty-thread-mark ?
=
480 "*There is a thread under the article."
481 :group
'gnus-summary-marks
484 (defcustom gnus-view-pseudo-asynchronously nil
485 "*If non-nil, Gnus will view pseudo-articles asynchronously."
486 :group
'gnus-extract-view
489 (defcustom gnus-auto-expirable-marks
490 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
491 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
492 gnus-souped-mark gnus-duplicate-mark
)
493 "*The list of marks converted into expiration if a group is auto-expirable."
496 :type
'(repeat character
))
498 (defcustom gnus-inhibit-user-auto-expire t
499 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
504 (defcustom gnus-view-pseudos nil
505 "*If `automatic', pseudo-articles will be viewed automatically.
506 If `not-confirm', pseudos will be viewed automatically, and the user
507 will not be asked to confirm the command."
508 :group
'gnus-extract-view
509 :type
'(choice (const :tag
"off" nil
)
511 (const not-confirm
)))
513 (defcustom gnus-view-pseudos-separately t
514 "*If non-nil, one pseudo-article will be created for each file to be viewed.
515 If nil, all files that use the same viewing command will be given as a
516 list of parameters to that command."
517 :group
'gnus-extract-view
520 (defcustom gnus-insert-pseudo-articles t
521 "*If non-nil, insert pseudo-articles when decoding articles."
522 :group
'gnus-extract-view
525 (defcustom gnus-summary-dummy-line-format
527 "*The format specification for the dummy roots in the summary buffer.
528 It works along the same lines as a normal formatting string,
529 with some simple extensions.
532 :group
'gnus-threading
535 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
536 "*The format specification for the summary mode line.
537 It works along the same lines as a normal formatting string,
538 with some simple extensions:
541 %p Unprefixed group name
542 %A Current article number
543 %z Current article score
545 %U Number of unread articles in the group
546 %e Number of unselected articles in the group
547 %Z A string with unread/unselected article counts
548 %g Shortish group name
549 %S Subject of the current article
551 %s Current score file name
552 %d Number of dormant articles
553 %r Number of articles that have been marked as read in this session
554 %E Number of articles expunged by the score files"
555 :group
'gnus-summary-format
558 (defcustom gnus-list-identifiers nil
559 "Regexp that matches list identifiers to be removed from subject.
560 This can also be a list of regexps."
562 :group
'gnus-summary-format
563 :group
'gnus-article-hiding
564 :type
'(choice (const :tag
"none" nil
)
566 (repeat :value
(".*") regexp
)))
568 (defcustom gnus-summary-mark-below
0
569 "*Mark all articles with a score below this variable as read.
570 This variable is local to each summary buffer and usually set by the
572 :group
'gnus-score-default
575 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
576 "*List of functions used for sorting articles in the summary buffer.
577 This variable is only used when not using a threaded display."
578 :group
'gnus-summary-sort
579 :type
'(repeat (choice (function-item gnus-article-sort-by-number
)
580 (function-item gnus-article-sort-by-author
)
581 (function-item gnus-article-sort-by-subject
)
582 (function-item gnus-article-sort-by-date
)
583 (function-item gnus-article-sort-by-score
)
584 (function :tag
"other"))))
586 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
587 "*List of functions used for sorting threads in the summary buffer.
588 By default, threads are sorted by article number.
590 Each function takes two threads and return non-nil if the first thread
591 should be sorted before the other. If you use more than one function,
592 the primary sort function should be the last. You should probably
593 always include `gnus-thread-sort-by-number' in the list of sorting
594 functions -- preferably first.
596 Ready-made functions include `gnus-thread-sort-by-number',
597 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
598 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
599 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
600 :group
'gnus-summary-sort
601 :type
'(repeat (choice (function-item gnus-thread-sort-by-number
)
602 (function-item gnus-thread-sort-by-author
)
603 (function-item gnus-thread-sort-by-subject
)
604 (function-item gnus-thread-sort-by-date
)
605 (function-item gnus-thread-sort-by-score
)
606 (function-item gnus-thread-sort-by-total-score
)
607 (function :tag
"other"))))
609 (defcustom gnus-thread-score-function
'+
610 "*Function used for calculating the total score of a thread.
612 The function is called with the scores of the article and each
613 subthread and should then return the score of the thread.
615 Some functions you can use are `+', `max', or `min'."
616 :group
'gnus-summary-sort
619 (defcustom gnus-summary-expunge-below nil
620 "All articles that have a score less than this variable will be expunged.
621 This variable is local to the summary buffers."
622 :group
'gnus-score-default
623 :type
'(choice (const :tag
"off" nil
)
626 (defcustom gnus-thread-expunge-below nil
627 "All threads that have a total score less than this variable will be expunged.
628 See `gnus-thread-score-function' for en explanation of what a
631 This variable is local to the summary buffers."
632 :group
'gnus-threading
633 :group
'gnus-score-default
634 :type
'(choice (const :tag
"off" nil
)
637 (defcustom gnus-summary-mode-hook nil
638 "*A hook for Gnus summary mode.
639 This hook is run before any variables are set in the summary buffer."
640 :options
'(turn-on-gnus-mailing-list-mode)
641 :group
'gnus-summary-various
644 (defcustom gnus-summary-menu-hook nil
645 "*Hook run after the creation of the summary mode menu."
646 :group
'gnus-summary-visual
649 (defcustom gnus-summary-exit-hook nil
650 "*A hook called on exit from the summary buffer.
651 It will be called with point in the group buffer."
652 :group
'gnus-summary-exit
655 (defcustom gnus-summary-prepare-hook nil
656 "*A hook called after the summary buffer has been generated.
657 If you want to modify the summary buffer, you can use this hook."
658 :group
'gnus-summary-various
661 (defcustom gnus-summary-prepared-hook nil
662 "*A hook called as the last thing after the summary buffer has been generated."
663 :group
'gnus-summary-various
666 (defcustom gnus-summary-generate-hook nil
667 "*A hook run just before generating the summary buffer.
668 This hook is commonly used to customize threading variables and the
670 :group
'gnus-summary-various
673 (defcustom gnus-select-group-hook nil
674 "*A hook called when a newsgroup is selected.
676 If you'd like to simplify subjects like the
677 `gnus-summary-next-same-subject' command does, you can use the
680 (setq gnus-select-group-hook
683 (mapcar (lambda (header)
684 (mail-header-set-subject
686 (gnus-simplify-subject
687 (mail-header-subject header) 're-only)))
688 gnus-newsgroup-headers))))"
689 :group
'gnus-group-select
692 (defcustom gnus-select-article-hook nil
693 "*A hook called when an article is selected."
694 :group
'gnus-summary-choose
697 (defcustom gnus-visual-mark-article-hook
698 (list 'gnus-highlight-selected-summary
)
699 "*Hook run after selecting an article in the summary buffer.
700 It is meant to be used for highlighting the article in some way. It
701 is not run if `gnus-visual' is nil."
702 :group
'gnus-summary-visual
705 (defcustom gnus-parse-headers-hook nil
706 "*A hook called before parsing the headers."
710 (defcustom gnus-exit-group-hook nil
711 "*A hook called when exiting summary mode.
712 This hook is not called from the non-updating exit commands like `Q'."
716 (defcustom gnus-summary-update-hook
717 (list 'gnus-summary-highlight-line
)
718 "*A hook called when a summary line is changed.
719 The hook will not be called if `gnus-visual' is nil.
721 The default function `gnus-summary-highlight-line' will
722 highlight the line according to the `gnus-summary-highlight'
724 :group
'gnus-summary-visual
727 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
728 "*A hook called when an article is selected for the first time.
729 The hook is intended to mark an article as read (or unread)
730 automatically when it is selected."
731 :group
'gnus-summary-choose
734 (defcustom gnus-group-no-more-groups-hook nil
735 "*A hook run when returning to group mode having no more (unread) groups."
736 :group
'gnus-group-select
739 (defcustom gnus-ps-print-hook nil
740 "*A hook run before ps-printing something from Gnus."
744 (defcustom gnus-summary-selected-face
'gnus-summary-selected-face
745 "Face used for highlighting the current article in the summary buffer."
746 :group
'gnus-summary-visual
749 (defcustom gnus-summary-highlight
750 '(((= mark gnus-canceled-mark
)
751 . gnus-summary-cancelled-face
)
752 ((and (> score default
)
753 (or (= mark gnus-dormant-mark
)
754 (= mark gnus-ticked-mark
)))
755 . gnus-summary-high-ticked-face
)
756 ((and (< score default
)
757 (or (= mark gnus-dormant-mark
)
758 (= mark gnus-ticked-mark
)))
759 . gnus-summary-low-ticked-face
)
760 ((or (= mark gnus-dormant-mark
)
761 (= mark gnus-ticked-mark
))
762 . gnus-summary-normal-ticked-face
)
763 ((and (> score default
) (= mark gnus-ancient-mark
))
764 . gnus-summary-high-ancient-face
)
765 ((and (< score default
) (= mark gnus-ancient-mark
))
766 . gnus-summary-low-ancient-face
)
767 ((= mark gnus-ancient-mark
)
768 . gnus-summary-normal-ancient-face
)
769 ((and (> score default
) (= mark gnus-unread-mark
))
770 . gnus-summary-high-unread-face
)
771 ((and (< score default
) (= mark gnus-unread-mark
))
772 . gnus-summary-low-unread-face
)
773 ((= mark gnus-unread-mark
)
774 . gnus-summary-normal-unread-face
)
775 ((and (> score default
) (memq mark
(list gnus-downloadable-mark
776 gnus-undownloaded-mark
)))
777 . gnus-summary-high-unread-face
)
778 ((and (< score default
) (memq mark
(list gnus-downloadable-mark
779 gnus-undownloaded-mark
)))
780 . gnus-summary-low-unread-face
)
781 ((memq mark
(list gnus-downloadable-mark gnus-undownloaded-mark
))
782 . gnus-summary-normal-unread-face
)
784 . gnus-summary-high-read-face
)
786 . gnus-summary-low-read-face
)
788 . gnus-summary-normal-read-face
))
789 "*Controls the highlighting of summary buffer lines.
791 A list of (FORM . FACE) pairs. When deciding how a particular summary
792 line should be displayed, each form is evaluated. The content of the
793 face field after the first true form is used. You can change how those
794 summary lines are displayed, by editing the face field.
796 You can use the following variables in the FORM field.
798 score: The articles score
799 default: The default article score.
800 below: The score below which articles are automatically marked as read.
801 mark: The articles mark."
802 :group
'gnus-summary-visual
803 :type
'(repeat (cons (sexp :tag
"Form" nil
)
806 (defcustom gnus-alter-header-function nil
807 "Function called to allow alteration of article header structures.
808 The function is called with one parameter, the article header vector,
809 which it may alter in any way.")
811 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
812 "Variable that says which function should be used to decode a string with encoded words.")
814 (defcustom gnus-extra-headers nil
815 "*Extra headers to parse."
818 :type
'(repeat symbol
))
820 (defcustom gnus-ignored-from-addresses
821 (and user-mail-address
(regexp-quote user-mail-address
))
822 "*Regexp of From headers that may be suppressed in favor of To headers."
827 (defcustom gnus-group-charset-alist
828 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5
)
829 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312
)
830 ("^fj\\>\\|^japan\\>" iso-2022-jp-2
)
831 ("^tnn\\>\\|^pin\\>\\|^sci.lang.japan" iso-2022-7bit
)
832 ("^relcom\\>" koi8-r
)
834 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2
)
835 ("^israel\\>" iso-8859-1
)
837 ("^alt.chinese.text.big5\\>" chinese-big5
)
838 ("^soc.culture.vietnamese\\>" vietnamese-viqr
)
839 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1
)
841 "Alist of regexps (to match group names) and default charsets to be used when reading."
842 :type
'(repeat (list (regexp :tag
"Group")
843 (symbol :tag
"Charset")))
844 :group
'gnus-charset
)
846 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
847 "List of charsets that should be ignored.
848 When these charsets are used in the \"charset\" parameter, the
849 default charset will be used instead."
851 :type
'(repeat symbol
)
852 :group
'gnus-charset
)
854 (defcustom gnus-group-ignored-charsets-alist
855 '(("alt\\.chinese\\.text" iso-8859-1
))
856 "Alist of regexps (to match group names) and charsets that should be ignored.
857 When these charsets are used in the \"charset\" parameter, the
858 default charset will be used instead."
859 :type
'(repeat (cons (regexp :tag
"Group")
861 :group
'gnus-charset
)
863 (defcustom gnus-group-highlight-words-alist nil
864 "Alist of group regexps and highlight regexps.
865 This variable uses the same syntax as `gnus-emphasis-alist'."
867 :type
'(repeat (cons (regexp :tag
"Group")
868 (repeat (list (regexp :tag
"Highlight regexp")
869 (number :tag
"Group for entire word" 0)
870 (number :tag
"Group for displayed part" 0)
872 gnus-emphasis-highlight-words
)))))
873 :group
'gnus-summary-visual
)
875 (defcustom gnus-summary-show-article-charset-alist
877 "Alist of number and charset.
878 The article will be shown with the charset corresponding to the
880 For example: ((1 . cn-gb-2312) (2 . big5))."
882 :type
'(repeat (cons (number :tag
"Argument" 1)
883 (symbol :tag
"Charset")))
884 :group
'gnus-charset
)
886 (defcustom gnus-preserve-marks t
887 "Whether marks are preserved when moving, copying and respooling messages."
890 :group
'gnus-summary-marks
)
892 (defcustom gnus-alter-articles-to-read-function nil
893 "Function to be called to alter the list of articles to be selected."
894 :type
'(choice (const nil
) function
)
895 :group
'gnus-summary
)
897 (defcustom gnus-orphan-score nil
898 "*All orphans get this score added. Set in the score file."
899 :group
'gnus-score-default
900 :type
'(choice (const nil
)
903 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
904 "*A regexp to match MIME parts when saving multiple parts of a message
905 with gnus-summary-save-parts (X m). This regexp will be used by default
906 when prompting the user for which type of files to save."
911 ;;; Internal variables
913 (defvar gnus-article-mime-handles nil
)
914 (defvar gnus-article-decoded-p nil
)
915 (defvar gnus-scores-exclude-files nil
)
916 (defvar gnus-page-broken nil
)
917 (defvar gnus-inhibit-mime-unbuttonizing nil
)
919 (defvar gnus-original-article nil
)
920 (defvar gnus-article-internal-prepare-hook nil
)
921 (defvar gnus-newsgroup-process-stack nil
)
923 (defvar gnus-thread-indent-array nil
)
924 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
925 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
926 "Function called to sort the articles within a thread after it has been gathered together.")
928 (defvar gnus-summary-save-parts-type-history nil
)
929 (defvar gnus-summary-save-parts-last-directory nil
)
931 ;; Avoid highlighting in kill files.
932 (defvar gnus-summary-inhibit-highlight nil
)
933 (defvar gnus-newsgroup-selected-overlay nil
)
934 (defvar gnus-inhibit-limiting nil
)
935 (defvar gnus-newsgroup-adaptive-score-file nil
)
936 (defvar gnus-current-score-file nil
)
937 (defvar gnus-current-move-group nil
)
938 (defvar gnus-current-copy-group nil
)
939 (defvar gnus-current-crosspost-group nil
)
941 (defvar gnus-newsgroup-dependencies nil
)
942 (defvar gnus-newsgroup-adaptive nil
)
943 (defvar gnus-summary-display-article-function nil
)
944 (defvar gnus-summary-highlight-line-function nil
945 "Function called after highlighting a summary line.")
947 (defvar gnus-summary-line-format-alist
948 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
949 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
950 (?s gnus-tmp-subject-or-nil ?s
)
951 (?n gnus-tmp-name ?s
)
952 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
954 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
956 (?F gnus-tmp-from ?s
)
957 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
958 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
959 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
960 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
961 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
962 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
963 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
964 (?L gnus-tmp-lines ?d
)
965 (?I gnus-tmp-indentation ?s
)
966 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
967 (?R gnus-tmp-replied ?c
)
968 (?\
[ gnus-tmp-opening-bracket ?c
)
969 (?\
] gnus-tmp-closing-bracket ?c
)
970 (?\
> (make-string gnus-tmp-level ?
) ?s
)
971 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
972 (?i gnus-tmp-score ?d
)
973 (?z gnus-tmp-score-char ?c
)
974 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
975 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
976 (?U gnus-tmp-unread ?c
)
977 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header
) ?s
)
978 (?t
(gnus-summary-number-of-articles-in-thread
979 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
981 (?e
(gnus-summary-number-of-articles-in-thread
982 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
984 (?u gnus-tmp-user-defined ?s
)
985 (?P
(gnus-pick-line-number) ?d
))
986 "An alist of format specifications that can appear in summary lines.
987 These are paired with what variables they correspond with, along with
988 the type of the variable (string, integer, character, etc).")
990 (defvar gnus-summary-dummy-line-format-alist
991 `((?S gnus-tmp-subject ?s
)
992 (?N gnus-tmp-number ?d
)
993 (?u gnus-tmp-user-defined ?s
)))
995 (defvar gnus-summary-mode-line-format-alist
996 `((?G gnus-tmp-group-name ?s
)
997 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
998 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
999 (?A gnus-tmp-article-number ?d
)
1000 (?Z gnus-tmp-unread-and-unselected ?s
)
1001 (?V gnus-version ?s
)
1002 (?U gnus-tmp-unread-and-unticked ?d
)
1003 (?S gnus-tmp-subject ?s
)
1004 (?e gnus-tmp-unselected ?d
)
1005 (?u gnus-tmp-user-defined ?s
)
1006 (?d
(length gnus-newsgroup-dormant
) ?d
)
1007 (?t
(length gnus-newsgroup-marked
) ?d
)
1008 (?r
(length gnus-newsgroup-reads
) ?d
)
1009 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1010 (?E gnus-newsgroup-expunged-tally ?d
)
1011 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1013 (defvar gnus-last-search-regexp nil
1014 "Default regexp for article search command.")
1016 (defvar gnus-last-shell-command nil
1017 "Default shell command on article.")
1019 (defvar gnus-newsgroup-begin nil
)
1020 (defvar gnus-newsgroup-end nil
)
1021 (defvar gnus-newsgroup-last-rmail nil
)
1022 (defvar gnus-newsgroup-last-mail nil
)
1023 (defvar gnus-newsgroup-last-folder nil
)
1024 (defvar gnus-newsgroup-last-file nil
)
1025 (defvar gnus-newsgroup-auto-expire nil
)
1026 (defvar gnus-newsgroup-active nil
)
1028 (defvar gnus-newsgroup-data nil
)
1029 (defvar gnus-newsgroup-data-reverse nil
)
1030 (defvar gnus-newsgroup-limit nil
)
1031 (defvar gnus-newsgroup-limits nil
)
1033 (defvar gnus-newsgroup-unreads nil
1034 "List of unread articles in the current newsgroup.")
1036 (defvar gnus-newsgroup-unselected nil
1037 "List of unselected unread articles in the current newsgroup.")
1039 (defvar gnus-newsgroup-reads nil
1040 "Alist of read articles and article marks in the current newsgroup.")
1042 (defvar gnus-newsgroup-expunged-tally nil
)
1044 (defvar gnus-newsgroup-marked nil
1045 "List of ticked articles in the current newsgroup (a subset of unread art).")
1047 (defvar gnus-newsgroup-killed nil
1048 "List of ranges of articles that have been through the scoring process.")
1050 (defvar gnus-newsgroup-cached nil
1051 "List of articles that come from the article cache.")
1053 (defvar gnus-newsgroup-saved nil
1054 "List of articles that have been saved.")
1056 (defvar gnus-newsgroup-kill-headers nil
)
1058 (defvar gnus-newsgroup-replied nil
1059 "List of articles that have been replied to in the current newsgroup.")
1061 (defvar gnus-newsgroup-expirable nil
1062 "List of articles in the current newsgroup that can be expired.")
1064 (defvar gnus-newsgroup-processable nil
1065 "List of articles in the current newsgroup that can be processed.")
1067 (defvar gnus-newsgroup-downloadable nil
1068 "List of articles in the current newsgroup that can be processed.")
1070 (defvar gnus-newsgroup-undownloaded nil
1071 "List of articles in the current newsgroup that haven't been downloaded..")
1073 (defvar gnus-newsgroup-unsendable nil
1074 "List of articles in the current newsgroup that won't be sent.")
1076 (defvar gnus-newsgroup-bookmarks nil
1077 "List of articles in the current newsgroup that have bookmarks.")
1079 (defvar gnus-newsgroup-dormant nil
1080 "List of dormant articles in the current newsgroup.")
1082 (defvar gnus-newsgroup-scored nil
1083 "List of scored articles in the current newsgroup.")
1085 (defvar gnus-newsgroup-headers nil
1086 "List of article headers in the current newsgroup.")
1088 (defvar gnus-newsgroup-threads nil
)
1090 (defvar gnus-newsgroup-prepared nil
1091 "Whether the current group has been prepared properly.")
1093 (defvar gnus-newsgroup-ancient nil
1094 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1096 (defvar gnus-newsgroup-sparse nil
)
1098 (defvar gnus-current-article nil
)
1099 (defvar gnus-article-current nil
)
1100 (defvar gnus-current-headers nil
)
1101 (defvar gnus-have-all-headers nil
)
1102 (defvar gnus-last-article nil
)
1103 (defvar gnus-newsgroup-history nil
)
1104 (defvar gnus-newsgroup-charset nil
)
1105 (defvar gnus-newsgroup-ephemeral-charset nil
)
1106 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1108 (defconst gnus-summary-local-variables
1109 '(gnus-newsgroup-name
1110 gnus-newsgroup-begin gnus-newsgroup-end
1111 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1112 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1113 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1114 gnus-newsgroup-unselected gnus-newsgroup-marked
1115 gnus-newsgroup-reads gnus-newsgroup-saved
1116 gnus-newsgroup-replied gnus-newsgroup-expirable
1117 gnus-newsgroup-processable gnus-newsgroup-killed
1118 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1119 gnus-newsgroup-unsendable
1120 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1121 gnus-newsgroup-headers gnus-newsgroup-threads
1122 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1123 gnus-current-article gnus-current-headers gnus-have-all-headers
1124 gnus-last-article gnus-article-internal-prepare-hook
1125 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1126 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1127 gnus-thread-expunge-below
1128 gnus-score-alist gnus-current-score-file
1129 (gnus-summary-expunge-below . global
)
1130 (gnus-summary-mark-below . global
)
1131 (gnus-orphan-score . global
)
1132 gnus-newsgroup-active gnus-scores-exclude-files
1133 gnus-newsgroup-history gnus-newsgroup-ancient
1134 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1135 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1136 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1137 (gnus-newsgroup-expunged-tally .
0)
1138 gnus-cache-removable-articles gnus-newsgroup-cached
1139 gnus-newsgroup-data gnus-newsgroup-data-reverse
1140 gnus-newsgroup-limit gnus-newsgroup-limits
1141 gnus-newsgroup-charset
)
1142 "Variables that are buffer-local to the summary buffers.")
1144 ;; Byte-compiler warning.
1145 (eval-when-compile (defvar gnus-article-mode-map
))
1149 (defvar gnus-decode-encoded-word-methods
1150 '(mail-decode-encoded-word-string)
1151 "List of methods used to decode encoded words.
1153 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1154 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1155 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1156 whose names match REGEXP.
1159 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1160 mail-decode-encoded-word-string
1161 (\"chinese\" . rfc1843-decode-string))")
1163 (defvar gnus-decode-encoded-word-methods-cache nil
)
1165 (defun gnus-multi-decode-encoded-word-string (string)
1166 "Apply the functions from `gnus-encoded-word-methods' that match."
1167 (unless (and gnus-decode-encoded-word-methods-cache
1168 (eq gnus-newsgroup-name
1169 (car gnus-decode-encoded-word-methods-cache
)))
1170 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1173 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1174 (if (and gnus-newsgroup-name
1175 (string-match (car x
) gnus-newsgroup-name
))
1176 (nconc gnus-decode-encoded-word-methods-cache
1178 gnus-decode-encoded-word-methods
))
1179 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1182 (setq string
(funcall (pop xlist
) string
))))
1185 ;; Subject simplification.
1187 (defun gnus-simplify-whitespace (str)
1188 "Remove excessive whitespace from STR."
1191 (while (string-match "[ \t][ \t]+" mystr
)
1192 (setq mystr
(concat (substring mystr
0 (match-beginning 0))
1194 (substring mystr
(match-end 0)))))
1196 (when (string-match "^[ \t]+" mystr
)
1197 (setq mystr
(substring mystr
(match-end 0))))
1199 (when (string-match "[ \t]+$" mystr
)
1200 (setq mystr
(substring mystr
0 (match-beginning 0))))
1203 (defsubst gnus-simplify-subject-re
(subject)
1204 "Remove \"Re:\" from subject lines."
1205 (if (string-match "^[Rr][Ee]: *" subject
)
1206 (substring subject
(match-end 0))
1209 (defun gnus-simplify-subject (subject &optional re-only
)
1210 "Remove `Re:' and words in parentheses.
1211 If RE-ONLY is non-nil, strip leading `Re:'s only."
1212 (let ((case-fold-search t
)) ;Ignore case.
1213 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1214 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1215 (setq subject
(substring subject
(match-end 0))))
1216 ;; Remove uninteresting prefixes.
1217 (when (and (not re-only
)
1218 gnus-simplify-ignored-prefixes
1219 (string-match gnus-simplify-ignored-prefixes subject
))
1220 (setq subject
(substring subject
(match-end 0))))
1221 ;; Remove words in parentheses from end.
1223 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1224 (setq subject
(substring subject
0 (match-beginning 0)))))
1225 ;; Return subject string.
1228 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1230 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1231 (goto-char (point-min))
1232 (while (re-search-forward regexp nil t
)
1233 (replace-match (or newtext
""))))
1235 (defun gnus-simplify-buffer-fuzzy ()
1236 "Simplify string in the buffer fuzzily.
1237 The string in the accessible portion of the current buffer is simplified.
1238 It is assumed to be a single-line subject.
1239 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1240 matter is removed. Additional things can be deleted by setting
1241 `gnus-simplify-subject-fuzzy-regexp'."
1242 (let ((case-fold-search t
)
1244 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1246 (while (not (eq modified-tick
(buffer-modified-tick)))
1247 (setq modified-tick
(buffer-modified-tick))
1249 ((listp gnus-simplify-subject-fuzzy-regexp
)
1250 (mapcar 'gnus-simplify-buffer-fuzzy-step
1251 gnus-simplify-subject-fuzzy-regexp
))
1252 (gnus-simplify-subject-fuzzy-regexp
1253 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1254 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1255 (gnus-simplify-buffer-fuzzy-step
1256 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1257 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1259 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1260 (gnus-simplify-buffer-fuzzy-step " +" " ")
1261 (gnus-simplify-buffer-fuzzy-step " $")
1262 (gnus-simplify-buffer-fuzzy-step "^ +")))
1264 (defun gnus-simplify-subject-fuzzy (subject)
1265 "Simplify a subject string fuzzily.
1266 See `gnus-simplify-buffer-fuzzy' for details."
1268 (gnus-set-work-buffer)
1269 (let ((case-fold-search t
))
1270 ;; Remove uninteresting prefixes.
1271 (when (and gnus-simplify-ignored-prefixes
1272 (string-match gnus-simplify-ignored-prefixes subject
))
1273 (setq subject
(substring subject
(match-end 0))))
1275 (inline (gnus-simplify-buffer-fuzzy))
1278 (defsubst gnus-simplify-subject-fully
(subject)
1279 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1281 (gnus-simplify-subject-functions
1282 (gnus-map-function gnus-simplify-subject-functions subject
))
1283 ((null gnus-summary-gather-subject-limit
)
1284 (gnus-simplify-subject-re subject
))
1285 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1286 (gnus-simplify-subject-fuzzy subject
))
1287 ((numberp gnus-summary-gather-subject-limit
)
1288 (gnus-limit-string (gnus-simplify-subject-re subject
)
1289 gnus-summary-gather-subject-limit
))
1293 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1294 "Check whether two subjects are equal.
1295 If optional argument simple-first is t, first argument is already
1298 ((null simple-first
)
1299 (equal (gnus-simplify-subject-fully s1
)
1300 (gnus-simplify-subject-fully s2
)))
1303 (gnus-simplify-subject-fully s2
)))))
1305 (defun gnus-summary-bubble-group ()
1306 "Increase the score of the current group.
1307 This is a handy function to add to `gnus-summary-exit-hook' to
1308 increase the score of each group you read."
1309 (gnus-group-add-score gnus-newsgroup-name
))
1313 ;;; Gnus summary mode
1316 (put 'gnus-summary-mode
'mode-class
'special
)
1318 (defvar gnus-article-commands-menu
)
1321 ;; Non-orthogonal keys
1323 (gnus-define-keys gnus-summary-mode-map
1324 " " gnus-summary-next-page
1325 "\177" gnus-summary-prev-page
1326 [delete] gnus-summary-prev-page
1327 [backspace] gnus-summary-prev-page
1328 "\r" gnus-summary-scroll-up
1329 "\M-\r" gnus-summary-scroll-down
1330 "n" gnus-summary-next-unread-article
1331 "p" gnus-summary-prev-unread-article
1332 "N" gnus-summary-next-article
1333 "P" gnus-summary-prev-article
1334 "\M-\C-n" gnus-summary-next-same-subject
1335 "\M-\C-p" gnus-summary-prev-same-subject
1336 "\M-n" gnus-summary-next-unread-subject
1337 "\M-p" gnus-summary-prev-unread-subject
1338 "." gnus-summary-first-unread-article
1339 "," gnus-summary-best-unread-article
1340 "\M-s" gnus-summary-search-article-forward
1341 "\M-r" gnus-summary-search-article-backward
1342 "<" gnus-summary-beginning-of-article
1343 ">" gnus-summary-end-of-article
1344 "j" gnus-summary-goto-article
1345 "^" gnus-summary-refer-parent-article
1346 "\M-^" gnus-summary-refer-article
1347 "u" gnus-summary-tick-article-forward
1348 "!" gnus-summary-tick-article-forward
1349 "U" gnus-summary-tick-article-backward
1350 "d" gnus-summary-mark-as-read-forward
1351 "D" gnus-summary-mark-as-read-backward
1352 "E" gnus-summary-mark-as-expirable
1353 "\M-u" gnus-summary-clear-mark-forward
1354 "\M-U" gnus-summary-clear-mark-backward
1355 "k" gnus-summary-kill-same-subject-and-select
1356 "\C-k" gnus-summary-kill-same-subject
1357 "\M-\C-k" gnus-summary-kill-thread
1358 "\M-\C-l" gnus-summary-lower-thread
1359 "e" gnus-summary-edit-article
1360 "#" gnus-summary-mark-as-processable
1361 "\M-#" gnus-summary-unmark-as-processable
1362 "\M-\C-t" gnus-summary-toggle-threads
1363 "\M-\C-s" gnus-summary-show-thread
1364 "\M-\C-h" gnus-summary-hide-thread
1365 "\M-\C-f" gnus-summary-next-thread
1366 "\M-\C-b" gnus-summary-prev-thread
1367 [(meta down)] gnus-summary-next-thread
1368 [(meta up)] gnus-summary-prev-thread
1369 "\M-\C-u" gnus-summary-up-thread
1370 "\M-\C-d" gnus-summary-down-thread
1371 "&" gnus-summary-execute-command
1372 "c" gnus-summary-catchup-and-exit
1373 "\C-w" gnus-summary-mark-region-as-read
1374 "\C-t" gnus-summary-toggle-truncation
1375 "?" gnus-summary-mark-as-dormant
1376 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1377 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1378 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1379 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1380 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1381 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1382 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1383 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1384 "=" gnus-summary-expand-window
1385 "\C-x\C-s" gnus-summary-reselect-current-group
1386 "\M-g" gnus-summary-rescan-group
1387 "w" gnus-summary-stop-page-breaking
1388 "\C-c\C-r" gnus-summary-caesar-message
1389 "f" gnus-summary-followup
1390 "F" gnus-summary-followup-with-original
1391 "C" gnus-summary-cancel-article
1392 "r" gnus-summary-reply
1393 "R" gnus-summary-reply-with-original
1394 "\C-c\C-f" gnus-summary-mail-forward
1395 "o" gnus-summary-save-article
1396 "\C-o" gnus-summary-save-article-mail
1397 "|" gnus-summary-pipe-output
1398 "\M-k" gnus-summary-edit-local-kill
1399 "\M-K" gnus-summary-edit-global-kill
1401 "\C-c\C-d" gnus-summary-describe-group
1402 "q" gnus-summary-exit
1403 "Q" gnus-summary-exit-no-update
1404 "\C-c\C-i" gnus-info-find-node
1405 gnus-mouse-2 gnus-mouse-pick-article
1406 "m" gnus-summary-mail-other-window
1407 "a" gnus-summary-post-news
1408 "x" gnus-summary-limit-to-unread
1409 "s" gnus-summary-isearch-article
1410 "t" gnus-summary-toggle-header
1411 "g" gnus-summary-show-article
1412 "l" gnus-summary-goto-last-article
1413 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1414 "\C-d" gnus-summary-enter-digest-group
1415 "\M-\C-d" gnus-summary-read-document
1416 "\M-\C-e" gnus-summary-edit-parameters
1417 "\M-\C-a" gnus-summary-customize-parameters
1419 "*" gnus-cache-enter-article
1420 "\M-*" gnus-cache-remove-article
1421 "\M-&" gnus-summary-universal-argument
1422 "\C-l" gnus-recenter
1423 "I" gnus-summary-increase-score
1424 "L" gnus-summary-lower-score
1425 "\M-i" gnus-symbolic-argument
1426 "h" gnus-summary-select-article-buffer
1428 "b" gnus-article-view-part
1429 "\M-t" gnus-summary-toggle-display-buttonized
1431 "V" gnus-summary-score-map
1432 "X" gnus-uu-extract-map
1433 "S" gnus-summary-send-map)
1435 ;; Sort of orthogonal keymap
1436 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1437 "t" gnus-summary-tick-article-forward
1438 "!" gnus-summary-tick-article-forward
1439 "d" gnus-summary-mark-as-read-forward
1440 "r" gnus-summary-mark-as-read-forward
1441 "c" gnus-summary-clear-mark-forward
1442 " " gnus-summary-clear-mark-forward
1443 "e" gnus-summary-mark-as-expirable
1444 "x" gnus-summary-mark-as-expirable
1445 "?" gnus-summary-mark-as-dormant
1446 "b" gnus-summary-set-bookmark
1447 "B" gnus-summary-remove-bookmark
1448 "#" gnus-summary-mark-as-processable
1449 "\M-#" gnus-summary-unmark-as-processable
1450 "S" gnus-summary-limit-include-expunged
1451 "C" gnus-summary-catchup
1452 "H" gnus-summary-catchup-to-here
1453 "\C-c" gnus-summary-catchup-all
1454 "k" gnus-summary-kill-same-subject-and-select
1455 "K" gnus-summary-kill-same-subject
1456 "P" gnus-uu-mark-map)
1458 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1459 "c" gnus-summary-clear-above
1460 "u" gnus-summary-tick-above
1461 "m" gnus-summary-mark-above
1462 "k" gnus-summary-kill-below)
1464 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1465 "/" gnus-summary-limit-to-subject
1466 "n" gnus-summary-limit-to-articles
1467 "w" gnus-summary-pop-limit
1468 "s" gnus-summary-limit-to-subject
1469 "a" gnus-summary-limit-to-author
1470 "u" gnus-summary-limit-to-unread
1471 "m" gnus-summary-limit-to-marks
1472 "M" gnus-summary-limit-exclude-marks
1473 "v" gnus-summary-limit-to-score
1474 "*" gnus-summary-limit-include-cached
1475 "D" gnus-summary-limit-include-dormant
1476 "T" gnus-summary-limit-include-thread
1477 "d" gnus-summary-limit-exclude-dormant
1478 "t" gnus-summary-limit-to-age
1479 "x" gnus-summary-limit-to-extra
1480 "E" gnus-summary-limit-include-expunged
1481 "c" gnus-summary-limit-exclude-childless-dormant
1482 "C" gnus-summary-limit-mark-excluded-as-read)
1484 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1485 "n" gnus-summary-next-unread-article
1486 "p" gnus-summary-prev-unread-article
1487 "N" gnus-summary-next-article
1488 "P" gnus-summary-prev-article
1489 "\C-n" gnus-summary-next-same-subject
1490 "\C-p" gnus-summary-prev-same-subject
1491 "\M-n" gnus-summary-next-unread-subject
1492 "\M-p" gnus-summary-prev-unread-subject
1493 "f" gnus-summary-first-unread-article
1494 "b" gnus-summary-best-unread-article
1495 "j" gnus-summary-goto-article
1496 "g" gnus-summary-goto-subject
1497 "l" gnus-summary-goto-last-article
1498 "o" gnus-summary-pop-article)
1500 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1501 "k" gnus-summary-kill-thread
1502 "l" gnus-summary-lower-thread
1503 "i" gnus-summary-raise-thread
1504 "T" gnus-summary-toggle-threads
1505 "t" gnus-summary-rethread-current
1506 "^" gnus-summary-reparent-thread
1507 "s" gnus-summary-show-thread
1508 "S" gnus-summary-show-all-threads
1509 "h" gnus-summary-hide-thread
1510 "H" gnus-summary-hide-all-threads
1511 "n" gnus-summary-next-thread
1512 "p" gnus-summary-prev-thread
1513 "u" gnus-summary-up-thread
1514 "o" gnus-summary-top-thread
1515 "d" gnus-summary-down-thread
1516 "#" gnus-uu-mark-thread
1517 "\M-#" gnus-uu-unmark-thread)
1519 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1520 "g" gnus-summary-prepare
1521 "c" gnus-summary-insert-cached-articles)
1523 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1524 "c" gnus-summary-catchup-and-exit
1525 "C" gnus-summary-catchup-all-and-exit
1526 "E" gnus-summary-exit-no-update
1527 "Q" gnus-summary-exit
1528 "Z" gnus-summary-exit
1529 "n" gnus-summary-catchup-and-goto-next-group
1530 "R" gnus-summary-reselect-current-group
1531 "G" gnus-summary-rescan-group
1532 "N" gnus-summary-next-group
1533 "s" gnus-summary-save-newsrc
1534 "P" gnus-summary-prev-group)
1536 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1537 " " gnus-summary-next-page
1538 "n" gnus-summary-next-page
1539 "\177" gnus-summary-prev-page
1540 [delete] gnus-summary-prev-page
1541 "p" gnus-summary-prev-page
1542 "\r" gnus-summary-scroll-up
1543 "\M-\r" gnus-summary-scroll-down
1544 "<" gnus-summary-beginning-of-article
1545 ">" gnus-summary-end-of-article
1546 "b" gnus-summary-beginning-of-article
1547 "e" gnus-summary-end-of-article
1548 "^" gnus-summary-refer-parent-article
1549 "r" gnus-summary-refer-parent-article
1550 "D" gnus-summary-enter-digest-group
1551 "R" gnus-summary-refer-references
1552 "T" gnus-summary-refer-thread
1553 "g" gnus-summary-show-article
1554 "s" gnus-summary-isearch-article
1555 "P" gnus-summary-print-article
1556 "t" gnus-article-babel
)
1558 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1559 "b" gnus-article-add-buttons
1560 "B" gnus-article-add-buttons-to-head
1561 "o" gnus-article-treat-overstrike
1562 "e" gnus-article-emphasize
1563 "w" gnus-article-fill-cited-article
1564 "Q" gnus-article-fill-long-lines
1565 "C" gnus-article-capitalize-sentences
1566 "c" gnus-article-remove-cr
1567 "q" gnus-article-de-quoted-unreadable
1568 "6" gnus-article-de-base64-unreadable
1569 "Z" gnus-article-decode-HZ
1570 "h" gnus-article-wash-html
1571 "f" gnus-article-display-x-face
1572 "l" gnus-summary-stop-page-breaking
1573 "r" gnus-summary-caesar-message
1574 "t" gnus-summary-toggle-header
1575 "v" gnus-summary-verbose-headers
1576 "H" gnus-article-strip-headers-in-body
1577 "d" gnus-article-treat-dumbquotes
)
1579 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1580 "a" gnus-article-hide
1581 "h" gnus-article-hide-headers
1582 "b" gnus-article-hide-boring-headers
1583 "s" gnus-article-hide-signature
1584 "c" gnus-article-hide-citation
1585 "C" gnus-article-hide-citation-in-followups
1586 "l" gnus-article-hide-list-identifiers
1587 "p" gnus-article-hide-pgp
1588 "B" gnus-article-strip-banner
1589 "P" gnus-article-hide-pem
1590 "\C-c" gnus-article-hide-citation-maybe
)
1592 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1593 "a" gnus-article-highlight
1594 "h" gnus-article-highlight-headers
1595 "c" gnus-article-highlight-citation
1596 "s" gnus-article-highlight-signature
)
1598 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1599 "w" gnus-article-decode-mime-words
1600 "c" gnus-article-decode-charset
1601 "v" gnus-mime-view-all-parts
1602 "b" gnus-article-view-part
)
1604 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1605 "z" gnus-article-date-ut
1606 "u" gnus-article-date-ut
1607 "l" gnus-article-date-local
1608 "e" gnus-article-date-lapsed
1609 "o" gnus-article-date-original
1610 "i" gnus-article-date-iso8601
1611 "s" gnus-article-date-user
)
1613 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1614 "t" gnus-article-remove-trailing-blank-lines
1615 "l" gnus-article-strip-leading-blank-lines
1616 "m" gnus-article-strip-multiple-blank-lines
1617 "a" gnus-article-strip-blank-lines
1618 "A" gnus-article-strip-all-blank-lines
1619 "s" gnus-article-strip-leading-space
1620 "e" gnus-article-strip-trailing-space
)
1622 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1624 "f" gnus-summary-fetch-faq
1625 "d" gnus-summary-describe-group
1626 "h" gnus-summary-describe-briefly
1627 "i" gnus-info-find-node
)
1629 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1630 "e" gnus-summary-expire-articles
1631 "\M-\C-e" gnus-summary-expire-articles-now
1632 "\177" gnus-summary-delete-article
1633 [delete] gnus-summary-delete-article
1634 [backspace] gnus-summary-delete-article
1635 "m" gnus-summary-move-article
1636 "r" gnus-summary-respool-article
1637 "w" gnus-summary-edit-article
1638 "c" gnus-summary-copy-article
1639 "B" gnus-summary-crosspost-article
1640 "q" gnus-summary-respool-query
1641 "t" gnus-summary-respool-trace
1642 "i" gnus-summary-import-article
1643 "p" gnus-summary-article-posted-p)
1645 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1646 "o" gnus-summary-save-article
1647 "m" gnus-summary-save-article-mail
1648 "F" gnus-summary-write-article-file
1649 "r" gnus-summary-save-article-rmail
1650 "f" gnus-summary-save-article-file
1651 "b" gnus-summary-save-article-body-file
1652 "h" gnus-summary-save-article-folder
1653 "v" gnus-summary-save-article-vm
1654 "p" gnus-summary-pipe-output
1655 "s" gnus-soup-add-article)
1657 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1658 "b" gnus-summary-display-buttonized
1659 "m" gnus-summary-repair-multipart
1660 "v" gnus-article-view-part
1661 "o" gnus-article-save-part
1662 "c" gnus-article-copy-part
1663 "e" gnus-article-externalize-part
1664 "i" gnus-article-inline-part
1665 "|" gnus-article-pipe-part))
1667 (defun gnus-summary-make-menu-bar ()
1668 (gnus-turn-off-edit-menu 'summary)
1670 (unless (boundp 'gnus-summary-misc-menu)
1673 gnus-summary-kill-menu gnus-summary-mode-map ""
1678 ["Enter score..." gnus-summary-score-entry t]
1679 ["Customize" gnus-score-customize t])
1680 (gnus-make-score-map 'increase)
1681 (gnus-make-score-map 'lower)
1683 ["Kill below" gnus-summary-kill-below t]
1684 ["Mark above" gnus-summary-mark-above t]
1685 ["Tick above" gnus-summary-tick-above t]
1686 ["Clear above" gnus-summary-clear-above t])
1687 ["Current score" gnus-summary-current-score t]
1688 ["Set score" gnus-summary-set-score t]
1689 ["Switch current score file..." gnus-score-change-score-file t]
1690 ["Set mark below..." gnus-score-set-mark-below t]
1691 ["Set expunge below..." gnus-score-set-expunge-below t]
1692 ["Edit current score file" gnus-score-edit-current-scores t]
1693 ["Edit score file" gnus-score-edit-file t]
1694 ["Trace score" gnus-score-find-trace t]
1695 ["Find words" gnus-score-find-favourite-words t]
1696 ["Rescore buffer" gnus-summary-rescore t]
1697 ["Increase score..." gnus-summary-increase-score t]
1698 ["Lower score..." gnus-summary-lower-score t]))))
1700 ;; Define both the Article menu in the summary buffer and the equivalent
1701 ;; Commands menu in the article buffer here for consistency.
1704 ["All" gnus-article-hide t]
1705 ["Headers" gnus-article-hide-headers t]
1706 ["Signature" gnus-article-hide-signature t]
1707 ["Citation" gnus-article-hide-citation t]
1708 ["List identifiers" gnus-article-hide-list-identifiers t]
1709 ["PGP" gnus-article-hide-pgp t]
1710 ["Banner" gnus-article-strip-banner t]
1711 ["Boring headers" gnus-article-hide-boring-headers t])
1713 ["All" gnus-article-highlight t]
1714 ["Headers" gnus-article-highlight-headers t]
1715 ["Signature" gnus-article-highlight-signature t]
1716 ["Citation" gnus-article-highlight-citation t])
1718 ["Words" gnus-article-decode-mime-words t]
1719 ["Charset" gnus-article-decode-charset t]
1720 ["QP" gnus-article-de-quoted-unreadable t]
1721 ["Base64" gnus-article-de-base64-unreadable t]
1722 ["View all" gnus-mime-view-all-parts t])
1724 ["Local" gnus-article-date-local t]
1725 ["ISO8601" gnus-article-date-iso8601 t]
1726 ["UT" gnus-article-date-ut t]
1727 ["Original" gnus-article-date-original t]
1728 ["Lapsed" gnus-article-date-lapsed t]
1729 ["User-defined" gnus-article-date-user t])
1732 ["Leading" gnus-article-strip-leading-blank-lines t]
1733 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1734 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1735 ["All of the above" gnus-article-strip-blank-lines t]
1736 ["All" gnus-article-strip-all-blank-lines t]
1737 ["Leading space" gnus-article-strip-leading-space t]
1738 ["Trailing space" gnus-article-strip-trailing-space t])
1739 ["Overstrike" gnus-article-treat-overstrike t]
1740 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1741 ["Emphasis" gnus-article-emphasize t]
1742 ["Word wrap" gnus-article-fill-cited-article t]
1743 ["Fill long lines" gnus-article-fill-long-lines t]
1744 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1745 ["CR" gnus-article-remove-cr t]
1746 ["Show X-Face" gnus-article-display-x-face t]
1747 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1748 ["Base64" gnus-article-de-base64-unreadable t]
1749 ["Rot 13" gnus-summary-caesar-message
1750 :help "\"Caesar rotate\" article by 13"]
1751 ["Unix pipe" gnus-summary-pipe-message t]
1752 ["Add buttons" gnus-article-add-buttons t]
1753 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1754 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1755 ["Verbose header" gnus-summary-verbose-headers t]
1756 ["Toggle header" gnus-summary-toggle-header t]
1757 ["Html" gnus-article-wash-html t]
1758 ["HZ" gnus-article-decode-HZ t])
1760 ["Save in default format" gnus-summary-save-article
1761 :help "Save article using default method"]
1762 ["Save in file" gnus-summary-save-article-file
1763 :help "Save article in file"]
1764 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1765 ["Save in MH folder" gnus-summary-save-article-folder t]
1766 ["Save in VM folder" gnus-summary-save-article-vm t]
1767 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1768 ["Save body in file" gnus-summary-save-article-body-file t]
1769 ["Pipe through a filter" gnus-summary-pipe-output t]
1770 ["Add to SOUP packet" gnus-soup-add-article t]
1771 ["Print" gnus-summary-print-article t])
1773 ["Respool article..." gnus-summary-respool-article t]
1774 ["Move article..." gnus-summary-move-article
1775 (gnus-check-backend-function
1776 'request-move-article gnus-newsgroup-name)]
1777 ["Copy article..." gnus-summary-copy-article t]
1778 ["Crosspost article..." gnus-summary-crosspost-article
1779 (gnus-check-backend-function
1780 'request-replace-article gnus-newsgroup-name)]
1781 ["Import file..." gnus-summary-import-article t]
1782 ["Check if posted" gnus-summary-article-posted-p t]
1783 ["Edit article" gnus-summary-edit-article
1784 (not (gnus-group-read-only-p))]
1785 ["Delete article" gnus-summary-delete-article
1786 (gnus-check-backend-function
1787 'request-expire-articles gnus-newsgroup-name)]
1788 ["Query respool" gnus-summary-respool-query t]
1789 ["Trace respool" gnus-summary-respool-trace t]
1790 ["Delete expirable articles" gnus-summary-expire-articles-now
1791 (gnus-check-backend-function
1792 'request-expire-articles gnus-newsgroup-name)])
1794 ["Uudecode" gnus-uu-decode-uu
1795 :help "Decode uuencoded article(s)"]
1796 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1797 ["Unshar" gnus-uu-decode-unshar t]
1798 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1799 ["Save" gnus-uu-decode-save t]
1800 ["Binhex" gnus-uu-decode-binhex t]
1801 ["Postscript" gnus-uu-decode-postscript t])
1803 ["Enter article" gnus-cache-enter-article t]
1804 ["Remove article" gnus-cache-remove-article t])
1805 ["Translate" gnus-article-babel t]
1806 ["Select article buffer" gnus-summary-select-article-buffer t]
1807 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1808 ["Isearch article..." gnus-summary-isearch-article t]
1809 ["Beginning of the article" gnus-summary-beginning-of-article t]
1810 ["End of the article" gnus-summary-end-of-article t]
1811 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1812 ["Fetch referenced articles" gnus-summary-refer-references t]
1813 ["Fetch current thread" gnus-summary-refer-thread t]
1814 ["Fetch article with id..." gnus-summary-refer-article t]
1815 ["Redisplay" gnus-summary-show-article t])))
1817 gnus-summary-article-menu gnus-summary-mode-map ""
1818 (cons "Article" innards))
1820 (if (not (keymapp gnus-summary-article-menu))
1822 gnus-article-commands-menu gnus-article-mode-map ""
1823 (cons "Commands" innards))
1824 ;; in Emacs, don't share menu.
1825 (setq gnus-article-commands-menu
1826 (copy-keymap gnus-summary-article-menu))
1827 (define-key gnus-article-mode-map [menu-bar commands]
1828 (cons "Commands" gnus-article-commands-menu))))
1831 gnus-summary-thread-menu gnus-summary-mode-map ""
1833 ["Toggle threading" gnus-summary-toggle-threads t]
1834 ["Hide threads" gnus-summary-hide-all-threads t]
1835 ["Show threads" gnus-summary-show-all-threads t]
1836 ["Hide thread" gnus-summary-hide-thread t]
1837 ["Show thread" gnus-summary-show-thread t]
1838 ["Go to next thread" gnus-summary-next-thread t]
1839 ["Go to previous thread" gnus-summary-prev-thread t]
1840 ["Go down thread" gnus-summary-down-thread t]
1841 ["Go up thread" gnus-summary-up-thread t]
1842 ["Top of thread" gnus-summary-top-thread t]
1843 ["Mark thread as read" gnus-summary-kill-thread t]
1844 ["Lower thread score" gnus-summary-lower-thread t]
1845 ["Raise thread score" gnus-summary-raise-thread t]
1846 ["Rethread current" gnus-summary-rethread-current t]))
1849 gnus-summary-post-menu gnus-summary-mode-map ""
1851 ["Post an article" gnus-summary-post-news
1852 :help "Post an article"]
1853 ["Followup" gnus-summary-followup
1854 :help "Post followup to this article"]
1855 ["Followup and yank" gnus-summary-followup-with-original
1856 :help "Post followup to this article, quoting its contents"]
1857 ["Supersede article" gnus-summary-supersede-article t]
1858 ["Cancel article" gnus-summary-cancel-article
1859 :help "Cancel an article you posted"]
1860 ["Reply" gnus-summary-reply t]
1861 ["Reply and yank" gnus-summary-reply-with-original t]
1862 ["Wide reply" gnus-summary-wide-reply t]
1863 ["Wide reply and yank" gnus-summary-wide-reply-with-original
1864 :help "Mail a reply, quoting this article"]
1865 ["Mail forward" gnus-summary-mail-forward t]
1866 ["Post forward" gnus-summary-post-forward t]
1867 ["Digest and mail" gnus-uu-digest-mail-forward t]
1868 ["Digest and post" gnus-uu-digest-post-forward t]
1869 ["Resend message" gnus-summary-resend-message t]
1870 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1871 ["Send a mail" gnus-summary-mail-other-window t]
1872 ["Uuencode and post" gnus-uu-post-news
1873 :help "Post a uuencoded article"]
1874 ["Followup via news" gnus-summary-followup-to-mail t]
1875 ["Followup via news and yank"
1876 gnus-summary-followup-to-mail-with-original t]
1878 ;;["Send" gnus-summary-send-draft t]
1879 ;;["Send bounced" gnus-resend-bounced-mail t])
1883 gnus-summary-misc-menu gnus-summary-mode-map ""
1886 ["Mark as read" gnus-summary-mark-as-read-forward t]
1887 ["Mark same subject and select"
1888 gnus-summary-kill-same-subject-and-select t]
1889 ["Mark same subject" gnus-summary-kill-same-subject t]
1890 ["Catchup" gnus-summary-catchup
1891 :help "Mark unread articles in this group as read"]
1892 ["Catchup all" gnus-summary-catchup-all t]
1893 ["Catchup to here" gnus-summary-catchup-to-here t]
1894 ["Catchup region" gnus-summary-mark-region-as-read t]
1895 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1897 ["Tick" gnus-summary-tick-article-forward t]
1898 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1899 ["Remove marks" gnus-summary-clear-mark-forward t]
1900 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1901 ["Set bookmark" gnus-summary-set-bookmark t]
1902 ["Remove bookmark" gnus-summary-remove-bookmark t])
1904 ["Marks..." gnus-summary-limit-to-marks t]
1905 ["Subject..." gnus-summary-limit-to-subject t]
1906 ["Author..." gnus-summary-limit-to-author t]
1907 ["Age..." gnus-summary-limit-to-age t]
1908 ["Extra..." gnus-summary-limit-to-extra t]
1909 ["Score" gnus-summary-limit-to-score t]
1910 ["Unread" gnus-summary-limit-to-unread t]
1911 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1912 ["Articles" gnus-summary-limit-to-articles t]
1913 ["Pop limit" gnus-summary-pop-limit t]
1914 ["Show dormant" gnus-summary-limit-include-dormant t]
1915 ["Hide childless dormant"
1916 gnus-summary-limit-exclude-childless-dormant t]
1917 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1918 ["Hide marked" gnus-summary-limit-exclude-marks t]
1919 ["Show expunged" gnus-summary-show-all-expunged t])
1921 ["Set mark" gnus-summary-mark-as-processable t]
1922 ["Remove mark" gnus-summary-unmark-as-processable t]
1923 ["Remove all marks" gnus-summary-unmark-all-processable t]
1924 ["Mark above" gnus-uu-mark-over t]
1925 ["Mark series" gnus-uu-mark-series t]
1926 ["Mark region" gnus-uu-mark-region t]
1927 ["Unmark region" gnus-uu-unmark-region t]
1928 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1929 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1930 ["Mark all" gnus-uu-mark-all t]
1931 ["Mark buffer" gnus-uu-mark-buffer t]
1932 ["Mark sparse" gnus-uu-mark-sparse t]
1933 ["Mark thread" gnus-uu-mark-thread t]
1934 ["Unmark thread" gnus-uu-unmark-thread t]
1935 ("Process Mark Sets"
1936 ["Kill" gnus-summary-kill-process-mark t]
1937 ["Yank" gnus-summary-yank-process-mark
1938 gnus-newsgroup-process-stack]
1939 ["Save" gnus-summary-save-process-mark t]))
1941 ["Page forward" gnus-summary-next-page
1942 :help "Show next page of article"]
1943 ["Page backward" gnus-summary-prev-page
1944 :help "Show previous page of article"]
1945 ["Line forward" gnus-summary-scroll-up t])
1947 ["Next unread article" gnus-summary-next-unread-article t]
1948 ["Previous unread article" gnus-summary-prev-unread-article t]
1949 ["Next article" gnus-summary-next-article t]
1950 ["Previous article" gnus-summary-prev-article t]
1951 ["Next unread subject" gnus-summary-next-unread-subject t]
1952 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1953 ["Next article same subject" gnus-summary-next-same-subject t]
1954 ["Previous article same subject" gnus-summary-prev-same-subject t]
1955 ["First unread article" gnus-summary-first-unread-article t]
1956 ["Best unread article" gnus-summary-best-unread-article t]
1957 ["Go to subject number..." gnus-summary-goto-subject t]
1958 ["Go to article number..." gnus-summary-goto-article t]
1959 ["Go to the last article" gnus-summary-goto-last-article t]
1960 ["Pop article off history" gnus-summary-pop-article t])
1962 ["Sort by number" gnus-summary-sort-by-number t]
1963 ["Sort by author" gnus-summary-sort-by-author t]
1964 ["Sort by subject" gnus-summary-sort-by-subject t]
1965 ["Sort by date" gnus-summary-sort-by-date t]
1966 ["Sort by score" gnus-summary-sort-by-score t]
1967 ["Sort by lines" gnus-summary-sort-by-lines t]
1968 ["Sort by characters" gnus-summary-sort-by-chars t])
1970 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1971 ["Describe group" gnus-summary-describe-group t]
1972 ["Read manual" gnus-info-find-node t])
1974 ["Pick and read" gnus-pick-mode t]
1975 ["Binary" gnus-binary-mode t])
1977 ["Regenerate" gnus-summary-prepare t]
1978 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1979 ["Toggle threading" gnus-summary-toggle-threads t])
1980 ["Filter articles..." gnus-summary-execute-command t]
1981 ["Run command on subjects..." gnus-summary-universal-argument t]
1982 ["Search articles forward..." gnus-summary-search-article-forward t]
1983 ["Search articles backward..." gnus-summary-search-article-backward t]
1984 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1985 ["Expand window" gnus-summary-expand-window t]
1986 ["Expire expirable articles" gnus-summary-expire-articles
1987 (gnus-check-backend-function
1988 'request-expire-articles gnus-newsgroup-name)]
1989 ["Edit local kill file" gnus-summary-edit-local-kill t]
1990 ["Edit main kill file" gnus-summary-edit-global-kill t]
1991 ["Edit group parameters" gnus-summary-edit-parameters t]
1992 ["Customize group parameters" gnus-summary-customize-parameters t]
1993 ["Send a bug report" gnus-bug t]
1995 ["Catchup and exit" gnus-summary-catchup-and-exit
1996 :help "Mark unread articles in this group as read, then exit"]
1997 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1998 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1999 ["Exit group" gnus-summary-exit
2000 :help "Exit current group, return to group selection mode"]
2001 ["Exit group without updating" gnus-summary-exit-no-update t]
2002 ["Exit and goto next group" gnus-summary-next-group t]
2003 ["Exit and goto prev group" gnus-summary-prev-group t]
2004 ["Reselect group" gnus-summary-reselect-current-group t]
2005 ["Rescan group" gnus-summary-rescan-group t]
2006 ["Update dribble" gnus-summary-save-newsrc t])))
2008 (gnus-run-hooks 'gnus-summary-menu-hook)))
2010 (defvar gnus-summary-tool-bar-map nil)
2012 ;; Emacs 21 tool bar. Should be no-op otherwise.
2013 ;; NB: A new function tool-bar-local-item-from-menu is added in Emacs
2014 ;; 21.2.50+. Considering many users use Emacs 21, use
2015 ;; tool-bar-add-item-from-menu here.
2016 (defun gnus-summary-make-tool-bar ()
2018 (condition-case nil (require 'tool-bar) (error nil))
2019 (fboundp 'tool-bar-add-item-from-menu)
2020 (default-value 'tool-bar-mode)
2021 (not gnus-summary-tool-bar-map))
2022 (setq gnus-summary-tool-bar-map
2023 (let ((tool-bar-map (make-sparse-keymap)))
2024 (tool-bar-add-item-from-menu
2025 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2026 (tool-bar-add-item-from-menu
2027 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2028 (tool-bar-add-item-from-menu
2029 'gnus-summary-post-news "post" gnus-summary-mode-map)
2030 (tool-bar-add-item-from-menu
2031 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2032 (tool-bar-add-item-from-menu
2033 'gnus-summary-followup "followup" gnus-summary-mode-map)
2034 (tool-bar-add-item-from-menu
2035 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2036 (tool-bar-add-item-from-menu
2037 'gnus-summary-reply "reply" gnus-summary-mode-map)
2038 (tool-bar-add-item-from-menu
2039 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2040 (tool-bar-add-item-from-menu
2041 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2042 (tool-bar-add-item-from-menu
2043 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2044 (tool-bar-add-item-from-menu
2045 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2046 (tool-bar-add-item-from-menu
2047 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2048 (tool-bar-add-item-from-menu
2049 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2050 (tool-bar-add-item-from-menu
2051 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2052 (tool-bar-add-item-from-menu
2053 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2055 (if gnus-summary-tool-bar-map
2056 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2058 (defun gnus-score-set-default (var value)
2059 "A version of set that updates the GNU Emacs menu-bar."
2061 ;; It is the message that forces the active status to be updated.
2064 (defun gnus-make-score-map (type)
2065 "Make a summary score map of type TYPE."
2068 (let ((headers '(("author" "from" string)
2069 ("subject" "subject" string)
2070 ("article body" "body" string)
2071 ("article head" "head" string)
2072 ("xref" "xref" string)
2073 ("extra header" "extra" string)
2074 ("lines" "lines" number)
2075 ("followups to author" "followup" string)))
2076 (types '((number ("less than" <)
2079 (string ("substring" s)
2083 (perms '(("temporary" (current-time-string))
2091 (if (eq type 'lower)
2096 (setq header (car headers))
2102 (let ((ts (cdr (assoc (nth 2 header) types)))
2118 'gnus-summary-score-entry
2120 (if (or (string= (nth 1 header)
2122 (string= (nth 1 header)
2125 (list 'gnus-summary-header
2127 (list 'quote (nth 1 (car ts)))
2128 (list 'gnus-score-delta-default
2135 (list (nreverse outp))))
2138 (list (nreverse outt))))
2140 (setq headers (cdr headers)))
2141 (list (nreverse outh))))))))
2145 (defun gnus-summary-mode (&optional group)
2146 "Major mode for reading articles.
2148 All normal editing commands are switched off.
2149 \\<gnus-summary-mode-map>
2150 Each line in this buffer represents one article. To read an
2151 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2152 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2155 You can also post articles and send mail from this buffer. To
2156 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2157 of an article, type `\\[gnus-summary-reply]'.
2159 There are approx. one gazillion commands you can execute in this
2160 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2162 The following commands are available:
2164 \\{gnus-summary-mode-map}"
2166 (kill-all-local-variables)
2167 (when (gnus-visual-p 'summary-menu 'menu)
2168 (gnus-summary-make-menu-bar)
2169 (gnus-summary-make-tool-bar))
2170 (gnus-summary-make-local-variables)
2171 (gnus-make-thread-indent-array)
2172 (gnus-simplify-mode-line)
2173 (setq major-mode 'gnus-summary-mode)
2174 (setq mode-name "Summary")
2175 (make-local-variable 'minor-mode-alist)
2176 (use-local-map gnus-summary-mode-map)
2177 (buffer-disable-undo)
2178 (setq buffer-read-only t) ;Disable modification
2179 (setq truncate-lines t)
2180 (setq selective-display t)
2181 (setq selective-display-ellipses t) ;Display `...'
2182 (gnus-summary-set-display-table)
2183 (gnus-set-default-directory)
2184 (setq gnus-newsgroup-name group)
2185 (make-local-variable 'gnus-summary-line-format)
2186 (make-local-variable 'gnus-summary-line-format-spec)
2187 (make-local-variable 'gnus-summary-dummy-line-format)
2188 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2189 (make-local-variable 'gnus-summary-mark-positions)
2190 (make-local-hook 'pre-command-hook)
2191 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2192 (gnus-run-hooks 'gnus-summary-mode-hook)
2193 (mm-enable-multibyte)
2194 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2195 (gnus-update-summary-mark-positions))
2197 (defun gnus-summary-make-local-variables ()
2198 "Make all the local summary buffer variables."
2200 (dolist (local gnus-summary-local-variables)
2203 (if (eq (cdr local) 'global)
2204 ;; Copy the global value of the variable.
2205 (setq global (symbol-value (car local)))
2206 ;; Use the value from the list.
2207 (setq global (eval (cdr local))))
2208 (set (make-local-variable (car local)) global))
2209 ;; Simple nil-valued local variable.
2210 (set (make-local-variable local) nil)))))
2212 (defun gnus-summary-clear-local-variables ()
2213 (let ((locals gnus-summary-local-variables))
2215 (if (consp (car locals))
2216 (and (vectorp (caar locals))
2217 (set (caar locals) nil))
2218 (and (vectorp (car locals))
2219 (set (car locals) nil)))
2220 (setq locals (cdr locals)))))
2222 ;; Summary data functions.
2224 (defmacro gnus-data-number (data)
2227 (defmacro gnus-data-set-number (data number)
2228 `(setcar ,data ,number))
2230 (defmacro gnus-data-mark (data)
2233 (defmacro gnus-data-set-mark (data mark)
2234 `(setcar (nthcdr 1 ,data) ,mark))
2236 (defmacro gnus-data-pos (data)
2239 (defmacro gnus-data-set-pos (data pos)
2240 `(setcar (nthcdr 2 ,data) ,pos))
2242 (defmacro gnus-data-header (data)
2245 (defmacro gnus-data-set-header (data header)
2246 `(setf (nth 3 ,data) ,header))
2248 (defmacro gnus-data-level (data)
2251 (defmacro gnus-data-unread-p (data)
2252 `(= (nth 1 ,data) gnus-unread-mark))
2254 (defmacro gnus-data-read-p (data)
2255 `(/= (nth 1 ,data) gnus-unread-mark))
2257 (defmacro gnus-data-pseudo-p (data)
2258 `(consp (nth 3 ,data)))
2260 (defmacro gnus-data-find (number)
2261 `(assq ,number gnus-newsgroup-data))
2263 (defmacro gnus-data-find-list (number &optional data)
2264 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2265 (memq (assq ,number bdata)
2268 (defmacro gnus-data-make (number mark pos header level)
2269 `(list ,number ,mark ,pos ,header ,level))
2271 (defun gnus-data-enter (after-article number mark pos header level offset)
2272 (let ((data (gnus-data-find-list after-article)))
2274 (error "No such article: %d" after-article))
2275 (setcdr data (cons (gnus-data-make number mark pos header level)
2277 (setq gnus-newsgroup-data-reverse nil)
2278 (gnus-data-update-list (cddr data) offset)))
2280 (defun gnus-data-enter-list (after-article list &optional offset)
2282 (let ((data (and after-article (gnus-data-find-list after-article)))
2286 (let ((odata gnus-newsgroup-data))
2287 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2289 (gnus-data-update-list odata offset)))
2290 ;; Find the last element in the list to be spliced into the main
2293 (setq list (cdr list)))
2296 (setcdr list gnus-newsgroup-data)
2297 (setq gnus-newsgroup-data ilist)
2299 (gnus-data-update-list (cdr list) offset)))
2300 (setcdr list (cdr data))
2303 (gnus-data-update-list (cdr list) offset))))
2304 (setq gnus-newsgroup-data-reverse nil))))
2306 (defun gnus-data-remove (article &optional offset)
2307 (let ((data gnus-newsgroup-data))
2308 (if (= (gnus-data-number (car data)) article)
2310 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2311 gnus-newsgroup-data-reverse nil)
2313 (gnus-data-update-list gnus-newsgroup-data offset)))
2315 (when (= (gnus-data-number (cadr data)) article)
2316 (setcdr data (cddr data))
2318 (gnus-data-update-list (cdr data) offset))
2320 gnus-newsgroup-data-reverse nil))
2321 (setq data (cdr data))))))
2323 (defmacro gnus-data-list (backward)
2325 (or gnus-newsgroup-data-reverse
2326 (setq gnus-newsgroup-data-reverse
2327 (reverse gnus-newsgroup-data)))
2328 gnus-newsgroup-data))
2330 (defun gnus-data-update-list (data offset)
2331 "Add OFFSET to the POS of all data entries in DATA."
2332 (setq gnus-newsgroup-data-reverse nil)
2334 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2335 (setq data (cdr data))))
2337 (defun gnus-summary-article-pseudo-p (article)
2338 "Say whether this article is a pseudo article or not."
2339 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2341 (defmacro gnus-summary-article-sparse-p (article)
2342 "Say whether this article is a sparse article or not."
2343 `(memq ,article gnus-newsgroup-sparse))
2345 (defmacro gnus-summary-article-ancient-p (article)
2346 "Say whether this article is a sparse article or not."
2347 `(memq ,article gnus-newsgroup-ancient))
2349 (defun gnus-article-parent-p (number)
2350 "Say whether this article is a parent or not."
2351 (let ((data (gnus-data-find-list number)))
2352 (and (cdr data) ; There has to be an article after...
2353 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2354 (gnus-data-level (nth 1 data))))))
2356 (defun gnus-article-children (number)
2357 "Return a list of all children to NUMBER."
2358 (let* ((data (gnus-data-find-list number))
2359 (level (gnus-data-level (car data)))
2361 (setq data (cdr data))
2363 (= (gnus-data-level (car data)) (1+ level)))
2364 (push (gnus-data-number (car data)) children)
2365 (setq data (cdr data)))
2368 (defmacro gnus-summary-skip-intangible ()
2369 "If the current article is intangible, then jump to a different article."
2370 '(let ((to (get-text-property (point) 'gnus-intangible)))
2371 (and to (gnus-summary-goto-subject to))))
2373 (defmacro gnus-summary-article-intangible-p ()
2374 "Say whether this article is intangible or not."
2375 '(get-text-property (point) 'gnus-intangible))
2377 (defun gnus-article-read-p (article)
2378 "Say whether ARTICLE is read or not."
2379 (not (or (memq article gnus-newsgroup-marked)
2380 (memq article gnus-newsgroup-unreads)
2381 (memq article gnus-newsgroup-unselected)
2382 (memq article gnus-newsgroup-dormant))))
2384 ;; Some summary mode macros.
2386 (defmacro gnus-summary-article-number ()
2387 "The article number of the article on the current line.
2388 If there isn's an article number here, then we return the current
2391 (gnus-summary-skip-intangible)
2392 (or (get-text-property (point) 'gnus-number)
2393 (gnus-summary-last-subject))))
2395 (defmacro gnus-summary-article-header (&optional number)
2396 "Return the header of article NUMBER."
2397 `(gnus-data-header (gnus-data-find
2398 ,(or number '(gnus-summary-article-number)))))
2400 (defmacro gnus-summary-thread-level (&optional number)
2401 "Return the level of thread that starts with article NUMBER."
2402 `(if (and (eq gnus-summary-make-false-root 'dummy)
2403 (get-text-property (point) 'gnus-intangible))
2405 (gnus-data-level (gnus-data-find
2406 ,(or number '(gnus-summary-article-number))))))
2408 (defmacro gnus-summary-article-mark (&optional number)
2409 "Return the mark of article NUMBER."
2410 `(gnus-data-mark (gnus-data-find
2411 ,(or number '(gnus-summary-article-number)))))
2413 (defmacro gnus-summary-article-pos (&optional number)
2414 "Return the position of the line of article NUMBER."
2415 `(gnus-data-pos (gnus-data-find
2416 ,(or number '(gnus-summary-article-number)))))
2418 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2419 (defmacro gnus-summary-article-subject (&optional number)
2420 "Return current subject string or nil if nothing."
2423 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2424 '(gnus-data-header (assq (gnus-summary-article-number)
2425 gnus-newsgroup-data)))))
2428 (mail-header-subject headers))))
2430 (defmacro gnus-summary-article-score (&optional number)
2431 "Return current article score."
2432 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2433 gnus-newsgroup-scored))
2434 gnus-summary-default-score 0))
2436 (defun gnus-summary-article-children (&optional number)
2437 "Return a list of article numbers that are children of article NUMBER."
2438 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2439 (level (gnus-data-level (car data)))
2441 (while (and (setq data (cdr data))
2442 (> (setq l (gnus-data-level (car data))) level))
2443 (and (= (1+ level) l)
2444 (push (gnus-data-number (car data))
2446 (nreverse children)))
2448 (defun gnus-summary-article-parent (&optional number)
2449 "Return the article number of the parent of article NUMBER."
2450 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2451 (gnus-data-list t)))
2452 (level (gnus-data-level (car data))))
2454 () ; This is a root.
2455 ;; We search until we find an article with a level less than
2456 ;; this one. That function has to be the parent.
2457 (while (and (setq data (cdr data))
2458 (not (< (gnus-data-level (car data)) level))))
2459 (and data (gnus-data-number (car data))))))
2461 (defun gnus-unread-mark-p (mark)
2462 "Say whether MARK is the unread mark."
2463 (= mark gnus-unread-mark))
2465 (defun gnus-read-mark-p (mark)
2466 "Say whether MARK is one of the marks that mark as read.
2467 This is all marks except unread, ticked, dormant, and expirable."
2468 (not (or (= mark gnus-unread-mark)
2469 (= mark gnus-ticked-mark)
2470 (= mark gnus-dormant-mark)
2471 (= mark gnus-expirable-mark))))
2473 (defmacro gnus-article-mark (number)
2474 "Return the MARK of article NUMBER.
2475 This macro should only be used when computing the mark the \"first\"
2476 time; i.e., when generating the summary lines. After that,
2477 `gnus-summary-article-mark' should be used to examine the
2480 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2481 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2482 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2483 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2484 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2485 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2486 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2487 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2488 gnus-ancient-mark))))
2490 ;; Saving hidden threads.
2492 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2493 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2495 (defmacro gnus-save-hidden-threads (&rest forms)
2496 "Save hidden threads, eval FORMS, and restore the hidden threads."
2497 (let ((config (make-symbol "config")))
2498 `(let ((,config (gnus-hidden-threads-configuration)))
2502 (gnus-restore-hidden-threads-configuration ,config)))))
2504 (defun gnus-data-compute-positions ()
2505 "Compute the positions of all articles."
2506 (setq gnus-newsgroup-data-reverse nil)
2507 (let ((data gnus-newsgroup-data))
2509 (gnus-save-hidden-threads
2510 (gnus-summary-show-all-threads)
2511 (goto-char (point-min))
2513 (while (get-text-property (point) 'gnus-intangible)
2515 (gnus-data-set-pos (car data) (+ (point) 3))
2516 (setq data (cdr data))
2517 (forward-line 1))))))
2519 (defun gnus-hidden-threads-configuration ()
2520 "Return the current hidden threads configuration."
2523 (goto-char (point-min))
2524 (while (search-forward "\r" nil t)
2525 (push (1- (point)) config))
2528 (defun gnus-restore-hidden-threads-configuration (config)
2529 "Restore hidden threads configuration from CONFIG."
2531 (let (point buffer-read-only)
2532 (while (setq point (pop config))
2533 (when (and (< point (point-max))
2535 (eq (char-after) ?\n))
2536 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2538 ;; Various summary mode internalish functions.
2540 (defun gnus-mouse-pick-article (e)
2543 (gnus-summary-next-page nil t))
2545 (defun gnus-summary-set-display-table ()
2546 "Change the display table.
2547 Odd characters have a tendency to mess
2548 up nicely formatted displays - we make all possible glyphs
2549 display only a single character."
2551 ;; We start from the standard display table, if any.
2552 (let ((table (or (copy-sequence standard-display-table)
2553 (make-display-table)))
2555 ;; Nix out all the control chars...
2556 (while (>= (setq i (1- i)) 0)
2557 (aset table i [??]))
2558 ;; ... but not newline and cr, of course. (cr is necessary for the
2559 ;; selective display).
2560 (aset table ?\n nil)
2561 (aset table ?\r nil)
2562 ;; We keep TAB as well.
2563 (aset table ?\t nil)
2564 ;; We nix out any glyphs over 126 that are not set already.
2566 (while (>= (setq i (1- i)) 127)
2567 ;; Only modify if the entry is nil.
2568 (unless (aref table i)
2569 (aset table i [??]))))
2570 (setq buffer-display-table table)))
2572 (defun gnus-summary-setup-buffer (group)
2573 "Initialize summary buffer."
2574 (let ((buffer (concat "*Summary " group "*")))
2575 (if (get-buffer buffer)
2578 (setq gnus-summary-buffer (current-buffer))
2579 (not gnus-newsgroup-prepared))
2580 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2581 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2582 (gnus-summary-mode group)
2584 (gnus-carpal-setup-buffer 'summary))
2585 (unless gnus-single-article-buffer
2586 (make-local-variable 'gnus-article-buffer)
2587 (make-local-variable 'gnus-article-current)
2588 (make-local-variable 'gnus-original-article-buffer))
2589 (setq gnus-newsgroup-name group)
2592 (defun gnus-set-global-variables ()
2593 "Set the global equivalents of the buffer-local variables.
2594 They are set to the latest values they had. These reflect the summary
2595 buffer that was in action when the last article was fetched."
2596 (when (eq major-mode 'gnus-summary-mode)
2597 (setq gnus-summary-buffer (current-buffer))
2598 (let ((name gnus-newsgroup-name)
2599 (marked gnus-newsgroup-marked)
2600 (unread gnus-newsgroup-unreads)
2601 (headers gnus-current-headers)
2602 (data gnus-newsgroup-data)
2603 (summary gnus-summary-buffer)
2604 (article-buffer gnus-article-buffer)
2605 (original gnus-original-article-buffer)
2606 (gac gnus-article-current)
2607 (reffed gnus-reffed-article-number)
2608 (score-file gnus-current-score-file)
2609 (default-charset gnus-newsgroup-charset))
2611 (set-buffer gnus-group-buffer)
2612 (setq gnus-newsgroup-name name
2613 gnus-newsgroup-marked marked
2614 gnus-newsgroup-unreads unread
2615 gnus-current-headers headers
2616 gnus-newsgroup-data data
2617 gnus-article-current gac
2618 gnus-summary-buffer summary
2619 gnus-article-buffer article-buffer
2620 gnus-original-article-buffer original
2621 gnus-reffed-article-number reffed
2622 gnus-current-score-file score-file
2623 gnus-newsgroup-charset default-charset)
2624 ;; The article buffer also has local variables.
2625 (when (gnus-buffer-live-p gnus-article-buffer)
2626 (set-buffer gnus-article-buffer)
2627 (setq gnus-summary-buffer summary))))))
2629 (defun gnus-summary-article-unread-p (article)
2630 "Say whether ARTICLE is unread or not."
2631 (memq article gnus-newsgroup-unreads))
2633 (defun gnus-summary-first-article-p (&optional article)
2634 "Return whether ARTICLE is the first article in the buffer."
2635 (if (not (setq article (or article (gnus-summary-article-number))))
2637 (eq article (caar gnus-newsgroup-data))))
2639 (defun gnus-summary-last-article-p (&optional article)
2640 "Return whether ARTICLE is the last article in the buffer."
2641 (if (not (setq article (or article (gnus-summary-article-number))))
2642 ;; All non-existent numbers are the last article. :-)
2644 (not (cdr (gnus-data-find-list article)))))
2646 (defun gnus-make-thread-indent-array ()
2648 (unless (and gnus-thread-indent-array
2649 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2650 (setq gnus-thread-indent-array (make-vector 201 "")
2651 gnus-thread-indent-array-level gnus-thread-indent-level)
2653 (aset gnus-thread-indent-array n
2654 (make-string (* n gnus-thread-indent-level) ? ))
2657 (defun gnus-update-summary-mark-positions ()
2658 "Compute where the summary marks are to go."
2660 (when (gnus-buffer-exists-p gnus-summary-buffer)
2661 (set-buffer gnus-summary-buffer))
2662 (let ((gnus-replied-mark 129)
2663 (gnus-score-below-mark 130)
2664 (gnus-score-over-mark 130)
2665 (gnus-download-mark 131)
2666 (spec gnus-summary-line-format-spec)
2669 (gnus-set-work-buffer)
2670 (let ((gnus-summary-line-format-spec spec)
2671 (gnus-newsgroup-downloadable '((0 . t))))
2672 (gnus-summary-insert-line
2673 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2674 (goto-char (point-min))
2675 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2676 (- (point) (point-min) 1)))))
2677 (goto-char (point-min))
2678 (push (cons 'replied (and (search-forward "\201" nil t)
2679 (- (point) (point-min) 1)))
2681 (goto-char (point-min))
2682 (push (cons 'score (and (search-forward "\202" nil t)
2683 (- (point) (point-min) 1)))
2685 (goto-char (point-min))
2686 (push (cons 'download
2687 (and (search-forward "\203" nil t)
2688 (- (point) (point-min) 1)))
2690 (setq gnus-summary-mark-positions pos))))
2692 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2693 "Insert a dummy root in the summary buffer."
2695 (gnus-add-text-properties
2696 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2697 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2699 (defun gnus-summary-from-or-to-or-newsgroups (header)
2700 (let ((to (cdr (assq 'To (mail-header-extra header))))
2701 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2702 (mail-parse-charset gnus-newsgroup-charset)
2703 (mail-parse-ignored-charsets
2704 (save-excursion (set-buffer gnus-summary-buffer)
2705 gnus-newsgroup-ignored-charsets)))
2708 gnus-ignored-from-addresses
2709 (string-match gnus-ignored-from-addresses
2710 (mail-header-from header)))
2712 (or (car (funcall gnus-extract-address-components
2714 gnus-decode-encoded-word-function to)))
2715 (funcall gnus-decode-encoded-word-function to))))
2717 gnus-ignored-from-addresses
2718 (string-match gnus-ignored-from-addresses
2719 (mail-header-from header)))
2720 (concat "=> " newsgroups))
2722 (or (car (funcall gnus-extract-address-components
2723 (mail-header-from header)))
2724 (mail-header-from header))))))
2726 (defun gnus-summary-insert-line (gnus-tmp-header
2727 gnus-tmp-level gnus-tmp-current
2728 gnus-tmp-unread gnus-tmp-replied
2729 gnus-tmp-expirable gnus-tmp-subject-or-nil
2730 &optional gnus-tmp-dummy gnus-tmp-score
2732 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2733 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2734 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2735 (gnus-tmp-score-char
2736 (if (or (null gnus-summary-default-score)
2737 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2738 gnus-summary-zcore-fuzz))
2740 (if (< gnus-tmp-score gnus-summary-default-score)
2741 gnus-score-below-mark gnus-score-over-mark)))
2743 (cond (gnus-tmp-process gnus-process-mark)
2744 ((memq gnus-tmp-current gnus-newsgroup-cached)
2746 (gnus-tmp-replied gnus-replied-mark)
2747 ((memq gnus-tmp-current gnus-newsgroup-saved)
2749 (t gnus-unread-mark)))
2750 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2753 ((string-match "<[^>]+> *$" gnus-tmp-from)
2754 (let ((beg (match-beginning 0)))
2755 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2756 (substring gnus-tmp-from (1+ (match-beginning 0))
2757 (1- (match-end 0))))
2758 (substring gnus-tmp-from 0 beg))))
2759 ((string-match "(.+)" gnus-tmp-from)
2760 (substring gnus-tmp-from
2761 (1+ (match-beginning 0)) (1- (match-end 0))))
2763 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2764 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2765 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2766 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2767 (buffer-read-only nil))
2768 (when (string= gnus-tmp-name "")
2769 (setq gnus-tmp-name gnus-tmp-from))
2770 (unless (numberp gnus-tmp-lines)
2771 (setq gnus-tmp-lines 0))
2772 (gnus-put-text-property
2774 (progn (eval gnus-summary-line-format-spec) (point))
2775 'gnus-number gnus-tmp-number)
2776 (when (gnus-visual-p 'summary-highlight 'highlight)
2778 (gnus-run-hooks 'gnus-summary-update-hook)
2781 (defun gnus-summary-update-line (&optional dont-update)
2782 "Update summary line after change."
2783 (when (and gnus-summary-default-score
2784 (not gnus-summary-inhibit-highlight))
2785 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2786 (article (gnus-summary-article-number))
2787 (score (gnus-summary-article-score article)))
2789 (if (and gnus-summary-mark-below
2790 (< (gnus-summary-article-score)
2791 gnus-summary-mark-below))
2792 ;; This article has a low score, so we mark it as read.
2793 (when (memq article gnus-newsgroup-unreads)
2794 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2795 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2796 ;; This article was previously marked as read on account
2797 ;; of a low score, but now it has risen, so we mark it as
2799 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2800 (gnus-summary-update-mark
2801 (if (or (null gnus-summary-default-score)
2802 (<= (abs (- score gnus-summary-default-score))
2803 gnus-summary-zcore-fuzz))
2805 (if (< score gnus-summary-default-score)
2806 gnus-score-below-mark gnus-score-over-mark))
2808 ;; Do visual highlighting.
2809 (when (gnus-visual-p 'summary-highlight 'highlight)
2810 (gnus-run-hooks 'gnus-summary-update-hook)))))
2812 (defvar gnus-tmp-new-adopts nil)
2814 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2815 "Return the number of articles in THREAD.
2816 This may be 0 in some cases -- if none of the articles in
2817 the thread are to be displayed."
2819 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2821 ((not (listp thread))
2823 ((and (consp thread) (cdr thread))
2826 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2829 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2832 (when (and level (zerop level) gnus-tmp-new-adopts)
2835 'gnus-summary-number-of-articles-in-thread
2836 gnus-tmp-new-adopts))))
2838 (if (> number 1) gnus-not-empty-thread-mark
2839 gnus-empty-thread-mark)
2842 (defun gnus-summary-set-local-parameters (group)
2843 "Go through the local params of GROUP and set all variable specs in that list."
2844 (let ((params (gnus-group-find-parameter group))
2847 (setq elem (car params)
2848 params (cdr params))
2849 (and (consp elem) ; Has to be a cons.
2850 (consp (cdr elem)) ; The cdr has to be a list.
2851 (symbolp (car elem)) ; Has to be a symbol in there.
2852 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2853 (ignore-errors ; So we set it.
2854 (make-local-variable (car elem))
2855 (set (car elem) (eval (nth 1 elem))))))))
2857 (defun gnus-summary-read-group (group &optional show-all no-article
2858 kill-buffer no-display backward
2860 "Start reading news in newsgroup GROUP.
2861 If SHOW-ALL is non-nil, already read articles are also listed.
2862 If NO-ARTICLE is non-nil, no article is selected initially.
2863 If NO-DISPLAY, don't generate a summary buffer."
2867 (let ((gnus-auto-select-next nil))
2868 (or (gnus-summary-read-group-1
2869 group show-all no-article
2870 kill-buffer no-display
2873 select-articles nil)))))
2874 (eq gnus-auto-select-next 'quietly))
2875 (set-buffer gnus-group-buffer)
2876 ;; The entry function called above goes to the next
2877 ;; group automatically, so we go two groups back
2878 ;; if we are searching for the previous group.
2880 (gnus-group-prev-unread-group 2))
2881 (if (not (equal group (gnus-group-group-name)))
2882 (setq group (gnus-group-group-name))
2886 (defun gnus-summary-read-group-1 (group show-all no-article
2887 kill-buffer no-display
2888 &optional select-articles)
2889 ;; Killed foreign groups can't be entered.
2890 (when (and (not (gnus-group-native-p group))
2891 (not (gnus-gethash group gnus-newsrc-hashtb)))
2892 (error "Dead non-native groups can't be entered"))
2893 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2894 (let* ((new-group (gnus-summary-setup-buffer group))
2895 (quit-config (gnus-group-quit-config group))
2896 (did-select (and new-group (gnus-select-newsgroup
2897 group show-all select-articles))))
2899 ;; This summary buffer exists already, so we just select it.
2901 (gnus-set-global-variables)
2903 (gnus-kill-or-deaden-summary kill-buffer))
2904 (gnus-configure-windows 'summary 'force)
2905 (gnus-set-mode-line 'summary)
2906 (gnus-summary-position-point)
2909 ;; We couldn't select this group.
2911 (when (and (eq major-mode 'gnus-summary-mode)
2912 (not (equal (current-buffer) kill-buffer)))
2913 (kill-buffer (current-buffer))
2914 (if (not quit-config)
2916 ;; Update the info -- marks might need to be removed,
2918 (gnus-summary-update-info)
2919 (set-buffer gnus-group-buffer)
2920 (gnus-group-jump-to-group group)
2921 (gnus-group-next-unread-group 1))
2922 (gnus-handle-ephemeral-exit quit-config)))
2923 (gnus-message 3 "Can't select group")
2925 ;; The user did a `C-g' while prompting for number of articles,
2926 ;; so we exit this group.
2927 ((eq did-select 'quit)
2928 (and (eq major-mode 'gnus-summary-mode)
2929 (not (equal (current-buffer) kill-buffer))
2930 (kill-buffer (current-buffer)))
2932 (gnus-kill-or-deaden-summary kill-buffer))
2933 (if (not quit-config)
2935 (set-buffer gnus-group-buffer)
2936 (gnus-group-jump-to-group group)
2937 (gnus-group-next-unread-group 1)
2938 (gnus-configure-windows 'group 'force))
2939 (gnus-handle-ephemeral-exit quit-config))
2940 ;; Finally signal the quit.
2942 ;; The group was successfully selected.
2944 (gnus-set-global-variables)
2945 ;; Save the active value in effect when the group was entered.
2946 (setq gnus-newsgroup-active
2948 (gnus-active gnus-newsgroup-name)))
2949 ;; You can change the summary buffer in some way with this hook.
2950 (gnus-run-hooks 'gnus-select-group-hook)
2951 ;; Set any local variables in the group parameters.
2952 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2953 (gnus-update-format-specifications
2954 nil 'summary 'summary-mode 'summary-dummy)
2955 (gnus-update-summary-mark-positions)
2956 ;; Do score processing.
2957 (when gnus-use-scoring
2958 (gnus-possibly-score-headers))
2959 ;; Check whether to fill in the gaps in the threads.
2960 (when gnus-build-sparse-threads
2961 (gnus-build-sparse-threads))
2962 ;; Find the initial limit.
2963 (if gnus-show-threads
2965 (let ((gnus-newsgroup-dormant nil))
2966 (gnus-summary-initial-limit show-all))
2967 (gnus-summary-initial-limit show-all))
2968 ;; When untreaded, all articles are always shown.
2969 (setq gnus-newsgroup-limit
2971 (lambda (header) (mail-header-number header))
2972 gnus-newsgroup-headers)))
2973 ;; Generate the summary buffer.
2975 (gnus-summary-prepare))
2976 (when gnus-use-trees
2977 (gnus-tree-open group)
2978 (setq gnus-summary-highlight-line-function
2979 'gnus-tree-highlight-article))
2980 ;; If the summary buffer is empty, but there are some low-scored
2981 ;; articles or some excluded dormants, we include these in the
2983 (when (and (zerop (buffer-size))
2985 (cond (gnus-newsgroup-dormant
2986 (gnus-summary-limit-include-dormant))
2987 ((and gnus-newsgroup-scored show-all)
2988 (gnus-summary-limit-include-expunged t))))
2989 ;; Function `gnus-apply-kill-file' must be called in this hook.
2990 (gnus-run-hooks 'gnus-apply-kill-hook)
2991 (if (and (zerop (buffer-size))
2994 ;; This newsgroup is empty.
2995 (gnus-summary-catchup-and-exit nil t)
2996 (gnus-message 6 "No unread news")
2998 (gnus-kill-or-deaden-summary kill-buffer))
2999 ;; Return nil from this function.
3001 ;; Hide conversation thread subtrees. We cannot do this in
3002 ;; gnus-summary-prepare-hook since kill processing may not
3003 ;; work with hidden articles.
3004 (and gnus-show-threads
3005 gnus-thread-hide-subtree
3006 (gnus-summary-hide-all-threads))
3008 (gnus-kill-or-deaden-summary kill-buffer))
3009 ;; Show first unread article if requested.
3010 (if (and (not no-article)
3012 gnus-newsgroup-unreads
3013 gnus-auto-select-first)
3015 (gnus-configure-windows 'summary)
3017 ((eq gnus-auto-select-first 'best)
3018 (gnus-summary-best-unread-article))
3019 ((eq gnus-auto-select-first t)
3020 (gnus-summary-first-unread-article))
3021 ((gnus-functionp gnus-auto-select-first)
3022 (funcall gnus-auto-select-first))))
3023 ;; Don't select any articles, just move point to the first
3024 ;; article in the group.
3025 (goto-char (point-min))
3026 (gnus-summary-position-point)
3027 (gnus-configure-windows 'summary 'force)
3028 (gnus-set-mode-line 'summary))
3029 (when (get-buffer-window gnus-group-buffer t)
3030 ;; Gotta use windows, because recenter does weird stuff if
3031 ;; the current buffer ain't the displayed window.
3032 (let ((owin (selected-window)))
3033 (select-window (get-buffer-window gnus-group-buffer t))
3034 (when (gnus-group-goto-group group)
3036 (select-window owin)))
3037 ;; Mark this buffer as "prepared".
3038 (setq gnus-newsgroup-prepared t)
3039 (gnus-run-hooks 'gnus-summary-prepared-hook)
3042 (defun gnus-summary-prepare ()
3043 "Generate the summary buffer."
3045 (let ((buffer-read-only nil))
3047 (setq gnus-newsgroup-data nil
3048 gnus-newsgroup-data-reverse nil)
3049 (gnus-run-hooks 'gnus-summary-generate-hook)
3050 ;; Generate the buffer, either with threads or without.
3051 (when gnus-newsgroup-headers
3052 (gnus-summary-prepare-threads
3053 (if gnus-show-threads
3054 (gnus-sort-gathered-threads
3055 (funcall gnus-summary-thread-gathering-function
3057 (gnus-cut-threads (gnus-make-threads)))))
3058 ;; Unthreaded display.
3059 (gnus-sort-articles gnus-newsgroup-headers))))
3060 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3061 ;; Call hooks for modifying summary buffer.
3062 (goto-char (point-min))
3063 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3065 (defsubst gnus-general-simplify-subject (subject)
3066 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3069 ;; Truncate the subject.
3070 (gnus-simplify-subject-functions
3071 (gnus-map-function gnus-simplify-subject-functions subject))
3072 ((numberp gnus-summary-gather-subject-limit)
3073 (setq subject (gnus-simplify-subject-re subject))
3074 (if (> (length subject) gnus-summary-gather-subject-limit)
3075 (substring subject 0 gnus-summary-gather-subject-limit)
3077 ;; Fuzzily simplify it.
3078 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3079 (gnus-simplify-subject-fuzzy subject))
3080 ;; Just remove the leading "Re:".
3082 (gnus-simplify-subject-re subject))))
3084 (if (and gnus-summary-gather-exclude-subject
3085 (string-match gnus-summary-gather-exclude-subject subject))
3086 nil ; This article shouldn't be gathered
3089 (defun gnus-summary-simplify-subject-query ()
3090 "Query where the respool algorithm would put this article."
3092 (gnus-summary-select-article)
3093 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3095 (defun gnus-gather-threads-by-subject (threads)
3096 "Gather threads by looking at Subject headers."
3097 (if (not gnus-summary-make-false-root)
3099 (let ((hashtb (gnus-make-hashtable 1024))
3102 subject hthread whole-subject)
3104 (setq subject (gnus-general-simplify-subject
3105 (setq whole-subject (mail-header-subject
3108 (if (setq hthread (gnus-gethash subject hashtb))
3110 ;; We enter a dummy root into the thread, if we
3111 ;; haven't done that already.
3112 (unless (stringp (caar hthread))
3113 (setcar hthread (list whole-subject (car hthread))))
3114 ;; We add this new gathered thread to this gathered
3116 (setcdr (car hthread)
3117 (nconc (cdar hthread) (list (car threads))))
3118 ;; Remove it from the list of threads.
3119 (setcdr prev (cdr threads))
3120 (setq threads prev))
3121 ;; Enter this thread into the hash table.
3122 (gnus-sethash subject threads hashtb)))
3124 (setq threads (cdr threads)))
3127 (defun gnus-gather-threads-by-references (threads)
3128 "Gather threads by looking at References headers."
3129 (let ((idhashtb (gnus-make-hashtable 1024))
3130 (thhashtb (gnus-make-hashtable 1024))
3133 ids references id gthread gid entered ref)
3135 (when (setq references (mail-header-references (caar threads)))
3136 (setq id (mail-header-id (caar threads))
3137 ids (gnus-split-references references)
3139 (while (setq ref (pop ids))
3140 (setq ids (delete ref ids))
3141 (if (not (setq gid (gnus-gethash ref idhashtb)))
3143 (gnus-sethash ref id idhashtb)
3144 (gnus-sethash id threads thhashtb))
3145 (setq gthread (gnus-gethash gid thhashtb))
3147 ;; We enter a dummy root into the thread, if we
3148 ;; haven't done that already.
3149 (unless (stringp (caar gthread))
3150 (setcar gthread (list (mail-header-subject (caar gthread))
3152 ;; We add this new gathered thread to this gathered
3154 (setcdr (car gthread)
3155 (nconc (cdar gthread) (list (car threads)))))
3156 ;; Add it into the thread hash table.
3157 (gnus-sethash id gthread thhashtb)
3159 ;; Remove it from the list of threads.
3160 (setcdr prev (cdr threads))
3161 (setq threads prev))))
3163 (setq threads (cdr threads)))
3166 (defun gnus-sort-gathered-threads (threads)
3167 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3168 (let ((result threads))
3170 (when (stringp (caar threads))
3171 (setcdr (car threads)
3172 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3173 (setq threads (cdr threads)))
3176 (defun gnus-thread-loop-p (root thread)
3177 "Say whether ROOT is in THREAD."
3178 (let ((stack (list thread))
3181 (while (setq thread (pop stack))
3182 (setq th (cdr thread))
3184 (not (eq (caar th) root)))
3187 ;; We have found a loop.
3189 (setcdr thread (delq (car th) (cdr thread)))
3190 (if (boundp (setq ref-dep (intern "none"
3191 gnus-newsgroup-dependencies)))
3192 (setcdr (symbol-value ref-dep)
3193 (nconc (cdr (symbol-value ref-dep))
3195 (set ref-dep (list nil (car th))))
3198 ;; Push all the subthreads onto the stack.
3199 (push (cdr thread) stack)))
3202 (defun gnus-make-threads ()
3203 "Go through the dependency hashtb and find the roots. Return all threads."
3205 (while (catch 'infloop
3208 ;; Deal with self-referencing References loops.
3209 (when (and (car (symbol-value refs))
3216 (car (symbol-value refs)) thread))
3217 (cdr (symbol-value refs)))))))
3220 (unless (car (symbol-value refs))
3221 ;; These threads do not refer back to any other articles,
3222 ;; so they're roots.
3223 (setq threads (append (cdr (symbol-value refs)) threads))))
3224 gnus-newsgroup-dependencies)))
3227 ;; Build the thread tree.
3228 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3229 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3231 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3232 if it was already present.
3234 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3235 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3236 Message-IDs will be renamed be renamed to a unique Message-ID before
3239 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3240 (let* ((id (mail-header-id header))
3241 (id-dep (and id (intern id dependencies)))
3242 ref ref-dep ref-header)
3243 ;; Enter this `header' in the `dependencies' table.
3247 ;; The first two cases do the normal part: enter a new `header'
3248 ;; in the `dependencies' table.
3249 ((not (boundp id-dep))
3250 (set id-dep (list header)))
3251 ((null (car (symbol-value id-dep)))
3252 (setcar (symbol-value id-dep) header))
3254 ;; From here the `header' was already present in the
3255 ;; `dependencies' table.
3257 ;; Overrides an existing entry;
3258 ;; just set the header part of the entry.
3259 (setcar (symbol-value id-dep) header))
3261 ;; Renames the existing `header' to a unique Message-ID.
3262 ((not gnus-summary-ignore-duplicates)
3263 ;; An article with this Message-ID has already been seen.
3264 ;; We rename the Message-ID.
3265 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3267 (mail-header-set-id header id))
3269 ;; The last case ignores an existing entry, except it adds any
3270 ;; additional Xrefs (in case the two articles came from different
3272 ;; Also sets `header' to `nil' meaning that the `dependencies'
3273 ;; table was *not* modified.
3275 (mail-header-set-xref
3276 (car (symbol-value id-dep))
3277 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3279 (or (mail-header-xref header) "")))
3283 ;; First check if that we are not creating a References loop.
3284 (setq ref (gnus-parent-id (mail-header-references header)))
3286 (setq ref-dep (intern-soft ref dependencies))
3288 (setq ref-header (car (symbol-value ref-dep))))
3289 (if (string= id ref)
3290 ;; Yuk! This is a reference loop. Make the article be a
3293 (mail-header-set-references (car (symbol-value id-dep)) "none")
3295 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3296 (setq ref (gnus-parent-id (mail-header-references header)))
3297 (setq ref-dep (intern (or ref "none") dependencies))
3298 (if (boundp ref-dep)
3299 (setcdr (symbol-value ref-dep)
3300 (nconc (cdr (symbol-value ref-dep))
3301 (list (symbol-value id-dep))))
3302 (set ref-dep (list nil (symbol-value id-dep)))))
3305 (defun gnus-build-sparse-threads ()
3306 (let ((headers gnus-newsgroup-headers)
3307 (mail-parse-charset gnus-newsgroup-charset)
3308 (gnus-summary-ignore-duplicates t)
3309 header references generation relations
3310 subject child end new-child date)
3311 ;; First we create an alist of generations/relations, where
3312 ;; generations is how much we trust the relation, and the relation
3314 (gnus-message 7 "Making sparse threads...")
3316 (nnheader-set-temp-buffer " *gnus sparse threads*")
3317 (while (setq header (pop headers))
3318 (when (and (setq references (mail-header-references header))
3319 (not (string= references "")))
3321 (setq child (mail-header-id header)
3322 subject (mail-header-subject header)
3323 date (mail-header-date header)
3325 (while (search-backward ">" nil t)
3326 (setq end (1+ (point)))
3327 (when (search-backward "<" nil t)
3328 (setq new-child (buffer-substring (point) end))
3329 (push (list (incf generation)
3330 child (setq child new-child)
3334 (push (list (1+ generation) child nil subject) relations))
3336 (kill-buffer (current-buffer)))
3337 ;; Sort over trustworthiness.
3340 (when (gnus-dependencies-add-header
3341 (make-full-mail-header
3342 gnus-reffed-article-number
3343 (nth 3 relation) "" (or (nth 4 relation) "")
3345 (or (nth 2 relation) "") 0 0 "")
3346 gnus-newsgroup-dependencies nil)
3347 (push gnus-reffed-article-number gnus-newsgroup-limit)
3348 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3349 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3350 gnus-newsgroup-reads)
3351 (decf gnus-reffed-article-number)))
3352 (sort relations 'car-less-than-car))
3353 (gnus-message 7 "Making sparse threads...done")))
3355 (defun gnus-build-old-threads ()
3356 ;; Look at all the articles that refer back to old articles, and
3357 ;; fetch the headers for the articles that aren't there. This will
3358 ;; build complete threads - if the roots haven't been expired by the
3360 (let ((mail-parse-charset gnus-newsgroup-charset)
3364 (when (not (car (symbol-value refs)))
3365 (setq heads (cdr (symbol-value refs)))
3367 (if (memq (mail-header-number (caar heads))
3368 gnus-newsgroup-dormant)
3369 (setq heads (cdr heads))
3370 (setq id (symbol-name refs))
3371 (while (and (setq id (gnus-build-get-header id))
3372 (not (car (gnus-id-to-thread id)))))
3373 (setq heads nil)))))
3374 gnus-newsgroup-dependencies)))
3376 ;; This function has to be called with point after the article number
3377 ;; on the beginning of the line.
3378 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3379 (let ((eol (gnus-point-at-eol))
3380 (buffer (current-buffer))
3383 ;; overview: [num subject from date id refs chars lines misc]
3386 (narrow-to-region (point) eol)
3391 (make-full-mail-header
3393 (funcall gnus-decode-encoded-word-function
3394 (nnheader-nov-field)) ; subject
3395 (funcall gnus-decode-encoded-word-function
3396 (nnheader-nov-field)) ; from
3397 (nnheader-nov-field) ; date
3398 (nnheader-nov-read-message-id) ; id
3399 (nnheader-nov-field) ; refs
3400 (nnheader-nov-read-integer) ; chars
3401 (nnheader-nov-read-integer) ; lines
3403 (if (looking-at "Xref: ")
3404 (goto-char (match-end 0)))
3405 (nnheader-nov-field)) ; Xref
3406 (nnheader-nov-parse-extra)))) ; extra
3410 (when gnus-alter-header-function
3411 (funcall gnus-alter-header-function header))
3412 (gnus-dependencies-add-header header dependencies force-new)))
3414 (defun gnus-build-get-header (id)
3415 "Look through the buffer of NOV lines and find the header to ID.
3416 Enter this line into the dependencies hash table, and return
3417 the id of the parent article (if any)."
3418 (let ((deps gnus-newsgroup-dependencies)
3422 (set-buffer nntp-server-buffer)
3423 (let ((case-fold-search nil))
3424 (goto-char (point-min))
3425 (while (and (not found)
3426 (search-forward id nil t))
3428 (setq found (looking-at
3429 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3430 (regexp-quote id))))
3431 (or found (beginning-of-line 2)))
3435 (setq header (gnus-nov-parse-line
3436 (read (current-buffer)) deps))
3437 (gnus-parent-id (mail-header-references header))))))
3439 (let ((number (mail-header-number header)))
3440 (push number gnus-newsgroup-limit)
3441 (push header gnus-newsgroup-headers)
3442 (if (memq number gnus-newsgroup-unselected)
3444 (push number gnus-newsgroup-unreads)
3445 (setq gnus-newsgroup-unselected
3446 (delq number gnus-newsgroup-unselected)))
3447 (push number gnus-newsgroup-ancient)))))))
3449 (defun gnus-build-all-threads ()
3450 "Read all the headers."
3451 (let ((gnus-summary-ignore-duplicates t)
3452 (mail-parse-charset gnus-newsgroup-charset)
3453 (dependencies gnus-newsgroup-dependencies)
3456 (set-buffer nntp-server-buffer)
3457 (let ((case-fold-search nil))
3458 (goto-char (point-min))
3461 (setq article (read (current-buffer))
3462 header (gnus-nov-parse-line article dependencies)))
3465 (set-buffer gnus-summary-buffer)
3466 (push header gnus-newsgroup-headers)
3467 (if (memq (setq article (mail-header-number header))
3468 gnus-newsgroup-unselected)
3470 (push article gnus-newsgroup-unreads)
3471 (setq gnus-newsgroup-unselected
3472 (delq article gnus-newsgroup-unselected)))
3473 (push article gnus-newsgroup-ancient)))
3474 (forward-line 1)))))))
3476 (defun gnus-summary-update-article-line (article header)
3477 "Update the line for ARTICLE using HEADERS."
3478 (let* ((id (mail-header-id header))
3479 (thread (gnus-id-to-thread id)))
3481 (error "Article in no thread"))
3482 ;; Update the thread.
3483 (setcar thread header)
3484 (gnus-summary-goto-subject article)
3485 (let* ((datal (gnus-data-find-list article))
3487 (length (when (cdr datal)
3488 (- (gnus-data-pos data)
3489 (gnus-data-pos (cadr datal)))))
3490 (buffer-read-only nil)
3491 (level (gnus-summary-thread-level)))
3493 (gnus-summary-insert-line
3494 header level nil (gnus-article-mark article)
3495 (memq article gnus-newsgroup-replied)
3496 (memq article gnus-newsgroup-expirable)
3497 ;; Only insert the Subject string when it's different
3498 ;; from the previous Subject string.
3503 (mail-header-subject
3506 (gnus-data-find-list
3508 (gnus-data-list t)))))
3509 ;; Error on the side of excessive subjects.
3511 (mail-header-subject header)))
3513 (mail-header-subject header))
3514 nil (cdr (assq article gnus-newsgroup-scored))
3515 (memq article gnus-newsgroup-processable))
3517 (gnus-data-update-list
3518 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3520 (defun gnus-summary-update-article (article &optional iheader)
3521 "Update ARTICLE in the summary buffer."
3522 (set-buffer gnus-summary-buffer)
3523 (let* ((header (gnus-summary-article-header article))
3524 (id (mail-header-id header))
3525 (data (gnus-data-find article))
3526 (thread (gnus-id-to-thread id))
3527 (references (mail-header-references header))
3531 (when (and references
3532 (not (equal "" references)))
3535 (buffer-read-only nil)
3541 (delq thread parent)))
3542 (if (gnus-summary-insert-subject id header)
3543 ;; Set the (possibly) new article number in the data structure.
3544 (gnus-data-set-number data (gnus-id-to-article id))
3548 (defun gnus-rebuild-thread (id &optional line)
3549 "Rebuild the thread containing ID.
3550 If LINE, insert the rebuilt thread starting on line LINE."
3551 (let ((buffer-read-only nil)
3552 old-pos current thread data)
3553 (if (not gnus-show-threads)
3554 (setq thread (list (car (gnus-id-to-thread id))))
3555 ;; Get the thread this article is part of.
3556 (setq thread (gnus-remove-thread id)))
3557 (setq old-pos (gnus-point-at-bol))
3558 (setq current (save-excursion
3559 (and (re-search-backward "[\r\n]" nil t)
3560 (gnus-summary-article-number))))
3561 ;; If this is a gathered thread, we have to go some re-gathering.
3562 (when (stringp (car thread))
3563 (let ((subject (car thread))
3565 (setq thread (cdr thread))
3567 (unless (memq (setq thr (gnus-id-to-thread
3569 (mail-header-id (caar thread)))))
3572 (setq thread (cdr thread)))
3573 ;; We now have all (unique) roots.
3574 (if (= (length roots) 1)
3575 ;; All the loose roots are now one solid root.
3576 (setq thread (car roots))
3577 (setq thread (cons subject (gnus-sort-threads roots))))))
3579 ;; We then insert this thread into the summary buffer.
3581 (goto-char (point-min))
3582 (forward-line (1- line)))
3583 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3584 (if gnus-show-threads
3585 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3586 (gnus-summary-prepare-unthreaded thread))
3587 (setq data (nreverse gnus-newsgroup-data))
3588 (setq threads gnus-newsgroup-threads))
3589 ;; We splice the new data into the data structure.
3590 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3591 ;;!!! then we want to insert at the beginning of the buffer.
3592 ;;!!! That happens to be true with Gnus now, but that may
3593 ;;!!! change in the future. Perhaps.
3594 (gnus-data-enter-list
3595 (if line nil current) data (- (point) old-pos))
3596 (setq gnus-newsgroup-threads
3597 (nconc threads gnus-newsgroup-threads))
3598 (gnus-data-compute-positions))))
3600 (defun gnus-number-to-header (number)
3601 "Return the header for article NUMBER."
3602 (let ((headers gnus-newsgroup-headers))
3604 (not (= number (mail-header-number (car headers)))))
3609 (defun gnus-parent-headers (in-headers &optional generation)
3610 "Return the headers of the GENERATIONeth parent of HEADERS."
3612 (setq generation 1))
3614 (headers in-headers)
3617 (not (zerop generation))
3618 (setq references (mail-header-references headers)))
3619 (setq headers (if (and references
3620 (setq parent (gnus-parent-id references)))
3621 (car (gnus-id-to-thread parent))
3624 (and (not (eq headers in-headers))
3627 (defun gnus-id-to-thread (id)
3628 "Return the (sub-)thread where ID appears."
3629 (gnus-gethash id gnus-newsgroup-dependencies))
3631 (defun gnus-id-to-article (id)
3632 "Return the article number of ID."
3633 (let ((thread (gnus-id-to-thread id)))
3636 (mail-header-number (car thread)))))
3638 (defun gnus-id-to-header (id)
3639 "Return the article headers of ID."
3640 (car (gnus-id-to-thread id)))
3642 (defun gnus-article-displayed-root-p (article)
3643 "Say whether ARTICLE is a root(ish) article."
3644 (let ((level (gnus-summary-thread-level article))
3645 (refs (mail-header-references (gnus-summary-article-header article)))
3651 ((null (gnus-parent-id refs)) t)
3653 (null (setq particle (gnus-id-to-article
3654 (gnus-parent-id refs))))
3655 (null (gnus-summary-thread-level particle)))))))
3657 (defun gnus-root-id (id)
3658 "Return the id of the root of the thread where ID appears."
3660 (while (and id (setq prev (car (gnus-id-to-thread id))))
3662 id (gnus-parent-id (mail-header-references prev))))
3665 (defun gnus-articles-in-thread (thread)
3666 "Return the list of articles in THREAD."
3667 (cons (mail-header-number (car thread))
3668 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3670 (defun gnus-remove-thread (id &optional dont-remove)
3671 "Remove the thread that has ID in it."
3672 (let (headers thread last-id)
3673 ;; First go up in this thread until we find the root.
3674 (setq last-id (gnus-root-id id)
3675 headers (message-flatten-list (gnus-id-to-thread last-id)))
3676 ;; We have now found the real root of this thread. It might have
3677 ;; been gathered into some loose thread, so we have to search
3678 ;; through the threads to find the thread we wanted.
3679 (let ((threads gnus-newsgroup-threads)
3682 (setq sub (car threads))
3683 (if (stringp (car sub))
3684 ;; This is a gathered thread, so we look at the roots
3685 ;; below it to find whether this article is in this
3688 (setq sub (cdr sub))
3690 (when (member (caar sub) headers)
3691 (setq thread (car threads)
3694 (setq sub (cdr sub))))
3695 ;; It's an ordinary thread, so we check it.
3696 (when (eq (car sub) (car headers))
3699 (setq threads (cdr threads)))
3700 ;; If this article is in no thread, then it's a root.
3703 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3704 (setq thread (gnus-id-to-thread last-id)))
3707 thread ; We return this thread.
3709 (if (stringp (car thread))
3711 ;; If we use dummy roots, then we have to remove the
3712 ;; dummy root as well.
3713 (when (eq gnus-summary-make-false-root 'dummy)
3714 ;; We go to the dummy root by going to
3715 ;; the first sub-"thread", and then one line up.
3716 (gnus-summary-goto-article
3717 (mail-header-number (caadr thread)))
3720 (gnus-data-compute-positions))
3721 (setq thread (cdr thread))
3723 (gnus-remove-thread-1 (car thread))
3724 (setq thread (cdr thread))))
3725 (gnus-remove-thread-1 thread))))))))
3727 (defun gnus-remove-thread-1 (thread)
3728 "Remove the thread THREAD recursively."
3729 (let ((number (mail-header-number (pop thread)))
3731 (setq thread (reverse thread))
3733 (gnus-remove-thread-1 (pop thread)))
3734 (when (setq d (gnus-data-find number))
3735 (goto-char (gnus-data-pos d))
3736 (gnus-summary-show-thread)
3739 (- (gnus-point-at-bol)
3741 (1+ (gnus-point-at-eol))
3742 (gnus-delete-line)))))))
3744 (defun gnus-sort-threads-1 (threads func)
3745 (sort (mapcar (lambda (thread)
3748 (gnus-sort-threads-1 (cdr thread) func))))
3751 (defun gnus-sort-threads (threads)
3753 (if (not gnus-thread-sort-functions)
3755 (gnus-message 8 "Sorting threads...")
3757 (gnus-sort-threads-1
3759 (gnus-make-sort-function gnus-thread-sort-functions))
3760 (gnus-message 8 "Sorting threads...done"))))
3762 (defun gnus-sort-articles (articles)
3764 (when gnus-article-sort-functions
3765 (gnus-message 7 "Sorting articles...")
3767 (setq gnus-newsgroup-headers
3768 (sort articles (gnus-make-sort-function
3769 gnus-article-sort-functions)))
3770 (gnus-message 7 "Sorting articles...done"))))
3772 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3773 (defmacro gnus-thread-header (thread)
3774 "Return header of first article in THREAD.
3775 Note that THREAD must never, ever be anything else than a variable -
3776 using some other form will lead to serious barfage."
3777 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3778 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3779 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
3782 (defsubst gnus-article-sort-by-number (h1 h2)
3783 "Sort articles by article number."
3784 (< (mail-header-number h1)
3785 (mail-header-number h2)))
3787 (defun gnus-thread-sort-by-number (h1 h2)
3788 "Sort threads by root article number."
3789 (gnus-article-sort-by-number
3790 (gnus-thread-header h1) (gnus-thread-header h2)))
3792 (defsubst gnus-article-sort-by-lines (h1 h2)
3793 "Sort articles by article Lines header."
3794 (< (mail-header-lines h1)
3795 (mail-header-lines h2)))
3797 (defun gnus-thread-sort-by-lines (h1 h2)
3798 "Sort threads by root article Lines header."
3799 (gnus-article-sort-by-lines
3800 (gnus-thread-header h1) (gnus-thread-header h2)))
3802 (defsubst gnus-article-sort-by-chars (h1 h2)
3803 "Sort articles by octet length."
3804 (< (mail-header-chars h1)
3805 (mail-header-chars h2)))
3807 (defun gnus-thread-sort-by-chars (h1 h2)
3808 "Sort threads by root article octet length."
3809 (gnus-article-sort-by-chars
3810 (gnus-thread-header h1) (gnus-thread-header h2)))
3812 (defsubst gnus-article-sort-by-author (h1 h2)
3813 "Sort articles by root author."
3815 (let ((extract (funcall
3816 gnus-extract-address-components
3817 (mail-header-from h1))))
3818 (or (car extract) (cadr extract) ""))
3819 (let ((extract (funcall
3820 gnus-extract-address-components
3821 (mail-header-from h2))))
3822 (or (car extract) (cadr extract) ""))))
3824 (defun gnus-thread-sort-by-author (h1 h2)
3825 "Sort threads by root author."
3826 (gnus-article-sort-by-author
3827 (gnus-thread-header h1) (gnus-thread-header h2)))
3829 (defsubst gnus-article-sort-by-subject (h1 h2)
3830 "Sort articles by root subject."
3832 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3833 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3835 (defun gnus-thread-sort-by-subject (h1 h2)
3836 "Sort threads by root subject."
3837 (gnus-article-sort-by-subject
3838 (gnus-thread-header h1) (gnus-thread-header h2)))
3840 (defsubst gnus-article-sort-by-date (h1 h2)
3841 "Sort articles by root article date."
3843 (gnus-date-get-time (mail-header-date h1))
3844 (gnus-date-get-time (mail-header-date h2))))
3846 (defun gnus-thread-sort-by-date (h1 h2)
3847 "Sort threads by root article date."
3848 (gnus-article-sort-by-date
3849 (gnus-thread-header h1) (gnus-thread-header h2)))
3851 (defsubst gnus-article-sort-by-score (h1 h2)
3852 "Sort articles by root article score.
3853 Unscored articles will be counted as having a score of zero."
3854 (> (or (cdr (assq (mail-header-number h1)
3855 gnus-newsgroup-scored))
3856 gnus-summary-default-score 0)
3857 (or (cdr (assq (mail-header-number h2)
3858 gnus-newsgroup-scored))
3859 gnus-summary-default-score 0)))
3861 (defun gnus-thread-sort-by-score (h1 h2)
3862 "Sort threads by root article score."
3863 (gnus-article-sort-by-score
3864 (gnus-thread-header h1) (gnus-thread-header h2)))
3866 (defun gnus-thread-sort-by-total-score (h1 h2)
3867 "Sort threads by the sum of all scores in the thread.
3868 Unscored articles will be counted as having a score of zero."
3869 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3871 (defun gnus-thread-total-score (thread)
3872 ;; This function find the total score of THREAD.
3873 (cond ((null thread)
3876 (if (stringp (car thread))
3877 (apply gnus-thread-score-function 0
3878 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3879 (gnus-thread-total-score-1 thread)))
3881 (gnus-thread-total-score-1 (list thread)))))
3883 (defun gnus-thread-total-score-1 (root)
3884 ;; This function find the total score of the thread below ROOT.
3885 (setq root (car root))
3886 (apply gnus-thread-score-function
3888 (mapcar 'gnus-thread-total-score
3889 (cdr (gnus-id-to-thread (mail-header-id root))))
3890 (when (> (mail-header-number root) 0)
3891 (list (or (cdr (assq (mail-header-number root)
3892 gnus-newsgroup-scored))
3893 gnus-summary-default-score 0))))
3894 (list gnus-summary-default-score)
3897 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3898 (defvar gnus-tmp-prev-subject nil)
3899 (defvar gnus-tmp-false-parent nil)
3900 (defvar gnus-tmp-root-expunged nil)
3901 (defvar gnus-tmp-dummy-line nil)
3903 (eval-when-compile (defvar gnus-tmp-header))
3904 (defun gnus-extra-header (type &optional header)
3905 "Return the extra header of TYPE."
3906 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3909 (defun gnus-summary-prepare-threads (threads)
3910 "Prepare summary buffer from THREADS and indentation LEVEL.
3911 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3912 or a straight list of headers."
3913 (gnus-message 7 "Generating summary...")
3915 (setq gnus-newsgroup-threads threads)
3918 (let ((gnus-tmp-level 0)
3919 (default-score (or gnus-summary-default-score 0))
3920 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3921 thread number subject stack state gnus-tmp-gathered beg-match
3922 new-roots gnus-tmp-new-adopts thread-end
3923 gnus-tmp-header gnus-tmp-unread
3924 gnus-tmp-replied gnus-tmp-subject-or-nil
3925 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3926 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3927 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3929 (setq gnus-tmp-prev-subject nil)
3931 (if (vectorp (car threads))
3932 ;; If this is a straight (sic) list of headers, then a
3933 ;; threaded summary display isn't required, so we just create
3934 ;; an unthreaded one.
3935 (gnus-summary-prepare-unthreaded threads)
3937 ;; Do the threaded display.
3939 (while (or threads stack gnus-tmp-new-adopts new-roots)
3941 (if (and (= gnus-tmp-level 0)
3944 (not gnus-tmp-false-parent)
3945 (or gnus-tmp-new-adopts new-roots))
3946 (if gnus-tmp-new-adopts
3947 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3948 thread (list (car gnus-tmp-new-adopts))
3949 gnus-tmp-header (caar thread)
3950 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3952 (setq thread (list (car new-roots))
3953 gnus-tmp-header (caar thread)
3954 new-roots (cdr new-roots))))
3957 ;; If there are some threads, we do them before the
3958 ;; threads on the stack.
3959 (setq thread threads
3960 gnus-tmp-header (caar thread))
3961 ;; There were no current threads, so we pop something off
3963 (setq state (car stack)
3964 gnus-tmp-level (car state)
3967 gnus-tmp-header (caar thread))))
3969 (setq gnus-tmp-false-parent nil)
3970 (setq gnus-tmp-root-expunged nil)
3971 (setq thread-end nil)
3973 (if (stringp gnus-tmp-header)
3974 ;; The header is a dummy root.
3976 ((eq gnus-summary-make-false-root 'adopt)
3977 ;; We let the first article adopt the rest.
3978 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3980 (setq gnus-tmp-gathered
3982 (lambda (h) (mail-header-number (car h)))
3985 (setq thread (cons (list (caar thread)
3988 (setq gnus-tmp-level -1
3989 gnus-tmp-false-parent t))
3990 ((eq gnus-summary-make-false-root 'empty)
3991 ;; We print adopted articles with empty subject fields.
3992 (setq gnus-tmp-gathered
3994 (lambda (h) (mail-header-number (car h)))
3997 (setq gnus-tmp-level -1))
3998 ((eq gnus-summary-make-false-root 'dummy)
3999 ;; We remember that we probably want to output a dummy
4001 (setq gnus-tmp-dummy-line gnus-tmp-header)
4002 (setq gnus-tmp-prev-subject gnus-tmp-header))
4004 ;; We do not make a root for the gathered
4005 ;; sub-threads at all.
4006 (setq gnus-tmp-level -1)))
4008 (setq number (mail-header-number gnus-tmp-header)
4009 subject (mail-header-subject gnus-tmp-header))
4012 ;; If the thread has changed subject, we might want to make
4013 ;; this subthread into a root.
4014 ((and (null gnus-thread-ignore-subject)
4015 (not (zerop gnus-tmp-level))
4016 gnus-tmp-prev-subject
4018 (gnus-subject-equal gnus-tmp-prev-subject subject))))
4019 (setq new-roots (nconc new-roots (list (car thread)))
4021 gnus-tmp-header nil))
4022 ;; If the article lies outside the current limit,
4023 ;; then we do not display it.
4024 ((not (memq number gnus-newsgroup-limit))
4025 (setq gnus-tmp-gathered
4027 (lambda (h) (mail-header-number (car h)))
4030 (setq gnus-tmp-new-adopts (if (cdar thread)
4031 (append gnus-tmp-new-adopts
4033 gnus-tmp-new-adopts)
4035 gnus-tmp-header nil)
4036 (when (zerop gnus-tmp-level)
4037 (setq gnus-tmp-root-expunged t)))
4038 ;; Perhaps this article is to be marked as read?
4039 ((and gnus-summary-mark-below
4040 (< (or (cdr (assq number gnus-newsgroup-scored))
4042 gnus-summary-mark-below)
4043 ;; Don't touch sparse articles.
4044 (not (gnus-summary-article-sparse-p number))
4045 (not (gnus-summary-article-ancient-p number)))
4046 (setq gnus-newsgroup-unreads
4047 (delq number gnus-newsgroup-unreads))
4048 (if gnus-newsgroup-auto-expire
4049 (push number gnus-newsgroup-expirable)
4050 (push (cons number gnus-low-score-mark)
4051 gnus-newsgroup-reads))))
4053 (when gnus-tmp-header
4054 ;; We may have an old dummy line to output before this
4056 (when (and gnus-tmp-dummy-line
4059 (mail-header-subject gnus-tmp-header)))
4060 (gnus-summary-insert-dummy-line
4061 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4062 (setq gnus-tmp-dummy-line nil))
4064 ;; Compute the mark.
4065 (setq gnus-tmp-unread (gnus-article-mark number))
4067 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4068 gnus-tmp-header gnus-tmp-level)
4069 gnus-newsgroup-data)
4071 ;; Actually insert the line.
4073 gnus-tmp-subject-or-nil
4075 ((and gnus-thread-ignore-subject
4076 gnus-tmp-prev-subject
4077 (not (inline (gnus-subject-equal
4078 gnus-tmp-prev-subject subject))))
4080 ((zerop gnus-tmp-level)
4081 (if (and (eq gnus-summary-make-false-root 'empty)
4082 (memq number gnus-tmp-gathered)
4083 gnus-tmp-prev-subject
4084 (inline (gnus-subject-equal
4085 gnus-tmp-prev-subject subject)))
4086 gnus-summary-same-subject
4088 (t gnus-summary-same-subject)))
4089 (if (and (eq gnus-summary-make-false-root 'adopt)
4090 (= gnus-tmp-level 1)
4091 (memq number gnus-tmp-gathered))
4092 (setq gnus-tmp-opening-bracket ?\<
4093 gnus-tmp-closing-bracket ?\>)
4094 (setq gnus-tmp-opening-bracket ?\[
4095 gnus-tmp-closing-bracket ?\]))
4097 gnus-tmp-indentation
4098 (aref gnus-thread-indent-array gnus-tmp-level)
4099 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4100 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4101 gnus-summary-default-score 0)
4103 (if (or (null gnus-summary-default-score)
4104 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4105 gnus-summary-zcore-fuzz))
4107 (if (< gnus-tmp-score gnus-summary-default-score)
4108 gnus-score-below-mark gnus-score-over-mark))
4110 (cond ((memq number gnus-newsgroup-processable)
4112 ((memq number gnus-newsgroup-cached)
4114 ((memq number gnus-newsgroup-replied)
4116 ((memq number gnus-newsgroup-saved)
4118 (t gnus-unread-mark))
4119 gnus-tmp-from (mail-header-from gnus-tmp-header)
4122 ((string-match "<[^>]+> *$" gnus-tmp-from)
4123 (setq beg-match (match-beginning 0))
4124 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
4125 (substring gnus-tmp-from (1+ (match-beginning 0))
4126 (1- (match-end 0))))
4127 (substring gnus-tmp-from 0 beg-match)))
4128 ((string-match "(.+)" gnus-tmp-from)
4129 (substring gnus-tmp-from
4130 (1+ (match-beginning 0)) (1- (match-end 0))))
4132 (when (string= gnus-tmp-name "")
4133 (setq gnus-tmp-name gnus-tmp-from))
4134 (unless (numberp gnus-tmp-lines)
4135 (setq gnus-tmp-lines 0))
4136 (gnus-put-text-property
4138 (progn (eval gnus-summary-line-format-spec) (point))
4139 'gnus-number number)
4142 (gnus-run-hooks 'gnus-summary-update-hook)
4145 (setq gnus-tmp-prev-subject subject)))
4147 (when (nth 1 thread)
4148 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4149 (incf gnus-tmp-level)
4150 (setq threads (if thread-end nil (cdar thread)))
4152 (setq gnus-tmp-level 0)))))
4153 (gnus-message 7 "Generating summary...done"))
4155 (defun gnus-summary-prepare-unthreaded (headers)
4156 "Generate an unthreaded summary buffer based on HEADERS."
4157 (let (header number mark)
4162 ;; We may have to root out some bad articles...
4163 (when (memq (setq number (mail-header-number
4164 (setq header (pop headers))))
4165 gnus-newsgroup-limit)
4166 ;; Mark article as read when it has a low score.
4167 (when (and gnus-summary-mark-below
4168 (< (or (cdr (assq number gnus-newsgroup-scored))
4169 gnus-summary-default-score 0)
4170 gnus-summary-mark-below)
4171 (not (gnus-summary-article-ancient-p number)))
4172 (setq gnus-newsgroup-unreads
4173 (delq number gnus-newsgroup-unreads))
4174 (if gnus-newsgroup-auto-expire
4175 (push number gnus-newsgroup-expirable)
4176 (push (cons number gnus-low-score-mark)
4177 gnus-newsgroup-reads)))
4179 (setq mark (gnus-article-mark number))
4180 (push (gnus-data-make number mark (1+ (point)) header 0)
4181 gnus-newsgroup-data)
4182 (gnus-summary-insert-line
4184 mark (memq number gnus-newsgroup-replied)
4185 (memq number gnus-newsgroup-expirable)
4186 (mail-header-subject header) nil
4187 (cdr (assq number gnus-newsgroup-scored))
4188 (memq number gnus-newsgroup-processable))))))
4190 (defun gnus-summary-remove-list-identifiers ()
4191 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4192 (let ((regexp (if (stringp gnus-list-identifiers)
4193 gnus-list-identifiers
4194 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4195 (dolist (header gnus-newsgroup-headers)
4196 (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
4197 " *\\)\\)+\\(Re: +\\)?\\)")
4198 (mail-header-subject header))
4199 (mail-header-set-subject
4200 header (concat (substring (mail-header-subject header)
4201 0 (match-beginning 1))
4203 (match-string 3 (mail-header-subject header))
4204 (match-string 5 (mail-header-subject header)))
4205 (substring (mail-header-subject header)
4206 (match-end 1))))))))
4208 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4209 "Select newsgroup GROUP.
4210 If READ-ALL is non-nil, all articles in the group are selected.
4211 If SELECT-ARTICLES, only select those articles from GROUP."
4212 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4213 ;;!!! Dirty hack; should be removed.
4214 (gnus-summary-ignore-duplicates
4215 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4217 gnus-summary-ignore-duplicates))
4218 (info (nth 2 entry))
4219 articles fetched-articles cached)
4221 (unless (gnus-check-server
4222 (set (make-local-variable 'gnus-current-select-method)
4223 (gnus-find-method-for-group group)))
4224 (error "Couldn't open server"))
4226 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4227 (gnus-activate-group group) ; Or we can activate it...
4228 (progn ; Or we bug out.
4229 (when (equal major-mode 'gnus-summary-mode)
4230 (kill-buffer (current-buffer)))
4231 (error "Couldn't request group %s: %s"
4232 group (gnus-status-message group))))
4234 (unless (gnus-request-group group t)
4235 (when (equal major-mode 'gnus-summary-mode)
4236 (kill-buffer (current-buffer)))
4237 (error "Couldn't request group %s: %s"
4238 group (gnus-status-message group)))
4240 (setq gnus-newsgroup-name group)
4241 (setq gnus-newsgroup-unselected nil)
4242 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4243 (gnus-summary-setup-default-charset)
4245 ;; Adjust and set lists of article marks.
4247 (gnus-adjust-marked-articles info))
4249 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4250 (when (gnus-virtual-group-p group)
4251 (setq cached gnus-newsgroup-cached))
4253 (setq gnus-newsgroup-unreads
4254 (gnus-set-difference
4255 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4256 gnus-newsgroup-dormant))
4258 (setq gnus-newsgroup-processable nil)
4260 (gnus-update-read-articles group gnus-newsgroup-unreads)
4262 (if (setq articles select-articles)
4263 (setq gnus-newsgroup-unselected
4264 (gnus-sorted-intersection
4265 gnus-newsgroup-unreads
4266 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4267 (setq articles (gnus-articles-to-read group read-all)))
4271 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4273 ((eq articles 0) nil)
4275 ;; Init the dependencies hash table.
4276 (setq gnus-newsgroup-dependencies
4277 (gnus-make-hashtable (length articles)))
4278 (gnus-set-global-variables)
4279 ;; Retrieve the headers and read them in.
4280 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4281 (setq gnus-newsgroup-headers
4283 (setq gnus-headers-retrieved-by
4284 (gnus-retrieve-headers
4285 articles gnus-newsgroup-name
4286 ;; We might want to fetch old headers, but
4287 ;; not if there is only 1 article.
4289 (not (eq gnus-fetch-old-headers 'some))
4290 (not (numberp gnus-fetch-old-headers)))
4291 (> (length articles) 1))
4292 gnus-fetch-old-headers))))
4293 (gnus-get-newsgroup-headers-xover
4294 articles nil nil gnus-newsgroup-name t)
4295 (gnus-get-newsgroup-headers)))
4296 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4298 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4300 (setq gnus-newsgroup-cached cached))
4302 ;; Suppress duplicates?
4303 (when gnus-suppress-duplicates
4304 (gnus-dup-suppress-articles))
4306 ;; Set the initial limit.
4307 (setq gnus-newsgroup-limit (copy-sequence articles))
4308 ;; Remove canceled articles from the list of unread articles.
4309 (setq gnus-newsgroup-unreads
4310 (gnus-set-sorted-intersection
4311 gnus-newsgroup-unreads
4312 (setq fetched-articles
4313 (mapcar (lambda (headers) (mail-header-number headers))
4314 gnus-newsgroup-headers))))
4315 ;; Removed marked articles that do not exist.
4316 (gnus-update-missing-marks
4317 (gnus-sorted-complement fetched-articles articles))
4318 ;; We might want to build some more threads first.
4319 (when (and gnus-fetch-old-headers
4320 (eq gnus-headers-retrieved-by 'nov))
4321 (if (eq gnus-fetch-old-headers 'invisible)
4322 (gnus-build-all-threads)
4323 (gnus-build-old-threads)))
4324 ;; Let the Gnus agent mark articles as read.
4326 (gnus-agent-get-undownloaded-list))
4327 ;; Remove list identifiers from subject
4328 (when gnus-list-identifiers
4329 (gnus-summary-remove-list-identifiers))
4330 ;; Check whether auto-expire is to be done in this group.
4331 (setq gnus-newsgroup-auto-expire
4332 (gnus-group-auto-expirable-p group))
4333 ;; Set up the article buffer now, if necessary.
4334 (unless gnus-single-article-buffer
4335 (gnus-article-setup-buffer))
4336 ;; First and last article in this newsgroup.
4337 (when gnus-newsgroup-headers
4338 (setq gnus-newsgroup-begin
4339 (mail-header-number (car gnus-newsgroup-headers))
4342 (gnus-last-element gnus-newsgroup-headers))))
4343 ;; GROUP is successfully selected.
4344 (or gnus-newsgroup-headers t)))))
4346 (defun gnus-articles-to-read (group &optional read-all)
4347 "Find out what articles the user wants to read."
4349 ;; Select all articles if `read-all' is non-nil, or if there
4350 ;; are no unread articles.
4352 (and (zerop (length gnus-newsgroup-marked))
4353 (zerop (length gnus-newsgroup-unreads)))
4354 (eq (gnus-group-find-parameter group 'display)
4357 (gnus-uncompress-range (gnus-active group))
4358 (gnus-cache-articles-in-group group))
4359 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4360 (copy-sequence gnus-newsgroup-unreads))
4362 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4363 (scored (length scored-list))
4364 (number (length articles))
4365 (marked (+ (length gnus-newsgroup-marked)
4366 (length gnus-newsgroup-dormant)))
4374 ((and (or (<= scored marked) (= scored number))
4375 (numberp gnus-large-newsgroup)
4376 (> number gnus-large-newsgroup))
4380 "How many articles from %s (default %d): "
4381 (gnus-limit-string gnus-newsgroup-name 35)
4383 (if (string-match "^[ \t]*$" input) number input)))
4384 ((and (> scored marked) (< scored number)
4385 (> (- scored number) 20))
4388 (format "%s %s (%d scored, %d total): "
4389 "How many articles from"
4390 group scored number))))
4391 (if (string-match "^[ \t]*$" input)
4395 (message "Quit getting the articles to read")
4397 (setq select (if (stringp select) (string-to-number select) select))
4398 (if (or (null select) (zerop select))
4400 (if (and (not (zerop scored)) (<= (abs select) scored))
4402 (setq articles (sort scored-list '<))
4403 (setq number (length articles)))
4404 (setq articles (copy-sequence articles)))
4406 (when (< (abs select) number)
4408 ;; Select the N oldest articles.
4409 (setcdr (nthcdr (1- (abs select)) articles) nil)
4410 ;; Select the N most recent articles.
4411 (setq articles (nthcdr (- number select) articles))))
4412 (setq gnus-newsgroup-unselected
4413 (gnus-sorted-intersection
4414 gnus-newsgroup-unreads
4415 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4416 (when gnus-alter-articles-to-read-function
4417 (setq gnus-newsgroup-unreads
4419 (funcall gnus-alter-articles-to-read-function
4420 gnus-newsgroup-name gnus-newsgroup-unreads)
4424 (defun gnus-killed-articles (killed articles)
4427 (when (inline (gnus-member-of-range (car articles) killed))
4428 (push (car articles) out))
4429 (setq articles (cdr articles)))
4432 (defun gnus-uncompress-marks (marks)
4433 "Uncompress the mark ranges in MARKS."
4434 (let ((uncompressed '(score bookmark))
4437 (if (memq (caar marks) uncompressed)
4438 (push (car marks) out)
4439 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4440 (setq marks (cdr marks)))
4443 (defun gnus-adjust-marked-articles (info)
4444 "Set all article lists and remove all marks that are no longer valid."
4445 (let* ((marked-lists (gnus-info-marks info))
4446 (active (gnus-active (gnus-info-group info)))
4449 (types gnus-article-mark-lists)
4450 (uncompressed '(score bookmark killed))
4451 marks var articles article mark)
4454 (setq marks (pop marked-lists))
4455 (set (setq var (intern (format "gnus-newsgroup-%s"
4456 (car (rassq (setq mark (car marks))
4458 (if (memq (car marks) uncompressed) (cdr marks)
4459 (gnus-uncompress-range (cdr marks))))
4461 (setq articles (symbol-value var))
4463 ;; All articles have to be subsets of the active articles.
4465 ;; Adjust "simple" lists.
4466 ((memq mark '(tick dormant expire reply save))
4468 (when (or (< (setq article (pop articles)) min) (> article max))
4469 (set var (delq article (symbol-value var))))))
4471 ((memq mark uncompressed)
4472 (when (not (listp (cdr (symbol-value var))))
4473 (set var (list (symbol-value var))))
4474 (when (not (listp (cdr articles)))
4475 (setq articles (list articles)))
4477 (when (or (not (consp (setq article (pop articles))))
4478 (< (car article) min)
4479 (> (car article) max))
4480 (set var (delq article (symbol-value var))))))))))
4482 (defun gnus-update-missing-marks (missing)
4483 "Go through the list of MISSING articles and remove them from the mark lists."
4485 (let ((types gnus-article-mark-lists)
4487 ;; Go through all types.
4489 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4490 (when (symbol-value var)
4491 ;; This list has articles. So we delete all missing articles
4495 (set var (delq (pop m) (symbol-value var)))))))))
4497 (defun gnus-update-marks ()
4498 "Enter the various lists of marked articles into the newsgroup info list."
4499 (let ((types gnus-article-mark-lists)
4500 (info (gnus-get-info gnus-newsgroup-name))
4501 (uncompressed '(score bookmark killed))
4502 type list newmarked symbol delta-marks)
4504 ;; Add all marks lists to the list of marks lists.
4505 (while (setq type (pop types))
4506 (setq list (symbol-value
4508 (intern (format "gnus-newsgroup-%s"
4512 ;; Get rid of the entries of the articles that have the
4514 (when (and (eq (cdr type) 'score)
4518 (prev (cons nil list))
4521 (if (or (not (consp (car arts)))
4522 (= (cdar arts) gnus-summary-default-score))
4523 (setcdr prev (cdr arts))
4525 (setq arts (cdr arts)))
4526 (setq list (cdr all)))))
4528 (unless (memq (cdr type) uncompressed)
4529 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4531 (when (gnus-check-backend-function
4532 'request-set-mark gnus-newsgroup-name)
4533 ;; propagate flags to server, with the following exceptions:
4534 ;; uncompressed:s are not proper flags (they are cons cells)
4535 ;; cache is a internal gnus flag
4536 ;; download are local to one gnus installation (well)
4537 ;; unsend are for nndraft groups only
4538 ;; xxx: generality of this? this suits nnimap anyway
4539 (unless (memq (cdr type) (append '(cache download unsend)
4541 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4542 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4543 (add (gnus-remove-from-range
4544 (gnus-copy-sequence list) old)))
4546 (push (list add 'add (list (cdr type))) delta-marks))
4548 (push (list del 'del (list (cdr type))) delta-marks)))))
4551 (push (cons (cdr type) list) newmarked)))
4554 (unless (gnus-check-group gnus-newsgroup-name)
4555 (error "Can't open server for %s" gnus-newsgroup-name))
4556 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4558 ;; Enter these new marks into the info of the group.
4560 (setcar (nthcdr 3 info) newmarked)
4561 ;; Add the marks lists to the end of the info.
4563 (setcdr (nthcdr 2 info) (list newmarked))))
4565 ;; Cut off the end of the info if there's nothing else there.
4569 (when (nthcdr (decf i) info)
4570 (setcdr (nthcdr i info) nil)))))))
4572 (defun gnus-set-mode-line (where)
4573 "Set the mode line of the article or summary buffers.
4574 If WHERE is `summary', the summary mode line format will be used."
4575 ;; Is this mode line one we keep updated?
4576 (when (and (memq where gnus-updated-mode-lines)
4578 (intern (format "gnus-%s-mode-line-format-spec" where))))
4581 ;; We evaluate this in the summary buffer since these
4582 ;; variables are buffer-local to that buffer.
4583 (set-buffer gnus-summary-buffer)
4584 ;; We bind all these variables that are used in the `eval' form
4586 (let* ((mformat (symbol-value
4588 (format "gnus-%s-mode-line-format-spec" where))))
4589 (gnus-tmp-group-name (gnus-group-name-decode
4591 (gnus-group-name-charset
4593 gnus-newsgroup-name)))
4594 (gnus-tmp-article-number (or gnus-current-article 0))
4595 (gnus-tmp-unread gnus-newsgroup-unreads)
4596 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4597 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4598 (gnus-tmp-unread-and-unselected
4599 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4600 (zerop gnus-tmp-unselected))
4602 ((zerop gnus-tmp-unselected)
4603 (format "{%d more}" gnus-tmp-unread-and-unticked))
4604 (t (format "{%d(+%d) more}"
4605 gnus-tmp-unread-and-unticked
4606 gnus-tmp-unselected))))
4608 (if (and gnus-current-headers
4609 (vectorp gnus-current-headers))
4610 (gnus-mode-string-quote
4611 (mail-header-subject gnus-current-headers))
4613 bufname-length max-len
4614 gnus-tmp-header);; passed as argument to any user-format-funcs
4615 (setq mode-string (eval mformat))
4616 (setq bufname-length (if (string-match "%b" mode-string)
4619 (if (eq where 'summary)
4621 (get-buffer gnus-article-buffer))))
4624 (setq max-len (max 4 (if gnus-mode-non-string-length
4626 gnus-mode-non-string-length
4628 (length mode-string))))
4629 ;; We might have to chop a bit of the string off...
4630 (when (> (length mode-string) max-len)
4632 (concat (truncate-string-to-width mode-string (- max-len 3))
4634 ;; Pad the mode string a bit.
4635 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4636 ;; Update the mode line.
4637 (setq mode-line-buffer-identification
4638 (gnus-mode-line-buffer-identification (list mode-string)))
4639 (set-buffer-modified-p t))))
4641 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4642 "Go through the HEADERS list and add all Xrefs to a hash table.
4643 The resulting hash table is returned, or nil if no Xrefs were found."
4644 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4645 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4646 (xref-hashtb (gnus-make-hashtable))
4647 start group entry number xrefs header)
4649 (setq header (pop headers))
4650 (when (and (setq xrefs (mail-header-xref header))
4651 (not (memq (setq number (mail-header-number header))
4654 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4655 (setq start (match-end 0))
4656 (setq group (if prefix
4657 (concat prefix (substring xrefs (match-beginning 1)
4659 (substring xrefs (match-beginning 1) (match-end 1))))
4661 (string-to-int (substring xrefs (match-beginning 2)
4663 (if (setq entry (gnus-gethash group xref-hashtb))
4664 (setcdr entry (cons number (cdr entry)))
4665 (gnus-sethash group (cons number nil) xref-hashtb)))))
4666 (and start xref-hashtb)))
4668 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4669 "Look through all the headers and mark the Xrefs as read."
4670 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4671 name entry info xref-hashtb idlist method nth4)
4673 (set-buffer gnus-group-buffer)
4674 (when (setq xref-hashtb
4675 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4678 (unless (string= from-newsgroup (setq name (symbol-name group)))
4679 (setq idlist (symbol-value group))
4680 ;; Dead groups are not updated.
4682 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4684 (when (stringp (setq nth4 (gnus-info-method info)))
4685 (setq nth4 (gnus-server-to-method nth4))))
4686 ;; Only do the xrefs if the group has the same
4687 ;; select method as the group we have just read.
4688 (or (gnus-methods-equal-p
4689 nth4 (gnus-find-method-for-group from-newsgroup))
4691 (equal nth4 (setq method (gnus-find-method-for-group
4693 (and (equal (car nth4) (car method))
4694 (equal (nth 1 nth4) (nth 1 method))))
4695 gnus-use-cross-reference
4696 (or (not (eq gnus-use-cross-reference t))
4698 ;; Only do cross-references on subscribed
4699 ;; groups, if that is what is wanted.
4700 (<= (gnus-info-level info) gnus-level-subscribed))
4701 (gnus-group-make-articles-read name idlist))))
4704 (defun gnus-compute-read-articles (group articles)
4705 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4706 (info (nth 2 entry))
4707 (active (gnus-active group))
4710 ;; First peel off all invalid article numbers.
4712 (let ((ids articles)
4714 (while (setq id (pop ids))
4715 (when (and first (> id (cdr active)))
4716 ;; We'll end up in this situation in one particular
4717 ;; obscure situation. If you re-scan a group and get
4718 ;; a new article that is cross-posted to a different
4719 ;; group that has not been re-scanned, you might get
4720 ;; crossposted article that has a higher number than
4721 ;; Gnus believes possible. So we re-activate this
4722 ;; group as well. This might mean doing the
4723 ;; crossposting thingy will *increase* the number
4724 ;; of articles in some groups. Tsk, tsk.
4725 (setq active (or (gnus-activate-group group) active)))
4726 (when (or (> id (cdr active))
4727 (< id (car active)))
4728 (setq articles (delq id articles))))))
4729 ;; If the read list is nil, we init it.
4731 (null (gnus-info-read info))
4733 (setq ninfo (cons 1 (1- (car active))))
4734 (setq ninfo (gnus-info-read info)))
4735 ;; Then we add the read articles to the range.
4737 ninfo (setq articles (sort articles '<))))))
4739 (defun gnus-group-make-articles-read (group articles)
4740 "Update the info of GROUP to say that ARTICLES are read."
4742 (entry (gnus-gethash group gnus-newsrc-hashtb))
4743 (info (nth 2 entry))
4744 (active (gnus-active group))
4747 (setq range (gnus-compute-read-articles group articles))
4749 (set-buffer gnus-group-buffer)
4752 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4753 (gnus-info-set-read ',info ',(gnus-info-read info))
4754 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4755 (gnus-group-update-group ,group t))))
4756 ;; Add the read articles to the range.
4757 (gnus-info-set-read info range)
4758 ;; Then we have to re-compute how many unread
4759 ;; articles there are in this group.
4763 (setq num (- (1+ (cdr active)) (car active))))
4764 ((not (listp (cdr range)))
4765 (setq num (- (cdr active) (- (1+ (cdr range))
4769 (if (numberp (car range))
4771 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4772 (setq range (cdr range)))
4773 (setq num (- (cdr active) num))))
4774 ;; Update the number of unread articles.
4776 ;; Update the group buffer.
4777 (gnus-group-update-group group t)))))
4779 (defvar gnus-newsgroup-none-id 0)
4781 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4782 (let ((cur nntp-server-buffer)
4785 (save-excursion (set-buffer gnus-summary-buffer)
4786 gnus-newsgroup-dependencies)))
4788 (mail-parse-charset gnus-newsgroup-charset)
4789 (mail-parse-ignored-charsets
4790 (save-excursion (condition-case nil
4791 (set-buffer gnus-summary-buffer)
4793 gnus-newsgroup-ignored-charsets)))
4795 (set-buffer nntp-server-buffer)
4796 ;; Translate all TAB characters into SPACE characters.
4797 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4798 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4799 (gnus-run-hooks 'gnus-parse-headers-hook)
4800 (let ((case-fold-search t)
4801 in-reply-to header p lines chars)
4802 (goto-char (point-min))
4803 ;; Search to the beginning of the next header. Error messages
4804 ;; do not begin with 2 or 3.
4805 (while (re-search-forward "^[23][0-9]+ " nil t)
4808 ;; This implementation of this function, with nine
4809 ;; search-forwards instead of the one re-search-forward and
4810 ;; a case (which basically was the old function) is actually
4811 ;; about twice as fast, even though it looks messier. You
4812 ;; can't have everything, I guess. Speed and elegance
4813 ;; doesn't always go hand in hand.
4822 (narrow-to-region (point)
4823 (or (and (search-forward "\n.\n" nil t)
4829 (if (search-forward "\nsubject: " nil t)
4830 (funcall gnus-decode-encoded-word-function
4831 (nnheader-header-value))
4836 (if (or (search-forward "\nfrom: " nil t)
4837 (search-forward "\nfrom:" nil t))
4838 (funcall gnus-decode-encoded-word-function
4839 (nnheader-header-value))
4844 (if (search-forward "\ndate: " nil t)
4845 (nnheader-header-value) ""))
4849 (setq id (if (re-search-forward
4850 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4851 ;; We do it this way to make sure the Message-ID
4852 ;; is (somewhat) syntactically valid.
4853 (buffer-substring (match-beginning 1)
4855 ;; If there was no message-id, we just fake one
4856 ;; to make subsequent routines simpler.
4857 (nnheader-generate-fake-message-id))))
4861 (if (search-forward "\nreferences: " nil t)
4865 (nnheader-header-value)
4870 (search-backward ">" end t)
4873 (search-backward "<" end t)
4875 ;; Get the references from the in-reply-to header if there
4876 ;; were no references and the in-reply-to header looks
4878 (if (and (search-forward "\nin-reply-to: " nil t)
4879 (setq in-reply-to (nnheader-header-value))
4880 (string-match "<[^>]+>" in-reply-to))
4882 (setq ref (substring in-reply-to (match-beginning 0)
4884 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4885 (setq ref2 (substring in-reply-to (match-beginning 0)
4887 (when (> (length ref2) (length ref))
4894 (if (search-forward "\nchars: " nil t)
4895 (if (numberp (setq chars (ignore-errors (read cur))))
4901 (if (search-forward "\nlines: " nil t)
4902 (if (numberp (setq lines (ignore-errors (read cur))))
4908 (and (search-forward "\nxref: " nil t)
4909 (nnheader-header-value)))
4911 (when gnus-extra-headers
4912 (let ((extra gnus-extra-headers)
4916 (when (search-forward
4917 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4918 (push (cons (car extra) (nnheader-header-value))
4922 (when (equal id ref)
4925 (when gnus-alter-header-function
4926 (funcall gnus-alter-header-function header)
4927 (setq id (mail-header-id header)
4928 ref (gnus-parent-id (mail-header-references header))))
4931 (gnus-dependencies-add-header
4932 header dependencies force-new))
4933 (push header headers))
4934 (goto-char (point-max))
4936 (nreverse headers)))))
4938 ;; Goes through the xover lines and returns a list of vectors
4939 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4940 force-new dependencies
4941 group also-fetch-heads)
4942 "Parse the news overview data in the server buffer.
4943 Return a list of headers that match SEQUENCE (see
4944 `nntp-retrieve-headers')."
4945 ;; Get the Xref when the users reads the articles since most/some
4946 ;; NNTP servers do not include Xrefs when using XOVER.
4947 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4948 (let ((mail-parse-charset gnus-newsgroup-charset)
4949 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4950 (cur nntp-server-buffer)
4951 (dependencies (or dependencies gnus-newsgroup-dependencies))
4952 number headers header)
4954 (set-buffer nntp-server-buffer)
4955 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4956 ;; Allow the user to mangle the headers before parsing them.
4957 (gnus-run-hooks 'gnus-parse-headers-hook)
4958 (goto-char (point-min))
4961 (while (and sequence (not (eobp)))
4962 (setq number (read cur))
4963 (while (and sequence
4964 (< (car sequence) number))
4965 (setq sequence (cdr sequence)))
4967 (eq number (car sequence))
4969 (setq sequence (cdr sequence))
4970 (setq header (inline
4971 (gnus-nov-parse-line
4972 number dependencies force-new))))
4973 (push header headers))
4976 (gnus-error 4 "Strange nov line (%d)"
4977 (count-lines (point-min) (point)))))
4979 ;; A common bug in inn is that if you have posted an article and
4980 ;; then retrieves the active file, it will answer correctly --
4981 ;; the new article is included. However, a NOV entry for the
4982 ;; article may not have been generated yet, so this may fail.
4983 ;; We work around this problem by retrieving the last few
4984 ;; headers using HEAD.
4985 (if (or (not also-fetch-heads)
4987 ;; We (probably) got all the headers.
4989 (let ((gnus-nov-is-evil t))
4992 (when (gnus-retrieve-headers sequence group)
4993 (gnus-get-newsgroup-headers))))))))
4995 (defun gnus-article-get-xrefs ()
4996 "Fill in the Xref value in `gnus-current-headers', if necessary.
4997 This is meant to be called in `gnus-article-internal-prepare-hook'."
4998 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4999 gnus-current-headers)))
5000 (or (not gnus-use-cross-reference)
5002 (and (mail-header-xref headers)
5003 (not (string= (mail-header-xref headers) "")))
5004 (let ((case-fold-search t)
5007 (nnheader-narrow-to-headers)
5008 (goto-char (point-min))
5009 (when (or (and (not (eobp))
5010 (eq (downcase (char-after)) ?x)
5011 (looking-at "Xref:"))
5012 (search-forward "\nXref:" nil t))
5013 (goto-char (1+ (match-end 0)))
5014 (setq xref (buffer-substring (point)
5015 (progn (end-of-line) (point))))
5016 (mail-header-set-xref headers xref)))))))
5018 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5019 "Find article ID and insert the summary line for that article.
5020 OLD-HEADER can either be a header or a line number to insert
5021 the subject line on."
5022 (let* ((line (and (numberp old-header) old-header))
5023 (old-header (and (vectorp old-header) old-header))
5024 (header (cond ((and old-header use-old-header)
5027 (gnus-number-to-header id))
5028 (gnus-number-to-header id))
5030 (gnus-read-header id))))
5031 (number (and (numberp id) id))
5034 ;; Rebuild the thread that this article is part of and go to the
5035 ;; article we have fetched.
5036 (when (and (not gnus-show-threads)
5039 (setq d (gnus-data-find (mail-header-number old-header))))
5040 (goto-char (gnus-data-pos d))
5043 (- (gnus-point-at-bol)
5045 (1+ (gnus-point-at-eol))
5046 (gnus-delete-line))))))
5048 (mail-header-set-number header (mail-header-number old-header)))
5049 (setq gnus-newsgroup-sparse
5050 (delq (setq number (mail-header-number header))
5051 gnus-newsgroup-sparse))
5052 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5053 (push number gnus-newsgroup-limit)
5054 (gnus-rebuild-thread (mail-header-id header) line)
5055 (gnus-summary-goto-subject number nil t))
5056 (when (and (numberp number)
5058 ;; We have to update the boundaries even if we can't fetch the
5059 ;; article if ID is a number -- so that the next `P' or `N'
5060 ;; command will fetch the previous (or next) article even
5061 ;; if the one we tried to fetch this time has been canceled.
5062 (when (> number gnus-newsgroup-end)
5063 (setq gnus-newsgroup-end number))
5064 (when (< number gnus-newsgroup-begin)
5065 (setq gnus-newsgroup-begin number))
5066 (setq gnus-newsgroup-unselected
5067 (delq number gnus-newsgroup-unselected)))
5068 ;; Report back a success?
5069 (and header (mail-header-number header))))
5071 ;;; Process/prefix in the summary buffer
5073 (defun gnus-summary-work-articles (n)
5074 "Return a list of articles to be worked upon.
5075 The prefix argument, the list of process marked articles, and the
5076 current article will be taken into consideration."
5078 (set-buffer gnus-summary-buffer)
5081 ;; A numerical prefix has been given.
5082 (setq n (prefix-numeric-value n))
5083 (let ((backward (< n 0))
5084 (n (abs (prefix-numeric-value n)))
5089 (push (setq article (gnus-summary-article-number))
5092 (gnus-summary-find-prev nil article)
5093 (gnus-summary-find-next nil article)))
5095 (nreverse articles)))
5096 ((and (gnus-region-active-p) (mark))
5097 (message "region active")
5098 ;; Work on the region between point and mark.
5099 (let ((max (max (point) (mark)))
5102 (goto-char (min (min (point) (mark))))
5105 (push (setq article (gnus-summary-article-number)) articles)
5106 (gnus-summary-find-next nil article)
5108 (nreverse articles))))
5109 (gnus-newsgroup-processable
5110 ;; There are process-marked articles present.
5111 ;; Save current state.
5112 (gnus-summary-save-process-mark)
5114 (reverse gnus-newsgroup-processable))
5116 ;; Just return the current article.
5117 (list (gnus-summary-article-number))))))
5119 (defmacro gnus-summary-iterate (arg &rest forms)
5120 "Iterate over the process/prefixed articles and do FORMS.
5121 ARG is the interactive prefix given to the command. FORMS will be
5122 executed with point over the summary line of the articles."
5123 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5124 `(let ((,articles (gnus-summary-work-articles ,arg)))
5126 (gnus-summary-goto-subject (car ,articles))
5130 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5131 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5133 (defun gnus-summary-save-process-mark ()
5134 "Push the current set of process marked articles on the stack."
5136 (push (copy-sequence gnus-newsgroup-processable)
5137 gnus-newsgroup-process-stack))
5139 (defun gnus-summary-kill-process-mark ()
5140 "Push the current set of process marked articles on the stack and unmark."
5142 (gnus-summary-save-process-mark)
5143 (gnus-summary-unmark-all-processable))
5145 (defun gnus-summary-yank-process-mark ()
5146 "Pop the last process mark state off the stack and restore it."
5148 (unless gnus-newsgroup-process-stack
5149 (error "Empty mark stack"))
5150 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5152 (defun gnus-summary-process-mark-set (set)
5153 "Make SET into the current process marked articles."
5154 (gnus-summary-unmark-all-processable)
5156 (gnus-summary-set-process-mark (pop set))))
5158 ;;; Searching and stuff
5160 (defun gnus-summary-search-group (&optional backward use-level)
5161 "Search for next unread newsgroup.
5162 If optional argument BACKWARD is non-nil, search backward instead."
5164 (set-buffer gnus-group-buffer)
5165 (when (gnus-group-search-forward
5166 backward nil (if use-level (gnus-group-group-level) nil))
5167 (gnus-group-group-name))))
5169 (defun gnus-summary-best-group (&optional exclude-group)
5170 "Find the name of the best unread group.
5171 If EXCLUDE-GROUP, do not go to this group."
5173 (set-buffer gnus-group-buffer)
5175 (gnus-group-best-unread-group exclude-group))))
5177 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5178 (if backward (gnus-summary-find-prev)
5179 (let* ((dummy (gnus-summary-article-intangible-p))
5180 (article (or article (gnus-summary-article-number)))
5181 (arts (gnus-data-find-list article))
5183 (when (and (not dummy)
5184 (or (not gnus-summary-check-current)
5186 (not (gnus-data-unread-p (car arts)))))
5187 (setq arts (cdr arts)))
5192 (when (or (and undownloaded
5193 (eq gnus-undownloaded-mark
5194 (gnus-data-mark (car arts))))
5195 (gnus-data-unread-p (car arts)))
5196 (setq result (car arts)
5198 (setq arts (cdr arts)))
5201 (goto-char (gnus-data-pos result))
5202 (gnus-data-number result)))))
5204 (defun gnus-summary-find-prev (&optional unread article)
5205 (let* ((eobp (eobp))
5206 (article (or article (gnus-summary-article-number)))
5207 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5209 (when (and (not eobp)
5210 (or (not gnus-summary-check-current)
5212 (not (gnus-data-unread-p (car arts)))))
5213 (setq arts (cdr arts)))
5218 (when (gnus-data-unread-p (car arts))
5219 (setq result (car arts)
5221 (setq arts (cdr arts)))
5224 (goto-char (gnus-data-pos result))
5225 (gnus-data-number result))))
5227 (defun gnus-summary-find-subject (subject &optional unread backward article)
5228 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5229 (article (or article (gnus-summary-article-number)))
5230 (articles (gnus-data-list backward))
5231 (arts (gnus-data-find-list article articles))
5233 (when (or (not gnus-summary-check-current)
5235 (not (gnus-data-unread-p (car arts))))
5236 (setq arts (cdr arts)))
5238 (and (or (not unread)
5239 (gnus-data-unread-p (car arts)))
5240 (vectorp (gnus-data-header (car arts)))
5242 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5243 (setq result (car arts)
5245 (setq arts (cdr arts)))
5247 (goto-char (gnus-data-pos result))
5248 (gnus-data-number result))))
5250 (defun gnus-summary-search-forward (&optional unread subject backward)
5251 "Search forward for an article.
5252 If UNREAD, look for unread articles. If SUBJECT, look for
5253 articles with that subject. If BACKWARD, search backward instead."
5254 (cond (subject (gnus-summary-find-subject subject unread backward))
5255 (backward (gnus-summary-find-prev unread))
5256 (t (gnus-summary-find-next unread))))
5258 (defun gnus-recenter (&optional n)
5259 "Center point in window and redisplay frame.
5260 Also do horizontal recentering."
5262 (when (and gnus-auto-center-summary
5263 (not (eq gnus-auto-center-summary 'vertical)))
5264 (gnus-horizontal-recenter))
5267 (defun gnus-summary-recenter ()
5268 "Center point in the summary window.
5269 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5270 displayed, no centering will be performed."
5271 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5272 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5274 (let* ((top (cond ((< (window-height) 4) 0)
5275 ((< (window-height) 7) 1)
5276 (t (if (numberp gnus-auto-center-summary)
5277 gnus-auto-center-summary
5279 (height (1- (window-height)))
5280 (bottom (save-excursion (goto-char (point-max))
5281 (forward-line (- height))
5283 (window (get-buffer-window (current-buffer))))
5284 ;; The user has to want it.
5285 (when gnus-auto-center-summary
5286 (when (get-buffer-window gnus-article-buffer)
5287 ;; Only do recentering when the article buffer is displayed,
5288 ;; Set the window start to either `bottom', which is the biggest
5289 ;; possible valid number, or the second line from the top,
5290 ;; whichever is the least.
5291 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
5292 (if (> bottom top-pos)
5293 ;; Keep the second line from the top visible
5294 (set-window-start window top-pos t)
5295 ;; Try to keep the bottom line visible; if it's partially
5296 ;; obscured, either scroll one more line to make it fully
5297 ;; visible, or revert to using TOP-POS.
5299 (goto-char (point-max))
5301 (let ((last-line-start (point)))
5303 (set-window-start window (point) t)
5304 (when (not (pos-visible-in-window-p last-line-start window))
5306 (set-window-start window (min (point) top-pos) t)))))))
5307 ;; Do horizontal recentering while we're at it.
5308 (when (and (get-buffer-window (current-buffer) t)
5309 (not (eq gnus-auto-center-summary 'vertical)))
5310 (let ((selected (selected-window)))
5311 (select-window (get-buffer-window (current-buffer) t))
5312 (gnus-summary-position-point)
5313 (gnus-horizontal-recenter)
5314 (select-window selected))))))
5316 (defun gnus-summary-jump-to-group (newsgroup)
5317 "Move point to NEWSGROUP in group mode buffer."
5318 ;; Keep update point of group mode buffer if visible.
5319 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5320 (save-window-excursion
5321 ;; Take care of tree window mode.
5322 (when (get-buffer-window gnus-group-buffer)
5323 (pop-to-buffer gnus-group-buffer))
5324 (gnus-group-jump-to-group newsgroup))
5326 ;; Take care of tree window mode.
5327 (if (get-buffer-window gnus-group-buffer)
5328 (pop-to-buffer gnus-group-buffer)
5329 (set-buffer gnus-group-buffer))
5330 (gnus-group-jump-to-group newsgroup))))
5332 ;; This function returns a list of article numbers based on the
5333 ;; difference between the ranges of read articles in this group and
5334 ;; the range of active articles.
5335 (defun gnus-list-of-unread-articles (group)
5336 (let* ((read (gnus-info-read (gnus-get-info group)))
5337 (active (or (gnus-active group) (gnus-activate-group group)))
5340 ;; If none are read, then all are unread.
5342 (setq first (car active))
5343 ;; If the range of read articles is a single range, then the
5344 ;; first unread article is the article after the last read
5345 ;; article. Sounds logical, doesn't it?
5346 (if (and (not (listp (cdr read)))
5347 (or (< (car read) (car active))
5348 (progn (setq read (list read))
5350 (setq first (max (car active) (1+ (cdr read))))
5351 ;; `read' is a list of ranges.
5352 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5355 (setq first (car active)))
5358 (while (< first nlast)
5360 (setq first (1+ first))))
5361 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5362 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5363 (setq read (cdr read)))))
5364 ;; And add the last unread articles.
5365 (while (<= first last)
5367 (setq first (1+ first)))
5368 ;; Return the list of unread articles.
5369 (delq 0 (nreverse unread))))
5371 (defun gnus-list-of-read-articles (group)
5372 "Return a list of unread, unticked and non-dormant articles."
5373 (let* ((info (gnus-get-info group))
5374 (marked (gnus-info-marks info))
5375 (active (gnus-active group)))
5377 (gnus-set-difference
5378 (gnus-sorted-complement
5379 (gnus-uncompress-range active)
5380 (gnus-list-of-unread-articles group))
5382 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5383 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5385 ;; Various summary commands
5387 (defun gnus-summary-select-article-buffer ()
5388 "Reconfigure windows to show article buffer."
5390 (if (not (gnus-buffer-live-p gnus-article-buffer))
5391 (error "There is no article buffer for this summary buffer")
5392 (gnus-configure-windows 'article)
5393 (select-window (get-buffer-window gnus-article-buffer))))
5395 (defun gnus-summary-universal-argument (arg)
5396 "Perform any operation on all articles that are process/prefixed."
5398 (let ((articles (gnus-summary-work-articles arg))
5405 (substitute-command-keys
5406 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
5408 (gnus-error 1 "Undefined key")
5411 (gnus-summary-goto-subject (setq article (pop articles)))
5412 (let (gnus-newsgroup-processable)
5413 (command-execute func))
5414 (gnus-summary-remove-process-mark article)))))
5415 (gnus-summary-position-point))
5417 (defun gnus-summary-toggle-truncation (&optional arg)
5418 "Toggle truncation of summary lines.
5419 With arg, turn line truncation on iff arg is positive."
5421 (setq truncate-lines
5422 (if (null arg) (not truncate-lines)
5423 (> (prefix-numeric-value arg) 0)))
5426 (defun gnus-summary-reselect-current-group (&optional all rescan)
5427 "Exit and then reselect the current newsgroup.
5428 The prefix argument ALL means to select all articles."
5430 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5431 (error "Ephemeral groups can't be reselected"))
5432 (let ((current-subject (gnus-summary-article-number))
5433 (group gnus-newsgroup-name))
5434 (setq gnus-newsgroup-begin nil)
5436 ;; We have to adjust the point of group mode buffer because
5437 ;; point was moved to the next unread newsgroup by exiting.
5438 (gnus-summary-jump-to-group group)
5441 (gnus-group-get-new-news-this-group 1)))
5442 (gnus-group-read-group all t)
5443 (gnus-summary-goto-subject current-subject nil t)))
5445 (defun gnus-summary-rescan-group (&optional all)
5446 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5448 (gnus-summary-reselect-current-group all t))
5450 (defun gnus-summary-update-info (&optional non-destructive)
5452 (let ((group gnus-newsgroup-name))
5454 (when gnus-newsgroup-kill-headers
5455 (setq gnus-newsgroup-killed
5456 (gnus-compress-sequence
5458 (gnus-set-sorted-intersection
5459 (gnus-uncompress-range gnus-newsgroup-killed)
5460 (setq gnus-newsgroup-unselected
5461 (sort gnus-newsgroup-unselected '<)))
5462 (setq gnus-newsgroup-unreads
5463 (sort gnus-newsgroup-unreads '<)))
5465 (unless (listp (cdr gnus-newsgroup-killed))
5466 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5467 (let ((headers gnus-newsgroup-headers))
5468 ;; Set the new ranges of read articles.
5470 (set-buffer gnus-group-buffer)
5471 (gnus-undo-force-boundary))
5472 (gnus-update-read-articles
5473 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5474 ;; Set the current article marks.
5475 (let ((gnus-newsgroup-scored
5476 (if (and (not gnus-save-score)
5477 (not non-destructive))
5479 gnus-newsgroup-scored)))
5481 (gnus-update-marks)))
5482 ;; Do the cross-ref thing.
5483 (when gnus-use-cross-reference
5484 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5485 ;; Do not switch windows but change the buffer to work.
5486 (set-buffer gnus-group-buffer)
5487 (unless (gnus-ephemeral-group-p group)
5488 (gnus-group-update-group group)))))))
5490 (defun gnus-summary-save-newsrc (&optional force)
5491 "Save the current number of read/marked articles in the dribble buffer.
5492 The dribble buffer will then be saved.
5493 If FORCE (the prefix), also save the .newsrc file(s)."
5495 (gnus-summary-update-info t)
5497 (gnus-save-newsrc-file)
5498 (gnus-dribble-save)))
5500 (defun gnus-summary-exit (&optional temporary)
5501 "Exit reading current newsgroup, and then return to group selection mode.
5502 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
5504 (gnus-set-global-variables)
5505 (when (gnus-buffer-live-p gnus-article-buffer)
5507 (set-buffer gnus-article-buffer)
5508 (mm-destroy-parts gnus-article-mime-handles)
5509 ;; Set it to nil for safety reason.
5510 (setq gnus-article-mime-handle-alist nil)
5511 (setq gnus-article-mime-handles nil)))
5512 (gnus-kill-save-kill-buffer)
5513 (gnus-async-halt-prefetch)
5514 (let* ((group gnus-newsgroup-name)
5515 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5518 (buf (current-buffer)))
5520 ;; Do adaptive scoring, and possibly save score files.
5521 (when gnus-newsgroup-adaptive
5522 (gnus-score-adaptive))
5523 (when gnus-use-scoring
5525 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5526 ;; If we have several article buffers, we kill them at exit.
5527 (unless gnus-single-article-buffer
5528 (gnus-kill-buffer gnus-original-article-buffer)
5529 (setq gnus-article-current nil))
5530 (when gnus-use-cache
5531 (gnus-cache-possibly-remove-articles)
5532 (gnus-cache-save-buffers))
5533 (gnus-async-prefetch-remove-group group)
5534 (when gnus-suppress-duplicates
5535 (gnus-dup-enter-articles))
5536 (when gnus-use-trees
5537 (gnus-tree-close group))
5538 (when gnus-use-cache
5539 (gnus-cache-write-active))
5540 ;; Remove entries for this group.
5541 (nnmail-purge-split-history (gnus-group-real-name group))
5542 ;; Make all changes in this group permanent.
5544 (gnus-run-hooks 'gnus-exit-group-hook)
5545 (gnus-summary-update-info))
5546 (gnus-close-group group)
5547 ;; Make sure where we were, and go to next newsgroup.
5548 (set-buffer gnus-group-buffer)
5550 (gnus-group-jump-to-group group))
5551 (gnus-run-hooks 'gnus-summary-exit-hook)
5552 (unless (or quit-config
5553 ;; If this group has disappeared from the summary
5554 ;; buffer, don't skip forwards.
5555 (not (string= group (gnus-group-group-name))))
5556 (gnus-group-next-unread-group 1))
5557 (setq group-point (point))
5560 ;; If we have several article buffers, we kill them at exit.
5561 (unless gnus-single-article-buffer
5562 (gnus-kill-buffer gnus-article-buffer)
5563 (gnus-kill-buffer gnus-original-article-buffer)
5564 (setq gnus-article-current nil))
5566 (if (not gnus-kill-summary-on-exit)
5567 (gnus-deaden-summary)
5568 ;; We set all buffer-local variables to nil. It is unclear why
5569 ;; this is needed, but if we don't, buffer-local variables are
5570 ;; not garbage-collected, it seems. This would the lead to en
5571 ;; ever-growing Emacs.
5572 (gnus-summary-clear-local-variables)
5573 (when (get-buffer gnus-article-buffer)
5574 (bury-buffer gnus-article-buffer))
5575 ;; We clear the global counterparts of the buffer-local
5576 ;; variables as well, just to be on the safe side.
5577 (set-buffer gnus-group-buffer)
5578 (gnus-summary-clear-local-variables)
5579 ;; Return to group mode buffer.
5580 (when (eq mode 'gnus-summary-mode)
5581 (gnus-kill-buffer buf)))
5582 (setq gnus-current-select-method gnus-select-method)
5583 (pop-to-buffer gnus-group-buffer)
5584 (if (not quit-config)
5586 (goto-char group-point)
5587 (gnus-configure-windows 'group 'force))
5588 (gnus-handle-ephemeral-exit quit-config))
5589 ;; Clear the current group name.
5591 (setq gnus-newsgroup-name nil)))))
5593 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5594 (defun gnus-summary-exit-no-update (&optional no-questions)
5595 "Quit reading current newsgroup without updating read article info."
5597 (let* ((group gnus-newsgroup-name)
5598 (quit-config (gnus-group-quit-config group)))
5599 (when (or no-questions
5601 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5602 (gnus-async-halt-prefetch)
5604 (delq 'gnus-summary-expire-articles
5605 (copy-sequence gnus-summary-prepare-exit-hook)))
5606 (when (gnus-buffer-live-p gnus-article-buffer)
5608 (set-buffer gnus-article-buffer)
5609 (mm-destroy-parts gnus-article-mime-handles)
5610 ;; Set it to nil for safety reason.
5611 (setq gnus-article-mime-handle-alist nil)
5612 (setq gnus-article-mime-handles nil)))
5613 ;; If we have several article buffers, we kill them at exit.
5614 (unless gnus-single-article-buffer
5615 (gnus-kill-buffer gnus-article-buffer)
5616 (gnus-kill-buffer gnus-original-article-buffer)
5617 (setq gnus-article-current nil))
5618 (if (not gnus-kill-summary-on-exit)
5619 (gnus-deaden-summary)
5620 (gnus-close-group group)
5621 (gnus-summary-clear-local-variables)
5622 (set-buffer gnus-group-buffer)
5623 (gnus-summary-clear-local-variables)
5624 (when (get-buffer gnus-summary-buffer)
5625 (kill-buffer gnus-summary-buffer)))
5626 (unless gnus-single-article-buffer
5627 (setq gnus-article-current nil))
5628 (when gnus-use-trees
5629 (gnus-tree-close group))
5630 (gnus-async-prefetch-remove-group group)
5631 (when (get-buffer gnus-article-buffer)
5632 (bury-buffer gnus-article-buffer))
5633 ;; Return to the group buffer.
5634 (gnus-configure-windows 'group 'force)
5635 ;; Clear the current group name.
5636 (setq gnus-newsgroup-name nil)
5637 (when (equal (gnus-group-group-name) group)
5638 (gnus-group-next-unread-group 1))
5640 (gnus-handle-ephemeral-exit quit-config)))))
5642 (defun gnus-handle-ephemeral-exit (quit-config)
5643 "Handle movement when leaving an ephemeral group.
5644 The state which existed when entering the ephemeral is reset."
5645 (if (not (buffer-name (car quit-config)))
5646 (gnus-configure-windows 'group 'force)
5647 (set-buffer (car quit-config))
5648 (cond ((eq major-mode 'gnus-summary-mode)
5649 (gnus-set-global-variables))
5650 ((eq major-mode 'gnus-article-mode)
5652 ;; The `gnus-summary-buffer' variable may point
5653 ;; to the old summary buffer when using a single
5655 (unless (gnus-buffer-live-p gnus-summary-buffer)
5656 (set-buffer gnus-group-buffer))
5657 (set-buffer gnus-summary-buffer)
5658 (gnus-set-global-variables))))
5659 (if (or (eq (cdr quit-config) 'article)
5660 (eq (cdr quit-config) 'pick))
5662 ;; The current article may be from the ephemeral group
5663 ;; thus it is best that we reload this article
5664 (gnus-summary-show-article)
5665 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5666 (gnus-configure-windows 'pick 'force)
5667 (gnus-configure-windows (cdr quit-config) 'force)))
5668 (gnus-configure-windows (cdr quit-config) 'force))
5669 (when (eq major-mode 'gnus-summary-mode)
5670 (gnus-summary-next-subject 1 nil t)
5671 (gnus-summary-recenter)
5672 (gnus-summary-position-point))))
5676 (defvar gnus-dead-summary-mode-map nil)
5678 (unless gnus-dead-summary-mode-map
5679 (setq gnus-dead-summary-mode-map (make-keymap))
5680 (suppress-keymap gnus-dead-summary-mode-map)
5681 (substitute-key-definition
5682 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5683 (let ((keys '("\C-d" "\r" "\177" [delete])))
5685 (define-key gnus-dead-summary-mode-map
5686 (pop keys
) 'gnus-summary-wake-up-the-dead
))))
5688 (defvar gnus-dead-summary-mode nil
5689 "Minor mode for Gnus summary buffers.")
5691 (defun gnus-dead-summary-mode (&optional arg
)
5692 "Minor mode for Gnus summary buffers."
5694 (when (eq major-mode
'gnus-summary-mode
)
5695 (make-local-variable 'gnus-dead-summary-mode
)
5696 (setq gnus-dead-summary-mode
5697 (if (null arg
) (not gnus-dead-summary-mode
)
5698 (> (prefix-numeric-value arg
) 0)))
5699 (when gnus-dead-summary-mode
5700 (gnus-add-minor-mode
5701 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
5703 (defun gnus-deaden-summary ()
5704 "Make the current summary buffer into a dead summary buffer."
5705 ;; Kill any previous dead summary buffer.
5706 (when (and gnus-dead-summary
5707 (buffer-name gnus-dead-summary
))
5709 (set-buffer gnus-dead-summary
)
5710 (when gnus-dead-summary-mode
5711 (kill-buffer (current-buffer)))))
5712 ;; Make this the current dead summary.
5713 (setq gnus-dead-summary
(current-buffer))
5714 (gnus-dead-summary-mode 1)
5715 (let ((name (buffer-name)))
5716 (when (string-match "Summary" name
)
5718 (concat (substring name
0 (match-beginning 0)) "Dead "
5719 (substring name
(match-beginning 0)))
5723 (defun gnus-kill-or-deaden-summary (buffer)
5724 "Kill or deaden the summary BUFFER."
5726 (when (and (buffer-name buffer
)
5727 (not gnus-single-article-buffer
))
5730 (gnus-kill-buffer gnus-article-buffer
)
5731 (gnus-kill-buffer gnus-original-article-buffer
)))
5732 (cond (gnus-kill-summary-on-exit
5733 (when (and gnus-use-trees
5734 (gnus-buffer-exists-p buffer
))
5737 (gnus-tree-close gnus-newsgroup-name
)))
5738 (gnus-kill-buffer buffer
))
5739 ((gnus-buffer-exists-p buffer
)
5742 (gnus-deaden-summary))))))
5744 (defun gnus-summary-wake-up-the-dead (&rest args
)
5745 "Wake up the dead summary buffer."
5747 (gnus-dead-summary-mode -
1)
5748 (let ((name (buffer-name)))
5749 (when (string-match "Dead " name
)
5751 (concat (substring name
0 (match-beginning 0))
5752 (substring name
(match-end 0)))
5754 (gnus-message 3 "This dead summary is now alive again"))
5756 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5757 (defun gnus-summary-fetch-faq (&optional faq-dir
)
5758 "Fetch the FAQ for the current group.
5759 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5763 (when current-prefix-arg
5765 "Faq dir: " (and (listp gnus-group-faq-directory
)
5766 (mapcar (lambda (file) (list file
))
5767 gnus-group-faq-directory
))))))
5768 (let (gnus-faq-buffer)
5769 (when (setq gnus-faq-buffer
5770 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
5771 (gnus-configure-windows 'summary-faq
))))
5773 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5774 (defun gnus-summary-describe-group (&optional force
)
5775 "Describe the current newsgroup."
5777 (gnus-group-describe-group force gnus-newsgroup-name
))
5779 (defun gnus-summary-describe-briefly ()
5780 "Describe summary mode commands briefly."
5782 (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")))
5784 ;; Walking around group mode buffer from summary mode.
5786 (defun gnus-summary-next-group (&optional no-article target-group backward
)
5787 "Exit current newsgroup and then select next unread newsgroup.
5788 If prefix argument NO-ARTICLE is non-nil, no article is selected
5789 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5790 previous group instead."
5792 ;; Stop pre-fetching.
5793 (gnus-async-halt-prefetch)
5794 (let ((current-group gnus-newsgroup-name
)
5795 (current-buffer (current-buffer))
5797 ;; First we semi-exit this group to update Xrefs and all variables.
5798 ;; We can't do a real exit, because the window conf must remain
5799 ;; the same in case the user is prompted for info, and we don't
5800 ;; want the window conf to change before that...
5801 (gnus-summary-exit t
)
5802 (while (not entered
)
5803 ;; Then we find what group we are supposed to enter.
5804 (set-buffer gnus-group-buffer
)
5805 (gnus-group-jump-to-group current-group
)
5808 (if (eq gnus-keep-same-level
'best
)
5809 (gnus-summary-best-group gnus-newsgroup-name
)
5810 (gnus-summary-search-group backward gnus-keep-same-level
))))
5811 (if (not target-group
)
5812 ;; There are no further groups, so we return to the group
5815 (gnus-message 5 "Returning to the group buffer")
5817 (when (gnus-buffer-live-p current-buffer
)
5818 (set-buffer current-buffer
)
5819 (gnus-summary-exit))
5820 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
5821 ;; We try to enter the target group.
5822 (gnus-group-jump-to-group target-group
)
5823 (let ((unreads (gnus-group-group-unread)))
5824 (if (and (or (eq t unreads
)
5825 (and unreads
(not (zerop unreads
))))
5826 (gnus-summary-read-group
5827 target-group nil no-article
5828 (and (buffer-name current-buffer
) current-buffer
)
5831 (setq current-group target-group
5832 target-group nil
)))))))
5834 (defun gnus-summary-prev-group (&optional no-article
)
5835 "Exit current newsgroup and then select previous unread newsgroup.
5836 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5838 (gnus-summary-next-group no-article nil t
))
5840 ;; Walking around summary lines.
5842 (defun gnus-summary-first-subject (&optional unread undownloaded
)
5843 "Go to the first unread subject.
5844 If UNREAD is non-nil, go to the first unread article.
5845 Returns the article selected or nil if there are no unread articles."
5850 ((null gnus-newsgroup-data
)
5851 (gnus-message 3 "No articles in the group")
5853 ;; Pick the first article.
5855 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
5856 (gnus-data-number (car gnus-newsgroup-data
)))
5857 ;; No unread articles.
5858 ((null gnus-newsgroup-unreads
)
5859 (gnus-message 3 "No more unread articles")
5861 ;; Find the first unread article.
5863 (let ((data gnus-newsgroup-data
))
5865 (and (not (and undownloaded
5866 (eq gnus-undownloaded-mark
5867 (gnus-data-mark (car data
)))))
5868 (not (gnus-data-unread-p (car data
)))))
5869 (setq data
(cdr data
)))
5871 (goto-char (gnus-data-pos (car data
)))
5872 (gnus-data-number (car data
))))))
5873 (gnus-summary-position-point)))
5875 (defun gnus-summary-next-subject (n &optional unread dont-display
)
5876 "Go to next N'th summary line.
5877 If N is negative, go to the previous N'th subject line.
5878 If UNREAD is non-nil, only unread articles are selected.
5879 The difference between N and the actual number of steps taken is
5882 (let ((backward (< n
0))
5886 (gnus-summary-find-prev unread
)
5887 (gnus-summary-find-next unread
)))
5888 (unless (zerop (setq n
(1- n
)))
5889 (gnus-summary-show-thread)))
5891 (gnus-message 7 "No more%s articles"
5892 (if unread
" unread" "")))
5893 (unless dont-display
5894 (gnus-summary-recenter)
5895 (gnus-summary-position-point))
5898 (defun gnus-summary-next-unread-subject (n)
5899 "Go to next N'th unread summary line."
5901 (gnus-summary-next-subject n t
))
5903 (defun gnus-summary-prev-subject (n &optional unread
)
5904 "Go to previous N'th summary line.
5905 If optional argument UNREAD is non-nil, only unread article is selected."
5907 (gnus-summary-next-subject (- n
) unread
))
5909 (defun gnus-summary-prev-unread-subject (n)
5910 "Go to previous N'th unread summary line."
5912 (gnus-summary-next-subject (- n
) t
))
5914 (defun gnus-summary-goto-subject (article &optional force silent
)
5915 "Go the subject line of ARTICLE.
5916 If FORCE, also allow jumping to articles not currently shown."
5917 (interactive "nArticle number: ")
5919 (data (gnus-data-find article
)))
5920 ;; We read in the article if we have to.
5923 (gnus-summary-insert-subject
5925 (if (or (numberp force
) (vectorp force
)) force
)
5927 (setq data
(gnus-data-find article
)))
5932 (gnus-message 3 "Can't find article %d" article
))
5934 (goto-char (gnus-data-pos data
))
5935 (gnus-summary-position-point)
5938 ;; Walking around summary lines with displaying articles.
5940 (defun gnus-summary-expand-window (&optional arg
)
5941 "Make the summary buffer take up the entire Emacs frame.
5942 Given a prefix, will force an `article' buffer configuration."
5945 (gnus-configure-windows 'article
'force
)
5946 (gnus-configure-windows 'summary
'force
)))
5948 (defun gnus-summary-display-article (article &optional all-header
)
5949 "Display ARTICLE in article buffer."
5950 (when (gnus-buffer-live-p gnus-article-buffer
)
5951 (with-current-buffer gnus-article-buffer
5952 (mm-enable-multibyte)))
5953 (gnus-set-global-variables)
5957 (if gnus-summary-display-article-function
5958 (funcall gnus-summary-display-article-function article all-header
)
5959 (gnus-article-prepare article all-header
))
5960 (gnus-run-hooks 'gnus-select-article-hook
)
5961 (when (and gnus-current-article
5962 (not (zerop gnus-current-article
)))
5963 (gnus-summary-goto-subject gnus-current-article
))
5964 (gnus-summary-recenter)
5965 (when (and gnus-use-trees gnus-show-threads
)
5966 (gnus-possibly-generate-tree article
)
5967 (gnus-highlight-selected-tree article
))
5968 ;; Successfully display article.
5969 (gnus-article-set-window-start
5970 (cdr (assq article gnus-newsgroup-bookmarks
))))))
5972 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
5973 "Select the current article.
5974 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5975 non-nil, the article will be re-fetched even if it already present in
5976 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5978 ;; Make sure we are in the summary buffer to work around bbdb bug.
5979 (unless (eq major-mode
'gnus-summary-mode
)
5980 (set-buffer gnus-summary-buffer
))
5981 (let ((article (or article
(gnus-summary-article-number)))
5982 (all-headers (not (not all-headers
))) ;Must be t or nil.
5983 gnus-summary-display-article-function
)
5985 (gnus-summary-article-pseudo-p article
)
5986 (error "This is a pseudo-article"))
5988 (set-buffer gnus-summary-buffer
)
5989 (if (or (and gnus-single-article-buffer
5990 (or (null gnus-current-article
)
5991 (null gnus-article-current
)
5992 (null (get-buffer gnus-article-buffer
))
5993 (not (eq article
(cdr gnus-article-current
)))
5994 (not (equal (car gnus-article-current
)
5995 gnus-newsgroup-name
))))
5996 (and (not gnus-single-article-buffer
)
5997 (or (null gnus-current-article
)
5998 (not (eq gnus-current-article article
))))
6000 ;; The requested article is different from the current article.
6002 (gnus-summary-display-article article all-headers
)
6003 (when (gnus-buffer-live-p gnus-article-buffer
)
6004 (with-current-buffer gnus-article-buffer
6005 (if (not gnus-article-decoded-p
) ;; a local variable
6006 (mm-disable-multibyte))))
6007 (when (or all-headers gnus-show-all-headers
)
6008 (gnus-article-show-all-headers))
6009 (gnus-article-set-window-start
6010 (cdr (assq article gnus-newsgroup-bookmarks
)))
6012 (when (or all-headers gnus-show-all-headers
)
6013 (gnus-article-show-all-headers))
6016 (defun gnus-summary-set-current-mark (&optional current-mark
)
6017 "Obsolete function."
6020 (defun gnus-summary-next-article (&optional unread subject backward push
)
6021 "Select the next article.
6022 If UNREAD, only unread articles are selected.
6023 If SUBJECT, only articles with SUBJECT are selected.
6024 If BACKWARD, the previous article is selected instead of the next."
6027 ;; Is there such an article?
6028 ((and (gnus-summary-search-forward unread subject backward
)
6029 (or (gnus-summary-display-article (gnus-summary-article-number))
6030 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
6031 (gnus-summary-position-point))
6032 ;; If not, we try the first unread, if that is wanted.
6034 gnus-auto-select-same
6035 (gnus-summary-first-unread-article))
6036 (gnus-summary-position-point)
6037 (gnus-message 6 "Wrapped"))
6038 ;; Try to get next/previous article not displayed in this group.
6039 ((and gnus-auto-extend-newsgroup
6040 (not unread
) (not subject
))
6041 (gnus-summary-goto-article
6042 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
6043 nil
(count-lines (point-min) (point))))
6044 ;; Go to next/previous group.
6046 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
6047 (gnus-summary-jump-to-group gnus-newsgroup-name
))
6048 (let ((cmd last-command-char
)
6051 (set-buffer gnus-group-buffer
)
6054 (if (eq gnus-keep-same-level
'best
)
6055 (gnus-summary-best-group gnus-newsgroup-name
)
6056 (gnus-summary-search-group backward gnus-keep-same-level
))))
6057 ;; For some reason, the group window gets selected. We change
6059 (select-window (get-buffer-window (current-buffer)))
6060 ;; Select next unread newsgroup automagically.
6062 ((or (not gnus-auto-select-next
)
6064 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
6065 ((or (eq gnus-auto-select-next
'quietly
)
6066 (and (eq gnus-auto-select-next
'slightly-quietly
)
6068 (and (eq gnus-auto-select-next
'almost-quietly
)
6069 (gnus-summary-last-article-p)))
6071 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
6073 (gnus-message 7 "No more%s articles (%s)..."
6074 (if unread
" unread" "")
6075 (if group
(concat "selecting " group
)
6077 (gnus-summary-next-group nil group backward
)))
6079 (when (gnus-key-press-event-p last-input-event
)
6080 (gnus-summary-walk-group-buffer
6081 gnus-newsgroup-name cmd unread backward point
))))))))
6083 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
6084 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
6085 (?\C-p
(gnus-group-prev-unread-group 1))))
6086 (cursor-in-echo-area t
)
6087 keve key group ended
)
6089 (set-buffer gnus-group-buffer
)
6092 (if (eq gnus-keep-same-level
'best
)
6093 (gnus-summary-best-group gnus-newsgroup-name
)
6094 (gnus-summary-search-group backward gnus-keep-same-level
))))
6097 5 "No more%s articles%s" (if unread
" unread" "")
6099 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
6100 (format " (Type %s for %s [%s])"
6101 (single-key-description cmd
) group
6102 (car (gnus-gethash group gnus-newsrc-hashtb
)))
6103 (format " (Type %s to exit %s)"
6104 (single-key-description cmd
)
6105 gnus-newsgroup-name
)))
6106 ;; Confirm auto selection.
6107 (setq key
(car (setq keve
(gnus-read-event-char))))
6110 ((assq key keystrokes
)
6111 (let ((obuf (current-buffer)))
6112 (switch-to-buffer gnus-group-buffer
)
6114 (gnus-group-jump-to-group group
))
6115 (eval (cadr (assq key keystrokes
)))
6116 (setq group
(gnus-group-group-name))
6117 (switch-to-buffer obuf
))
6121 (gnus-ephemeral-group-p gnus-newsgroup-name
))
6123 (gnus-summary-next-group nil group backward
)))
6125 (push (cdr keve
) unread-command-events
))))))
6127 (defun gnus-summary-next-unread-article ()
6128 "Select unread article after current one."
6130 (gnus-summary-next-article
6131 (or (not (eq gnus-summary-goto-unread
'never
))
6132 (gnus-summary-last-article-p (gnus-summary-article-number)))
6133 (and gnus-auto-select-same
6134 (gnus-summary-article-subject))))
6136 (defun gnus-summary-prev-article (&optional unread subject
)
6137 "Select the article after the current one.
6138 If UNREAD is non-nil, only unread articles are selected."
6140 (gnus-summary-next-article unread subject t
))
6142 (defun gnus-summary-prev-unread-article ()
6143 "Select unread article before current one."
6145 (gnus-summary-prev-article
6146 (or (not (eq gnus-summary-goto-unread
'never
))
6147 (gnus-summary-first-article-p (gnus-summary-article-number)))
6148 (and gnus-auto-select-same
6149 (gnus-summary-article-subject))))
6151 (defun gnus-summary-next-page (&optional lines circular
)
6152 "Show next page of the selected article.
6153 If at the end of the current article, select the next article.
6154 LINES says how many lines should be scrolled up.
6156 If CIRCULAR is non-nil, go to the start of the article instead of
6157 selecting the next article when reaching the end of the current
6160 (setq gnus-summary-buffer
(current-buffer))
6161 (gnus-set-global-variables)
6162 (let ((article (gnus-summary-article-number))
6163 (article-window (get-buffer-window gnus-article-buffer t
))
6165 ;; If the buffer is empty, we have no article.
6167 (error "No article to select"))
6168 (gnus-configure-windows 'article
)
6169 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
6170 (if (and (eq gnus-summary-goto-unread
'never
)
6171 (not (gnus-summary-last-article-p article
)))
6172 (gnus-summary-next-article)
6173 (gnus-summary-next-unread-article))
6174 (if (or (null gnus-current-article
)
6175 (null gnus-article-current
)
6176 (/= article
(cdr gnus-article-current
))
6177 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6178 ;; Selected subject is different from current article's.
6179 (gnus-summary-display-article article
)
6180 (when article-window
6181 (gnus-eval-in-buffer-window gnus-article-buffer
6182 (setq endp
(gnus-article-next-page lines
)))
6185 (gnus-summary-beginning-of-article))
6187 (gnus-message 3 "End of message"))
6189 (if (and (eq gnus-summary-goto-unread
'never
)
6190 (not (gnus-summary-last-article-p article
)))
6191 (gnus-summary-next-article)
6192 (gnus-summary-next-unread-article))))))))
6193 (gnus-summary-recenter)
6194 (gnus-summary-position-point)))
6196 (defun gnus-summary-prev-page (&optional lines move
)
6197 "Show previous page of selected article.
6198 Argument LINES specifies lines to be scrolled down.
6199 If MOVE, move to the previous unread article if point is at
6200 the beginning of the buffer."
6202 (let ((article (gnus-summary-article-number))
6203 (article-window (get-buffer-window gnus-article-buffer t
))
6205 (gnus-configure-windows 'article
)
6206 (if (or (null gnus-current-article
)
6207 (null gnus-article-current
)
6208 (/= article
(cdr gnus-article-current
))
6209 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6210 ;; Selected subject is different from current article's.
6211 (gnus-summary-display-article article
)
6212 (gnus-summary-recenter)
6213 (when article-window
6214 (gnus-eval-in-buffer-window gnus-article-buffer
6215 (setq endp
(gnus-article-prev-page lines
)))
6216 (when (and move endp
)
6218 (gnus-message 3 "Beginning of message"))
6220 (if (and (eq gnus-summary-goto-unread
'never
)
6221 (not (gnus-summary-first-article-p article
)))
6222 (gnus-summary-prev-article)
6223 (gnus-summary-prev-unread-article))))))))
6224 (gnus-summary-position-point))
6226 (defun gnus-summary-prev-page-or-article (&optional lines
)
6227 "Show previous page of selected article.
6228 Argument LINES specifies lines to be scrolled down.
6229 If at the beginning of the article, go to the next article."
6231 (gnus-summary-prev-page lines t
))
6233 (defun gnus-summary-scroll-up (lines)
6234 "Scroll up (or down) one line current article.
6235 Argument LINES specifies lines to be scrolled up (or down if negative)."
6237 (gnus-configure-windows 'article
)
6238 (gnus-summary-show-thread)
6239 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
6240 (gnus-eval-in-buffer-window gnus-article-buffer
6242 (when (gnus-article-next-page lines
)
6243 (gnus-message 3 "End of message")))
6245 (gnus-article-prev-page (- lines
))))))
6246 (gnus-summary-recenter)
6247 (gnus-summary-position-point))
6249 (defun gnus-summary-scroll-down (lines)
6250 "Scroll down (or up) one line current article.
6251 Argument LINES specifies lines to be scrolled down (or up if negative)."
6253 (gnus-summary-scroll-up (- lines
)))
6255 (defun gnus-summary-next-same-subject ()
6256 "Select next article which has the same subject as current one."
6258 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
6260 (defun gnus-summary-prev-same-subject ()
6261 "Select previous article which has the same subject as current one."
6263 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
6265 (defun gnus-summary-next-unread-same-subject ()
6266 "Select next unread article which has the same subject as current one."
6268 (gnus-summary-next-article t
(gnus-summary-article-subject)))
6270 (defun gnus-summary-prev-unread-same-subject ()
6271 "Select previous unread article which has the same subject as current one."
6273 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
6275 (defun gnus-summary-first-unread-article ()
6276 "Select the first unread article.
6277 Return nil if there are no unread articles."
6280 (when (gnus-summary-first-subject t
)
6281 (gnus-summary-show-thread)
6282 (gnus-summary-first-subject t
)
6283 (gnus-summary-display-article (gnus-summary-article-number)))
6284 (gnus-summary-position-point)))
6286 (defun gnus-summary-first-unread-subject ()
6287 "Place the point on the subject line of the first unread article.
6288 Return nil if there are no unread articles."
6291 (when (gnus-summary-first-subject t
)
6292 (gnus-summary-show-thread)
6293 (gnus-summary-first-subject t
))
6294 (gnus-summary-position-point)))
6296 (defun gnus-summary-first-article ()
6297 "Select the first article.
6298 Return nil if there are no articles."
6301 (when (gnus-summary-first-subject)
6302 (gnus-summary-show-thread)
6303 (gnus-summary-first-subject)
6304 (gnus-summary-display-article (gnus-summary-article-number)))
6305 (gnus-summary-position-point)))
6307 (defun gnus-summary-best-unread-article ()
6308 "Select the unread article with the highest score."
6310 (let ((best -
1000000)
6311 (data gnus-newsgroup-data
)
6314 (and (gnus-data-unread-p (car data
))
6316 (gnus-summary-article-score (gnus-data-number (car data
))))
6319 article
(gnus-data-number (car data
))))
6320 (setq data
(cdr data
)))
6323 (gnus-summary-goto-article article
)
6324 (error "No unread articles"))
6325 (gnus-summary-position-point))))
6327 (defun gnus-summary-last-subject ()
6328 "Go to the last displayed subject line in the group."
6329 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
6331 (gnus-summary-goto-subject article
))))
6333 (defun gnus-summary-goto-article (article &optional all-headers force
)
6334 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6335 If ALL-HEADERS is non-nil, no header lines are hidden.
6336 If FORCE, go to the article even if it isn't displayed. If FORCE
6337 is a number, it is the line the article is to be displayed on."
6341 "Article number or Message-ID: "
6342 (mapcar (lambda (number) (list (int-to-string number
)))
6343 gnus-newsgroup-limit
))
6347 (if (and (stringp article
)
6348 (string-match "@" article
))
6349 (gnus-summary-refer-article article
)
6350 (when (stringp article
)
6351 (setq article
(string-to-number article
)))
6352 (if (gnus-summary-goto-subject article force
)
6353 (gnus-summary-display-article article all-headers
)
6354 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
6355 (gnus-summary-position-point)))
6357 (defun gnus-summary-goto-last-article ()
6358 "Go to the previously read article."
6361 (when gnus-last-article
6362 (gnus-summary-goto-article gnus-last-article nil t
))
6363 (gnus-summary-position-point)))
6365 (defun gnus-summary-pop-article (number)
6366 "Pop one article off the history and go to the previous.
6367 NUMBER articles will be popped off."
6370 (setq gnus-newsgroup-history
6371 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
6373 (gnus-summary-goto-article (car to
) nil t
)
6374 (error "Article history empty")))
6375 (gnus-summary-position-point))
6377 ;; Summary commands and functions for limiting the summary buffer.
6379 (defun gnus-summary-limit-to-articles (n)
6380 "Limit the summary buffer to the next N articles.
6381 If not given a prefix, use the process marked articles instead."
6384 (let ((articles (gnus-summary-work-articles n
)))
6385 (setq gnus-newsgroup-processable nil
)
6386 (gnus-summary-limit articles
))
6387 (gnus-summary-position-point)))
6389 (defun gnus-summary-pop-limit (&optional total
)
6390 "Restore the previous limit.
6391 If given a prefix, remove all limits."
6394 (setq gnus-newsgroup-limits
6395 (list (mapcar (lambda (h) (mail-header-number h
))
6396 gnus-newsgroup-headers
))))
6397 (unless gnus-newsgroup-limits
6398 (error "No limit to pop"))
6400 (gnus-summary-limit nil
'pop
)
6401 (gnus-summary-position-point)))
6403 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
6404 "Limit the summary buffer to articles that have subjects that match a regexp.
6405 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
6407 (list (read-string (if current-prefix-arg
6408 "Exclude subject (regexp): "
6409 "Limit to subject (regexp): "))
6410 nil current-prefix-arg
))
6412 (setq header
"subject"))
6413 (when (not (equal "" subject
))
6415 (let ((articles (gnus-summary-find-matching
6416 (or header
"subject") subject
'all nil nil
6419 (error "Found no matches for \"%s\"" subject
))
6420 (gnus-summary-limit articles
))
6421 (gnus-summary-position-point))))
6423 (defun gnus-summary-limit-to-author (from &optional not-matching
)
6424 "Limit the summary buffer to articles that have authors that match a regexp.
6425 If NOT-MATCHING, excluding articles that have authors that match a regexp."
6427 (list (read-string (if current-prefix-arg
6428 "Exclude author (regexp): "
6429 "Limit to author (regexp): "))
6430 current-prefix-arg
))
6431 (gnus-summary-limit-to-subject from
"from" not-matching
))
6433 (defun gnus-summary-limit-to-age (age &optional younger-p
)
6434 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6435 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6436 articles that are younger than AGE days."
6438 (let ((younger current-prefix-arg
)
6441 (while (not days-got
)
6442 (setq days
(if younger
6443 (read-string "Limit to articles within (in days): ")
6444 (read-string "Limit to articles old than (in days): ")))
6445 (when (> (length days
) 0)
6446 (setq days
(read days
)))
6449 (message "Please enter a number.")
6451 (list days younger
)))
6453 (let ((data gnus-newsgroup-data
)
6454 (cutoff (days-to-time age
))
6455 articles d date is-younger
)
6456 (while (setq d
(pop data
))
6457 (when (and (vectorp (gnus-data-header d
))
6458 (setq date
(mail-header-date (gnus-data-header d
))))
6459 (setq is-younger
(time-less-p
6460 (time-since (condition-case ()
6467 (push (gnus-data-number d
) articles
))))
6468 (gnus-summary-limit (nreverse articles
)))
6469 (gnus-summary-position-point)))
6471 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
6472 "Limit the summary buffer to articles that match an 'extra' header."
6476 (gnus-completing-read
6477 (symbol-name (car gnus-extra-headers
))
6478 (if current-prefix-arg
6479 "Exclude extra header:"
6480 "Limit extra header:")
6482 (cons (symbol-name x
) x
))
6487 (read-string (format "%s header %s (regexp): "
6488 (if current-prefix-arg
"Exclude" "Limit to")
6490 current-prefix-arg
)))
6491 (when (not (equal "" regexp
))
6493 (let ((articles (gnus-summary-find-matching
6494 (cons 'extra header
) regexp
'all nil nil
6497 (error "Found no matches for \"%s\"" regexp
))
6498 (gnus-summary-limit articles
))
6499 (gnus-summary-position-point))))
6501 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6503 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6505 (defun gnus-summary-limit-to-unread (&optional all
)
6506 "Limit the summary buffer to articles that are not marked as read.
6507 If ALL is non-nil, limit strictly to unread articles."
6510 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
6511 (gnus-summary-limit-to-marks
6512 ;; Concat all the marks that say that an article is read and have
6514 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6515 gnus-killed-mark gnus-kill-file-mark
6516 gnus-low-score-mark gnus-expirable-mark
6517 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6518 gnus-duplicate-mark gnus-souped-mark
)
6521 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
6522 (make-obsolete 'gnus-summary-delete-marked-with
6523 'gnus-summary-limit-exclude-marks
)
6525 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
6526 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6527 If REVERSE, limit the summary buffer to articles that are marked
6528 with MARKS. MARKS can either be a string of marks or a list of marks.
6529 Returns how many articles were removed."
6530 (interactive "sMarks: ")
6531 (gnus-summary-limit-to-marks marks t
))
6533 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
6534 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6535 If REVERSE (the prefix), limit the summary buffer to articles that are
6536 not marked with MARKS. MARKS can either be a string of marks or a
6538 Returns how many articles were removed."
6539 (interactive "sMarks: \nP")
6541 (let ((data gnus-newsgroup-data
)
6542 (marks (if (listp marks
) marks
6543 (append marks nil
))) ; Transform to list.
6546 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
6547 (memq (gnus-data-mark (car data
)) marks
))
6548 (push (gnus-data-number (car data
)) articles
))
6549 (setq data
(cdr data
)))
6550 (gnus-summary-limit articles
))
6551 (gnus-summary-position-point)))
6553 (defun gnus-summary-limit-to-score (&optional score
)
6554 "Limit to articles with score at or above SCORE."
6556 (setq score
(if score
6557 (prefix-numeric-value score
)
6558 (or gnus-summary-default-score
0)))
6559 (let ((data gnus-newsgroup-data
)
6562 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
6564 (push (gnus-data-number (car data
)) articles
))
6565 (setq data
(cdr data
)))
6567 (gnus-summary-limit articles
)
6568 (gnus-summary-position-point))))
6570 (defun gnus-summary-limit-include-thread (id)
6571 "Display all the hidden articles that in the current thread."
6572 (interactive (list (mail-header-id (gnus-summary-article-header))))
6573 (let ((articles (gnus-articles-in-thread
6574 (gnus-id-to-thread (gnus-root-id id
)))))
6576 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
6577 (gnus-summary-position-point))))
6579 (defun gnus-summary-limit-include-dormant ()
6580 "Display all the hidden articles that are marked as dormant.
6581 Note that this command only works on a subset of the articles currently
6582 fetched for this group."
6584 (unless gnus-newsgroup-dormant
6585 (error "There are no dormant articles in this group"))
6587 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
6588 (gnus-summary-position-point)))
6590 (defun gnus-summary-limit-exclude-dormant ()
6591 "Hide all dormant articles."
6594 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
6595 (gnus-summary-position-point)))
6597 (defun gnus-summary-limit-exclude-childless-dormant ()
6598 "Hide all dormant articles that have no children."
6600 (let ((data (gnus-data-list t
))
6601 articles d children
)
6602 ;; Find all articles that are either not dormant or have
6604 (while (setq d
(pop data
))
6605 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
6607 (gnus-article-children (gnus-data-number d
)))
6610 (when (memq (car children
) articles
)
6615 (push (gnus-data-number d
) articles
)))
6618 (gnus-summary-limit articles
)
6619 (gnus-summary-position-point))))
6621 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
6622 "Mark all unread excluded articles as read.
6623 If ALL, mark even excluded ticked and dormants as read."
6625 (let ((articles (gnus-sorted-complement
6627 (mapcar (lambda (h) (mail-header-number h
))
6628 gnus-newsgroup-headers
)
6630 (sort gnus-newsgroup-limit
'<)))
6632 (setq gnus-newsgroup-unreads
6633 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit
))
6635 (setq gnus-newsgroup-dormant nil
6636 gnus-newsgroup-marked nil
6637 gnus-newsgroup-reads
6639 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
6640 gnus-newsgroup-reads
))
6641 (while (setq article
(pop articles
))
6642 (unless (or (memq article gnus-newsgroup-dormant
)
6643 (memq article gnus-newsgroup-marked
))
6644 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
6646 (defun gnus-summary-limit (articles &optional pop
)
6648 ;; We pop the previous limit off the stack and use that.
6649 (setq articles
(car gnus-newsgroup-limits
)
6650 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
6651 ;; We use the new limit, so we push the old limit on the stack.
6652 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
6654 (setq gnus-newsgroup-limit articles
)
6655 (let ((total (length gnus-newsgroup-data
))
6656 (data (gnus-data-find-list (gnus-summary-article-number)))
6657 (gnus-summary-mark-below nil
) ; Inhibit this.
6659 ;; This will do all the work of generating the new summary buffer
6660 ;; according to the new limit.
6661 (gnus-summary-prepare)
6662 ;; Hide any threads, possibly.
6663 (and gnus-show-threads
6664 gnus-thread-hide-subtree
6665 (gnus-summary-hide-all-threads))
6666 ;; Try to return to the article you were at, or one in the
6669 ;; We try to find some article after the current one.
6671 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
6674 (setq data
(cdr data
))))
6676 ;; If there is no data, that means that we were after the last
6677 ;; article. The same goes when we can't find any articles
6678 ;; after the current one.
6679 (goto-char (point-max))
6680 (gnus-summary-find-prev))
6681 (gnus-set-mode-line 'summary
)
6682 ;; We return how many articles were removed from the summary
6683 ;; buffer as a result of the new limit.
6684 (- total
(length gnus-newsgroup-data
))))
6686 (defsubst gnus-invisible-cut-children
(threads)
6689 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
6694 (defsubst gnus-cut-thread
(thread)
6695 "Go forwards in the thread until we find an article that we want to display."
6696 (when (or (eq gnus-fetch-old-headers
'some
)
6697 (eq gnus-fetch-old-headers
'invisible
)
6698 (numberp gnus-fetch-old-headers
)
6699 (eq gnus-build-sparse-threads
'some
)
6700 (eq gnus-build-sparse-threads
'more
))
6701 ;; Deal with old-fetched headers and sparse threads.
6705 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
6706 (gnus-summary-article-ancient-p
6707 (mail-header-number (car thread
))))
6708 (if (or (<= (length (cdr thread
)) 1)
6709 (eq gnus-fetch-old-headers
'invisible
))
6710 (setq gnus-newsgroup-limit
6711 (delq (mail-header-number (car thread
))
6712 gnus-newsgroup-limit
)
6713 thread
(cadr thread
))
6714 (when (gnus-invisible-cut-children (cdr thread
))
6715 (let ((th (cdr thread
)))
6717 (if (memq (mail-header-number (caar th
))
6718 gnus-newsgroup-limit
)
6719 (setq thread
(car th
)
6721 (setq th
(cdr th
))))))))))
6724 (defun gnus-cut-threads (threads)
6725 "Cut off all uninteresting articles from the beginning of threads."
6726 (when (or (eq gnus-fetch-old-headers
'some
)
6727 (eq gnus-fetch-old-headers
'invisible
)
6728 (numberp gnus-fetch-old-headers
)
6729 (eq gnus-build-sparse-threads
'some
)
6730 (eq gnus-build-sparse-threads
'more
))
6733 (setcar th
(gnus-cut-thread (car th
)))
6734 (setq th
(cdr th
)))))
6735 ;; Remove nixed out threads.
6738 (defun gnus-summary-initial-limit (&optional show-if-empty
)
6739 "Figure out what the initial limit is supposed to be on group entry.
6740 This entails weeding out unwanted dormants, low-scored articles,
6741 fetch-old-headers verbiage, and so on."
6742 ;; Most groups have nothing to remove.
6743 (if (or gnus-inhibit-limiting
6744 (and (null gnus-newsgroup-dormant
)
6745 (not (eq gnus-fetch-old-headers
'some
))
6746 (not (numberp gnus-fetch-old-headers
))
6747 (not (eq gnus-fetch-old-headers
'invisible
))
6748 (null gnus-summary-expunge-below
)
6749 (not (eq gnus-build-sparse-threads
'some
))
6750 (not (eq gnus-build-sparse-threads
'more
))
6751 (null gnus-thread-expunge-below
)
6752 (not gnus-use-nocem
)))
6754 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
6755 (setq gnus-newsgroup-limit nil
)
6758 (unless (car (symbol-value node
))
6759 ;; These threads have no parents -- they are roots.
6760 (let ((nodes (cdr (symbol-value node
)))
6763 (if (and gnus-thread-expunge-below
6764 (< (gnus-thread-total-score (car nodes
))
6765 gnus-thread-expunge-below
))
6766 (gnus-expunge-thread (pop nodes
))
6767 (setq thread
(pop nodes
))
6768 (gnus-summary-limit-children thread
))))))
6769 gnus-newsgroup-dependencies
)
6770 ;; If this limitation resulted in an empty group, we might
6771 ;; pop the previous limit and use it instead.
6772 (when (and (not gnus-newsgroup-limit
)
6774 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
6775 gnus-newsgroup-limit
))
6777 (defun gnus-summary-limit-children (thread)
6778 "Return 1 if this subthread is visible and 0 if it is not."
6779 ;; First we get the number of visible children to this thread. This
6780 ;; is done by recursing down the thread using this function, so this
6781 ;; will really go down to a leaf article first, before slowly
6782 ;; working its way up towards the root.
6786 (apply '+ (mapcar 'gnus-summary-limit-children
6789 (number (mail-header-number (car thread
)))
6792 (not (memq number gnus-newsgroup-marked
))
6794 ;; If this article is dormant and has absolutely no visible
6795 ;; children, then this article isn't visible.
6796 (and (memq number gnus-newsgroup-dormant
)
6798 ;; If this is "fetch-old-headered" and there is no
6799 ;; visible children, then we don't want this article.
6800 (and (or (eq gnus-fetch-old-headers
'some
)
6801 (numberp gnus-fetch-old-headers
))
6802 (gnus-summary-article-ancient-p number
)
6804 ;; If this is "fetch-old-headered" and `invisible', then
6805 ;; we don't want this article.
6806 (and (eq gnus-fetch-old-headers
'invisible
)
6807 (gnus-summary-article-ancient-p number
))
6808 ;; If this is a sparsely inserted article with no children,
6809 ;; we don't want it.
6810 (and (eq gnus-build-sparse-threads
'some
)
6811 (gnus-summary-article-sparse-p number
)
6813 ;; If we use expunging, and this article is really
6814 ;; low-scored, then we don't want this article.
6815 (when (and gnus-summary-expunge-below
6817 (or (cdr (assq number gnus-newsgroup-scored
))
6818 gnus-summary-default-score
))
6819 gnus-summary-expunge-below
))
6820 ;; We increase the expunge-tally here, but that has
6821 ;; nothing to do with the limits, really.
6822 (incf gnus-newsgroup-expunged-tally
)
6823 ;; We also mark as read here, if that's wanted.
6824 (when (and gnus-summary-mark-below
6825 (< score gnus-summary-mark-below
))
6826 (setq gnus-newsgroup-unreads
6827 (delq number gnus-newsgroup-unreads
))
6828 (if gnus-newsgroup-auto-expire
6829 (push number gnus-newsgroup-expirable
)
6830 (push (cons number gnus-low-score-mark
)
6831 gnus-newsgroup-reads
)))
6833 ;; Check NoCeM things.
6834 (if (and gnus-use-nocem
6835 (gnus-nocem-unwanted-article-p
6836 (mail-header-id (car thread
))))
6838 (setq gnus-newsgroup-unreads
6839 (delq number gnus-newsgroup-unreads
))
6841 ;; Nope, invisible article.
6843 ;; Ok, this article is to be visible, so we add it to the limit
6845 (push number gnus-newsgroup-limit
)
6848 (defun gnus-expunge-thread (thread)
6849 "Mark all articles in THREAD as read."
6850 (let* ((number (mail-header-number (car thread
))))
6851 (incf gnus-newsgroup-expunged-tally
)
6852 ;; We also mark as read here, if that's wanted.
6853 (setq gnus-newsgroup-unreads
6854 (delq number gnus-newsgroup-unreads
))
6855 (if gnus-newsgroup-auto-expire
6856 (push number gnus-newsgroup-expirable
)
6857 (push (cons number gnus-low-score-mark
)
6858 gnus-newsgroup-reads
)))
6859 ;; Go recursively through all subthreads.
6860 (mapcar 'gnus-expunge-thread
(cdr thread
)))
6862 ;; Summary article oriented commands
6864 (defun gnus-summary-refer-parent-article (n)
6865 "Refer parent article N times.
6866 If N is negative, go to ancestor -N instead.
6867 The difference between N and the number of articles fetched is returned."
6871 (when (not (natnump n
))
6876 (setq header
(gnus-summary-article-header))
6877 (if (and (eq (mail-header-number header
)
6878 (cdr gnus-article-current
))
6879 (equal gnus-newsgroup-name
6880 (car gnus-article-current
)))
6881 ;; If we try to find the parent of the currently
6882 ;; displayed article, then we take a look at the actual
6883 ;; References header, since this is slightly more
6884 ;; reliable than the References field we got from the
6887 (set-buffer gnus-original-article-buffer
)
6888 (nnheader-narrow-to-headers)
6889 (unless (setq ref
(message-fetch-field "references"))
6890 (setq ref
(message-fetch-field "in-reply-to")))
6893 ;; It's not the current article, so we take a bet on
6894 ;; the value we got from the server.
6895 (mail-header-references header
)))
6897 (not (equal ref
"")))
6898 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
6899 (gnus-message 1 "Couldn't find parent"))
6900 (gnus-message 1 "No references in article %d"
6901 (gnus-summary-article-number))
6904 (gnus-summary-position-point)
6907 (defun gnus-summary-refer-references ()
6908 "Fetch all articles mentioned in the References header.
6909 Return the number of articles fetched."
6911 (let ((ref (mail-header-references (gnus-summary-article-header)))
6912 (current (gnus-summary-article-number))
6916 (error "No References in the current article")
6917 ;; For each Message-ID in the References header...
6918 (while (string-match "<[^>]*>" ref
)
6920 ;; ... fetch that article.
6921 (gnus-summary-refer-article
6922 (prog1 (match-string 0 ref
)
6923 (setq ref
(substring ref
(match-end 0))))))
6924 (gnus-summary-goto-subject current
)
6925 (gnus-summary-position-point)
6928 (defun gnus-summary-refer-thread (&optional limit
)
6929 "Fetch all articles in the current thread.
6930 If LIMIT (the numerical prefix), fetch that many old headers instead
6931 of what's specified by the `gnus-refer-thread-limit' variable."
6933 (let ((id (mail-header-id (gnus-summary-article-header)))
6934 (limit (if limit
(prefix-numeric-value limit
)
6935 gnus-refer-thread-limit
)))
6936 ;; We want to fetch LIMIT *old* headers, but we also have to
6937 ;; re-fetch all the headers in the current buffer, because many of
6938 ;; them may be undisplayed. So we adjust LIMIT.
6939 (when (numberp limit
)
6940 (incf limit
(- gnus-newsgroup-end gnus-newsgroup-begin
)))
6941 (unless (eq gnus-fetch-old-headers
'invisible
)
6942 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
6943 ;; Retrieve the headers and read them in.
6944 (if (eq (gnus-retrieve-headers
6945 (list gnus-newsgroup-end
) gnus-newsgroup-name limit
)
6947 (gnus-build-all-threads)
6948 (error "Can't fetch thread from backends that don't support NOV"))
6949 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
6950 (gnus-summary-limit-include-thread id
)))
6952 (defun gnus-summary-refer-article (message-id)
6953 "Fetch an article specified by MESSAGE-ID."
6954 (interactive "sMessage-ID: ")
6955 (when (and (stringp message-id
)
6956 (not (zerop (length message-id
))))
6957 ;; Construct the correct Message-ID if necessary.
6958 ;; Suggested by tale@pawl.rpi.edu.
6959 (unless (string-match "^<" message-id
)
6960 (setq message-id
(concat "<" message-id
)))
6961 (unless (string-match ">$" message-id
)
6962 (setq message-id
(concat message-id
">")))
6963 (let* ((header (gnus-id-to-header message-id
))
6965 (gnus-summary-article-sparse-p
6966 (mail-header-number header
))
6967 (memq (mail-header-number header
)
6968 gnus-newsgroup-limit
)))
6971 ;; If the article is present in the buffer we just go to it.
6973 (or (not (gnus-summary-article-sparse-p
6974 (mail-header-number header
)))
6977 (gnus-summary-goto-article
6978 (mail-header-number header
) nil t
)
6980 (gnus-summary-update-article (mail-header-number header
)))))
6982 ;; We fetch the article.
6984 (dolist (gnus-override-method (gnus-refer-article-methods))
6985 (gnus-check-server gnus-override-method
)
6986 ;; Fetch the header, and display the article.
6987 (when (setq number
(gnus-summary-insert-subject message-id
))
6988 (gnus-summary-select-article nil nil nil number
)
6990 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
6992 (defun gnus-refer-article-methods ()
6993 "Return a list of referrable methods."
6995 ;; No method, so we default to current and native.
6996 ((null gnus-refer-article-method
)
6997 (list gnus-current-select-method gnus-select-method
))
6999 ((eq 'current gnus-refer-article-method
)
7000 (list gnus-current-select-method
))
7001 ;; List of select methods.
7002 ((not (and (symbolp (car gnus-refer-article-method
))
7003 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
7005 (dolist (method gnus-refer-article-method
)
7006 (push (if (eq 'current method
)
7007 gnus-current-select-method
7011 ;; One single select method.
7013 (list gnus-refer-article-method
))))
7015 (defun gnus-summary-edit-parameters ()
7016 "Edit the group parameters of the current group."
7018 (gnus-group-edit-group gnus-newsgroup-name
'params
))
7020 (defun gnus-summary-customize-parameters ()
7021 "Customize the group parameters of the current group."
7023 (gnus-group-customize gnus-newsgroup-name
))
7025 (defun gnus-summary-enter-digest-group (&optional force
)
7026 "Enter an nndoc group based on the current article.
7027 If FORCE, force a digest interpretation. If not, try
7028 to guess what the document format is."
7030 (let ((conf gnus-current-window-configuration
))
7032 (gnus-summary-select-article))
7033 (setq gnus-current-window-configuration conf
)
7034 (let* ((name (format "%s-%d"
7035 (gnus-group-prefixed-name
7036 gnus-newsgroup-name
(list 'nndoc
""))
7038 (set-buffer gnus-summary-buffer
)
7039 gnus-current-article
)))
7040 (ogroup gnus-newsgroup-name
)
7041 (params (append (gnus-info-params (gnus-get-info ogroup
))
7042 (list (cons 'to-group ogroup
))
7043 (list (cons 'save-article-group ogroup
))))
7044 (case-fold-search t
)
7045 (buf (current-buffer))
7048 (set-buffer gnus-original-article-buffer
)
7049 ;; Have the digest group inherit the main mail address of
7050 ;; the parent article.
7051 (when (setq to-address
(or (message-fetch-field "reply-to")
7052 (message-fetch-field "from")))
7053 (setq params
(append
7054 (list (cons 'to-address
7055 (funcall gnus-decode-encoded-word-function
7057 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
7058 (insert-buffer-substring gnus-original-article-buffer
)
7059 ;; Remove lines that may lead nndoc to misinterpret the
7062 (goto-char (point-min))
7063 (or (search-forward "\n\n" nil t
) (point)))
7064 (goto-char (point-min))
7065 (delete-matching-lines "^Path:\\|^From ")
7068 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
7069 (gnus-newsgroup-ephemeral-ignored-charsets
7070 gnus-newsgroup-ignored-charsets
))
7071 (gnus-group-read-ephemeral-group
7072 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
7074 ,(if force
'mbox
'guess
))) t
))
7075 ;; Make all postings to this group go to the parent group.
7076 (nconc (gnus-info-params (gnus-get-info name
))
7078 ;; Couldn't select this doc group.
7079 (switch-to-buffer buf
)
7080 (gnus-set-global-variables)
7081 (gnus-configure-windows 'summary
)
7082 (gnus-message 3 "Article couldn't be entered?"))
7083 (kill-buffer dig
)))))
7085 (defun gnus-summary-read-document (n)
7086 "Open a new group based on the current article(s).
7087 This will allow you to read digests and other similar
7088 documents as newsgroups.
7089 Obeys the standard process/prefix convention."
7091 (let* ((articles (gnus-summary-work-articles n
))
7092 (ogroup gnus-newsgroup-name
)
7093 (params (append (gnus-info-params (gnus-get-info ogroup
))
7094 (list (cons 'to-group ogroup
))))
7095 article group egroup groups vgroup
)
7096 (while (setq article
(pop articles
))
7097 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
7098 (gnus-summary-remove-process-mark article
)
7099 (when (gnus-summary-display-article article
)
7102 (insert-buffer-substring gnus-original-article-buffer
)
7103 ;; Remove some headers that may lead nndoc to make
7105 (message-narrow-to-head)
7106 (goto-char (point-min))
7107 (delete-matching-lines "^\\(Path\\):\\|^From ")
7110 (gnus-group-read-ephemeral-group
7111 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
7112 (nndoc-article-type guess
))
7115 ;; Make all postings to this group go to the parent group.
7116 (nconc (gnus-info-params (gnus-get-info egroup
))
7118 (push egroup groups
))
7119 ;; Couldn't select this doc group.
7120 (gnus-error 3 "Article couldn't be entered"))))))
7121 ;; Now we have selected all the documents.
7124 (error "None of the articles could be interpreted as documents"))
7125 ((gnus-group-read-ephemeral-group
7126 (setq vgroup
(format
7127 "nnvirtual:%s-%s" gnus-newsgroup-name
7128 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7129 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
7131 (cons (current-buffer) 'summary
)))
7133 (error "Couldn't select virtual nndoc group")))))
7135 (defun gnus-summary-isearch-article (&optional regexp-p
)
7136 "Do incremental search forward on the current article.
7137 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7139 (gnus-summary-select-article)
7140 (gnus-configure-windows 'article
)
7141 (gnus-eval-in-buffer-window gnus-article-buffer
7144 (isearch-forward regexp-p
))))
7146 (defun gnus-summary-search-article-forward (regexp &optional backward
)
7147 "Search for an article containing REGEXP forward.
7148 If BACKWARD, search backward instead."
7151 (format "Search article %s (regexp%s): "
7152 (if current-prefix-arg
"backward" "forward")
7153 (if gnus-last-search-regexp
7154 (concat ", default " gnus-last-search-regexp
)
7156 current-prefix-arg
))
7157 (if (string-equal regexp
"")
7158 (setq regexp
(or gnus-last-search-regexp
""))
7159 (setq gnus-last-search-regexp regexp
))
7160 (if (gnus-summary-search-article regexp backward
)
7161 (gnus-summary-show-thread)
7162 (error "Search failed: \"%s\"" regexp
)))
7164 (defun gnus-summary-search-article-backward (regexp)
7165 "Search for an article containing REGEXP backward."
7168 (format "Search article backward (regexp%s): "
7169 (if gnus-last-search-regexp
7170 (concat ", default " gnus-last-search-regexp
)
7172 (gnus-summary-search-article-forward regexp
'backward
))
7174 (defun gnus-summary-search-article (regexp &optional backward
)
7175 "Search for an article containing REGEXP.
7176 Optional argument BACKWARD means do search for backward.
7177 `gnus-select-article-hook' is not called during the search."
7178 ;; We have to require this here to make sure that the following
7179 ;; dynamic binding isn't shadowed by autoloading.
7180 (require 'gnus-async
)
7182 (let ((gnus-select-article-hook nil
) ;Disable hook.
7183 (gnus-article-prepare-hook nil
)
7184 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
7185 (gnus-use-article-prefetch nil
)
7186 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
7187 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
7188 (sum (current-buffer))
7189 (gnus-display-mime-function nil
)
7192 (gnus-save-hidden-threads
7193 (gnus-summary-select-article)
7194 (set-buffer gnus-article-buffer
)
7195 (goto-char (window-point (get-buffer-window (current-buffer))))
7199 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
7201 (re-search-backward regexp nil t
)
7202 (re-search-forward regexp nil t
))
7203 ;; We found the regexp.
7208 (get-buffer-window (current-buffer))
7212 (get-buffer-window (current-buffer))
7215 (setq point
(point)))
7216 ;; We didn't find it, so we go to the next article.
7219 (while (eq found
'not
)
7220 (if (not (if backward
(gnus-summary-find-prev)
7221 (gnus-summary-find-next)))
7222 ;; No more articles.
7224 ;; Select the next article and adjust point.
7225 (unless (gnus-summary-article-sparse-p
7226 (gnus-summary-article-number))
7228 (gnus-summary-select-article)
7229 (set-buffer gnus-article-buffer
)
7231 (goto-char (if backward
(point-max) (point-min))))))))
7232 (gnus-message 7 ""))
7233 ;; Return whether we found the regexp.
7234 (when (eq found
'found
)
7236 (gnus-summary-show-thread)
7237 (gnus-summary-goto-subject gnus-current-article
)
7238 (gnus-summary-position-point)
7241 (defun gnus-summary-find-matching (header regexp
&optional backward unread
7242 not-case-fold not-matching
)
7243 "Return a list of all articles that match REGEXP on HEADER.
7244 The search stars on the current article and goes forwards unless
7245 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7246 If UNREAD is non-nil, only unread articles will
7247 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7248 in the comparisons. If NOT-MATCHING, return a list of all articles that
7249 not match REGEXP on HEADER."
7250 (let ((case-fold-search (not not-case-fold
))
7253 (if (eq (car header
) 'extra
)
7256 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
7258 (error "%s is an invalid header" header
))
7259 (unless (fboundp (intern (concat "mail-header-" header
)))
7260 (error "%s is not a valid header" header
))
7261 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
7262 (dolist (d (if (eq backward
'all
)
7264 (gnus-data-find-list
7265 (gnus-summary-article-number)
7266 (gnus-data-list backward
))))
7267 (when (and (or (not unread
) ; We want all articles...
7268 (gnus-data-unread-p d
)) ; Or just unreads.
7269 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
7273 (funcall func
(gnus-data-header d
))))
7274 (string-match regexp
7275 (funcall func
(gnus-data-header d
)))))
7276 (push (gnus-data-number d
) articles
))) ; Success!
7277 (nreverse articles
)))
7279 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
7280 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7281 If HEADER is an empty string (or nil), the match is done on the entire
7282 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7284 (list (let ((completion-ignore-case t
))
7287 (mapcar (lambda (string) (list string
))
7288 '("Number" "Subject" "From" "Lines" "Date"
7289 "Message-ID" "Xref" "References" "Body"))
7290 nil
'require-match
))
7291 (read-string "Regexp: ")
7292 (read-key-sequence "Command: ")
7293 current-prefix-arg
))
7294 (when (equal header
"Body")
7296 ;; Hidden thread subtrees must be searched as well.
7297 (gnus-summary-show-all-threads)
7298 ;; We don't want to change current point nor window configuration.
7300 (save-window-excursion
7301 (gnus-message 6 "Executing %s..." (key-description command
))
7302 ;; We'd like to execute COMMAND interactively so as to give arguments.
7303 (gnus-execute header regexp
7304 `(call-interactively ',(key-binding command
))
7306 (gnus-message 6 "Executing %s...done" (key-description command
)))))
7308 (defun gnus-summary-beginning-of-article ()
7309 "Scroll the article back to the beginning."
7311 (gnus-summary-select-article)
7312 (gnus-configure-windows 'article
)
7313 (gnus-eval-in-buffer-window gnus-article-buffer
7315 (goto-char (point-min))
7316 (when gnus-page-broken
7317 (gnus-narrow-to-page))))
7319 (defun gnus-summary-end-of-article ()
7320 "Scroll to the end of the article."
7322 (gnus-summary-select-article)
7323 (gnus-configure-windows 'article
)
7324 (gnus-eval-in-buffer-window gnus-article-buffer
7326 (goto-char (point-max))
7328 (when gnus-page-broken
7329 (gnus-narrow-to-page))))
7331 (defun gnus-summary-print-article (&optional filename n
)
7332 "Generate and print a PostScript image of the N next (mail) articles.
7334 If N is negative, print the N previous articles. If N is nil and articles
7335 have been marked with the process mark, print these instead.
7337 If the optional first argument FILENAME is nil, send the image to the
7338 printer. If FILENAME is a string, save the PostScript image in a file with
7339 that name. If FILENAME is a number, prompt the user for the name of the file
7341 (interactive (list (ps-print-preprint current-prefix-arg
)))
7342 (dolist (article (gnus-summary-work-articles n
))
7343 (gnus-summary-select-article nil nil
'pseudo article
)
7344 (gnus-eval-in-buffer-window gnus-article-buffer
7345 (let ((buffer (generate-new-buffer " *print*")))
7348 (copy-to-buffer buffer
(point-min) (point-max))
7350 (gnus-article-delete-invisible-text)
7351 (let ((ps-left-header
7354 (mail-header-subject gnus-current-headers
) ")")
7356 (mail-header-from gnus-current-headers
) ")")))
7359 "/pagenumberstring load"
7361 (mail-header-date gnus-current-headers
) ")"))))
7362 (gnus-run-hooks 'gnus-ps-print-hook
)
7364 (ps-spool-buffer-with-faces))))
7365 (kill-buffer buffer
))))
7366 (gnus-summary-remove-process-mark article
))
7367 (ps-despool filename
))
7369 (defun gnus-summary-show-article (&optional arg
)
7370 "Force re-fetching of the current article.
7371 If ARG (the prefix) is a number, show the article with the charset
7372 defined in `gnus-summary-show-article-charset-alist', or the charset
7374 If ARG (the prefix) is non-nil and not a number, show the raw article
7375 without any article massaging functions being run."
7379 (let ((gnus-newsgroup-charset
7380 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
7381 (read-coding-system "Charset: ")))
7382 (gnus-newsgroup-ignored-charsets 'gnus-all
))
7383 (gnus-summary-select-article nil
'force
)))
7385 ;; Select the article the normal way.
7386 (gnus-summary-select-article nil
'force
))
7388 ;; We have to require this here to make sure that the following
7389 ;; dynamic binding isn't shadowed by autoloading.
7390 (require 'gnus-async
)
7392 ;; Bind the article treatment functions to nil.
7393 (let ((gnus-have-all-headers t
)
7394 gnus-article-prepare-hook
7395 gnus-article-decode-hook
7396 gnus-display-mime-function
7398 ;; Destroy any MIME parts.
7399 (when (gnus-buffer-live-p gnus-article-buffer
)
7401 (set-buffer gnus-article-buffer
)
7402 (mm-destroy-parts gnus-article-mime-handles
)
7403 ;; Set it to nil for safety reason.
7404 (setq gnus-article-mime-handle-alist nil
)
7405 (setq gnus-article-mime-handles nil
)))
7406 (gnus-summary-select-article nil
'force
))))
7407 (gnus-summary-goto-subject gnus-current-article
)
7408 (gnus-summary-position-point))
7410 (defun gnus-summary-verbose-headers (&optional arg
)
7411 "Toggle permanent full header display.
7412 If ARG is a positive number, turn header display on.
7413 If ARG is a negative number, turn header display off."
7415 (setq gnus-show-all-headers
7416 (cond ((or (not (numberp arg
))
7418 (not gnus-show-all-headers
))
7421 (gnus-summary-show-article))
7423 (defun gnus-summary-toggle-header (&optional arg
)
7424 "Show the headers if they are hidden, or hide them if they are shown.
7425 If ARG is a positive number, show the entire header.
7426 If ARG is a negative number, hide the unwanted header lines."
7429 (set-buffer gnus-article-buffer
)
7431 (let* ((buffer-read-only nil
)
7432 (inhibit-point-motion-hooks t
)
7438 (article-narrow-to-head)
7439 (gnus-article-hidden-text-p 'headers
))))
7440 (goto-char (point-min))
7441 (when (search-forward "\n\n" nil t
)
7442 (delete-region (point-min) (1- (point))))
7443 (goto-char (point-min))
7444 (with-current-buffer gnus-original-article-buffer
7445 (goto-char (setq s
(point-min)))
7446 (setq e
(1- (or (search-forward "\n\n" nil t
) (point-max)))))
7447 (insert-buffer-substring gnus-original-article-buffer s e
)
7449 (narrow-to-region (point-min) (point))
7450 (article-decode-encoded-words)
7452 (let ((gnus-treat-hide-headers nil
)
7453 (gnus-treat-hide-boring-headers nil
))
7454 (setq gnus-article-wash-types
7455 (delq 'headers gnus-article-wash-types
))
7456 (gnus-treat-article 'head
))
7457 (gnus-treat-article 'head
)))
7458 (gnus-set-mode-line 'article
)))))
7460 (defun gnus-summary-show-all-headers ()
7461 "Make all header lines visible."
7463 (gnus-article-show-all-headers))
7465 (defun gnus-summary-caesar-message (&optional arg
)
7466 "Caesar rotate the current article by 13.
7467 The numerical prefix specifies how many places to rotate each letter
7470 (gnus-summary-select-article)
7471 (let ((mail-header-separator ""))
7472 (gnus-eval-in-buffer-window gnus-article-buffer
7475 (let ((start (window-start))
7477 (message-caesar-buffer-body arg
)
7478 (set-window-start (get-buffer-window (current-buffer)) start
))))))
7480 (defun gnus-summary-stop-page-breaking ()
7481 "Stop page breaking in the current article."
7483 (gnus-summary-select-article)
7484 (gnus-eval-in-buffer-window gnus-article-buffer
7486 (when (gnus-visual-p 'page-marker
)
7487 (let ((buffer-read-only nil
))
7488 (gnus-remove-text-with-property 'gnus-prev
)
7489 (gnus-remove-text-with-property 'gnus-next
))
7490 (setq gnus-page-broken nil
))))
7492 (defun gnus-summary-move-article (&optional n to-newsgroup
7493 select-method action
)
7494 "Move the current article to a different newsgroup.
7495 If N is a positive number, move the N next articles.
7496 If N is a negative number, move the N previous articles.
7497 If N is nil and any articles have been marked with the process mark,
7498 move those articles instead.
7499 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7500 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7501 re-spool using this method.
7503 For this function to work, both the current newsgroup and the
7504 newsgroup that you want to move to have to support the `request-move'
7505 and `request-accept' functions.
7507 ACTION can be either `move' (the default), `crosspost' or `copy'."
7510 (setq action
'move
))
7511 ;; Disable marking as read.
7512 (let (gnus-mark-article-hook)
7513 (save-window-excursion
7514 (gnus-summary-select-article)))
7515 ;; Check whether the source group supports the required functions.
7516 (cond ((and (eq action
'move
)
7517 (not (gnus-check-backend-function
7518 'request-move-article gnus-newsgroup-name
)))
7519 (error "The current group does not support article moving"))
7520 ((and (eq action
'crosspost
)
7521 (not (gnus-check-backend-function
7522 'request-replace-article gnus-newsgroup-name
)))
7523 (error "The current group does not support article editing")))
7524 (let ((articles (gnus-summary-work-articles n
))
7525 (prefix (if (gnus-check-backend-function
7526 'request-move-article gnus-newsgroup-name
)
7527 (gnus-group-real-prefix gnus-newsgroup-name
)
7529 (names '((move "Move" "Moving")
7530 (copy "Copy" "Copying")
7531 (crosspost "Crosspost" "Crossposting")))
7532 (copy-buf (save-excursion
7533 (nnheader-set-temp-buffer " *copy article*")))
7534 art-group to-method new-xref article to-groups
)
7535 (unless (assq action names
)
7536 (error "Unknown action %s" action
))
7537 ;; Read the newsgroup name.
7538 (when (and (not to-newsgroup
)
7539 (not select-method
))
7541 (gnus-read-move-group-name
7542 (cadr (assq action names
))
7543 (symbol-value (intern (format "gnus-current-%s-group" action
)))
7545 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
7546 (setq to-method
(or select-method
7547 (gnus-server-to-method
7548 (gnus-group-method to-newsgroup
))))
7549 ;; Check the method we are to move this article to...
7550 (unless (gnus-check-backend-function
7551 'request-accept-article
(car to-method
))
7552 (error "%s does not support article copying" (car to-method
)))
7553 (unless (gnus-check-server to-method
)
7554 (error "Can't open server %s" (car to-method
)))
7555 (gnus-message 6 "%s to %s: %s..."
7556 (caddr (assq action names
))
7557 (or (car select-method
) to-newsgroup
) articles
)
7559 (setq article
(pop articles
))
7563 ;; Move the article.
7565 ;; Remove this article from future suppression.
7566 (gnus-dup-unsuppress-article article
)
7567 (gnus-request-move-article
7568 article
; Article to move
7569 gnus-newsgroup-name
; From newsgroup
7570 (nth 1 (gnus-find-method-for-group
7571 gnus-newsgroup-name
)) ; Server
7572 (list 'gnus-request-accept-article
7573 to-newsgroup
(list 'quote select-method
)
7574 (not articles
) t
) ; Accept form
7575 (not articles
))) ; Only save nov last time
7576 ;; Copy the article.
7579 (set-buffer copy-buf
)
7580 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7581 (gnus-request-accept-article
7582 to-newsgroup select-method
(not articles
) t
))))
7583 ;; Crosspost the article.
7584 ((eq action
'crosspost
)
7585 (let ((xref (message-tokenize-header
7586 (mail-header-xref (gnus-summary-article-header article
))
7588 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
7591 (setq xref
(list (system-name))))
7594 (mapconcat 'identity
7595 (delete "Xref:" (delete new-xref xref
))
7599 (set-buffer copy-buf
)
7600 ;; First put the article in the destination group.
7601 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7602 (when (consp (setq art-group
7603 (gnus-request-accept-article
7604 to-newsgroup select-method
(not articles
))))
7605 (setq new-xref
(concat new-xref
" " (car art-group
)
7606 ":" (cdr art-group
)))
7607 ;; Now we have the new Xrefs header, so we insert
7608 ;; it and replace the new article.
7609 (nnheader-replace-header "Xref" new-xref
)
7610 (gnus-request-replace-article
7611 (cdr art-group
) to-newsgroup
(current-buffer))
7615 (gnus-message 1 "Couldn't %s article %s: %s"
7616 (cadr (assq action names
)) article
7617 (nnheader-get-report (car to-method
))))
7618 ((eq art-group
'junk
)
7619 (when (eq action
'move
)
7620 (gnus-summary-mark-article article gnus-canceled-mark
)
7621 (gnus-message 4 "Deleted article %s" article
)))
7623 (let* ((pto-group (gnus-group-prefixed-name
7624 (car art-group
) to-method
))
7626 (gnus-gethash pto-group gnus-newsrc-hashtb
))
7627 (info (nth 2 entry
))
7628 (to-group (gnus-info-group info
))
7630 ;; Update the group that has been moved to.
7632 (memq action
'(move copy
)))
7633 (unless (member to-group to-groups
)
7634 (push to-group to-groups
))
7636 (unless (memq article gnus-newsgroup-unreads
)
7637 (push 'read to-marks
)
7639 info
(gnus-add-to-range (gnus-info-read info
)
7640 (list (cdr art-group
)))))
7642 ;; See whether the article is to be put in the cache.
7643 (let ((marks gnus-article-mark-lists
)
7644 (to-article (cdr art-group
)))
7646 ;; Enter the article into the cache in the new group,
7647 ;; if that is required.
7648 (when gnus-use-cache
7649 (gnus-cache-possibly-enter-article
7651 (memq article gnus-newsgroup-marked
)
7652 (memq article gnus-newsgroup-dormant
)
7653 (memq article gnus-newsgroup-unreads
)))
7655 (when gnus-preserve-marks
7656 ;; Copy any marks over to the new group.
7657 (when (and (equal to-group gnus-newsgroup-name
)
7658 (not (memq article gnus-newsgroup-unreads
)))
7659 ;; Mark this article as read in this group.
7660 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
7661 (setcdr (gnus-active to-group
) to-article
)
7662 (setcdr gnus-newsgroup-active to-article
))
7665 (when (memq article
(symbol-value
7666 (intern (format "gnus-newsgroup-%s"
7668 (push (cdar marks
) to-marks
)
7669 ;; If the other group is the same as this group,
7670 ;; then we have to add the mark to the list.
7671 (when (equal to-group gnus-newsgroup-name
)
7672 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
7675 (intern (format "gnus-newsgroup-%s"
7677 ;; Copy the marks to other group.
7678 (gnus-add-marked-articles
7679 to-group
(cdar marks
) (list to-article
) info
))
7680 (setq marks
(cdr marks
)))
7682 (gnus-request-set-mark to-group
(list (list (list to-article
)
7687 (concat "(gnus-group-set-info '"
7688 (gnus-prin1-to-string (gnus-get-info to-group
))
7691 ;; Update the Xref header in this article to point to
7692 ;; the new crossposted article we have just created.
7693 (when (eq action
'crosspost
)
7695 (set-buffer copy-buf
)
7696 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7697 (nnheader-replace-header "Xref" new-xref
)
7698 (gnus-request-replace-article
7699 article gnus-newsgroup-name
(current-buffer)))))
7701 ;;;!!!Why is this necessary?
7702 (set-buffer gnus-summary-buffer
)
7704 (gnus-summary-goto-subject article
)
7705 (when (eq action
'move
)
7706 (gnus-summary-mark-article article gnus-canceled-mark
))))
7707 (gnus-summary-remove-process-mark article
))
7708 ;; Re-activate all groups that have been moved to.
7711 (set-buffer gnus-group-buffer
)
7712 (when (gnus-group-goto-group (car to-groups
) t
)
7713 (gnus-group-get-new-news-this-group 1 t
))
7716 (gnus-kill-buffer copy-buf
)
7717 (gnus-summary-position-point)
7718 (gnus-set-mode-line 'summary
)))
7720 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
7721 "Move the current article to a different newsgroup.
7722 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7723 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7724 re-spool using this method."
7726 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
7728 (defun gnus-summary-crosspost-article (&optional n
)
7729 "Crosspost the current article to some other group."
7731 (gnus-summary-move-article n nil nil
'crosspost
))
7733 (defcustom gnus-summary-respool-default-method nil
7734 "Default method for respooling an article.
7735 If nil, use to the current newsgroup method."
7736 :type
'(choice (gnus-select-method :value
(nnml ""))
7738 :group
'gnus-summary-mail
)
7740 (defun gnus-summary-respool-article (&optional n method
)
7741 "Respool the current article.
7742 The article will be squeezed through the mail spooling process again,
7743 which means that it will be put in some mail newsgroup or other
7744 depending on `nnmail-split-methods'.
7745 If N is a positive number, respool the N next articles.
7746 If N is a negative number, respool the N previous articles.
7747 If N is nil and any articles have been marked with the process mark,
7748 respool those articles instead.
7750 Respooling can be done both from mail groups and \"real\" newsgroups.
7751 In the former case, the articles in question will be moved from the
7752 current group into whatever groups they are destined to. In the
7753 latter case, they will be copied into the relevant groups."
7755 (list current-prefix-arg
7756 (let* ((methods (gnus-methods-using 'respool
))
7758 (symbol-name (or gnus-summary-respool-default-method
7759 (car (gnus-find-method-for-group
7760 gnus-newsgroup-name
)))))
7762 (gnus-completing-read
7763 methname
"What backend do you want to use when respooling?"
7764 methods nil t nil
'gnus-mail-method-history
))
7767 ((zerop (length (setq ms
(gnus-servers-using-backend
7769 (list (intern method
) ""))
7773 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
7774 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
7777 (error "No method given for respooling"))
7778 (if (assoc (symbol-name
7779 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
7780 (gnus-methods-using 'respool
))
7781 (gnus-summary-move-article n nil method
)
7782 (gnus-summary-copy-article n nil method
)))
7784 (defun gnus-summary-import-article (file)
7785 "Import an arbitrary file into a mail newsgroup."
7786 (interactive "fImport file: ")
7787 (let ((group gnus-newsgroup-name
)
7788 (now (current-time))
7790 (unless (gnus-check-backend-function 'request-accept-article group
)
7791 (error "%s does not support article importing" group
))
7792 (or (file-readable-p file
)
7793 (not (file-regular-p file
))
7794 (error "Can't read %s" file
))
7796 (set-buffer (gnus-get-buffer-create " *import file*"))
7798 (nnheader-insert-file-contents file
)
7799 (goto-char (point-min))
7800 (unless (nnheader-article-p)
7801 ;; This doesn't look like an article, so we fudge some headers.
7802 (setq atts
(file-attributes file
)
7803 lines
(count-lines (point-min) (point-max)))
7804 (insert "From: " (read-string "From: ") "\n"
7805 "Subject: " (read-string "Subject: ") "\n"
7806 "Date: " (message-make-date (nth 5 atts
))
7808 "Message-ID: " (message-make-message-id) "\n"
7809 "Lines: " (int-to-string lines
) "\n"
7810 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
7811 (gnus-request-accept-article group nil t
)
7812 (kill-buffer (current-buffer)))))
7814 (defun gnus-summary-article-posted-p ()
7815 "Say whether the current (mail) article is available from news as well.
7816 This will be the case if the article has both been mailed and posted."
7818 (let ((id (mail-header-references (gnus-summary-article-header)))
7819 (gnus-override-method (car (gnus-refer-article-methods))))
7820 (if (gnus-request-head id
"")
7821 (gnus-message 2 "The current message was found on %s"
7822 gnus-override-method
)
7823 (gnus-message 2 "The current message couldn't be found on %s"
7824 gnus-override-method
)
7827 (defun gnus-summary-expire-articles (&optional now
)
7828 "Expire all articles that are marked as expirable in the current group."
7830 (when (gnus-check-backend-function
7831 'request-expire-articles gnus-newsgroup-name
)
7832 ;; This backend supports expiry.
7833 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
7834 (expirable (if total
7836 ;; We need to update the info for
7837 ;; this group for `gnus-list-of-read-articles'
7838 ;; to give us the right answer.
7839 (gnus-run-hooks 'gnus-exit-group-hook
)
7840 (gnus-summary-update-info)
7841 (gnus-list-of-read-articles gnus-newsgroup-name
))
7842 (setq gnus-newsgroup-expirable
7843 (sort gnus-newsgroup-expirable
'<))))
7844 (expiry-wait (if now
'immediate
7845 (gnus-group-find-parameter
7846 gnus-newsgroup-name
'expiry-wait
)))
7847 (nnmail-expiry-target
7848 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
7849 nnmail-expiry-target
))
7852 ;; There are expirable articles in this group, so we run them
7853 ;; through the expiry process.
7854 (gnus-message 6 "Expiring articles...")
7855 (unless (gnus-check-group gnus-newsgroup-name
)
7856 (error "Can't open server for %s" gnus-newsgroup-name
))
7857 ;; The list of articles that weren't expired is returned.
7860 (let ((nnmail-expiry-wait-function nil
)
7861 (nnmail-expiry-wait expiry-wait
))
7862 (setq es
(gnus-request-expire-articles
7863 expirable gnus-newsgroup-name
)))
7864 (setq es
(gnus-request-expire-articles
7865 expirable gnus-newsgroup-name
))))
7867 (setq gnus-newsgroup-expirable es
))
7868 ;; We go through the old list of expirable, and mark all
7869 ;; really expired articles as nonexistent.
7870 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
7871 (let ((gnus-use-cache nil
))
7873 (unless (memq (car expirable
) es
)
7874 (when (gnus-data-find (car expirable
))
7875 (gnus-summary-mark-article
7876 (car expirable
) gnus-canceled-mark
)))
7877 (setq expirable
(cdr expirable
)))))
7878 (gnus-message 6 "Expiring articles...done")))))
7880 (defun gnus-summary-expire-articles-now ()
7881 "Expunge all expirable articles in the current group.
7882 This means that *all* articles that are marked as expirable will be
7883 deleted forever, right now."
7885 (or gnus-expert-user
7887 "Are you really, really, really sure you want to delete all these messages? ")
7889 (gnus-summary-expire-articles t
))
7891 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7892 (defun gnus-summary-delete-article (&optional n
)
7893 "Delete the N next (mail) articles.
7894 This command actually deletes articles. This is not a marking
7895 command. The article will disappear forever from your life, never to
7897 If N is negative, delete backwards.
7898 If N is nil and articles have been marked with the process mark,
7899 delete these instead."
7901 (unless (gnus-check-backend-function 'request-expire-articles
7902 gnus-newsgroup-name
)
7903 (error "The current newsgroup does not support article deletion"))
7904 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
7905 (error "Couldn't open server"))
7906 ;; Compute the list of articles to delete.
7907 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
7909 (if (and gnus-novice-user
7910 (not (gnus-yes-or-no-p
7911 (format "Do you really want to delete %s forever? "
7912 (if (> (length articles
) 1)
7913 (format "these %s articles" (length articles
))
7916 ;; Delete the articles.
7917 (setq not-deleted
(gnus-request-expire-articles
7918 articles gnus-newsgroup-name
'force
))
7920 (gnus-summary-remove-process-mark (car articles
))
7921 ;; The backend might not have been able to delete the article
7923 (unless (memq (car articles
) not-deleted
)
7924 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
7925 (setq articles
(cdr articles
)))
7927 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
7928 (gnus-summary-position-point)
7929 (gnus-set-mode-line 'summary
)
7932 (defun gnus-summary-edit-article (&optional arg
)
7933 "Edit the current article.
7934 This will have permanent effect only in mail groups.
7935 If ARG is nil, edit the decoded articles.
7936 If ARG is 1, edit the raw articles.
7937 If ARG is 2, edit the raw articles even in read-only groups.
7938 Otherwise, allow editing of articles even in read-only
7944 ((eq arg
1) (setq raw t
))
7945 ((eq arg
2) (setq raw t
7948 (if (and raw
(not force
) (equal gnus-newsgroup-name
"nndraft:drafts"))
7949 (error "Can't edit the raw article in group nndraft:drafts"))
7951 (set-buffer gnus-summary-buffer
)
7952 (let ((mail-parse-charset gnus-newsgroup-charset
)
7953 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
7954 (gnus-set-global-variables)
7955 (when (and (not force
)
7956 (gnus-group-read-only-p))
7957 (error "The current newsgroup does not support article editing"))
7958 (gnus-summary-show-article t
)
7959 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
7960 (with-current-buffer gnus-article-buffer
7961 (mm-enable-multibyte)))
7962 (if (equal gnus-newsgroup-name
"nndraft:drafts")
7964 (gnus-article-edit-article
7967 (let ((mbl mml-buffer-list
))
7968 (setq mml-buffer-list nil
)
7970 (make-local-hook 'kill-buffer-hook
)
7971 (let ((mml-buffer-list mml-buffer-list
))
7972 (setq mml-buffer-list mbl
)
7973 (make-local-variable 'mml-buffer-list
))
7974 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
7975 `(lambda (no-highlight)
7976 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
7977 (mail-parse-ignored-charsets
7978 ',gnus-newsgroup-ignored-charsets
))
7979 ,(if (not raw
) '(progn
7981 (mml-destroy-buffers)
7982 (remove-hook 'kill-buffer-hook
7983 'mml-destroy-buffers t
)
7984 (kill-local-variable 'mml-buffer-list
)))
7985 (gnus-summary-edit-article-done
7986 ,(or (mail-header-references gnus-current-headers
) "")
7987 ,(gnus-group-read-only-p)
7988 ,gnus-summary-buffer no-highlight
))))))))
7990 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
7992 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7994 "Make edits to the current article permanent."
7996 ;; Replace the article.
7997 (let ((buf (current-buffer)))
7999 (insert-buffer-substring buf
)
8000 (if (and (not read-only
)
8001 (not (gnus-request-replace-article
8002 (cdr gnus-article-current
) (car gnus-article-current
)
8003 (current-buffer) t
)))
8004 (error "Couldn't replace article")
8005 ;; Update the summary buffer.
8007 (equal (message-tokenize-header references
" ")
8008 (message-tokenize-header
8009 (or (message-fetch-field "references") "") " ")))
8010 ;; We only have to update this line.
8013 (message-narrow-to-head)
8014 (let ((head (buffer-string))
8017 (insert (format "211 %d Article retrieved.\n"
8018 (cdr gnus-article-current
)))
8021 (let ((nntp-server-buffer (current-buffer)))
8022 (setq header
(car (gnus-get-newsgroup-headers
8024 (set-buffer gnus-summary-buffer
)
8025 gnus-newsgroup-dependencies
)
8028 (set-buffer gnus-summary-buffer
)
8029 (gnus-data-set-header
8030 (gnus-data-find (cdr gnus-article-current
))
8032 (gnus-summary-update-article-line
8033 (cdr gnus-article-current
) header
))))))
8035 (set-buffer (or buffer gnus-summary-buffer
))
8036 (gnus-summary-update-article (cdr gnus-article-current
)))
8037 ;; Prettify the article buffer again.
8038 (unless no-highlight
8040 (set-buffer gnus-article-buffer
)
8041 ;;;!!! Fix this -- article should be rehighlighted.
8042 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8043 (set-buffer gnus-original-article-buffer
)
8044 (gnus-request-article
8045 (cdr gnus-article-current
)
8046 (car gnus-article-current
) (current-buffer))))
8047 ;; Prettify the summary buffer line.
8048 (when (gnus-visual-p 'summary-highlight
'highlight
)
8049 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
8051 (defun gnus-summary-edit-wash (key)
8052 "Perform editing command KEY in the article buffer."
8056 (message "%s" (concat (this-command-keys) "- "))
8059 (gnus-summary-edit-article)
8060 (execute-kbd-macro (concat (this-command-keys) key
))
8061 (gnus-article-edit-done))
8065 (defun gnus-summary-respool-query (&optional silent trace
)
8066 "Query where the respool algorithm would put this article."
8068 (let (gnus-mark-article-hook)
8069 (gnus-summary-select-article)
8071 (set-buffer gnus-original-article-buffer
)
8073 (message-narrow-to-head)
8074 (let ((groups (nnmail-article-group 'identity trace
)))
8077 (message "This message would go to %s"
8078 (mapconcat 'car groups
", "))
8079 (message "This message would go to no groups"))
8082 (defun gnus-summary-respool-trace ()
8083 "Trace where the respool algorithm would put this article.
8084 Display a buffer showing all fancy splitting patterns which matched."
8086 (gnus-summary-respool-query nil t
))
8088 ;; Summary marking commands.
8090 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
8091 "Mark articles which has the same subject as read, and then select the next.
8092 If UNMARK is positive, remove any kind of mark.
8093 If UNMARK is negative, tick articles."
8096 (setq unmark
(prefix-numeric-value unmark
)))
8098 (gnus-summary-mark-same-subject
8099 (gnus-summary-article-subject) unmark
)))
8100 ;; Select next unread article. If auto-select-same mode, should
8101 ;; select the first unread article.
8102 (gnus-summary-next-article t
(and gnus-auto-select-same
8103 (gnus-summary-article-subject)))
8104 (gnus-message 7 "%d article%s marked as %s"
8105 count
(if (= count
1) " is" "s are")
8106 (if unmark
"unread" "read"))))
8108 (defun gnus-summary-kill-same-subject (&optional unmark
)
8109 "Mark articles which has the same subject as read.
8110 If UNMARK is positive, remove any kind of mark.
8111 If UNMARK is negative, tick articles."
8114 (setq unmark
(prefix-numeric-value unmark
)))
8116 (gnus-summary-mark-same-subject
8117 (gnus-summary-article-subject) unmark
)))
8118 ;; If marked as read, go to next unread subject.
8120 ;; Go to next unread subject.
8121 (gnus-summary-next-subject 1 t
))
8122 (gnus-message 7 "%d articles are marked as %s"
8123 count
(if unmark
"unread" "read"))))
8125 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
8126 "Mark articles with same SUBJECT as read, and return marked number.
8127 If optional argument UNMARK is positive, remove any kinds of marks.
8128 If optional argument UNMARK is negative, mark articles as unread instead."
8132 ((null unmark
) ; Mark as read.
8135 (gnus-summary-mark-article-as-read gnus-killed-mark
)
8136 (gnus-summary-show-thread) t
)
8137 (gnus-summary-find-subject subject
))
8138 (setq count
(1+ count
))))
8139 ((> unmark
0) ; Tick.
8142 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
8143 (gnus-summary-show-thread) t
)
8144 (gnus-summary-find-subject subject
))
8145 (setq count
(1+ count
))))
8146 (t ; Mark as unread.
8149 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
8150 (gnus-summary-show-thread) t
)
8151 (gnus-summary-find-subject subject
))
8152 (setq count
(1+ count
)))))
8153 (gnus-set-mode-line 'summary
)
8154 ;; Return the number of marked articles.
8157 (defun gnus-summary-mark-as-processable (n &optional unmark
)
8158 "Set the process mark on the next N articles.
8159 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8160 the process mark instead. The difference between N and the actual
8161 number of articles marked is returned."
8163 (let ((backward (< n
0))
8168 (gnus-summary-remove-process-mark
8169 (gnus-summary-article-number))
8170 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8171 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
8174 (gnus-message 7 "No more articles"))
8175 (gnus-summary-recenter)
8176 (gnus-summary-position-point)
8179 (defun gnus-summary-unmark-as-processable (n)
8180 "Remove the process mark from the next N articles.
8181 If N is negative, unmark backward instead. The difference between N and
8182 the actual number of articles unmarked is returned."
8184 (gnus-summary-mark-as-processable n t
))
8186 (defun gnus-summary-unmark-all-processable ()
8187 "Remove the process mark from all articles."
8190 (while gnus-newsgroup-processable
8191 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
8192 (gnus-summary-position-point))
8194 (defun gnus-summary-mark-as-expirable (n)
8195 "Mark N articles forward as expirable.
8196 If N is negative, mark backward instead. The difference between N and
8197 the actual number of articles marked is returned."
8199 (gnus-summary-mark-forward n gnus-expirable-mark
))
8201 (defun gnus-summary-mark-article-as-replied (article)
8202 "Mark ARTICLE replied and update the summary line."
8203 (push article gnus-newsgroup-replied
)
8204 (let ((buffer-read-only nil
))
8205 (when (gnus-summary-goto-subject article nil t
)
8206 (gnus-summary-update-secondary-mark article
))))
8208 (defun gnus-summary-set-bookmark (article)
8209 "Set a bookmark in current article."
8210 (interactive (list (gnus-summary-article-number)))
8211 (when (or (not (get-buffer gnus-article-buffer
))
8212 (not gnus-current-article
)
8213 (not gnus-article-current
)
8214 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
8215 (error "No current article selected"))
8216 ;; Remove old bookmark, if one exists.
8217 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8219 (setq gnus-newsgroup-bookmarks
8220 (delq old gnus-newsgroup-bookmarks
))))
8221 ;; Set the new bookmark, which is on the form
8222 ;; (article-number . line-number-in-body).
8226 (set-buffer gnus-article-buffer
)
8230 (goto-char (point-min))
8231 (search-forward "\n\n" nil t
)
8234 gnus-newsgroup-bookmarks
)
8235 (gnus-message 6 "A bookmark has been added to the current article."))
8237 (defun gnus-summary-remove-bookmark (article)
8238 "Remove the bookmark from the current article."
8239 (interactive (list (gnus-summary-article-number)))
8240 ;; Remove old bookmark, if one exists.
8241 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8244 (setq gnus-newsgroup-bookmarks
8245 (delq old gnus-newsgroup-bookmarks
))
8246 (gnus-message 6 "Removed bookmark."))
8247 (gnus-message 6 "No bookmark in current article."))))
8249 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8250 (defun gnus-summary-mark-as-dormant (n)
8251 "Mark N articles forward as dormant.
8252 If N is negative, mark backward instead. The difference between N and
8253 the actual number of articles marked is returned."
8255 (gnus-summary-mark-forward n gnus-dormant-mark
))
8257 (defun gnus-summary-set-process-mark (article)
8258 "Set the process mark on ARTICLE and update the summary line."
8259 (setq gnus-newsgroup-processable
8261 (delq article gnus-newsgroup-processable
)))
8262 (when (gnus-summary-goto-subject article
)
8263 (gnus-summary-show-thread)
8264 (gnus-summary-goto-subject article
)
8265 (gnus-summary-update-secondary-mark article
)))
8267 (defun gnus-summary-remove-process-mark (article)
8268 "Remove the process mark from ARTICLE and update the summary line."
8269 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
8270 (when (gnus-summary-goto-subject article
)
8271 (gnus-summary-show-thread)
8272 (gnus-summary-goto-subject article
)
8273 (gnus-summary-update-secondary-mark article
)))
8275 (defun gnus-summary-set-saved-mark (article)
8276 "Set the process mark on ARTICLE and update the summary line."
8277 (push article gnus-newsgroup-saved
)
8278 (when (gnus-summary-goto-subject article
)
8279 (gnus-summary-update-secondary-mark article
)))
8281 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
8282 "Mark N articles as read forwards.
8283 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8284 The difference between N and the actual number of articles marked is
8286 Iff NO-EXPIRE, auto-expiry will be inhibited."
8288 (gnus-summary-show-thread)
8289 (let ((backward (< n
0))
8290 (gnus-summary-goto-unread
8291 (and gnus-summary-goto-unread
8292 (not (eq gnus-summary-goto-unread
'never
))
8293 (not (memq mark
(list gnus-unread-mark
8294 gnus-ticked-mark gnus-dormant-mark
)))))
8296 (mark (or mark gnus-del-mark
)))
8298 (gnus-summary-mark-article nil mark no-expire
)
8299 (zerop (gnus-summary-next-subject
8301 (and gnus-summary-goto-unread
8302 (not (eq gnus-summary-goto-unread
'never
)))
8306 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
8307 (gnus-summary-recenter)
8308 (gnus-summary-position-point)
8309 (gnus-set-mode-line 'summary
)
8312 (defun gnus-summary-mark-article-as-read (mark)
8313 "Mark the current article quickly as read with MARK."
8314 (let ((article (gnus-summary-article-number)))
8315 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8316 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8317 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8318 (push (cons article mark
) gnus-newsgroup-reads
)
8319 ;; Possibly remove from cache, if that is used.
8320 (when gnus-use-cache
8321 (gnus-cache-enter-remove-article article
))
8322 ;; Allow the backend to change the mark.
8323 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8324 ;; Check for auto-expiry.
8325 (when (and gnus-newsgroup-auto-expire
8326 (memq mark gnus-auto-expirable-marks
))
8327 (setq mark gnus-expirable-mark
)
8328 ;; Let the backend know about the mark change.
8329 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8330 (push article gnus-newsgroup-expirable
))
8331 ;; Set the mark in the buffer.
8332 (gnus-summary-update-mark mark
'unread
)
8335 (defun gnus-summary-mark-article-as-unread (mark)
8336 "Mark the current article quickly as unread with MARK."
8337 (let* ((article (gnus-summary-article-number))
8338 (old-mark (gnus-summary-article-mark article
)))
8339 ;; Allow the backend to change the mark.
8340 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8341 (if (eq mark old-mark
)
8345 (gnus-error 1 "Can't mark negative article numbers")
8347 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8348 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8349 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
8350 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
8351 (cond ((= mark gnus-ticked-mark
)
8352 (push article gnus-newsgroup-marked
))
8353 ((= mark gnus-dormant-mark
)
8354 (push article gnus-newsgroup-dormant
))
8356 (push article gnus-newsgroup-unreads
)))
8357 (gnus-pull article gnus-newsgroup-reads
)
8359 ;; See whether the article is to be put in the cache.
8361 (vectorp (gnus-summary-article-header article
))
8363 (gnus-cache-possibly-enter-article
8364 gnus-newsgroup-name article
8365 (= mark gnus-ticked-mark
)
8366 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8369 (gnus-summary-update-mark mark
'unread
)
8372 (defun gnus-summary-mark-article (&optional article mark no-expire
)
8373 "Mark ARTICLE with MARK. MARK can be any character.
8374 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8375 `??' (dormant) and `?E' (expirable).
8376 If MARK is nil, then the default character `?r' is used.
8377 If ARTICLE is nil, then the article on the current line will be
8379 Iff NO-EXPIRE, auto-expiry will be inhibited."
8380 ;; The mark might be a string.
8381 (when (stringp mark
)
8382 (setq mark
(aref mark
0)))
8383 ;; If no mark is given, then we check auto-expiring.
8385 (setq mark gnus-del-mark
))
8386 (when (and (not no-expire
)
8387 gnus-newsgroup-auto-expire
8388 (memq mark gnus-auto-expirable-marks
))
8389 (setq mark gnus-expirable-mark
))
8390 (let ((article (or article
(gnus-summary-article-number)))
8391 (old-mark (gnus-summary-article-mark article
)))
8392 ;; Allow the backend to change the mark.
8393 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8394 (if (eq mark old-mark
)
8397 (error "No article on current line"))
8398 (if (not (if (or (= mark gnus-unread-mark
)
8399 (= mark gnus-ticked-mark
)
8400 (= mark gnus-dormant-mark
))
8401 (gnus-mark-article-as-unread article mark
)
8402 (gnus-mark-article-as-read article mark
)))
8404 ;; See whether the article is to be put in the cache.
8406 (not (= mark gnus-canceled-mark
))
8407 (vectorp (gnus-summary-article-header article
))
8409 (gnus-cache-possibly-enter-article
8410 gnus-newsgroup-name article
8411 (= mark gnus-ticked-mark
)
8412 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8414 (when (gnus-summary-goto-subject article nil t
)
8415 (let ((buffer-read-only nil
))
8416 (gnus-summary-show-thread)
8418 (gnus-summary-update-mark mark
'unread
)
8421 (defun gnus-summary-update-secondary-mark (article)
8422 "Update the secondary (read, process, cache) mark."
8423 (gnus-summary-update-mark
8424 (cond ((memq article gnus-newsgroup-processable
)
8426 ((memq article gnus-newsgroup-cached
)
8428 ((memq article gnus-newsgroup-replied
)
8430 ((memq article gnus-newsgroup-saved
)
8432 (t gnus-unread-mark
))
8434 (when (gnus-visual-p 'summary-highlight
'highlight
)
8435 (gnus-run-hooks 'gnus-summary-update-hook
))
8438 (defun gnus-summary-update-mark (mark type
)
8439 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
8440 (buffer-read-only nil
))
8441 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
8443 (when (looking-at "\r")
8445 (when (<= (+ forward
(point)) (point-max))
8446 ;; Go to the right position on the line.
8447 (goto-char (+ forward
(point)))
8448 ;; Replace the old mark with the new mark.
8449 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
8450 ;; Optionally update the marks by some user rule.
8451 (when (eq type
'unread
)
8453 (gnus-data-find (gnus-summary-article-number)) mark
)
8454 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
8456 (defun gnus-mark-article-as-read (article &optional mark
)
8457 "Enter ARTICLE in the pertinent lists and remove it from others."
8458 ;; Make the article expirable.
8459 (let ((mark (or mark gnus-del-mark
)))
8460 (if (= mark gnus-expirable-mark
)
8461 (push article gnus-newsgroup-expirable
)
8462 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)))
8463 ;; Remove from unread and marked lists.
8464 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8465 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8466 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8467 (push (cons article mark
) gnus-newsgroup-reads
)
8468 ;; Possibly remove from cache, if that is used.
8469 (when gnus-use-cache
8470 (gnus-cache-enter-remove-article article
))
8473 (defun gnus-mark-article-as-unread (article &optional mark
)
8474 "Enter ARTICLE in the pertinent lists and remove it from others."
8475 (let ((mark (or mark gnus-ticked-mark
)))
8478 (gnus-error 1 "Can't mark negative article numbers")
8480 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
8481 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
8482 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
8483 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8485 ;; Unsuppress duplicates?
8486 (when gnus-suppress-duplicates
8487 (gnus-dup-unsuppress-article article
))
8489 (cond ((= mark gnus-ticked-mark
)
8490 (push article gnus-newsgroup-marked
))
8491 ((= mark gnus-dormant-mark
)
8492 (push article gnus-newsgroup-dormant
))
8494 (push article gnus-newsgroup-unreads
)))
8495 (gnus-pull article gnus-newsgroup-reads
)
8498 (defalias 'gnus-summary-mark-as-unread-forward
8499 'gnus-summary-tick-article-forward
)
8500 (make-obsolete 'gnus-summary-mark-as-unread-forward
8501 'gnus-summary-tick-article-forward
)
8502 (defun gnus-summary-tick-article-forward (n)
8503 "Tick N articles forwards.
8504 If N is negative, tick backwards instead.
8505 The difference between N and the number of articles ticked is returned."
8507 (gnus-summary-mark-forward n gnus-ticked-mark
))
8509 (defalias 'gnus-summary-mark-as-unread-backward
8510 'gnus-summary-tick-article-backward
)
8511 (make-obsolete 'gnus-summary-mark-as-unread-backward
8512 'gnus-summary-tick-article-backward
)
8513 (defun gnus-summary-tick-article-backward (n)
8514 "Tick N articles backwards.
8515 The difference between N and the number of articles ticked is returned."
8517 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
8519 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8520 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8521 (defun gnus-summary-tick-article (&optional article clear-mark
)
8522 "Mark current article as unread.
8523 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8524 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8526 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
8529 (defun gnus-summary-mark-as-read-forward (n)
8530 "Mark N articles as read forwards.
8531 If N is negative, mark backwards instead.
8532 The difference between N and the actual number of articles marked is
8535 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
8537 (defun gnus-summary-mark-as-read-backward (n)
8538 "Mark the N articles as read backwards.
8539 The difference between N and the actual number of articles marked is
8542 (gnus-summary-mark-forward
8543 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
8545 (defun gnus-summary-mark-as-read (&optional article mark
)
8546 "Mark current article as read.
8547 ARTICLE specifies the article to be marked as read.
8548 MARK specifies a string to be inserted at the beginning of the line."
8549 (gnus-summary-mark-article article mark
))
8551 (defun gnus-summary-clear-mark-forward (n)
8552 "Clear marks from N articles forward.
8553 If N is negative, clear backward instead.
8554 The difference between N and the number of marks cleared is returned."
8556 (gnus-summary-mark-forward n gnus-unread-mark
))
8558 (defun gnus-summary-clear-mark-backward (n)
8559 "Clear marks from N articles backward.
8560 The difference between N and the number of marks cleared is returned."
8562 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
8564 (defun gnus-summary-mark-unread-as-read ()
8565 "Intended to be used by `gnus-summary-mark-article-hook'."
8566 (when (memq gnus-current-article gnus-newsgroup-unreads
)
8567 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
8569 (defun gnus-summary-mark-read-and-unread-as-read ()
8570 "Intended to be used by `gnus-summary-mark-article-hook'."
8571 (let ((mark (gnus-summary-article-mark)))
8572 (when (or (gnus-unread-mark-p mark
)
8573 (gnus-read-mark-p mark
))
8574 (gnus-summary-mark-article gnus-current-article gnus-read-mark
))))
8576 (defun gnus-summary-mark-region-as-read (point mark all
)
8577 "Mark all unread articles between point and mark as read.
8578 If given a prefix, mark all articles between point and mark as read,
8579 even ticked and dormant ones."
8580 (interactive "r\nP")
8589 (memq (setq article
(gnus-summary-article-number))
8590 gnus-newsgroup-unreads
))
8591 (gnus-summary-mark-article article gnus-del-mark
))
8593 (gnus-summary-find-next))))))
8595 (defun gnus-summary-mark-below (score mark
)
8596 "Mark articles with score less than SCORE with MARK."
8597 (interactive "P\ncMark: ")
8598 (setq score
(if score
8599 (prefix-numeric-value score
)
8600 (or gnus-summary-default-score
0)))
8602 (set-buffer gnus-summary-buffer
)
8603 (goto-char (point-min))
8606 (and (< (gnus-summary-article-score) score
)
8607 (gnus-summary-mark-article nil mark
))
8608 (gnus-summary-find-next)))))
8610 (defun gnus-summary-kill-below (&optional score
)
8611 "Mark articles with score below SCORE as read."
8613 (gnus-summary-mark-below score gnus-killed-mark
))
8615 (defun gnus-summary-clear-above (&optional score
)
8616 "Clear all marks from articles with score above SCORE."
8618 (gnus-summary-mark-above score gnus-unread-mark
))
8620 (defun gnus-summary-tick-above (&optional score
)
8621 "Tick all articles with score above SCORE."
8623 (gnus-summary-mark-above score gnus-ticked-mark
))
8625 (defun gnus-summary-mark-above (score mark
)
8626 "Mark articles with score over SCORE with MARK."
8627 (interactive "P\ncMark: ")
8628 (setq score
(if score
8629 (prefix-numeric-value score
)
8630 (or gnus-summary-default-score
0)))
8632 (set-buffer gnus-summary-buffer
)
8633 (goto-char (point-min))
8635 (when (> (gnus-summary-article-score) score
)
8636 (gnus-summary-mark-article nil mark
))
8638 (gnus-summary-find-next)))))
8640 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8641 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
8642 (defun gnus-summary-limit-include-expunged (&optional no-error
)
8643 "Display all the hidden articles that were expunged for low scores."
8645 (let ((buffer-read-only nil
))
8646 (let ((scored gnus-newsgroup-scored
)
8649 (unless (gnus-summary-goto-subject (caar scored
))
8650 (and (setq h
(gnus-summary-article-header (caar scored
)))
8651 (< (cdar scored
) gnus-summary-expunge-below
)
8653 (setq scored
(cdr scored
)))
8655 (when (not no-error
)
8656 (error "No expunged articles hidden"))
8657 (goto-char (point-min))
8658 (gnus-summary-prepare-unthreaded (nreverse headers
))
8659 (goto-char (point-min))
8660 (gnus-summary-position-point)
8663 (defun gnus-summary-catchup (&optional all quietly to-here not-mark
)
8664 "Mark all unread articles in this newsgroup as read.
8665 If prefix argument ALL is non-nil, ticked and dormant articles will
8666 also be marked as read.
8667 If QUIETLY is non-nil, no questions will be asked.
8668 If TO-HERE is non-nil, it should be a point in the buffer. All
8669 articles before this point will be marked as read.
8670 Note that this function will only catch up the unread article
8671 in the current summary buffer limitation.
8672 The number of articles marked as read is returned."
8677 (not gnus-interactive-catchup
) ;Without confirmation?
8681 "Mark absolutely all articles as read? "
8682 "Mark all unread articles as read? ")))
8684 (not gnus-newsgroup-adaptive
)
8685 (not gnus-newsgroup-auto-expire
)
8686 (not gnus-suppress-duplicates
)
8687 (or (not gnus-use-cache
)
8688 (eq gnus-use-cache
'passive
)))
8691 (setq gnus-newsgroup-marked nil
8692 gnus-newsgroup-dormant nil
))
8693 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable
))
8694 ;; We actually mark all articles as canceled, which we
8695 ;; have to do when using auto-expiry or adaptive scoring.
8696 (gnus-summary-show-all-threads)
8697 (when (gnus-summary-first-subject (not all
) t
)
8699 (if to-here
(< (point) to-here
) t
)
8700 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
8701 (gnus-summary-find-next (not all
) nil nil t
))))
8702 (gnus-set-mode-line 'summary
))
8704 (gnus-summary-position-point)))
8706 (defun gnus-summary-catchup-to-here (&optional all
)
8707 "Mark all unticked articles before the current one as read.
8708 If ALL is non-nil, also mark ticked and dormant articles as read."
8711 (gnus-save-hidden-threads
8712 (let ((beg (point)))
8713 ;; We check that there are unread articles.
8714 (when (or all
(gnus-summary-find-prev))
8715 (gnus-summary-catchup all t beg
)))))
8716 (gnus-summary-position-point))
8718 (defun gnus-summary-catchup-all (&optional quietly
)
8719 "Mark all articles in this newsgroup as read."
8721 (gnus-summary-catchup t quietly
))
8723 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
8724 "Mark all unread articles in this group as read, then exit.
8725 If prefix argument ALL is non-nil, all articles are marked as read."
8727 (when (gnus-summary-catchup all quietly nil
'fast
)
8728 ;; Select next newsgroup or exit.
8729 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
8730 (eq gnus-auto-select-next
'quietly
))
8731 (gnus-summary-next-group nil
)
8732 (gnus-summary-exit))))
8734 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
8735 "Mark all articles in this newsgroup as read, and then exit."
8737 (gnus-summary-catchup-and-exit t quietly
))
8739 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
8740 "Mark all articles in this group as read and select the next group.
8741 If given a prefix, mark all articles, unread as well as ticked, as
8745 (gnus-summary-catchup all
))
8746 (gnus-summary-next-group))
8752 (defmacro gnus-with-article
(article &rest forms
)
8753 "Select ARTICLE and perform FORMS in the original article buffer.
8754 Then replace the article with the result."
8756 ;; We don't want the article to be marked as read.
8757 (let (gnus-mark-article-hook)
8758 (gnus-summary-select-article t t nil
,article
))
8759 (set-buffer gnus-original-article-buffer
)
8761 (if (not (gnus-check-backend-function
8762 'request-replace-article
(car gnus-article-current
)))
8763 (gnus-message 5 "Read-only group; not replacing")
8764 (unless (gnus-request-replace-article
8765 ,article
(car gnus-article-current
)
8767 (error "Couldn't replace article")))
8768 ;; The cache and backlog have to be flushed somewhat.
8769 (when gnus-keep-backlog
8770 (gnus-backlog-remove-article
8771 (car gnus-article-current
) (cdr gnus-article-current
)))
8772 (when gnus-use-cache
8773 (gnus-cache-update-article
8774 (car gnus-article-current
) (cdr gnus-article-current
)))))
8776 (put 'gnus-with-article
'lisp-indent-function
1)
8777 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
8779 ;; Thread-based commands.
8781 (defun gnus-summary-articles-in-thread (&optional article
)
8782 "Return a list of all articles in the current thread.
8783 If ARTICLE is non-nil, return all articles in the thread that starts
8785 (let* ((article (or article
(gnus-summary-article-number)))
8786 (data (gnus-data-find-list article
))
8787 (top-level (gnus-data-level (car data
)))
8789 (cond ((null gnus-thread-operation-ignore-subject
)
8790 (gnus-simplify-subject-re
8791 (mail-header-subject (gnus-data-header (car data
)))))
8792 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
8793 (gnus-simplify-subject-fuzzy
8794 (mail-header-subject (gnus-data-header (car data
)))))
8796 (end-point (save-excursion
8797 (if (gnus-summary-go-to-next-thread)
8798 (point) (point-max))))
8801 (< (gnus-data-pos (car data
)) end-point
))
8802 (when (or (not top-subject
)
8803 (string= top-subject
8804 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
8805 (gnus-simplify-subject-fuzzy
8806 (mail-header-subject
8807 (gnus-data-header (car data
))))
8808 (gnus-simplify-subject-re
8809 (mail-header-subject
8810 (gnus-data-header (car data
)))))))
8811 (push (gnus-data-number (car data
)) articles
))
8812 (unless (and (setq data
(cdr data
))
8813 (> (gnus-data-level (car data
)) top-level
))
8815 ;; Return the list of articles.
8816 (nreverse articles
)))
8818 (defun gnus-summary-rethread-current ()
8819 "Rethread the thread the current article is part of."
8821 (let* ((gnus-show-threads t
)
8822 (article (gnus-summary-article-number))
8823 (id (mail-header-id (gnus-summary-article-header)))
8824 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
8826 (error "No article on the current line"))
8827 (gnus-rebuild-thread id
)
8828 (gnus-summary-goto-subject article
)))
8830 (defun gnus-summary-reparent-thread ()
8831 "Make the current article child of the marked (or previous) article.
8833 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8834 is non-nil or the Subject: of both articles are the same."
8836 (unless (not (gnus-group-read-only-p))
8837 (error "The current newsgroup does not support article editing"))
8838 (unless (<= (length gnus-newsgroup-processable
) 1)
8839 (error "No more than one article may be marked"))
8840 (save-window-excursion
8841 (let ((gnus-article-buffer " *reparent*")
8842 (current-article (gnus-summary-article-number))
8843 ;; First grab the marked article, otherwise one line up.
8844 (parent-article (if (not (null gnus-newsgroup-processable
))
8845 (car gnus-newsgroup-processable
)
8847 (if (eq (forward-line -
1) 0)
8848 (gnus-summary-article-number)
8849 (error "Beginning of summary buffer"))))))
8850 (unless (not (eq current-article parent-article
))
8851 (error "An article may not be self-referential"))
8852 (let ((message-id (mail-header-id
8853 (gnus-summary-article-header parent-article
))))
8854 (unless (and message-id
(not (equal message-id
"")))
8855 (error "No message-id in desired parent"))
8856 (gnus-with-article current-article
8858 (goto-char (point-min))
8859 (message-narrow-to-head)
8860 (if (re-search-forward "^References: " nil t
)
8862 (re-search-forward "^[^ \t]" nil t
)
8865 (insert " " message-id
))
8866 (insert "References: " message-id
"\n"))))
8867 (set-buffer gnus-summary-buffer
)
8868 (gnus-summary-unmark-all-processable)
8869 (gnus-summary-update-article current-article
)
8870 (gnus-summary-rethread-current)
8871 (gnus-message 3 "Article %d is now the child of article %d"
8872 current-article parent-article
)))))
8874 (defun gnus-summary-toggle-threads (&optional arg
)
8875 "Toggle showing conversation threads.
8876 If ARG is positive number, turn showing conversation threads on."
8878 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
8879 (setq gnus-show-threads
8880 (if (null arg
) (not gnus-show-threads
)
8881 (> (prefix-numeric-value arg
) 0)))
8882 (gnus-summary-prepare)
8883 (gnus-summary-goto-subject current
)
8884 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
8885 (gnus-summary-position-point)))
8887 (defun gnus-summary-show-all-threads ()
8891 (let ((buffer-read-only nil
))
8892 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
8893 (gnus-summary-position-point))
8895 (defun gnus-summary-show-thread ()
8896 "Show thread subtrees.
8897 Returns nil if no thread was there to be shown."
8899 (let ((buffer-read-only nil
)
8901 ;; first goto end then to beg, to have point at beg after let
8902 (end (progn (end-of-line) (point)))
8903 (beg (progn (beginning-of-line) (point))))
8905 ;; Any hidden lines here?
8906 (search-forward "\r" end t
)
8907 (subst-char-in-region beg end ?\^M ?
\n t
)
8909 (gnus-summary-position-point))))
8911 (defun gnus-summary-hide-all-threads ()
8912 "Hide all thread subtrees."
8915 (goto-char (point-min))
8916 (gnus-summary-hide-thread)
8917 (while (zerop (gnus-summary-next-thread 1 t
))
8918 (gnus-summary-hide-thread)))
8919 (gnus-summary-position-point))
8921 (defun gnus-summary-hide-thread ()
8922 "Hide thread subtrees.
8923 Returns nil if no threads were there to be hidden."
8925 (let ((buffer-read-only nil
)
8927 (article (gnus-summary-article-number)))
8929 ;; Go forward until either the buffer ends or the subthread
8931 (when (and (not (eobp))
8932 (or (zerop (gnus-summary-next-thread 1 t
))
8933 (goto-char (point-max))))
8935 (if (and (> (point) start
)
8936 (search-backward "\n" start t
))
8938 (subst-char-in-region start
(point) ?
\n ?\^M
)
8939 (gnus-summary-goto-subject article
))
8943 (defun gnus-summary-go-to-next-thread (&optional previous
)
8944 "Go to the same level (or less) next thread.
8945 If PREVIOUS is non-nil, go to previous thread instead.
8946 Return the article number moved to, or nil if moving was impossible."
8947 (let ((level (gnus-summary-thread-level))
8948 (way (if previous -
1 1))
8951 (while (and (not (eobp))
8952 (< level
(gnus-summary-thread-level)))
8960 (gnus-summary-article-number)
8963 (defun gnus-summary-next-thread (n &optional silent
)
8964 "Go to the same level next N'th thread.
8965 If N is negative, search backward instead.
8966 Returns the difference between N and the number of skips actually
8969 If SILENT, don't output messages."
8971 (let ((backward (< n
0))
8974 (gnus-summary-go-to-next-thread backward
))
8977 (gnus-summary-position-point))
8978 (when (and (not silent
) (/= 0 n
))
8979 (gnus-message 7 "No more threads"))
8982 (defun gnus-summary-prev-thread (n)
8983 "Go to the same level previous N'th thread.
8984 Returns the difference between N and the number of skips actually
8987 (gnus-summary-next-thread (- n
)))
8989 (defun gnus-summary-go-down-thread ()
8990 "Go down one level in the current thread."
8991 (let ((children (gnus-summary-article-children)))
8993 (gnus-summary-goto-subject (car children
)))))
8995 (defun gnus-summary-go-up-thread ()
8996 "Go up one level in the current thread."
8997 (let ((parent (gnus-summary-article-parent)))
8999 (gnus-summary-goto-subject parent
))))
9001 (defun gnus-summary-down-thread (n)
9002 "Go down thread N steps.
9003 If N is negative, go up instead.
9004 Returns the difference between N and how many steps down that were
9010 (if up
(gnus-summary-go-up-thread)
9011 (gnus-summary-go-down-thread)))
9013 (gnus-summary-position-point)
9015 (gnus-message 7 "Can't go further"))
9018 (defun gnus-summary-up-thread (n)
9019 "Go up thread N steps.
9020 If N is negative, go up instead.
9021 Returns the difference between N and how many steps down that were
9024 (gnus-summary-down-thread (- n
)))
9026 (defun gnus-summary-top-thread ()
9027 "Go to the top of the thread."
9029 (while (gnus-summary-go-up-thread))
9030 (gnus-summary-article-number))
9032 (defun gnus-summary-kill-thread (&optional unmark
)
9033 "Mark articles under current thread as read.
9034 If the prefix argument is positive, remove any kinds of marks.
9035 If the prefix argument is negative, tick articles instead."
9038 (setq unmark
(prefix-numeric-value unmark
)))
9039 (let ((articles (gnus-summary-articles-in-thread)))
9041 ;; Expand the thread.
9042 (gnus-summary-show-thread)
9043 ;; Mark all the articles.
9045 (gnus-summary-goto-subject (car articles
))
9046 (cond ((null unmark
)
9047 (gnus-summary-mark-article-as-read gnus-killed-mark
))
9049 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
9051 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
9052 (setq articles
(cdr articles
))))
9053 ;; Hide killed subtrees.
9055 gnus-thread-hide-killed
9056 (gnus-summary-hide-thread))
9057 ;; If marked as read, go to next unread subject.
9059 ;; Go to next unread subject.
9060 (gnus-summary-next-subject 1 t
)))
9061 (gnus-set-mode-line 'summary
))
9063 ;; Summary sorting commands
9065 (defun gnus-summary-sort-by-number (&optional reverse
)
9066 "Sort the summary buffer by article number.
9067 Argument REVERSE means reverse order."
9069 (gnus-summary-sort 'number reverse
))
9071 (defun gnus-summary-sort-by-author (&optional reverse
)
9072 "Sort the summary buffer by author name alphabetically.
9073 If `case-fold-search' is non-nil, case of letters is ignored.
9074 Argument REVERSE means reverse order."
9076 (gnus-summary-sort 'author reverse
))
9078 (defun gnus-summary-sort-by-subject (&optional reverse
)
9079 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
9080 If `case-fold-search' is non-nil, case of letters is ignored.
9081 Argument REVERSE means reverse order."
9083 (gnus-summary-sort 'subject reverse
))
9085 (defun gnus-summary-sort-by-date (&optional reverse
)
9086 "Sort the summary buffer by date.
9087 Argument REVERSE means reverse order."
9089 (gnus-summary-sort 'date reverse
))
9091 (defun gnus-summary-sort-by-score (&optional reverse
)
9092 "Sort the summary buffer by score.
9093 Argument REVERSE means reverse order."
9095 (gnus-summary-sort 'score reverse
))
9097 (defun gnus-summary-sort-by-lines (&optional reverse
)
9098 "Sort the summary buffer by the number of lines.
9099 Argument REVERSE means reverse order."
9101 (gnus-summary-sort 'lines reverse
))
9103 (defun gnus-summary-sort-by-chars (&optional reverse
)
9104 "Sort the summary buffer by article length.
9105 Argument REVERSE means reverse order."
9107 (gnus-summary-sort 'chars reverse
))
9109 (defun gnus-summary-sort (predicate reverse
)
9110 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
9111 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
9112 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
9113 (gnus-thread-sort-functions
9118 (gnus-sort-gathered-threads-function
9119 gnus-thread-sort-functions
)
9120 (gnus-article-sort-functions
9126 (gnus-summary-prepare-hook nil
))
9127 ;; We do the sorting by regenerating the threads.
9128 (gnus-summary-prepare)
9129 ;; Hide subthreads if needed.
9130 (when (and gnus-show-threads gnus-thread-hide-subtree
)
9131 (gnus-summary-hide-all-threads))))
9133 ;; Summary saving commands.
9135 (defun gnus-summary-save-article (&optional n not-saved
)
9136 "Save the current article using the default saver function.
9137 If N is a positive number, save the N next articles.
9138 If N is a negative number, save the N previous articles.
9139 If N is nil and any articles have been marked with the process mark,
9140 save those articles instead.
9141 The variable `gnus-default-article-saver' specifies the saver function."
9143 (let* ((articles (gnus-summary-work-articles n
))
9144 (save-buffer (save-excursion
9145 (nnheader-set-temp-buffer " *Gnus Save*")))
9146 (num (length articles
))
9148 (dolist (article articles
)
9149 (setq header
(gnus-summary-article-header article
))
9150 (if (not (vectorp header
))
9151 ;; This is a pseudo-article.
9152 (if (assq 'name header
)
9153 (gnus-copy-file (cdr (assq 'name header
)))
9154 (gnus-message 1 "Article %d is unsaveable" article
))
9155 ;; This is a real article.
9156 (save-window-excursion
9157 (let ((gnus-display-mime-function nil
)
9158 (gnus-article-prepare-hook nil
))
9159 (gnus-summary-select-article t nil nil article
)))
9161 (set-buffer save-buffer
)
9163 (insert-buffer-substring gnus-original-article-buffer
))
9164 (setq file
(gnus-article-save save-buffer file num
))
9165 (gnus-summary-remove-process-mark article
)
9167 (gnus-summary-set-saved-mark article
))))
9168 (gnus-kill-buffer save-buffer
)
9169 (gnus-summary-position-point)
9170 (gnus-set-mode-line 'summary
)
9173 (defun gnus-summary-pipe-output (&optional arg
)
9174 "Pipe the current article to a subprocess.
9175 If N is a positive number, pipe the N next articles.
9176 If N is a negative number, pipe the N previous articles.
9177 If N is nil and any articles have been marked with the process mark,
9178 pipe those articles instead."
9181 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
))
9182 (gnus-summary-save-article arg t
))
9183 (gnus-configure-windows 'pipe
))
9185 (defun gnus-summary-save-article-mail (&optional arg
)
9186 "Append the current article to an mail 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."
9193 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
9194 (gnus-summary-save-article arg
)))
9196 (defun gnus-summary-save-article-rmail (&optional arg
)
9197 "Append the current article to an rmail file.
9198 If N is a positive number, save the N next articles.
9199 If N is a negative number, save the N previous articles.
9200 If N is nil and any articles have been marked with the process mark,
9201 save those articles instead."
9204 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
9205 (gnus-summary-save-article arg
)))
9207 (defun gnus-summary-save-article-file (&optional arg
)
9208 "Append the current article to a file.
9209 If N is a positive number, save the N next articles.
9210 If N is a negative number, save the N previous articles.
9211 If N is nil and any articles have been marked with the process mark,
9212 save those articles instead."
9215 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
9216 (gnus-summary-save-article arg
)))
9218 (defun gnus-summary-write-article-file (&optional arg
)
9219 "Write the current article to a file, deleting the previous file.
9220 If N is a positive number, save the N next articles.
9221 If N is a negative number, save the N previous articles.
9222 If N is nil and any articles have been marked with the process mark,
9223 save those articles instead."
9226 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
9227 (gnus-summary-save-article arg
)))
9229 (defun gnus-summary-save-article-body-file (&optional arg
)
9230 "Append the current article body to a file.
9231 If N is a positive number, save the N next articles.
9232 If N is a negative number, save the N previous articles.
9233 If N is nil and any articles have been marked with the process mark,
9234 save those articles instead."
9237 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
9238 (gnus-summary-save-article arg
)))
9240 (defun gnus-summary-pipe-message (program)
9241 "Pipe the current article through PROGRAM."
9242 (interactive "sProgram: ")
9243 (gnus-summary-select-article)
9244 (let ((mail-header-separator ""))
9245 (gnus-eval-in-buffer-window gnus-article-buffer
9248 (let ((start (window-start))
9250 (message-pipe-buffer-body program
)
9251 (set-window-start (get-buffer-window (current-buffer)) start
))))))
9253 (defun gnus-get-split-value (methods)
9254 "Return a value based on the split METHODS."
9255 (let (split-name method result match
)
9258 (set-buffer gnus-original-article-buffer
)
9260 (nnheader-narrow-to-headers)
9261 (while (and methods
(not split-name
))
9262 (goto-char (point-min))
9263 (setq method
(pop methods
))
9264 (setq match
(car method
))
9267 ;; Regular expression.
9269 (re-search-forward match nil t
)))
9270 ((gnus-functionp match
)
9274 (setq result
(funcall match gnus-newsgroup-name
))))
9279 (setq result
(eval match
)))))
9280 (setq split-name
(cdr method
))
9281 (cond ((stringp result
)
9282 (push (expand-file-name
9283 result gnus-article-save-directory
)
9286 (setq split-name
(append result split-name
)))))))))
9287 (nreverse split-name
)))
9289 (defun gnus-valid-move-group-p (group)
9292 (symbol-value group
)
9293 (gnus-get-function (gnus-find-method-for-group
9294 (symbol-name group
)) 'request-accept-article t
)))
9296 (defun gnus-read-move-group-name (prompt default articles prefix
)
9297 "Read a group name."
9298 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
9299 (minibuffer-confirm-incomplete nil
) ; XEmacs
9303 (if (> (length articles
) 1)
9304 (format "these %d articles" (length articles
))
9309 (gnus-completing-read default prom
9311 'gnus-valid-move-group-p
9313 'gnus-group-history
))
9314 ((= 1 (length split-name
))
9315 (gnus-completing-read (car split-name
) prom
9317 'gnus-valid-move-group-p
9319 'gnus-group-history
))
9321 (gnus-completing-read nil prom
9322 (mapcar (lambda (el) (list el
))
9323 (nreverse split-name
))
9325 'gnus-group-history
))))
9326 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
9328 (if (or (string= to-newsgroup
"")
9329 (string= to-newsgroup prefix
))
9330 (setq to-newsgroup default
))
9331 (unless to-newsgroup
9332 (error "No group name entered"))
9333 (or (gnus-active to-newsgroup
)
9334 (gnus-activate-group to-newsgroup nil nil to-method
)
9335 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9337 (or (and (gnus-request-create-group to-newsgroup to-method
)
9338 (gnus-activate-group
9339 to-newsgroup nil nil to-method
)
9340 (gnus-subscribe-group to-newsgroup
))
9341 (error "Couldn't create group %s" to-newsgroup
)))
9342 (error "No such group: %s" to-newsgroup
)))
9345 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
9346 "Save parts matching TYPE to DIR.
9347 If REVERSE, save parts that do not match TYPE."
9349 (list (read-string "Save parts of type: "
9350 (or (car gnus-summary-save-parts-type-history
)
9351 gnus-summary-save-parts-default-mime
)
9352 'gnus-summary-save-parts-type-history
)
9353 (setq gnus-summary-save-parts-last-directory
9354 (read-file-name "Save to directory: "
9355 gnus-summary-save-parts-last-directory
9357 current-prefix-arg
))
9358 (gnus-summary-iterate n
9359 (let ((gnus-display-mime-function nil
)
9360 (gnus-inhibit-treatment t
))
9361 (gnus-summary-select-article))
9363 (set-buffer gnus-article-buffer
)
9364 (let ((handles (or gnus-article-mime-handles
9365 (mm-dissect-buffer) (mm-uu-dissect))))
9367 (gnus-summary-save-parts-1 type dir handles reverse
)
9368 (unless gnus-article-mime-handles
;; Don't destroy this case.
9369 (mm-destroy-parts handles
)))))))
9371 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
9372 (if (stringp (car handle
))
9373 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
9376 (not (string-match type
(mm-handle-media-type handle
)))
9377 (string-match type
(mm-handle-media-type handle
)))
9378 (let ((file (expand-file-name
9379 (file-name-nondirectory
9381 (mail-content-type-get
9382 (mm-handle-disposition handle
) 'filename
)
9383 (concat gnus-newsgroup-name
9384 "." (number-to-string
9385 (cdr gnus-article-current
)))))
9387 (unless (file-exists-p file
)
9388 (mm-save-part-to-file handle file
))))))
9390 ;; Summary extract commands
9392 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
9393 (let ((buffer-read-only nil
)
9394 (article (gnus-summary-article-number))
9396 (unless (gnus-summary-goto-subject article
)
9397 (error "No such article: %d" article
))
9398 (gnus-summary-position-point)
9399 ;; If all commands are to be bunched up on one line, we collect
9401 (unless gnus-view-pseudos-separately
9402 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
9405 (setq action
(cdr (assq 'action
(car ps
))))
9406 (setq files
(list (cdr (assq 'name
(car ps
)))))
9407 (while (and ps
(cdr ps
)
9408 (string= (or action
"1")
9409 (or (cdr (assq 'action
(cadr ps
))) "2")))
9410 (push (cdr (assq 'name
(cadr ps
))) files
)
9411 (setcdr ps
(cddr ps
)))
9413 (when (not (string-match "%s" action
))
9416 (when (assq 'execute
(car ps
))
9417 (setcdr (assq 'execute
(car ps
))
9418 (funcall (if (string-match "%s" action
)
9427 (setq ps
(cdr ps
)))))
9428 (if (and gnus-view-pseudos
(not not-view
))
9430 (when (assq 'execute
(car pslist
))
9431 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
9432 (eq gnus-view-pseudos
'not-confirm
)))
9433 (setq pslist
(cdr pslist
)))
9436 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
9437 (gnus-summary-article-number)))
9438 (gnus-summary-goto-subject after-article
)
9441 (insert " " (file-name-nondirectory
9442 (cdr (assq 'name
(car pslist
))))
9443 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
9445 (forward-line -
1) ; back to `b'
9446 (gnus-add-text-properties
9447 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
9448 gnus-mouse-face-prop gnus-mouse-face
))
9450 after-article gnus-reffed-article-number
9451 gnus-unread-mark b
(car pslist
) 0 (- e b
))
9452 (push gnus-reffed-article-number gnus-newsgroup-unreads
)
9453 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
9454 (setq pslist
(cdr pslist
)))))))
9456 (defun gnus-pseudos< (p1 p2
)
9457 (let ((c1 (cdr (assq 'action p1
)))
9458 (c2 (cdr (assq 'action p2
))))
9459 (and c1 c2
(string< c1 c2
))))
9461 (defun gnus-request-pseudo-article (props)
9462 (cond ((assq 'execute props
)
9463 (gnus-execute-command (cdr (assq 'execute props
)))))
9464 (let ((gnus-current-article (gnus-summary-article-number)))
9465 (gnus-run-hooks 'gnus-mark-article-hook
)))
9467 (defun gnus-execute-command (command &optional automatic
)
9469 (gnus-article-setup-buffer)
9470 (set-buffer gnus-article-buffer
)
9471 (setq buffer-read-only nil
)
9472 (let ((command (if automatic command
9473 (read-string "Command: " (cons command
0)))))
9475 (insert "$ " command
"\n\n")
9476 (if gnus-view-pseudo-asynchronously
9477 (start-process "gnus-execute" (current-buffer) shell-file-name
9478 shell-command-switch command
)
9479 (call-process shell-file-name nil t nil
9480 shell-command-switch command
)))))
9482 ;; Summary kill commands.
9484 (defun gnus-summary-edit-global-kill (article)
9485 "Edit the \"global\" kill file."
9486 (interactive (list (gnus-summary-article-number)))
9487 (gnus-group-edit-global-kill article
))
9489 (defun gnus-summary-edit-local-kill ()
9490 "Edit a local kill file applied to the current newsgroup."
9492 (setq gnus-current-headers
(gnus-summary-article-header))
9493 (gnus-group-edit-local-kill
9494 (gnus-summary-article-number) gnus-newsgroup-name
))
9498 (defun gnus-read-header (id &optional header
)
9499 "Read the headers of article ID and enter them into the Gnus system."
9500 (let ((group gnus-newsgroup-name
)
9501 (gnus-override-method
9503 gnus-override-method
9504 (and (gnus-news-group-p gnus-newsgroup-name
)
9505 (car (gnus-refer-article-methods)))))
9507 ;; First we check to see whether the header in question is already
9510 ;; This is a Message-ID.
9511 (setq header
(or header
(gnus-id-to-header id
)))
9512 ;; This is an article number.
9513 (setq header
(or header
(gnus-summary-article-header id
))))
9515 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
9516 ;; We have found the header.
9518 ;; If this is a sparse article, we have to nix out its
9519 ;; previous entry in the thread hashtb.
9521 (gnus-summary-article-sparse-p (mail-header-number header
)))
9522 (let* ((parent (gnus-parent-id (mail-header-references header
)))
9523 (thread (and parent
(gnus-id-to-thread parent
))))
9525 (delq (assq header thread
) thread
))))
9526 ;; We have to really fetch the header to this article.
9528 (set-buffer nntp-server-buffer
)
9529 (when (setq where
(gnus-request-head id group
))
9530 (nnheader-fold-continuation-lines)
9531 (goto-char (point-max))
9533 (goto-char (point-min))
9537 ((cdr where
) (cdr where
))
9538 (header (mail-header-number header
))
9539 (t gnus-reffed-article-number
))
9541 (insert " Article retrieved.\n"))
9543 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
9544 () ; Malformed head.
9545 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
9546 (when (and (stringp id
)
9547 (not (string= (gnus-group-real-name group
)
9549 ;; If we fetched by Message-ID and the article came
9550 ;; from a different group, we fudge some bogus article
9551 ;; numbers for this article.
9552 (mail-header-set-number header gnus-reffed-article-number
))
9554 (set-buffer gnus-summary-buffer
)
9555 (decf gnus-reffed-article-number
)
9556 (gnus-remove-header (mail-header-number header
))
9557 (push header gnus-newsgroup-headers
)
9558 (setq gnus-current-headers header
)
9559 (push (mail-header-number header
) gnus-newsgroup-limit
)))
9562 (defun gnus-remove-header (number)
9563 "Remove header NUMBER from `gnus-newsgroup-headers'."
9564 (if (and gnus-newsgroup-headers
9565 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
9566 (pop gnus-newsgroup-headers
)
9567 (let ((headers gnus-newsgroup-headers
))
9568 (while (and (cdr headers
)
9569 (not (= number
(mail-header-number (cadr headers
)))))
9572 (setcdr headers
(cddr headers
))))))
9575 ;;; summary highlights
9578 (defun gnus-highlight-selected-summary ()
9579 "Highlight selected article in summary buffer."
9580 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9581 (when gnus-summary-selected-face
9583 (let* ((beg (progn (beginning-of-line) (point)))
9584 (end (progn (end-of-line) (point)))
9585 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9586 (from (if (get-text-property beg gnus-mouse-face-prop
)
9588 (or (next-single-property-change
9589 beg gnus-mouse-face-prop nil end
)
9594 (or (next-single-property-change
9595 from gnus-mouse-face-prop nil end
)
9597 ;; If no mouse-face prop on line we will have to = from = end,
9598 ;; so we highlight the entire line instead.
9599 (when (= (+ to
2) from
)
9602 (if gnus-newsgroup-selected-overlay
9603 ;; Move old overlay.
9605 gnus-newsgroup-selected-overlay from to
(current-buffer))
9606 ;; Create new overlay.
9608 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
9609 'face gnus-summary-selected-face
))))))
9611 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9612 (defun gnus-summary-highlight-line ()
9613 "Highlight current line according to `gnus-summary-highlight'."
9614 (let* ((list gnus-summary-highlight
)
9616 (end (progn (end-of-line) (point)))
9617 ;; now find out where the line starts and leave point there.
9618 (beg (progn (beginning-of-line) (point)))
9619 (article (gnus-summary-article-number))
9620 (score (or (cdr (assq (or article gnus-current-article
)
9621 gnus-newsgroup-scored
))
9622 gnus-summary-default-score
0))
9623 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
9624 (inhibit-read-only t
))
9625 ;; Eval the cars of the lists until we find a match.
9626 (let ((default gnus-summary-default-score
))
9628 (not (eval (caar list
))))
9629 (setq list
(cdr list
))))
9630 (let ((face (cdar list
)))
9631 (unless (eq face
(get-text-property beg
'face
))
9632 (gnus-put-text-property-excluding-characters-with-faces
9634 (setq face
(if (boundp face
) (symbol-value face
) face
)))
9635 (when gnus-summary-highlight-line-function
9636 (funcall gnus-summary-highlight-line-function article face
))))
9639 (defun gnus-update-read-articles (group unread
&optional compute
)
9640 "Update the list of read articles in GROUP."
9641 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
9642 (entry (gnus-gethash group gnus-newsrc-hashtb
))
9643 (info (nth 2 entry
))
9645 (unread (sort (copy-sequence unread
) '<))
9647 (if (or (not info
) (not active
))
9648 ;; There is no info on this group if it was, in fact,
9649 ;; killed. Gnus stores no information on killed groups, so
9650 ;; there's nothing to be done.
9651 ;; One could store the information somewhere temporarily,
9652 ;; perhaps... Hmmm...
9654 ;; Remove any negative articles numbers.
9655 (while (and unread
(< (car unread
) 0))
9656 (setq unread
(cdr unread
)))
9657 ;; Remove any expired article numbers
9658 (while (and unread
(< (car unread
) (car active
)))
9659 (setq unread
(cdr unread
)))
9660 ;; Compute the ranges of read articles by looking at the list of
9663 (when (/= (car unread
) prev
)
9664 (push (if (= prev
(1- (car unread
))) prev
9665 (cons prev
(1- (car unread
))))
9667 (setq prev
(1+ (car unread
)))
9668 (setq unread
(cdr unread
)))
9669 (when (<= prev
(cdr active
))
9670 (push (cons prev
(cdr active
)) read
))
9671 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
9676 ;; Propagate the read marks to the backend.
9677 (when (gnus-check-backend-function 'request-set-mark group
)
9678 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
9679 (add (gnus-remove-from-range read
(gnus-info-read info
))))
9681 (unless (gnus-check-group group
)
9682 (error "Can't open server for %s" group
))
9683 (gnus-request-set-mark
9684 group
(delq nil
(list (if add
(list add
'add
'(read)))
9685 (if del
(list del
'del
'(read))))))
9687 `(gnus-request-set-mark
9690 (if del
(list del
'add
'(read)))
9691 (if add
(list add
'del
'(read))))))))))
9692 (set-buffer gnus-group-buffer
)
9695 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
9696 (gnus-info-set-read ',info
',(gnus-info-read info
))
9697 (gnus-get-unread-articles-in-group ',info
9698 (gnus-active ,group
))
9699 (gnus-group-update-group ,group t
)
9701 ;; Enter this list into the group info.
9702 (gnus-info-set-read info read
)
9703 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9704 (gnus-get-unread-articles-in-group info
(gnus-active group
))
9707 (defun gnus-offer-save-summaries ()
9708 "Offer to save all active summary buffers."
9710 (let ((buflist (buffer-list))
9712 ;; Go through all buffers and find all summaries.
9714 (and (setq bufname
(buffer-name (car buflist
)))
9715 (string-match "Summary" bufname
)
9717 (set-buffer bufname
)
9718 ;; We check that this is, indeed, a summary buffer.
9719 (and (eq major-mode
'gnus-summary-mode
)
9720 ;; Also make sure this isn't bogus.
9721 gnus-newsgroup-prepared
9722 ;; Also make sure that this isn't a dead summary buffer.
9723 (not gnus-dead-summary-mode
)))
9724 (push bufname buffers
))
9725 (setq buflist
(cdr buflist
)))
9726 ;; Go through all these summary buffers and offer to save them.
9729 "Update summary buffer %s? "
9731 (switch-to-buffer buf
)
9732 (gnus-summary-exit))
9735 (defun gnus-summary-setup-default-charset ()
9736 "Setup newsgroup default charset."
9737 (if (equal gnus-newsgroup-name
"nndraft:drafts")
9738 (setq gnus-newsgroup-charset nil
)
9739 (let* ((name (and gnus-newsgroup-name
9740 (gnus-group-real-name gnus-newsgroup-name
)))
9742 (or gnus-newsgroup-ephemeral-ignored-charsets
9744 (and gnus-newsgroup-name
9745 (or (gnus-group-find-parameter gnus-newsgroup-name
9746 'ignored-charsets t
)
9747 (let ((alist gnus-group-ignored-charsets-alist
)
9748 elem
(charsets nil
))
9749 (while (setq elem
(pop alist
))
9751 (string-match (car elem
) name
))
9753 charsets
(cdr elem
))))
9755 gnus-newsgroup-ignored-charsets
))))
9756 (setq gnus-newsgroup-charset
9757 (or gnus-newsgroup-ephemeral-charset
9758 (and gnus-newsgroup-name
9759 (or (gnus-group-find-parameter gnus-newsgroup-name
'charset
)
9760 (let ((alist gnus-group-charset-alist
)
9762 (while (setq elem
(pop alist
))
9764 (string-match (car elem
) name
))
9766 charset
(cadr elem
))))
9768 gnus-default-charset
))
9769 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
9770 ignored-charsets
))))
9776 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
9777 "Display the current article buffer fully MIME-buttonized.
9778 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9779 treated as multipart/mixed."
9782 (let ((gnus-unbuttonized-mime-types nil
)
9783 (gnus-mime-display-multipart-as-mixed show-all-parts
))
9784 (gnus-summary-show-article)))
9786 (defun gnus-summary-repair-multipart (article)
9787 "Add a Content-Type header to a multipart article without one."
9788 (interactive (list (gnus-summary-article-number)))
9789 (gnus-with-article article
9790 (message-narrow-to-head)
9791 (goto-char (point-max))
9793 (when (search-forward "\n--" nil t
)
9794 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9795 (message-narrow-to-head)
9796 (message-remove-header "Mime-Version")
9797 (message-remove-header "Content-Type")
9798 (goto-char (point-max))
9799 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9801 (insert "Mime-Version: 1.0\n")
9803 (let (gnus-mark-article-hook)
9804 (gnus-summary-select-article t t nil article
)))
9806 (defun gnus-summary-toggle-display-buttonized ()
9807 "Toggle the buttonizing of the article buffer."
9810 (if (setq gnus-inhibit-mime-unbuttonizing
9811 (not gnus-inhibit-mime-unbuttonizing
))
9812 (let ((gnus-unbuttonized-mime-types nil
))
9813 (gnus-summary-show-article))
9814 (gnus-summary-show-article)))
9817 ;;; Generic summary marking commands
9820 (defvar gnus-summary-marking-alist
9821 '((read gnus-del-mark
"d")
9822 (unread gnus-unread-mark
"u")
9823 (ticked gnus-ticked-mark
"!")
9824 (dormant gnus-dormant-mark
"?")
9825 (expirable gnus-expirable-mark
"e"))
9826 "An alist of names/marks/keystrokes.")
9828 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
9829 (defvar gnus-summary-mark-map
)
9831 (defun gnus-summary-make-all-marking-commands ()
9832 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
9833 (dolist (elem gnus-summary-marking-alist
)
9834 (apply 'gnus-summary-make-marking-command elem
)))
9836 (defun gnus-summary-make-marking-command (name mark keystroke
)
9837 (let ((map (make-sparse-keymap)))
9838 (define-key gnus-summary-generic-mark-map keystroke map
)
9839 (dolist (lway `((next "next" next nil
"n")
9840 (next-unread "next unread" next t
"N")
9841 (prev "previous" prev nil
"p")
9842 (prev-unread "previous unread" prev t
"P")
9843 (nomove "" nil nil
,keystroke
)))
9844 (let ((func (gnus-summary-make-marking-command-1
9845 mark
(car lway
) lway name
)))
9846 (setq func
(eval func
))
9847 (define-key map
(nth 4 lway
) func
)))))
9849 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
9851 (format "gnus-summary-put-mark-as-%s%s"
9852 name
(if (eq way
'nomove
)
9854 (concat "-" (symbol-name way
)))))
9857 "Mark the current article as %s%s.
9858 If N, the prefix, then repeat N times.
9859 If N is negative, move in reverse order.
9860 The difference between N and the actual number of articles marked is
9864 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
9866 (defun gnus-summary-generic-mark (n mark move unread
)
9867 "Mark N articles with MARK."
9868 (unless (eq major-mode
'gnus-summary-mode
)
9869 (error "This command can only be used in the summary buffer"))
9870 (gnus-summary-show-thread)
9874 ((eq move
'prev
) -
1)
9880 nummove
(* -
1 nummove
))))
9882 (gnus-summary-mark-article nil mark
)
9883 (zerop (gnus-summary-next-subject nummove unread t
)))
9886 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
9887 (gnus-summary-recenter)
9888 (gnus-summary-position-point)
9889 (gnus-set-mode-line 'summary
)
9892 (gnus-summary-make-all-marking-commands)
9898 (run-hooks 'gnus-sum-load-hook
)
9900 ;;; gnus-sum.el ends here