1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl
))
40 ;; (require 'gnus-art)
42 (autoload 'gnus-summary-limit-include-cached
"gnus-cache" nil t
)
43 (autoload 'gnus-cache-write-active
"gnus-cache")
44 (autoload 'mm-uu-dissect
"mm-uu")
46 (defcustom gnus-kill-summary-on-exit t
47 "*If non-nil, kill the summary buffer when you exit from it.
48 If nil, the summary will become a \"*Dead Summary*\" buffer, and
49 it will be killed sometime later."
50 :group
'gnus-summary-exit
53 (defcustom gnus-fetch-old-headers nil
54 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
55 If an unread article in the group refers to an older, already read (or
56 just marked as read) article, the old article will not normally be
57 displayed in the Summary buffer. If this variable is non-nil, Gnus
58 will attempt to grab the headers to the old articles, and thereby
59 build complete threads. If it has the value `some', only enough
60 headers to connect otherwise loose threads will be displayed. This
61 variable can also be a number. In that case, no more than that number
62 of old headers will be fetched. If it has the value `invisible', all
63 old headers will be fetched, but none will be displayed.
65 The server has to support NOV for any of this to work."
67 :type
'(choice (const :tag
"off" nil
)
70 (sexp :menu-tag
"other" t
)))
72 (defcustom gnus-refer-thread-limit
200
73 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
74 If t, fetch all the available old headers."
77 (sexp :menu-tag
"other" t
)))
79 (defcustom gnus-summary-make-false-root
'adopt
80 "*nil means that Gnus won't gather loose threads.
81 If the root of a thread has expired or been read in a previous
82 session, the information necessary to build a complete thread has been
83 lost. Instead of having many small sub-threads from this original thread
84 scattered all over the summary buffer, Gnus can gather them.
86 If non-nil, Gnus will try to gather all loose sub-threads from an
87 original thread into one large thread.
89 If this variable is non-nil, it should be one of `none', `adopt',
92 If this variable is `none', Gnus will not make a false root, but just
93 present the sub-threads after another.
94 If this variable is `dummy', Gnus will create a dummy root that will
95 have all the sub-threads as children.
96 If this variable is `adopt', Gnus will make one of the \"children\"
97 the parent and mark all the step-children as such.
98 If this variable is `empty', the \"children\" are printed with empty
99 subject fields. (Or rather, they will be printed with a string
100 given by the `gnus-summary-same-subject' variable.)"
102 :type
'(choice (const :tag
"off" nil
)
108 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
109 "*A regexp to match subjects to be excluded from loose thread gathering.
110 As loose thread gathering is done on subjects only, that means that
111 there can be many false gatherings performed. By rooting out certain
112 common subjects, gathering might become saner."
116 (defcustom gnus-summary-gather-subject-limit nil
117 "*Maximum length of subject comparisons when gathering loose threads.
118 Use nil to compare full subjects. Setting this variable to a low
119 number will help gather threads that have been corrupted by
120 newsreaders chopping off subject lines, but it might also mean that
121 unrelated articles that have subject that happen to begin with the
122 same few characters will be incorrectly gathered.
124 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
127 :type
'(choice (const :tag
"off" nil
)
129 (sexp :menu-tag
"on" t
)))
131 (defcustom gnus-simplify-subject-functions nil
132 "List of functions taking a string argument that simplify subjects.
133 The functions are applied recursively.
135 Useful functions to put in this list include: `gnus-simplify-subject-re',
136 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
138 :type
'(repeat function
))
140 (defcustom gnus-simplify-ignored-prefixes nil
141 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
143 :type
'(choice (const :tag
"off" nil
)
146 (defcustom gnus-build-sparse-threads nil
147 "*If non-nil, fill in the gaps in threads.
148 If `some', only fill in the gaps that are needed to tie loose threads
149 together. If `more', fill in all leaf nodes that Gnus can find. If
150 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
152 :type
'(choice (const :tag
"off" nil
)
155 (sexp :menu-tag
"all" t
)))
157 (defcustom gnus-summary-thread-gathering-function
158 'gnus-gather-threads-by-subject
159 "*Function used for gathering loose threads.
160 There are two pre-defined functions: `gnus-gather-threads-by-subject',
161 which only takes Subjects into consideration; and
162 `gnus-gather-threads-by-references', which compared the References
163 headers of the articles to find matches."
165 :type
'(radio (function-item gnus-gather-threads-by-subject
)
166 (function-item gnus-gather-threads-by-references
)
167 (function :tag
"other")))
169 (defcustom gnus-summary-same-subject
""
170 "*String indicating that the current article has the same subject as the previous.
171 This variable will only be used if the value of
172 `gnus-summary-make-false-root' is `empty'."
173 :group
'gnus-summary-format
176 (defcustom gnus-summary-goto-unread t
177 "*If t, many commands will go to the next unread article.
178 This applies to marking commands as well as other commands that
179 \"naturally\" select the next article, like, for instance, `SPC' at
180 the end of an article.
182 If nil, the marking commands do NOT go to the next unread article
183 (they go to the next article instead). If `never', commands that
184 usually go to the next unread article, will go to the next article,
185 whether it is read or not."
186 :group
'gnus-summary-marks
187 :link
'(custom-manual "(gnus)Setting Marks")
188 :type
'(choice (const :tag
"off" nil
)
190 (sexp :menu-tag
"on" t
)))
192 (defcustom gnus-summary-default-score
0
193 "*Default article score level.
194 All scores generated by the score files will be added to this score.
195 If this variable is nil, scoring will be disabled."
196 :group
'gnus-score-default
197 :type
'(choice (const :tag
"disable")
200 (defcustom gnus-summary-zcore-fuzz
0
201 "*Fuzziness factor for the zcore in the summary buffer.
202 Articles with scores closer than this to `gnus-summary-default-score'
204 :group
'gnus-summary-format
207 (defcustom gnus-simplify-subject-fuzzy-regexp nil
208 "*Strings to be removed when doing fuzzy matches.
209 This can either be a regular expression or list of regular expressions
210 that will be removed from subject strings if fuzzy subject
211 simplification is selected."
213 :type
'(repeat regexp
))
215 (defcustom gnus-show-threads t
216 "*If non-nil, display threads in summary mode."
220 (defcustom gnus-thread-hide-subtree nil
221 "*If non-nil, hide all threads initially.
222 If threads are hidden, you have to run the command
223 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
224 to expose hidden threads."
228 (defcustom gnus-thread-hide-killed t
229 "*If non-nil, hide killed threads automatically."
233 (defcustom gnus-thread-ignore-subject t
234 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
235 If nil, articles that have different subjects from their parents will
236 start separate threads."
240 (defcustom gnus-thread-operation-ignore-subject t
241 "*If non-nil, subjects will be ignored when doing thread commands.
242 This affects commands like `gnus-summary-kill-thread' and
243 `gnus-summary-lower-thread'.
245 If this variable is nil, articles in the same thread with different
246 subjects will not be included in the operation in question. If this
247 variable is `fuzzy', only articles that have subjects that are fuzzily
248 equal will be included."
250 :type
'(choice (const :tag
"off" nil
)
254 (defcustom gnus-thread-indent-level
4
255 "*Number that says how much each sub-thread should be indented."
259 (defcustom gnus-auto-extend-newsgroup t
260 "*If non-nil, extend newsgroup forward and backward when requested."
261 :group
'gnus-summary-choose
264 (defcustom gnus-auto-select-first t
265 "*If nil, don't select the first unread article when entering a group.
266 If this variable is `best', select the highest-scored unread article
267 in the group. If t, select the first unread article.
269 This variable can also be a function to place point on a likely
270 subject line. Useful values include `gnus-summary-first-unread-subject',
271 `gnus-summary-first-unread-article' and
272 `gnus-summary-best-unread-article'.
274 If you want to prevent automatic selection of the first unread article
275 in some newsgroups, set the variable to nil in
276 `gnus-select-group-hook'."
277 :group
'gnus-group-select
278 :type
'(choice (const :tag
"none" nil
)
280 (sexp :menu-tag
"first" t
)
281 (function-item gnus-summary-first-unread-subject
)
282 (function-item gnus-summary-first-unread-article
)
283 (function-item gnus-summary-best-unread-article
)))
285 (defcustom gnus-auto-select-next t
286 "*If non-nil, offer to go to the next group from the end of the previous.
287 If the value is t and the next newsgroup is empty, Gnus will exit
288 summary mode and go back to group mode. If the value is neither nil
289 nor t, Gnus will select the following unread newsgroup. In
290 particular, if the value is the symbol `quietly', the next unread
291 newsgroup will be selected without any confirmation, and if it is
292 `almost-quietly', the next group will be selected without any
293 confirmation if you are located on the last article in the group.
294 Finally, if this variable is `slightly-quietly', the `Z n' command
295 will go to the next group without confirmation."
296 :group
'gnus-summary-maneuvering
297 :type
'(choice (const :tag
"off" nil
)
299 (const almost-quietly
)
300 (const slightly-quietly
)
301 (sexp :menu-tag
"on" t
)))
303 (defcustom gnus-auto-select-same nil
304 "*If non-nil, select the next article with the same subject.
305 If there are no more articles with the same subject, go to
306 the first unread article."
307 :group
'gnus-summary-maneuvering
310 (defcustom gnus-summary-check-current nil
311 "*If non-nil, consider the current article when moving.
312 The \"unread\" movement commands will stay on the same line if the
313 current article is unread."
314 :group
'gnus-summary-maneuvering
317 (defcustom gnus-auto-center-summary t
318 "*If non-nil, always center the current summary buffer.
319 In particular, if `vertical' do only vertical recentering. If non-nil
320 and non-`vertical', do both horizontal and vertical recentering."
321 :group
'gnus-summary-maneuvering
322 :type
'(choice (const :tag
"none" nil
)
324 (integer :tag
"height")
325 (sexp :menu-tag
"both" t
)))
327 (defcustom gnus-show-all-headers nil
328 "*If non-nil, don't hide any headers."
329 :group
'gnus-article-hiding
330 :group
'gnus-article-headers
333 (defcustom gnus-summary-ignore-duplicates nil
334 "*If non-nil, ignore articles with identical Message-ID headers."
338 (defcustom gnus-single-article-buffer t
339 "*If non-nil, display all articles in the same buffer.
340 If nil, each group will get its own article buffer."
341 :group
'gnus-article-various
344 (defcustom gnus-break-pages t
345 "*If non-nil, do page breaking on articles.
346 The page delimiter is specified by the `gnus-page-delimiter'
348 :group
'gnus-article-various
351 (defcustom gnus-move-split-methods nil
352 "*Variable used to suggest where articles are to be moved to.
353 It uses the same syntax as the `gnus-split-methods' variable."
354 :group
'gnus-summary-mail
355 :type
'(repeat (choice (list :value
(fun) function
)
356 (cons :value
("" "") regexp
(repeat string
))
359 (defcustom gnus-unread-mark ?
;Whitespace
360 "*Mark used for unread articles."
361 :group
'gnus-summary-marks
364 (defcustom gnus-ticked-mark ?
!
365 "*Mark used for ticked articles."
366 :group
'gnus-summary-marks
369 (defcustom gnus-dormant-mark ??
370 "*Mark used for dormant articles."
371 :group
'gnus-summary-marks
374 (defcustom gnus-del-mark ?r
375 "*Mark used for del'd articles."
376 :group
'gnus-summary-marks
379 (defcustom gnus-read-mark ?R
380 "*Mark used for read articles."
381 :group
'gnus-summary-marks
384 (defcustom gnus-expirable-mark ?E
385 "*Mark used for expirable articles."
386 :group
'gnus-summary-marks
389 (defcustom gnus-killed-mark ?K
390 "*Mark used for killed articles."
391 :group
'gnus-summary-marks
394 (defcustom gnus-souped-mark ?F
395 "*Mark used for killed articles."
396 :group
'gnus-summary-marks
399 (defcustom gnus-kill-file-mark ?X
400 "*Mark used for articles killed by kill files."
401 :group
'gnus-summary-marks
404 (defcustom gnus-low-score-mark ?Y
405 "*Mark used for articles with a low score."
406 :group
'gnus-summary-marks
409 (defcustom gnus-catchup-mark ?C
410 "*Mark used for articles that are caught up."
411 :group
'gnus-summary-marks
414 (defcustom gnus-replied-mark ?A
415 "*Mark used for articles that have been replied to."
416 :group
'gnus-summary-marks
419 (defcustom gnus-cached-mark ?
*
420 "*Mark used for articles that are in the cache."
421 :group
'gnus-summary-marks
424 (defcustom gnus-saved-mark ?S
425 "*Mark used for articles that have been saved to."
426 :group
'gnus-summary-marks
429 (defcustom gnus-ancient-mark ?O
430 "*Mark used for ancient articles."
431 :group
'gnus-summary-marks
434 (defcustom gnus-sparse-mark ?Q
435 "*Mark used for sparsely reffed articles."
436 :group
'gnus-summary-marks
439 (defcustom gnus-canceled-mark ?G
440 "*Mark used for canceled articles."
441 :group
'gnus-summary-marks
444 (defcustom gnus-duplicate-mark ?M
445 "*Mark used for duplicate articles."
446 :group
'gnus-summary-marks
449 (defcustom gnus-undownloaded-mark ?
@
450 "*Mark used for articles that weren't downloaded."
451 :group
'gnus-summary-marks
454 (defcustom gnus-downloadable-mark ?%
455 "*Mark used for articles that are to be downloaded."
456 :group
'gnus-summary-marks
459 (defcustom gnus-unsendable-mark ?
=
460 "*Mark used for articles that won't be sent."
461 :group
'gnus-summary-marks
464 (defcustom gnus-score-over-mark ?
+
465 "*Score mark used for articles with high scores."
466 :group
'gnus-summary-marks
469 (defcustom gnus-score-below-mark ?-
470 "*Score mark used for articles with low scores."
471 :group
'gnus-summary-marks
474 (defcustom gnus-empty-thread-mark ?
;Whitespace
475 "*There is no thread under the article."
476 :group
'gnus-summary-marks
479 (defcustom gnus-not-empty-thread-mark ?
=
480 "*There is a thread under the article."
481 :group
'gnus-summary-marks
484 (defcustom gnus-view-pseudo-asynchronously nil
485 "*If non-nil, Gnus will view pseudo-articles asynchronously."
486 :group
'gnus-extract-view
489 (defcustom gnus-auto-expirable-marks
490 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
491 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
492 gnus-souped-mark gnus-duplicate-mark
)
493 "*The list of marks converted into expiration if a group is auto-expirable."
495 :type
'(repeat character
))
497 (defcustom gnus-inhibit-user-auto-expire t
498 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
502 (defcustom gnus-view-pseudos nil
503 "*If `automatic', pseudo-articles will be viewed automatically.
504 If `not-confirm', pseudos will be viewed automatically, and the user
505 will not be asked to confirm the command."
506 :group
'gnus-extract-view
507 :type
'(choice (const :tag
"off" nil
)
509 (const not-confirm
)))
511 (defcustom gnus-view-pseudos-separately t
512 "*If non-nil, one pseudo-article will be created for each file to be viewed.
513 If nil, all files that use the same viewing command will be given as a
514 list of parameters to that command."
515 :group
'gnus-extract-view
518 (defcustom gnus-insert-pseudo-articles t
519 "*If non-nil, insert pseudo-articles when decoding articles."
520 :group
'gnus-extract-view
523 (defcustom gnus-summary-dummy-line-format
525 "*The format specification for the dummy roots in the summary buffer.
526 It works along the same lines as a normal formatting string,
527 with some simple extensions.
530 :group
'gnus-threading
533 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
534 "*The format specification for the summary mode line.
535 It works along the same lines as a normal formatting string,
536 with some simple extensions:
539 %p Unprefixed group name
540 %A Current article number
541 %z Current article score
543 %U Number of unread articles in the group
544 %e Number of unselected articles in the group
545 %Z A string with unread/unselected article counts
546 %g Shortish group name
547 %S Subject of the current article
549 %s Current score file name
550 %d Number of dormant articles
551 %r Number of articles that have been marked as read in this session
552 %E Number of articles expunged by the score files"
553 :group
'gnus-summary-format
556 (defcustom gnus-list-identifiers nil
557 "Regexp that matches list identifiers to be removed from subject.
558 This can also be a list of regexps."
559 :group
'gnus-summary-format
560 :group
'gnus-article-hiding
561 :type
'(choice (const :tag
"none" nil
)
563 (repeat :value
(".*") regexp
)))
565 (defcustom gnus-summary-mark-below
0
566 "*Mark all articles with a score below this variable as read.
567 This variable is local to each summary buffer and usually set by the
569 :group
'gnus-score-default
572 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
573 "*List of functions used for sorting articles in the summary buffer.
574 This variable is only used when not using a threaded display."
575 :group
'gnus-summary-sort
576 :type
'(repeat (choice (function-item gnus-article-sort-by-number
)
577 (function-item gnus-article-sort-by-author
)
578 (function-item gnus-article-sort-by-subject
)
579 (function-item gnus-article-sort-by-date
)
580 (function-item gnus-article-sort-by-score
)
581 (function :tag
"other"))))
583 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
584 "*List of functions used for sorting threads in the summary buffer.
585 By default, threads are sorted by article number.
587 Each function takes two threads and return non-nil if the first thread
588 should be sorted before the other. If you use more than one function,
589 the primary sort function should be the last. You should probably
590 always include `gnus-thread-sort-by-number' in the list of sorting
591 functions -- preferably first.
593 Ready-made functions include `gnus-thread-sort-by-number',
594 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
595 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
596 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
597 :group
'gnus-summary-sort
598 :type
'(repeat (choice (function-item gnus-thread-sort-by-number
)
599 (function-item gnus-thread-sort-by-author
)
600 (function-item gnus-thread-sort-by-subject
)
601 (function-item gnus-thread-sort-by-date
)
602 (function-item gnus-thread-sort-by-score
)
603 (function-item gnus-thread-sort-by-total-score
)
604 (function :tag
"other"))))
606 (defcustom gnus-thread-score-function
'+
607 "*Function used for calculating the total score of a thread.
609 The function is called with the scores of the article and each
610 subthread and should then return the score of the thread.
612 Some functions you can use are `+', `max', or `min'."
613 :group
'gnus-summary-sort
616 (defcustom gnus-summary-expunge-below nil
617 "All articles that have a score less than this variable will be expunged.
618 This variable is local to the summary buffers."
619 :group
'gnus-score-default
620 :type
'(choice (const :tag
"off" nil
)
623 (defcustom gnus-thread-expunge-below nil
624 "All threads that have a total score less than this variable will be expunged.
625 See `gnus-thread-score-function' for en explanation of what a
628 This variable is local to the summary buffers."
629 :group
'gnus-threading
630 :group
'gnus-score-default
631 :type
'(choice (const :tag
"off" nil
)
634 (defcustom gnus-summary-mode-hook nil
635 "*A hook for Gnus summary mode.
636 This hook is run before any variables are set in the summary buffer."
637 :options
'(turn-on-gnus-mailing-list-mode)
638 :group
'gnus-summary-various
641 (defcustom gnus-summary-menu-hook nil
642 "*Hook run after the creation of the summary mode menu."
643 :group
'gnus-summary-visual
646 (defcustom gnus-summary-exit-hook nil
647 "*A hook called on exit from the summary buffer.
648 It will be called with point in the group buffer."
649 :group
'gnus-summary-exit
652 (defcustom gnus-summary-prepare-hook nil
653 "*A hook called after the summary buffer has been generated.
654 If you want to modify the summary buffer, you can use this hook."
655 :group
'gnus-summary-various
658 (defcustom gnus-summary-prepared-hook nil
659 "*A hook called as the last thing after the summary buffer has been generated."
660 :group
'gnus-summary-various
663 (defcustom gnus-summary-generate-hook nil
664 "*A hook run just before generating the summary buffer.
665 This hook is commonly used to customize threading variables and the
667 :group
'gnus-summary-various
670 (defcustom gnus-select-group-hook nil
671 "*A hook called when a newsgroup is selected.
673 If you'd like to simplify subjects like the
674 `gnus-summary-next-same-subject' command does, you can use the
677 (setq gnus-select-group-hook
680 (mapcar (lambda (header)
681 (mail-header-set-subject
683 (gnus-simplify-subject
684 (mail-header-subject header) 're-only)))
685 gnus-newsgroup-headers))))"
686 :group
'gnus-group-select
689 (defcustom gnus-select-article-hook nil
690 "*A hook called when an article is selected."
691 :group
'gnus-summary-choose
694 (defcustom gnus-visual-mark-article-hook
695 (list 'gnus-highlight-selected-summary
)
696 "*Hook run after selecting an article in the summary buffer.
697 It is meant to be used for highlighting the article in some way. It
698 is not run if `gnus-visual' is nil."
699 :group
'gnus-summary-visual
702 (defcustom gnus-parse-headers-hook nil
703 "*A hook called before parsing the headers."
707 (defcustom gnus-exit-group-hook nil
708 "*A hook called when exiting summary mode.
709 This hook is not called from the non-updating exit commands like `Q'."
713 (defcustom gnus-summary-update-hook
714 (list 'gnus-summary-highlight-line
)
715 "*A hook called when a summary line is changed.
716 The hook will not be called if `gnus-visual' is nil.
718 The default function `gnus-summary-highlight-line' will
719 highlight the line according to the `gnus-summary-highlight'
721 :group
'gnus-summary-visual
724 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
725 "*A hook called when an article is selected for the first time.
726 The hook is intended to mark an article as read (or unread)
727 automatically when it is selected."
728 :group
'gnus-summary-choose
731 (defcustom gnus-group-no-more-groups-hook nil
732 "*A hook run when returning to group mode having no more (unread) groups."
733 :group
'gnus-group-select
736 (defcustom gnus-ps-print-hook nil
737 "*A hook run before ps-printing something from Gnus."
741 (defcustom gnus-summary-selected-face
'gnus-summary-selected-face
742 "Face used for highlighting the current article in the summary buffer."
743 :group
'gnus-summary-visual
746 (defcustom gnus-summary-highlight
747 '(((= mark gnus-canceled-mark
)
748 . gnus-summary-cancelled-face
)
749 ((and (> score default
)
750 (or (= mark gnus-dormant-mark
)
751 (= mark gnus-ticked-mark
)))
752 . gnus-summary-high-ticked-face
)
753 ((and (< score default
)
754 (or (= mark gnus-dormant-mark
)
755 (= mark gnus-ticked-mark
)))
756 . gnus-summary-low-ticked-face
)
757 ((or (= mark gnus-dormant-mark
)
758 (= mark gnus-ticked-mark
))
759 . gnus-summary-normal-ticked-face
)
760 ((and (> score default
) (= mark gnus-ancient-mark
))
761 . gnus-summary-high-ancient-face
)
762 ((and (< score default
) (= mark gnus-ancient-mark
))
763 . gnus-summary-low-ancient-face
)
764 ((= mark gnus-ancient-mark
)
765 . gnus-summary-normal-ancient-face
)
766 ((and (> score default
) (= mark gnus-unread-mark
))
767 . gnus-summary-high-unread-face
)
768 ((and (< score default
) (= mark gnus-unread-mark
))
769 . gnus-summary-low-unread-face
)
770 ((= mark gnus-unread-mark
)
771 . gnus-summary-normal-unread-face
)
772 ((and (> score default
) (memq mark
(list gnus-downloadable-mark
773 gnus-undownloaded-mark
)))
774 . gnus-summary-high-unread-face
)
775 ((and (< score default
) (memq mark
(list gnus-downloadable-mark
776 gnus-undownloaded-mark
)))
777 . gnus-summary-low-unread-face
)
778 ((memq mark
(list gnus-downloadable-mark gnus-undownloaded-mark
))
779 . gnus-summary-normal-unread-face
)
781 . gnus-summary-high-read-face
)
783 . gnus-summary-low-read-face
)
785 . gnus-summary-normal-read-face
))
786 "*Controls the highlighting of summary buffer lines.
788 A list of (FORM . FACE) pairs. When deciding how a a particular
789 summary line should be displayed, each form is evaluated. The content
790 of the face field after the first true form is used. You can change
791 how those summary lines are displayed, by editing the face field.
793 You can use the following variables in the FORM field.
795 score: The articles score
796 default: The default article score.
797 below: The score below which articles are automatically marked as read.
798 mark: The articles mark."
799 :group
'gnus-summary-visual
800 :type
'(repeat (cons (sexp :tag
"Form" nil
)
803 (defcustom gnus-alter-header-function nil
804 "Function called to allow alteration of article header structures.
805 The function is called with one parameter, the article header vector,
806 which it may alter in any way.")
808 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
809 "Variable that says which function should be used to decode a string with encoded words.")
811 (defcustom gnus-extra-headers nil
812 "*Extra headers to parse."
814 :type
'(repeat symbol
))
816 (defcustom gnus-ignored-from-addresses
817 (and user-mail-address
(regexp-quote user-mail-address
))
818 "*Regexp of From headers that may be suppressed in favor of To headers."
822 (defcustom gnus-group-charset-alist
823 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5
)
824 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312
)
825 ("^fj\\>\\|^japan\\>" iso-2022-jp-2
)
826 ("^tnn\\>\\|^pin\\>\\|^sci.lang.japan" iso-2022-7bit
)
827 ("^relcom\\>" koi8-r
)
829 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2
)
830 ("^israel\\>" iso-8859-1
)
832 ("^alt.chinese.text.big5\\>" chinese-big5
)
833 ("^soc.culture.vietnamese\\>" vietnamese-viqr
)
834 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1
)
836 "Alist of regexps (to match group names) and default charsets to be used when reading."
837 :type
'(repeat (list (regexp :tag
"Group")
838 (symbol :tag
"Charset")))
839 :group
'gnus-charset
)
841 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
842 "List of charsets that should be ignored.
843 When these charsets are used in the \"charset\" parameter, the
844 default charset will be used instead."
845 :type
'(repeat symbol
)
846 :group
'gnus-charset
)
848 (defcustom gnus-group-ignored-charsets-alist
849 '(("alt\\.chinese\\.text" iso-8859-1
))
850 "Alist of regexps (to match group names) and charsets that should be ignored.
851 When these charsets are used in the \"charset\" parameter, the
852 default charset will be used instead."
853 :type
'(repeat (cons (regexp :tag
"Group")
855 :group
'gnus-charset
)
857 (defcustom gnus-group-highlight-words-alist nil
858 "Alist of group regexps and highlight regexps.
859 This variable uses the same syntax as `gnus-emphasis-alist'."
860 :type
'(repeat (cons (regexp :tag
"Group")
861 (repeat (list (regexp :tag
"Highlight regexp")
862 (number :tag
"Group for entire word" 0)
863 (number :tag
"Group for displayed part" 0)
865 gnus-emphasis-highlight-words
)))))
866 :group
'gnus-summary-visual
)
868 (defcustom gnus-summary-show-article-charset-alist
870 "Alist of number and charset.
871 The article will be shown with the charset corresponding to the
873 For example: ((1 . cn-gb-2312) (2 . big5))."
874 :type
'(repeat (cons (number :tag
"Argument" 1)
875 (symbol :tag
"Charset")))
876 :group
'gnus-charset
)
878 (defcustom gnus-preserve-marks t
879 "Whether marks are preserved when moving, copying and respooling messages."
881 :group
'gnus-summary-marks
)
883 (defcustom gnus-alter-articles-to-read-function nil
884 "Function to be called to alter the list of articles to be selected."
886 :group
'gnus-summary
)
888 (defcustom gnus-orphan-score nil
889 "*All orphans get this score added. Set in the score file."
890 :group
'gnus-score-default
891 :type
'(choice (const nil
)
894 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
895 "*A regexp to match MIME parts when saving multiple parts of a message
896 with gnus-summary-save-parts (X m). This regexp will be used by default
897 when prompting the user for which type of files to save."
902 ;;; Internal variables
904 (defvar gnus-article-mime-handles nil
)
905 (defvar gnus-article-decoded-p nil
)
906 (defvar gnus-scores-exclude-files nil
)
907 (defvar gnus-page-broken nil
)
908 (defvar gnus-inhibit-mime-unbuttonizing nil
)
910 (defvar gnus-original-article nil
)
911 (defvar gnus-article-internal-prepare-hook nil
)
912 (defvar gnus-newsgroup-process-stack nil
)
914 (defvar gnus-thread-indent-array nil
)
915 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
916 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
917 "Function called to sort the articles within a thread after it has been gathered together.")
919 (defvar gnus-summary-save-parts-type-history nil
)
920 (defvar gnus-summary-save-parts-last-directory nil
)
922 ;; Avoid highlighting in kill files.
923 (defvar gnus-summary-inhibit-highlight nil
)
924 (defvar gnus-newsgroup-selected-overlay nil
)
925 (defvar gnus-inhibit-limiting nil
)
926 (defvar gnus-newsgroup-adaptive-score-file nil
)
927 (defvar gnus-current-score-file nil
)
928 (defvar gnus-current-move-group nil
)
929 (defvar gnus-current-copy-group nil
)
930 (defvar gnus-current-crosspost-group nil
)
932 (defvar gnus-newsgroup-dependencies nil
)
933 (defvar gnus-newsgroup-adaptive nil
)
934 (defvar gnus-summary-display-article-function nil
)
935 (defvar gnus-summary-highlight-line-function nil
936 "Function called after highlighting a summary line.")
938 (defvar gnus-summary-line-format-alist
939 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
940 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
941 (?s gnus-tmp-subject-or-nil ?s
)
942 (?n gnus-tmp-name ?s
)
943 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
945 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
947 (?F gnus-tmp-from ?s
)
948 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
949 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
950 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
951 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
952 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
953 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
954 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
955 (?L gnus-tmp-lines ?d
)
956 (?I gnus-tmp-indentation ?s
)
957 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
958 (?R gnus-tmp-replied ?c
)
959 (?\
[ gnus-tmp-opening-bracket ?c
)
960 (?\
] gnus-tmp-closing-bracket ?c
)
961 (?\
> (make-string gnus-tmp-level ?
) ?s
)
962 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
963 (?i gnus-tmp-score ?d
)
964 (?z gnus-tmp-score-char ?c
)
965 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
966 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
967 (?U gnus-tmp-unread ?c
)
968 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header
) ?s
)
969 (?t
(gnus-summary-number-of-articles-in-thread
970 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
972 (?e
(gnus-summary-number-of-articles-in-thread
973 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
975 (?u gnus-tmp-user-defined ?s
)
976 (?P
(gnus-pick-line-number) ?d
))
977 "An alist of format specifications that can appear in summary lines.
978 These are paired with what variables they correspond with, along with
979 the type of the variable (string, integer, character, etc).")
981 (defvar gnus-summary-dummy-line-format-alist
982 `((?S gnus-tmp-subject ?s
)
983 (?N gnus-tmp-number ?d
)
984 (?u gnus-tmp-user-defined ?s
)))
986 (defvar gnus-summary-mode-line-format-alist
987 `((?G gnus-tmp-group-name ?s
)
988 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
989 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
990 (?A gnus-tmp-article-number ?d
)
991 (?Z gnus-tmp-unread-and-unselected ?s
)
993 (?U gnus-tmp-unread-and-unticked ?d
)
994 (?S gnus-tmp-subject ?s
)
995 (?e gnus-tmp-unselected ?d
)
996 (?u gnus-tmp-user-defined ?s
)
997 (?d
(length gnus-newsgroup-dormant
) ?d
)
998 (?t
(length gnus-newsgroup-marked
) ?d
)
999 (?r
(length gnus-newsgroup-reads
) ?d
)
1000 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1001 (?E gnus-newsgroup-expunged-tally ?d
)
1002 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1004 (defvar gnus-last-search-regexp nil
1005 "Default regexp for article search command.")
1007 (defvar gnus-last-shell-command nil
1008 "Default shell command on article.")
1010 (defvar gnus-newsgroup-begin nil
)
1011 (defvar gnus-newsgroup-end nil
)
1012 (defvar gnus-newsgroup-last-rmail nil
)
1013 (defvar gnus-newsgroup-last-mail nil
)
1014 (defvar gnus-newsgroup-last-folder nil
)
1015 (defvar gnus-newsgroup-last-file nil
)
1016 (defvar gnus-newsgroup-auto-expire nil
)
1017 (defvar gnus-newsgroup-active nil
)
1019 (defvar gnus-newsgroup-data nil
)
1020 (defvar gnus-newsgroup-data-reverse nil
)
1021 (defvar gnus-newsgroup-limit nil
)
1022 (defvar gnus-newsgroup-limits nil
)
1024 (defvar gnus-newsgroup-unreads nil
1025 "List of unread articles in the current newsgroup.")
1027 (defvar gnus-newsgroup-unselected nil
1028 "List of unselected unread articles in the current newsgroup.")
1030 (defvar gnus-newsgroup-reads nil
1031 "Alist of read articles and article marks in the current newsgroup.")
1033 (defvar gnus-newsgroup-expunged-tally nil
)
1035 (defvar gnus-newsgroup-marked nil
1036 "List of ticked articles in the current newsgroup (a subset of unread art).")
1038 (defvar gnus-newsgroup-killed nil
1039 "List of ranges of articles that have been through the scoring process.")
1041 (defvar gnus-newsgroup-cached nil
1042 "List of articles that come from the article cache.")
1044 (defvar gnus-newsgroup-saved nil
1045 "List of articles that have been saved.")
1047 (defvar gnus-newsgroup-kill-headers nil
)
1049 (defvar gnus-newsgroup-replied nil
1050 "List of articles that have been replied to in the current newsgroup.")
1052 (defvar gnus-newsgroup-expirable nil
1053 "List of articles in the current newsgroup that can be expired.")
1055 (defvar gnus-newsgroup-processable nil
1056 "List of articles in the current newsgroup that can be processed.")
1058 (defvar gnus-newsgroup-downloadable nil
1059 "List of articles in the current newsgroup that can be processed.")
1061 (defvar gnus-newsgroup-undownloaded nil
1062 "List of articles in the current newsgroup that haven't been downloaded..")
1064 (defvar gnus-newsgroup-unsendable nil
1065 "List of articles in the current newsgroup that won't be sent.")
1067 (defvar gnus-newsgroup-bookmarks nil
1068 "List of articles in the current newsgroup that have bookmarks.")
1070 (defvar gnus-newsgroup-dormant nil
1071 "List of dormant articles in the current newsgroup.")
1073 (defvar gnus-newsgroup-scored nil
1074 "List of scored articles in the current newsgroup.")
1076 (defvar gnus-newsgroup-headers nil
1077 "List of article headers in the current newsgroup.")
1079 (defvar gnus-newsgroup-threads nil
)
1081 (defvar gnus-newsgroup-prepared nil
1082 "Whether the current group has been prepared properly.")
1084 (defvar gnus-newsgroup-ancient nil
1085 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1087 (defvar gnus-newsgroup-sparse nil
)
1089 (defvar gnus-current-article nil
)
1090 (defvar gnus-article-current nil
)
1091 (defvar gnus-current-headers nil
)
1092 (defvar gnus-have-all-headers nil
)
1093 (defvar gnus-last-article nil
)
1094 (defvar gnus-newsgroup-history nil
)
1095 (defvar gnus-newsgroup-charset nil
)
1096 (defvar gnus-newsgroup-ephemeral-charset nil
)
1097 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1099 (defconst gnus-summary-local-variables
1100 '(gnus-newsgroup-name
1101 gnus-newsgroup-begin gnus-newsgroup-end
1102 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1103 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1104 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1105 gnus-newsgroup-unselected gnus-newsgroup-marked
1106 gnus-newsgroup-reads gnus-newsgroup-saved
1107 gnus-newsgroup-replied gnus-newsgroup-expirable
1108 gnus-newsgroup-processable gnus-newsgroup-killed
1109 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1110 gnus-newsgroup-unsendable
1111 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1112 gnus-newsgroup-headers gnus-newsgroup-threads
1113 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1114 gnus-current-article gnus-current-headers gnus-have-all-headers
1115 gnus-last-article gnus-article-internal-prepare-hook
1116 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1117 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1118 gnus-thread-expunge-below
1119 gnus-score-alist gnus-current-score-file
1120 (gnus-summary-expunge-below . global
)
1121 (gnus-summary-mark-below . global
)
1122 (gnus-orphan-score . global
)
1123 gnus-newsgroup-active gnus-scores-exclude-files
1124 gnus-newsgroup-history gnus-newsgroup-ancient
1125 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1126 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1127 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1128 (gnus-newsgroup-expunged-tally .
0)
1129 gnus-cache-removable-articles gnus-newsgroup-cached
1130 gnus-newsgroup-data gnus-newsgroup-data-reverse
1131 gnus-newsgroup-limit gnus-newsgroup-limits
1132 gnus-newsgroup-charset
)
1133 "Variables that are buffer-local to the summary buffers.")
1135 ;; Byte-compiler warning.
1136 (eval-when-compile (defvar gnus-article-mode-map
))
1140 (defvar gnus-decode-encoded-word-methods
1141 '(mail-decode-encoded-word-string)
1142 "List of methods used to decode encoded words.
1144 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1145 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1146 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1147 whose names match REGEXP.
1150 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1151 mail-decode-encoded-word-string
1152 (\"chinese\" . rfc1843-decode-string))")
1154 (defvar gnus-decode-encoded-word-methods-cache nil
)
1156 (defun gnus-multi-decode-encoded-word-string (string)
1157 "Apply the functions from `gnus-encoded-word-methods' that match."
1158 (unless (and gnus-decode-encoded-word-methods-cache
1159 (eq gnus-newsgroup-name
1160 (car gnus-decode-encoded-word-methods-cache
)))
1161 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1164 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1165 (if (and gnus-newsgroup-name
1166 (string-match (car x
) gnus-newsgroup-name
))
1167 (nconc gnus-decode-encoded-word-methods-cache
1169 gnus-decode-encoded-word-methods
))
1170 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1173 (setq string
(funcall (pop xlist
) string
))))
1176 ;; Subject simplification.
1178 (defun gnus-simplify-whitespace (str)
1179 "Remove excessive whitespace from STR."
1182 (while (string-match "[ \t][ \t]+" mystr
)
1183 (setq mystr
(concat (substring mystr
0 (match-beginning 0))
1185 (substring mystr
(match-end 0)))))
1187 (when (string-match "^[ \t]+" mystr
)
1188 (setq mystr
(substring mystr
(match-end 0))))
1190 (when (string-match "[ \t]+$" mystr
)
1191 (setq mystr
(substring mystr
0 (match-beginning 0))))
1194 (defsubst gnus-simplify-subject-re
(subject)
1195 "Remove \"Re:\" from subject lines."
1196 (if (string-match "^[Rr][Ee]: *" subject
)
1197 (substring subject
(match-end 0))
1200 (defun gnus-simplify-subject (subject &optional re-only
)
1201 "Remove `Re:' and words in parentheses.
1202 If RE-ONLY is non-nil, strip leading `Re:'s only."
1203 (let ((case-fold-search t
)) ;Ignore case.
1204 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1205 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1206 (setq subject
(substring subject
(match-end 0))))
1207 ;; Remove uninteresting prefixes.
1208 (when (and (not re-only
)
1209 gnus-simplify-ignored-prefixes
1210 (string-match gnus-simplify-ignored-prefixes subject
))
1211 (setq subject
(substring subject
(match-end 0))))
1212 ;; Remove words in parentheses from end.
1214 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1215 (setq subject
(substring subject
0 (match-beginning 0)))))
1216 ;; Return subject string.
1219 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1221 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1222 (goto-char (point-min))
1223 (while (re-search-forward regexp nil t
)
1224 (replace-match (or newtext
""))))
1226 (defun gnus-simplify-buffer-fuzzy ()
1227 "Simplify string in the buffer fuzzily.
1228 The string in the accessible portion of the current buffer is simplified.
1229 It is assumed to be a single-line subject.
1230 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1231 matter is removed. Additional things can be deleted by setting
1232 `gnus-simplify-subject-fuzzy-regexp'."
1233 (let ((case-fold-search t
)
1235 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1237 (while (not (eq modified-tick
(buffer-modified-tick)))
1238 (setq modified-tick
(buffer-modified-tick))
1240 ((listp gnus-simplify-subject-fuzzy-regexp
)
1241 (mapcar 'gnus-simplify-buffer-fuzzy-step
1242 gnus-simplify-subject-fuzzy-regexp
))
1243 (gnus-simplify-subject-fuzzy-regexp
1244 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1245 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1246 (gnus-simplify-buffer-fuzzy-step
1247 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1248 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1250 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1251 (gnus-simplify-buffer-fuzzy-step " +" " ")
1252 (gnus-simplify-buffer-fuzzy-step " $")
1253 (gnus-simplify-buffer-fuzzy-step "^ +")))
1255 (defun gnus-simplify-subject-fuzzy (subject)
1256 "Simplify a subject string fuzzily.
1257 See `gnus-simplify-buffer-fuzzy' for details."
1259 (gnus-set-work-buffer)
1260 (let ((case-fold-search t
))
1261 ;; Remove uninteresting prefixes.
1262 (when (and gnus-simplify-ignored-prefixes
1263 (string-match gnus-simplify-ignored-prefixes subject
))
1264 (setq subject
(substring subject
(match-end 0))))
1266 (inline (gnus-simplify-buffer-fuzzy))
1269 (defsubst gnus-simplify-subject-fully
(subject)
1270 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1272 (gnus-simplify-subject-functions
1273 (gnus-map-function gnus-simplify-subject-functions subject
))
1274 ((null gnus-summary-gather-subject-limit
)
1275 (gnus-simplify-subject-re subject
))
1276 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1277 (gnus-simplify-subject-fuzzy subject
))
1278 ((numberp gnus-summary-gather-subject-limit
)
1279 (gnus-limit-string (gnus-simplify-subject-re subject
)
1280 gnus-summary-gather-subject-limit
))
1284 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1285 "Check whether two subjects are equal.
1286 If optional argument simple-first is t, first argument is already
1289 ((null simple-first
)
1290 (equal (gnus-simplify-subject-fully s1
)
1291 (gnus-simplify-subject-fully s2
)))
1294 (gnus-simplify-subject-fully s2
)))))
1296 (defun gnus-summary-bubble-group ()
1297 "Increase the score of the current group.
1298 This is a handy function to add to `gnus-summary-exit-hook' to
1299 increase the score of each group you read."
1300 (gnus-group-add-score gnus-newsgroup-name
))
1304 ;;; Gnus summary mode
1307 (put 'gnus-summary-mode
'mode-class
'special
)
1310 ;; Non-orthogonal keys
1312 (gnus-define-keys gnus-summary-mode-map
1313 " " gnus-summary-next-page
1314 "\177" gnus-summary-prev-page
1315 [delete] gnus-summary-prev-page
1316 [backspace] gnus-summary-prev-page
1317 "\r" gnus-summary-scroll-up
1318 "\M-\r" gnus-summary-scroll-down
1319 "n" gnus-summary-next-unread-article
1320 "p" gnus-summary-prev-unread-article
1321 "N" gnus-summary-next-article
1322 "P" gnus-summary-prev-article
1323 "\M-\C-n" gnus-summary-next-same-subject
1324 "\M-\C-p" gnus-summary-prev-same-subject
1325 "\M-n" gnus-summary-next-unread-subject
1326 "\M-p" gnus-summary-prev-unread-subject
1327 "." gnus-summary-first-unread-article
1328 "," gnus-summary-best-unread-article
1329 "\M-s" gnus-summary-search-article-forward
1330 "\M-r" gnus-summary-search-article-backward
1331 "<" gnus-summary-beginning-of-article
1332 ">" gnus-summary-end-of-article
1333 "j" gnus-summary-goto-article
1334 "^" gnus-summary-refer-parent-article
1335 "\M-^" gnus-summary-refer-article
1336 "u" gnus-summary-tick-article-forward
1337 "!" gnus-summary-tick-article-forward
1338 "U" gnus-summary-tick-article-backward
1339 "d" gnus-summary-mark-as-read-forward
1340 "D" gnus-summary-mark-as-read-backward
1341 "E" gnus-summary-mark-as-expirable
1342 "\M-u" gnus-summary-clear-mark-forward
1343 "\M-U" gnus-summary-clear-mark-backward
1344 "k" gnus-summary-kill-same-subject-and-select
1345 "\C-k" gnus-summary-kill-same-subject
1346 "\M-\C-k" gnus-summary-kill-thread
1347 "\M-\C-l" gnus-summary-lower-thread
1348 "e" gnus-summary-edit-article
1349 "#" gnus-summary-mark-as-processable
1350 "\M-#" gnus-summary-unmark-as-processable
1351 "\M-\C-t" gnus-summary-toggle-threads
1352 "\M-\C-s" gnus-summary-show-thread
1353 "\M-\C-h" gnus-summary-hide-thread
1354 "\M-\C-f" gnus-summary-next-thread
1355 "\M-\C-b" gnus-summary-prev-thread
1356 [(meta down)] gnus-summary-next-thread
1357 [(meta up)] gnus-summary-prev-thread
1358 "\M-\C-u" gnus-summary-up-thread
1359 "\M-\C-d" gnus-summary-down-thread
1360 "&" gnus-summary-execute-command
1361 "c" gnus-summary-catchup-and-exit
1362 "\C-w" gnus-summary-mark-region-as-read
1363 "\C-t" gnus-summary-toggle-truncation
1364 "?" gnus-summary-mark-as-dormant
1365 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1366 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1367 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1368 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1369 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1370 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1371 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1372 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1373 "=" gnus-summary-expand-window
1374 "\C-x\C-s" gnus-summary-reselect-current-group
1375 "\M-g" gnus-summary-rescan-group
1376 "w" gnus-summary-stop-page-breaking
1377 "\C-c\C-r" gnus-summary-caesar-message
1378 "f" gnus-summary-followup
1379 "F" gnus-summary-followup-with-original
1380 "C" gnus-summary-cancel-article
1381 "r" gnus-summary-reply
1382 "R" gnus-summary-reply-with-original
1383 "\C-c\C-f" gnus-summary-mail-forward
1384 "o" gnus-summary-save-article
1385 "\C-o" gnus-summary-save-article-mail
1386 "|" gnus-summary-pipe-output
1387 "\M-k" gnus-summary-edit-local-kill
1388 "\M-K" gnus-summary-edit-global-kill
1390 "\C-c\C-d" gnus-summary-describe-group
1391 "q" gnus-summary-exit
1392 "Q" gnus-summary-exit-no-update
1393 "\C-c\C-i" gnus-info-find-node
1394 gnus-mouse-2 gnus-mouse-pick-article
1395 "m" gnus-summary-mail-other-window
1396 "a" gnus-summary-post-news
1397 "x" gnus-summary-limit-to-unread
1398 "s" gnus-summary-isearch-article
1399 "t" gnus-summary-toggle-header
1400 "g" gnus-summary-show-article
1401 "l" gnus-summary-goto-last-article
1402 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1403 "\C-d" gnus-summary-enter-digest-group
1404 "\M-\C-d" gnus-summary-read-document
1405 "\M-\C-e" gnus-summary-edit-parameters
1406 "\M-\C-a" gnus-summary-customize-parameters
1408 "*" gnus-cache-enter-article
1409 "\M-*" gnus-cache-remove-article
1410 "\M-&" gnus-summary-universal-argument
1411 "\C-l" gnus-recenter
1412 "I" gnus-summary-increase-score
1413 "L" gnus-summary-lower-score
1414 "\M-i" gnus-symbolic-argument
1415 "h" gnus-summary-select-article-buffer
1417 "b" gnus-article-view-part
1418 "\M-t" gnus-summary-toggle-display-buttonized
1420 "V" gnus-summary-score-map
1421 "X" gnus-uu-extract-map
1422 "S" gnus-summary-send-map)
1424 ;; Sort of orthogonal keymap
1425 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1426 "t" gnus-summary-tick-article-forward
1427 "!" gnus-summary-tick-article-forward
1428 "d" gnus-summary-mark-as-read-forward
1429 "r" gnus-summary-mark-as-read-forward
1430 "c" gnus-summary-clear-mark-forward
1431 " " gnus-summary-clear-mark-forward
1432 "e" gnus-summary-mark-as-expirable
1433 "x" gnus-summary-mark-as-expirable
1434 "?" gnus-summary-mark-as-dormant
1435 "b" gnus-summary-set-bookmark
1436 "B" gnus-summary-remove-bookmark
1437 "#" gnus-summary-mark-as-processable
1438 "\M-#" gnus-summary-unmark-as-processable
1439 "S" gnus-summary-limit-include-expunged
1440 "C" gnus-summary-catchup
1441 "H" gnus-summary-catchup-to-here
1442 "\C-c" gnus-summary-catchup-all
1443 "k" gnus-summary-kill-same-subject-and-select
1444 "K" gnus-summary-kill-same-subject
1445 "P" gnus-uu-mark-map)
1447 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1448 "c" gnus-summary-clear-above
1449 "u" gnus-summary-tick-above
1450 "m" gnus-summary-mark-above
1451 "k" gnus-summary-kill-below)
1453 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1454 "/" gnus-summary-limit-to-subject
1455 "n" gnus-summary-limit-to-articles
1456 "w" gnus-summary-pop-limit
1457 "s" gnus-summary-limit-to-subject
1458 "a" gnus-summary-limit-to-author
1459 "u" gnus-summary-limit-to-unread
1460 "m" gnus-summary-limit-to-marks
1461 "M" gnus-summary-limit-exclude-marks
1462 "v" gnus-summary-limit-to-score
1463 "*" gnus-summary-limit-include-cached
1464 "D" gnus-summary-limit-include-dormant
1465 "T" gnus-summary-limit-include-thread
1466 "d" gnus-summary-limit-exclude-dormant
1467 "t" gnus-summary-limit-to-age
1468 "x" gnus-summary-limit-to-extra
1469 "E" gnus-summary-limit-include-expunged
1470 "c" gnus-summary-limit-exclude-childless-dormant
1471 "C" gnus-summary-limit-mark-excluded-as-read)
1473 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1474 "n" gnus-summary-next-unread-article
1475 "p" gnus-summary-prev-unread-article
1476 "N" gnus-summary-next-article
1477 "P" gnus-summary-prev-article
1478 "\C-n" gnus-summary-next-same-subject
1479 "\C-p" gnus-summary-prev-same-subject
1480 "\M-n" gnus-summary-next-unread-subject
1481 "\M-p" gnus-summary-prev-unread-subject
1482 "f" gnus-summary-first-unread-article
1483 "b" gnus-summary-best-unread-article
1484 "j" gnus-summary-goto-article
1485 "g" gnus-summary-goto-subject
1486 "l" gnus-summary-goto-last-article
1487 "o" gnus-summary-pop-article)
1489 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1490 "k" gnus-summary-kill-thread
1491 "l" gnus-summary-lower-thread
1492 "i" gnus-summary-raise-thread
1493 "T" gnus-summary-toggle-threads
1494 "t" gnus-summary-rethread-current
1495 "^" gnus-summary-reparent-thread
1496 "s" gnus-summary-show-thread
1497 "S" gnus-summary-show-all-threads
1498 "h" gnus-summary-hide-thread
1499 "H" gnus-summary-hide-all-threads
1500 "n" gnus-summary-next-thread
1501 "p" gnus-summary-prev-thread
1502 "u" gnus-summary-up-thread
1503 "o" gnus-summary-top-thread
1504 "d" gnus-summary-down-thread
1505 "#" gnus-uu-mark-thread
1506 "\M-#" gnus-uu-unmark-thread)
1508 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1509 "g" gnus-summary-prepare
1510 "c" gnus-summary-insert-cached-articles)
1512 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1513 "c" gnus-summary-catchup-and-exit
1514 "C" gnus-summary-catchup-all-and-exit
1515 "E" gnus-summary-exit-no-update
1516 "Q" gnus-summary-exit
1517 "Z" gnus-summary-exit
1518 "n" gnus-summary-catchup-and-goto-next-group
1519 "R" gnus-summary-reselect-current-group
1520 "G" gnus-summary-rescan-group
1521 "N" gnus-summary-next-group
1522 "s" gnus-summary-save-newsrc
1523 "P" gnus-summary-prev-group)
1525 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1526 " " gnus-summary-next-page
1527 "n" gnus-summary-next-page
1528 "\177" gnus-summary-prev-page
1529 [delete] gnus-summary-prev-page
1530 "p" gnus-summary-prev-page
1531 "\r" gnus-summary-scroll-up
1532 "\M-\r" gnus-summary-scroll-down
1533 "<" gnus-summary-beginning-of-article
1534 ">" gnus-summary-end-of-article
1535 "b" gnus-summary-beginning-of-article
1536 "e" gnus-summary-end-of-article
1537 "^" gnus-summary-refer-parent-article
1538 "r" gnus-summary-refer-parent-article
1539 "D" gnus-summary-enter-digest-group
1540 "R" gnus-summary-refer-references
1541 "T" gnus-summary-refer-thread
1542 "g" gnus-summary-show-article
1543 "s" gnus-summary-isearch-article
1544 "P" gnus-summary-print-article
1545 "t" gnus-article-babel
)
1547 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1548 "b" gnus-article-add-buttons
1549 "B" gnus-article-add-buttons-to-head
1550 "o" gnus-article-treat-overstrike
1551 "e" gnus-article-emphasize
1552 "w" gnus-article-fill-cited-article
1553 "Q" gnus-article-fill-long-lines
1554 "C" gnus-article-capitalize-sentences
1555 "c" gnus-article-remove-cr
1556 "q" gnus-article-de-quoted-unreadable
1557 "6" gnus-article-de-base64-unreadable
1558 "Z" gnus-article-decode-HZ
1559 "h" gnus-article-wash-html
1560 "f" gnus-article-display-x-face
1561 "l" gnus-summary-stop-page-breaking
1562 "r" gnus-summary-caesar-message
1563 "t" gnus-summary-toggle-header
1564 "v" gnus-summary-verbose-headers
1565 "H" gnus-article-strip-headers-in-body
1566 "d" gnus-article-treat-dumbquotes
)
1568 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1569 "a" gnus-article-hide
1570 "h" gnus-article-hide-headers
1571 "b" gnus-article-hide-boring-headers
1572 "s" gnus-article-hide-signature
1573 "c" gnus-article-hide-citation
1574 "C" gnus-article-hide-citation-in-followups
1575 "l" gnus-article-hide-list-identifiers
1576 "p" gnus-article-hide-pgp
1577 "B" gnus-article-strip-banner
1578 "P" gnus-article-hide-pem
1579 "\C-c" gnus-article-hide-citation-maybe
)
1581 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1582 "a" gnus-article-highlight
1583 "h" gnus-article-highlight-headers
1584 "c" gnus-article-highlight-citation
1585 "s" gnus-article-highlight-signature
)
1587 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1588 "w" gnus-article-decode-mime-words
1589 "c" gnus-article-decode-charset
1590 "v" gnus-mime-view-all-parts
1591 "b" gnus-article-view-part
)
1593 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1594 "z" gnus-article-date-ut
1595 "u" gnus-article-date-ut
1596 "l" gnus-article-date-local
1597 "e" gnus-article-date-lapsed
1598 "o" gnus-article-date-original
1599 "i" gnus-article-date-iso8601
1600 "s" gnus-article-date-user
)
1602 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1603 "t" gnus-article-remove-trailing-blank-lines
1604 "l" gnus-article-strip-leading-blank-lines
1605 "m" gnus-article-strip-multiple-blank-lines
1606 "a" gnus-article-strip-blank-lines
1607 "A" gnus-article-strip-all-blank-lines
1608 "s" gnus-article-strip-leading-space
1609 "e" gnus-article-strip-trailing-space
)
1611 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1613 "f" gnus-summary-fetch-faq
1614 "d" gnus-summary-describe-group
1615 "h" gnus-summary-describe-briefly
1616 "i" gnus-info-find-node
)
1618 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1619 "e" gnus-summary-expire-articles
1620 "\M-\C-e" gnus-summary-expire-articles-now
1621 "\177" gnus-summary-delete-article
1622 [delete] gnus-summary-delete-article
1623 [backspace] gnus-summary-delete-article
1624 "m" gnus-summary-move-article
1625 "r" gnus-summary-respool-article
1626 "w" gnus-summary-edit-article
1627 "c" gnus-summary-copy-article
1628 "B" gnus-summary-crosspost-article
1629 "q" gnus-summary-respool-query
1630 "t" gnus-summary-respool-trace
1631 "i" gnus-summary-import-article
1632 "p" gnus-summary-article-posted-p)
1634 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1635 "o" gnus-summary-save-article
1636 "m" gnus-summary-save-article-mail
1637 "F" gnus-summary-write-article-file
1638 "r" gnus-summary-save-article-rmail
1639 "f" gnus-summary-save-article-file
1640 "b" gnus-summary-save-article-body-file
1641 "h" gnus-summary-save-article-folder
1642 "v" gnus-summary-save-article-vm
1643 "p" gnus-summary-pipe-output
1644 "s" gnus-soup-add-article)
1646 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1647 "b" gnus-summary-display-buttonized
1648 "m" gnus-summary-repair-multipart
1649 "v" gnus-article-view-part
1650 "o" gnus-article-save-part
1651 "c" gnus-article-copy-part
1652 "e" gnus-article-externalize-part
1653 "i" gnus-article-inline-part
1654 "|" gnus-article-pipe-part))
1656 (defun gnus-summary-make-menu-bar ()
1657 (gnus-turn-off-edit-menu 'summary)
1659 (unless (boundp 'gnus-summary-misc-menu)
1662 gnus-summary-kill-menu gnus-summary-mode-map ""
1667 ["Enter score..." gnus-summary-score-entry t]
1668 ["Customize" gnus-score-customize t])
1669 (gnus-make-score-map 'increase)
1670 (gnus-make-score-map 'lower)
1672 ["Kill below" gnus-summary-kill-below t]
1673 ["Mark above" gnus-summary-mark-above t]
1674 ["Tick above" gnus-summary-tick-above t]
1675 ["Clear above" gnus-summary-clear-above t])
1676 ["Current score" gnus-summary-current-score t]
1677 ["Set score" gnus-summary-set-score t]
1678 ["Switch current score file..." gnus-score-change-score-file t]
1679 ["Set mark below..." gnus-score-set-mark-below t]
1680 ["Set expunge below..." gnus-score-set-expunge-below t]
1681 ["Edit current score file" gnus-score-edit-current-scores t]
1682 ["Edit score file" gnus-score-edit-file t]
1683 ["Trace score" gnus-score-find-trace t]
1684 ["Find words" gnus-score-find-favourite-words t]
1685 ["Rescore buffer" gnus-summary-rescore t]
1686 ["Increase score..." gnus-summary-increase-score t]
1687 ["Lower score..." gnus-summary-lower-score t]))))
1689 ;; Define both the Article menu in the summary buffer and the equivalent
1690 ;; Commands menu in the article buffer here for consistency.
1693 ["All" gnus-article-hide t]
1694 ["Headers" gnus-article-hide-headers t]
1695 ["Signature" gnus-article-hide-signature t]
1696 ["Citation" gnus-article-hide-citation t]
1697 ["List identifiers" gnus-article-hide-list-identifiers t]
1698 ["PGP" gnus-article-hide-pgp t]
1699 ["Banner" gnus-article-strip-banner t]
1700 ["Boring headers" gnus-article-hide-boring-headers t])
1702 ["All" gnus-article-highlight t]
1703 ["Headers" gnus-article-highlight-headers t]
1704 ["Signature" gnus-article-highlight-signature t]
1705 ["Citation" gnus-article-highlight-citation t])
1707 ["Words" gnus-article-decode-mime-words t]
1708 ["Charset" gnus-article-decode-charset t]
1709 ["QP" gnus-article-de-quoted-unreadable t]
1710 ["Base64" gnus-article-de-base64-unreadable t]
1711 ["View all" gnus-mime-view-all-parts t])
1713 ["Local" gnus-article-date-local t]
1714 ["ISO8601" gnus-article-date-iso8601 t]
1715 ["UT" gnus-article-date-ut t]
1716 ["Original" gnus-article-date-original t]
1717 ["Lapsed" gnus-article-date-lapsed t]
1718 ["User-defined" gnus-article-date-user t])
1721 ["Leading" gnus-article-strip-leading-blank-lines t]
1722 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1723 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1724 ["All of the above" gnus-article-strip-blank-lines t]
1725 ["All" gnus-article-strip-all-blank-lines t]
1726 ["Leading space" gnus-article-strip-leading-space t]
1727 ["Trailing space" gnus-article-strip-trailing-space t])
1728 ["Overstrike" gnus-article-treat-overstrike t]
1729 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1730 ["Emphasis" gnus-article-emphasize t]
1731 ["Word wrap" gnus-article-fill-cited-article t]
1732 ["Fill long lines" gnus-article-fill-long-lines t]
1733 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1734 ["CR" gnus-article-remove-cr t]
1735 ["Show X-Face" gnus-article-display-x-face t]
1736 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1737 ["Base64" gnus-article-de-base64-unreadable t]
1738 ["Rot 13" gnus-summary-caesar-message
1739 :help "\"Caesar rotate\" article by 13"]
1740 ["Unix pipe" gnus-summary-pipe-message t]
1741 ["Add buttons" gnus-article-add-buttons t]
1742 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1743 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1744 ["Verbose header" gnus-summary-verbose-headers t]
1745 ["Toggle header" gnus-summary-toggle-header t]
1746 ["Html" gnus-article-wash-html t]
1747 ["HZ" gnus-article-decode-HZ t])
1749 ["Save in default format" gnus-summary-save-article
1750 :help "Save article using default method"]
1751 ["Save in file" gnus-summary-save-article-file
1752 :help "Save article in file"]
1753 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1754 ["Save in MH folder" gnus-summary-save-article-folder t]
1755 ["Save in VM folder" gnus-summary-save-article-vm t]
1756 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1757 ["Save body in file" gnus-summary-save-article-body-file t]
1758 ["Pipe through a filter" gnus-summary-pipe-output t]
1759 ["Add to SOUP packet" gnus-soup-add-article t]
1760 ["Print" gnus-summary-print-article t])
1762 ["Respool article..." gnus-summary-respool-article t]
1763 ["Move article..." gnus-summary-move-article
1764 (gnus-check-backend-function
1765 'request-move-article gnus-newsgroup-name)]
1766 ["Copy article..." gnus-summary-copy-article t]
1767 ["Crosspost article..." gnus-summary-crosspost-article
1768 (gnus-check-backend-function
1769 'request-replace-article gnus-newsgroup-name)]
1770 ["Import file..." gnus-summary-import-article t]
1771 ["Check if posted" gnus-summary-article-posted-p t]
1772 ["Edit article" gnus-summary-edit-article
1773 (not (gnus-group-read-only-p))]
1774 ["Delete article" gnus-summary-delete-article
1775 (gnus-check-backend-function
1776 'request-expire-articles gnus-newsgroup-name)]
1777 ["Query respool" gnus-summary-respool-query t]
1778 ["Trace respool" gnus-summary-respool-trace t]
1779 ["Delete expirable articles" gnus-summary-expire-articles-now
1780 (gnus-check-backend-function
1781 'request-expire-articles gnus-newsgroup-name)])
1783 ["Uudecode" gnus-uu-decode-uu
1784 :help "Decode uuencoded article(s)"]
1785 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1786 ["Unshar" gnus-uu-decode-unshar t]
1787 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1788 ["Save" gnus-uu-decode-save t]
1789 ["Binhex" gnus-uu-decode-binhex t]
1790 ["Postscript" gnus-uu-decode-postscript t])
1792 ["Enter article" gnus-cache-enter-article t]
1793 ["Remove article" gnus-cache-remove-article t])
1794 ["Translate" gnus-article-babel t]
1795 ["Select article buffer" gnus-summary-select-article-buffer t]
1796 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1797 ["Isearch article..." gnus-summary-isearch-article t]
1798 ["Beginning of the article" gnus-summary-beginning-of-article t]
1799 ["End of the article" gnus-summary-end-of-article t]
1800 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1801 ["Fetch referenced articles" gnus-summary-refer-references t]
1802 ["Fetch current thread" gnus-summary-refer-thread t]
1803 ["Fetch article with id..." gnus-summary-refer-article t]
1804 ["Redisplay" gnus-summary-show-article t])))
1806 gnus-summary-article-menu gnus-summary-mode-map ""
1807 (cons "Article" innards))
1810 gnus-article-commands-menu gnus-article-mode-map ""
1811 (cons "Commands" innards)))
1814 gnus-summary-thread-menu gnus-summary-mode-map ""
1816 ["Toggle threading" gnus-summary-toggle-threads t]
1817 ["Hide threads" gnus-summary-hide-all-threads t]
1818 ["Show threads" gnus-summary-show-all-threads t]
1819 ["Hide thread" gnus-summary-hide-thread t]
1820 ["Show thread" gnus-summary-show-thread t]
1821 ["Go to next thread" gnus-summary-next-thread t]
1822 ["Go to previous thread" gnus-summary-prev-thread t]
1823 ["Go down thread" gnus-summary-down-thread t]
1824 ["Go up thread" gnus-summary-up-thread t]
1825 ["Top of thread" gnus-summary-top-thread t]
1826 ["Mark thread as read" gnus-summary-kill-thread t]
1827 ["Lower thread score" gnus-summary-lower-thread t]
1828 ["Raise thread score" gnus-summary-raise-thread t]
1829 ["Rethread current" gnus-summary-rethread-current t]))
1832 gnus-summary-post-menu gnus-summary-mode-map ""
1834 ["Post an article" gnus-summary-post-news
1835 :help "Post an article"]
1836 ["Followup" gnus-summary-followup
1837 :help "Post followup to this article"]
1838 ["Followup and yank" gnus-summary-followup-with-original
1839 :help "Post followup to this article, quoting its contents"]
1840 ["Supersede article" gnus-summary-supersede-article t]
1841 ["Cancel article" gnus-summary-cancel-article
1842 :help "Cancel an article you posted"]
1843 ["Reply" gnus-summary-reply t]
1844 ["Reply and yank" gnus-summary-reply-with-original t]
1845 ["Wide reply" gnus-summary-wide-reply t]
1846 ["Wide reply and yank" gnus-summary-wide-reply-with-original
1847 :help "Mail a reply, quoting this article"]
1848 ["Mail forward" gnus-summary-mail-forward t]
1849 ["Post forward" gnus-summary-post-forward t]
1850 ["Digest and mail" gnus-uu-digest-mail-forward t]
1851 ["Digest and post" gnus-uu-digest-post-forward t]
1852 ["Resend message" gnus-summary-resend-message t]
1853 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1854 ["Send a mail" gnus-summary-mail-other-window t]
1855 ["Uuencode and post" gnus-uu-post-news
1856 :help "Post a uuencoded article"]
1857 ["Followup via news" gnus-summary-followup-to-mail t]
1858 ["Followup via news and yank"
1859 gnus-summary-followup-to-mail-with-original t]
1861 ;;["Send" gnus-summary-send-draft t]
1862 ;;["Send bounced" gnus-resend-bounced-mail t])
1866 gnus-summary-misc-menu gnus-summary-mode-map ""
1869 ["Mark as read" gnus-summary-mark-as-read-forward t]
1870 ["Mark same subject and select"
1871 gnus-summary-kill-same-subject-and-select t]
1872 ["Mark same subject" gnus-summary-kill-same-subject t]
1873 ["Catchup" gnus-summary-catchup
1874 :help "Mark unread articles in this group as read"]
1875 ["Catchup all" gnus-summary-catchup-all t]
1876 ["Catchup to here" gnus-summary-catchup-to-here t]
1877 ["Catchup region" gnus-summary-mark-region-as-read t]
1878 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1880 ["Tick" gnus-summary-tick-article-forward t]
1881 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1882 ["Remove marks" gnus-summary-clear-mark-forward t]
1883 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1884 ["Set bookmark" gnus-summary-set-bookmark t]
1885 ["Remove bookmark" gnus-summary-remove-bookmark t])
1887 ["Marks..." gnus-summary-limit-to-marks t]
1888 ["Subject..." gnus-summary-limit-to-subject t]
1889 ["Author..." gnus-summary-limit-to-author t]
1890 ["Age..." gnus-summary-limit-to-age t]
1891 ["Extra..." gnus-summary-limit-to-extra t]
1892 ["Score" gnus-summary-limit-to-score t]
1893 ["Unread" gnus-summary-limit-to-unread t]
1894 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1895 ["Articles" gnus-summary-limit-to-articles t]
1896 ["Pop limit" gnus-summary-pop-limit t]
1897 ["Show dormant" gnus-summary-limit-include-dormant t]
1898 ["Hide childless dormant"
1899 gnus-summary-limit-exclude-childless-dormant t]
1900 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1901 ["Hide marked" gnus-summary-limit-exclude-marks t]
1902 ["Show expunged" gnus-summary-show-all-expunged t])
1904 ["Set mark" gnus-summary-mark-as-processable t]
1905 ["Remove mark" gnus-summary-unmark-as-processable t]
1906 ["Remove all marks" gnus-summary-unmark-all-processable t]
1907 ["Mark above" gnus-uu-mark-over t]
1908 ["Mark series" gnus-uu-mark-series t]
1909 ["Mark region" gnus-uu-mark-region t]
1910 ["Unmark region" gnus-uu-unmark-region t]
1911 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1912 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1913 ["Mark all" gnus-uu-mark-all t]
1914 ["Mark buffer" gnus-uu-mark-buffer t]
1915 ["Mark sparse" gnus-uu-mark-sparse t]
1916 ["Mark thread" gnus-uu-mark-thread t]
1917 ["Unmark thread" gnus-uu-unmark-thread t]
1918 ("Process Mark Sets"
1919 ["Kill" gnus-summary-kill-process-mark t]
1920 ["Yank" gnus-summary-yank-process-mark
1921 gnus-newsgroup-process-stack]
1922 ["Save" gnus-summary-save-process-mark t]))
1924 ["Page forward" gnus-summary-next-page
1925 :help "Show next page of article"]
1926 ["Page backward" gnus-summary-prev-page
1927 :help "Show previous page of article"]
1928 ["Line forward" gnus-summary-scroll-up t])
1930 ["Next unread article" gnus-summary-next-unread-article t]
1931 ["Previous unread article" gnus-summary-prev-unread-article t]
1932 ["Next article" gnus-summary-next-article t]
1933 ["Previous article" gnus-summary-prev-article t]
1934 ["Next unread subject" gnus-summary-next-unread-subject t]
1935 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1936 ["Next article same subject" gnus-summary-next-same-subject t]
1937 ["Previous article same subject" gnus-summary-prev-same-subject t]
1938 ["First unread article" gnus-summary-first-unread-article t]
1939 ["Best unread article" gnus-summary-best-unread-article t]
1940 ["Go to subject number..." gnus-summary-goto-subject t]
1941 ["Go to article number..." gnus-summary-goto-article t]
1942 ["Go to the last article" gnus-summary-goto-last-article t]
1943 ["Pop article off history" gnus-summary-pop-article t])
1945 ["Sort by number" gnus-summary-sort-by-number t]
1946 ["Sort by author" gnus-summary-sort-by-author t]
1947 ["Sort by subject" gnus-summary-sort-by-subject t]
1948 ["Sort by date" gnus-summary-sort-by-date t]
1949 ["Sort by score" gnus-summary-sort-by-score t]
1950 ["Sort by lines" gnus-summary-sort-by-lines t]
1951 ["Sort by characters" gnus-summary-sort-by-chars t])
1953 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1954 ["Describe group" gnus-summary-describe-group t]
1955 ["Read manual" gnus-info-find-node t])
1957 ["Pick and read" gnus-pick-mode t]
1958 ["Binary" gnus-binary-mode t])
1960 ["Regenerate" gnus-summary-prepare t]
1961 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1962 ["Toggle threading" gnus-summary-toggle-threads t])
1963 ["Filter articles..." gnus-summary-execute-command t]
1964 ["Run command on subjects..." gnus-summary-universal-argument t]
1965 ["Search articles forward..." gnus-summary-search-article-forward t]
1966 ["Search articles backward..." gnus-summary-search-article-backward t]
1967 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1968 ["Expand window" gnus-summary-expand-window t]
1969 ["Expire expirable articles" gnus-summary-expire-articles
1970 (gnus-check-backend-function
1971 'request-expire-articles gnus-newsgroup-name)]
1972 ["Edit local kill file" gnus-summary-edit-local-kill t]
1973 ["Edit main kill file" gnus-summary-edit-global-kill t]
1974 ["Edit group parameters" gnus-summary-edit-parameters t]
1975 ["Customize group parameters" gnus-summary-customize-parameters t]
1976 ["Send a bug report" gnus-bug t]
1978 ["Catchup and exit" gnus-summary-catchup-and-exit
1979 :help "Mark unread articles in this group as read, then exit"]
1980 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1981 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1982 ["Exit group" gnus-summary-exit
1983 :help "Exit current group, return to group selection mode"]
1984 ["Exit group without updating" gnus-summary-exit-no-update t]
1985 ["Exit and goto next group" gnus-summary-next-group t]
1986 ["Exit and goto prev group" gnus-summary-prev-group t]
1987 ["Reselect group" gnus-summary-reselect-current-group t]
1988 ["Rescan group" gnus-summary-rescan-group t]
1989 ["Update dribble" gnus-summary-save-newsrc t])))
1991 (gnus-run-hooks 'gnus-summary-menu-hook)))
1993 (defvar gnus-summary-tool-bar-map nil)
1995 ;; Emacs 21 tool bar. Should be no-op otherwise.
1996 (defun gnus-summary-make-tool-bar ()
1997 (if (and (fboundp 'tool-bar-add-item-from-menu)
1998 (default-value 'tool-bar-mode)
1999 (not gnus-summary-tool-bar-map))
2000 (setq gnus-summary-tool-bar-map
2001 (let ((tool-bar-map (make-sparse-keymap)))
2002 (tool-bar-add-item-from-menu
2003 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2004 (tool-bar-add-item-from-menu
2005 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2006 (tool-bar-add-item-from-menu
2007 'gnus-summary-post-news "post" gnus-summary-mode-map)
2008 (tool-bar-add-item-from-menu
2009 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2010 (tool-bar-add-item-from-menu
2011 'gnus-summary-followup "followup" gnus-summary-mode-map)
2012 (tool-bar-add-item-from-menu
2013 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2014 (tool-bar-add-item-from-menu
2015 'gnus-summary-reply "reply" gnus-summary-mode-map)
2016 (tool-bar-add-item-from-menu
2017 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2018 (tool-bar-add-item-from-menu
2019 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2020 (tool-bar-add-item-from-menu
2021 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2022 (tool-bar-add-item-from-menu
2023 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2024 (tool-bar-add-item-from-menu
2025 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2026 (tool-bar-add-item-from-menu
2027 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2028 (tool-bar-add-item-from-menu
2029 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2030 (tool-bar-add-item-from-menu
2031 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2033 (if gnus-summary-tool-bar-map
2034 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2036 (defun gnus-score-set-default (var value)
2037 "A version of set that updates the GNU Emacs menu-bar."
2039 ;; It is the message that forces the active status to be updated.
2042 (defun gnus-make-score-map (type)
2043 "Make a summary score map of type TYPE."
2046 (let ((headers '(("author" "from" string)
2047 ("subject" "subject" string)
2048 ("article body" "body" string)
2049 ("article head" "head" string)
2050 ("xref" "xref" string)
2051 ("extra header" "extra" string)
2052 ("lines" "lines" number)
2053 ("followups to author" "followup" string)))
2054 (types '((number ("less than" <)
2057 (string ("substring" s)
2061 (perms '(("temporary" (current-time-string))
2069 (if (eq type 'lower)
2074 (setq header (car headers))
2080 (let ((ts (cdr (assoc (nth 2 header) types)))
2096 'gnus-summary-score-entry
2098 (if (or (string= (nth 1 header)
2100 (string= (nth 1 header)
2103 (list 'gnus-summary-header
2105 (list 'quote (nth 1 (car ts)))
2106 (list 'gnus-score-delta-default
2113 (list (nreverse outp))))
2116 (list (nreverse outt))))
2118 (setq headers (cdr headers)))
2119 (list (nreverse outh))))))))
2123 (defun gnus-summary-mode (&optional group)
2124 "Major mode for reading articles.
2126 All normal editing commands are switched off.
2127 \\<gnus-summary-mode-map>
2128 Each line in this buffer represents one article. To read an
2129 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2130 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2133 You can also post articles and send mail from this buffer. To
2134 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2135 of an article, type `\\[gnus-summary-reply]'.
2137 There are approx. one gazillion commands you can execute in this
2138 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2140 The following commands are available:
2142 \\{gnus-summary-mode-map}"
2144 (kill-all-local-variables)
2145 (when (gnus-visual-p 'summary-menu 'menu)
2146 (gnus-summary-make-menu-bar)
2147 (gnus-summary-make-tool-bar))
2148 (gnus-summary-make-local-variables)
2149 (gnus-make-thread-indent-array)
2150 (gnus-simplify-mode-line)
2151 (setq major-mode 'gnus-summary-mode)
2152 (setq mode-name "Summary")
2153 (make-local-variable 'minor-mode-alist)
2154 (use-local-map gnus-summary-mode-map)
2155 (buffer-disable-undo)
2156 (setq buffer-read-only t) ;Disable modification
2157 (setq truncate-lines t)
2158 (setq selective-display t)
2159 (setq selective-display-ellipses t) ;Display `...'
2160 (gnus-summary-set-display-table)
2161 (gnus-set-default-directory)
2162 (setq gnus-newsgroup-name group)
2163 (make-local-variable 'gnus-summary-line-format)
2164 (make-local-variable 'gnus-summary-line-format-spec)
2165 (make-local-variable 'gnus-summary-dummy-line-format)
2166 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2167 (make-local-variable 'gnus-summary-mark-positions)
2168 (make-local-hook 'pre-command-hook)
2169 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2170 (gnus-run-hooks 'gnus-summary-mode-hook)
2171 (mm-enable-multibyte-mule4)
2172 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2173 (gnus-update-summary-mark-positions))
2175 (defun gnus-summary-make-local-variables ()
2176 "Make all the local summary buffer variables."
2178 (dolist (local gnus-summary-local-variables)
2181 (if (eq (cdr local) 'global)
2182 ;; Copy the global value of the variable.
2183 (setq global (symbol-value (car local)))
2184 ;; Use the value from the list.
2185 (setq global (eval (cdr local))))
2186 (set (make-local-variable (car local)) global))
2187 ;; Simple nil-valued local variable.
2188 (set (make-local-variable local) nil)))))
2190 (defun gnus-summary-clear-local-variables ()
2191 (let ((locals gnus-summary-local-variables))
2193 (if (consp (car locals))
2194 (and (vectorp (caar locals))
2195 (set (caar locals) nil))
2196 (and (vectorp (car locals))
2197 (set (car locals) nil)))
2198 (setq locals (cdr locals)))))
2200 ;; Summary data functions.
2202 (defmacro gnus-data-number (data)
2205 (defmacro gnus-data-set-number (data number)
2206 `(setcar ,data ,number))
2208 (defmacro gnus-data-mark (data)
2211 (defmacro gnus-data-set-mark (data mark)
2212 `(setcar (nthcdr 1 ,data) ,mark))
2214 (defmacro gnus-data-pos (data)
2217 (defmacro gnus-data-set-pos (data pos)
2218 `(setcar (nthcdr 2 ,data) ,pos))
2220 (defmacro gnus-data-header (data)
2223 (defmacro gnus-data-set-header (data header)
2224 `(setf (nth 3 ,data) ,header))
2226 (defmacro gnus-data-level (data)
2229 (defmacro gnus-data-unread-p (data)
2230 `(= (nth 1 ,data) gnus-unread-mark))
2232 (defmacro gnus-data-read-p (data)
2233 `(/= (nth 1 ,data) gnus-unread-mark))
2235 (defmacro gnus-data-pseudo-p (data)
2236 `(consp (nth 3 ,data)))
2238 (defmacro gnus-data-find (number)
2239 `(assq ,number gnus-newsgroup-data))
2241 (defmacro gnus-data-find-list (number &optional data)
2242 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2243 (memq (assq ,number bdata)
2246 (defmacro gnus-data-make (number mark pos header level)
2247 `(list ,number ,mark ,pos ,header ,level))
2249 (defun gnus-data-enter (after-article number mark pos header level offset)
2250 (let ((data (gnus-data-find-list after-article)))
2252 (error "No such article: %d" after-article))
2253 (setcdr data (cons (gnus-data-make number mark pos header level)
2255 (setq gnus-newsgroup-data-reverse nil)
2256 (gnus-data-update-list (cddr data) offset)))
2258 (defun gnus-data-enter-list (after-article list &optional offset)
2260 (let ((data (and after-article (gnus-data-find-list after-article)))
2264 (let ((odata gnus-newsgroup-data))
2265 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2267 (gnus-data-update-list odata offset)))
2268 ;; Find the last element in the list to be spliced into the main
2271 (setq list (cdr list)))
2274 (setcdr list gnus-newsgroup-data)
2275 (setq gnus-newsgroup-data ilist)
2277 (gnus-data-update-list (cdr list) offset)))
2278 (setcdr list (cdr data))
2281 (gnus-data-update-list (cdr list) offset))))
2282 (setq gnus-newsgroup-data-reverse nil))))
2284 (defun gnus-data-remove (article &optional offset)
2285 (let ((data gnus-newsgroup-data))
2286 (if (= (gnus-data-number (car data)) article)
2288 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2289 gnus-newsgroup-data-reverse nil)
2291 (gnus-data-update-list gnus-newsgroup-data offset)))
2293 (when (= (gnus-data-number (cadr data)) article)
2294 (setcdr data (cddr data))
2296 (gnus-data-update-list (cdr data) offset))
2298 gnus-newsgroup-data-reverse nil))
2299 (setq data (cdr data))))))
2301 (defmacro gnus-data-list (backward)
2303 (or gnus-newsgroup-data-reverse
2304 (setq gnus-newsgroup-data-reverse
2305 (reverse gnus-newsgroup-data)))
2306 gnus-newsgroup-data))
2308 (defun gnus-data-update-list (data offset)
2309 "Add OFFSET to the POS of all data entries in DATA."
2310 (setq gnus-newsgroup-data-reverse nil)
2312 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2313 (setq data (cdr data))))
2315 (defun gnus-summary-article-pseudo-p (article)
2316 "Say whether this article is a pseudo article or not."
2317 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2319 (defmacro gnus-summary-article-sparse-p (article)
2320 "Say whether this article is a sparse article or not."
2321 `(memq ,article gnus-newsgroup-sparse))
2323 (defmacro gnus-summary-article-ancient-p (article)
2324 "Say whether this article is a sparse article or not."
2325 `(memq ,article gnus-newsgroup-ancient))
2327 (defun gnus-article-parent-p (number)
2328 "Say whether this article is a parent or not."
2329 (let ((data (gnus-data-find-list number)))
2330 (and (cdr data) ; There has to be an article after...
2331 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2332 (gnus-data-level (nth 1 data))))))
2334 (defun gnus-article-children (number)
2335 "Return a list of all children to NUMBER."
2336 (let* ((data (gnus-data-find-list number))
2337 (level (gnus-data-level (car data)))
2339 (setq data (cdr data))
2341 (= (gnus-data-level (car data)) (1+ level)))
2342 (push (gnus-data-number (car data)) children)
2343 (setq data (cdr data)))
2346 (defmacro gnus-summary-skip-intangible ()
2347 "If the current article is intangible, then jump to a different article."
2348 '(let ((to (get-text-property (point) 'gnus-intangible)))
2349 (and to (gnus-summary-goto-subject to))))
2351 (defmacro gnus-summary-article-intangible-p ()
2352 "Say whether this article is intangible or not."
2353 '(get-text-property (point) 'gnus-intangible))
2355 (defun gnus-article-read-p (article)
2356 "Say whether ARTICLE is read or not."
2357 (not (or (memq article gnus-newsgroup-marked)
2358 (memq article gnus-newsgroup-unreads)
2359 (memq article gnus-newsgroup-unselected)
2360 (memq article gnus-newsgroup-dormant))))
2362 ;; Some summary mode macros.
2364 (defmacro gnus-summary-article-number ()
2365 "The article number of the article on the current line.
2366 If there isn's an article number here, then we return the current
2369 (gnus-summary-skip-intangible)
2370 (or (get-text-property (point) 'gnus-number)
2371 (gnus-summary-last-subject))))
2373 (defmacro gnus-summary-article-header (&optional number)
2374 "Return the header of article NUMBER."
2375 `(gnus-data-header (gnus-data-find
2376 ,(or number '(gnus-summary-article-number)))))
2378 (defmacro gnus-summary-thread-level (&optional number)
2379 "Return the level of thread that starts with article NUMBER."
2380 `(if (and (eq gnus-summary-make-false-root 'dummy)
2381 (get-text-property (point) 'gnus-intangible))
2383 (gnus-data-level (gnus-data-find
2384 ,(or number '(gnus-summary-article-number))))))
2386 (defmacro gnus-summary-article-mark (&optional number)
2387 "Return the mark of article NUMBER."
2388 `(gnus-data-mark (gnus-data-find
2389 ,(or number '(gnus-summary-article-number)))))
2391 (defmacro gnus-summary-article-pos (&optional number)
2392 "Return the position of the line of article NUMBER."
2393 `(gnus-data-pos (gnus-data-find
2394 ,(or number '(gnus-summary-article-number)))))
2396 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2397 (defmacro gnus-summary-article-subject (&optional number)
2398 "Return current subject string or nil if nothing."
2401 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2402 '(gnus-data-header (assq (gnus-summary-article-number)
2403 gnus-newsgroup-data)))))
2406 (mail-header-subject headers))))
2408 (defmacro gnus-summary-article-score (&optional number)
2409 "Return current article score."
2410 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2411 gnus-newsgroup-scored))
2412 gnus-summary-default-score 0))
2414 (defun gnus-summary-article-children (&optional number)
2415 "Return a list of article numbers that are children of article NUMBER."
2416 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2417 (level (gnus-data-level (car data)))
2419 (while (and (setq data (cdr data))
2420 (> (setq l (gnus-data-level (car data))) level))
2421 (and (= (1+ level) l)
2422 (push (gnus-data-number (car data))
2424 (nreverse children)))
2426 (defun gnus-summary-article-parent (&optional number)
2427 "Return the article number of the parent of article NUMBER."
2428 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2429 (gnus-data-list t)))
2430 (level (gnus-data-level (car data))))
2432 () ; This is a root.
2433 ;; We search until we find an article with a level less than
2434 ;; this one. That function has to be the parent.
2435 (while (and (setq data (cdr data))
2436 (not (< (gnus-data-level (car data)) level))))
2437 (and data (gnus-data-number (car data))))))
2439 (defun gnus-unread-mark-p (mark)
2440 "Say whether MARK is the unread mark."
2441 (= mark gnus-unread-mark))
2443 (defun gnus-read-mark-p (mark)
2444 "Say whether MARK is one of the marks that mark as read.
2445 This is all marks except unread, ticked, dormant, and expirable."
2446 (not (or (= mark gnus-unread-mark)
2447 (= mark gnus-ticked-mark)
2448 (= mark gnus-dormant-mark)
2449 (= mark gnus-expirable-mark))))
2451 (defmacro gnus-article-mark (number)
2452 "Return the MARK of article NUMBER.
2453 This macro should only be used when computing the mark the \"first\"
2454 time; i.e., when generating the summary lines. After that,
2455 `gnus-summary-article-mark' should be used to examine the
2458 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2459 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2460 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2461 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2462 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2463 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2464 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2465 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2466 gnus-ancient-mark))))
2468 ;; Saving hidden threads.
2470 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2471 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2473 (defmacro gnus-save-hidden-threads (&rest forms)
2474 "Save hidden threads, eval FORMS, and restore the hidden threads."
2475 (let ((config (make-symbol "config")))
2476 `(let ((,config (gnus-hidden-threads-configuration)))
2480 (gnus-restore-hidden-threads-configuration ,config)))))
2482 (defun gnus-data-compute-positions ()
2483 "Compute the positions of all articles."
2484 (setq gnus-newsgroup-data-reverse nil)
2485 (let ((data gnus-newsgroup-data))
2487 (gnus-save-hidden-threads
2488 (gnus-summary-show-all-threads)
2489 (goto-char (point-min))
2491 (while (get-text-property (point) 'gnus-intangible)
2493 (gnus-data-set-pos (car data) (+ (point) 3))
2494 (setq data (cdr data))
2495 (forward-line 1))))))
2497 (defun gnus-hidden-threads-configuration ()
2498 "Return the current hidden threads configuration."
2501 (goto-char (point-min))
2502 (while (search-forward "\r" nil t)
2503 (push (1- (point)) config))
2506 (defun gnus-restore-hidden-threads-configuration (config)
2507 "Restore hidden threads configuration from CONFIG."
2509 (let (point buffer-read-only)
2510 (while (setq point (pop config))
2511 (when (and (< point (point-max))
2513 (eq (char-after) ?\n))
2514 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2516 ;; Various summary mode internalish functions.
2518 (defun gnus-mouse-pick-article (e)
2521 (gnus-summary-next-page nil t))
2523 (defun gnus-summary-set-display-table ()
2524 "Change the display table.
2525 Odd characters have a tendency to mess
2526 up nicely formatted displays - we make all possible glyphs
2527 display only a single character."
2529 ;; We start from the standard display table, if any.
2530 (let ((table (or (copy-sequence standard-display-table)
2531 (make-display-table)))
2533 ;; Nix out all the control chars...
2534 (while (>= (setq i (1- i)) 0)
2535 (aset table i [??]))
2536 ;; ... but not newline and cr, of course. (cr is necessary for the
2537 ;; selective display).
2538 (aset table ?\n nil)
2539 (aset table ?\r nil)
2540 ;; We keep TAB as well.
2541 (aset table ?\t nil)
2542 ;; We nix out any glyphs over 126 that are not set already.
2544 (while (>= (setq i (1- i)) 127)
2545 ;; Only modify if the entry is nil.
2546 (unless (aref table i)
2547 (aset table i [??]))))
2548 (setq buffer-display-table table)))
2550 (defun gnus-summary-setup-buffer (group)
2551 "Initialize summary buffer."
2552 (let ((buffer (concat "*Summary " group "*")))
2553 (if (get-buffer buffer)
2556 (setq gnus-summary-buffer (current-buffer))
2557 (not gnus-newsgroup-prepared))
2558 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2559 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2560 (gnus-summary-mode group)
2562 (gnus-carpal-setup-buffer 'summary))
2563 (unless gnus-single-article-buffer
2564 (make-local-variable 'gnus-article-buffer)
2565 (make-local-variable 'gnus-article-current)
2566 (make-local-variable 'gnus-original-article-buffer))
2567 (setq gnus-newsgroup-name group)
2570 (defun gnus-set-global-variables ()
2571 "Set the global equivalents of the buffer-local variables.
2572 They are set to the latest values they had. These reflect the summary
2573 buffer that was in action when the last article was fetched."
2574 (when (eq major-mode 'gnus-summary-mode)
2575 (setq gnus-summary-buffer (current-buffer))
2576 (let ((name gnus-newsgroup-name)
2577 (marked gnus-newsgroup-marked)
2578 (unread gnus-newsgroup-unreads)
2579 (headers gnus-current-headers)
2580 (data gnus-newsgroup-data)
2581 (summary gnus-summary-buffer)
2582 (article-buffer gnus-article-buffer)
2583 (original gnus-original-article-buffer)
2584 (gac gnus-article-current)
2585 (reffed gnus-reffed-article-number)
2586 (score-file gnus-current-score-file)
2587 (default-charset gnus-newsgroup-charset))
2589 (set-buffer gnus-group-buffer)
2590 (setq gnus-newsgroup-name name
2591 gnus-newsgroup-marked marked
2592 gnus-newsgroup-unreads unread
2593 gnus-current-headers headers
2594 gnus-newsgroup-data data
2595 gnus-article-current gac
2596 gnus-summary-buffer summary
2597 gnus-article-buffer article-buffer
2598 gnus-original-article-buffer original
2599 gnus-reffed-article-number reffed
2600 gnus-current-score-file score-file
2601 gnus-newsgroup-charset default-charset)
2602 ;; The article buffer also has local variables.
2603 (when (gnus-buffer-live-p gnus-article-buffer)
2604 (set-buffer gnus-article-buffer)
2605 (setq gnus-summary-buffer summary))))))
2607 (defun gnus-summary-article-unread-p (article)
2608 "Say whether ARTICLE is unread or not."
2609 (memq article gnus-newsgroup-unreads))
2611 (defun gnus-summary-first-article-p (&optional article)
2612 "Return whether ARTICLE is the first article in the buffer."
2613 (if (not (setq article (or article (gnus-summary-article-number))))
2615 (eq article (caar gnus-newsgroup-data))))
2617 (defun gnus-summary-last-article-p (&optional article)
2618 "Return whether ARTICLE is the last article in the buffer."
2619 (if (not (setq article (or article (gnus-summary-article-number))))
2620 ;; All non-existent numbers are the last article. :-)
2622 (not (cdr (gnus-data-find-list article)))))
2624 (defun gnus-make-thread-indent-array ()
2626 (unless (and gnus-thread-indent-array
2627 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2628 (setq gnus-thread-indent-array (make-vector 201 "")
2629 gnus-thread-indent-array-level gnus-thread-indent-level)
2631 (aset gnus-thread-indent-array n
2632 (make-string (* n gnus-thread-indent-level) ? ))
2635 (defun gnus-update-summary-mark-positions ()
2636 "Compute where the summary marks are to go."
2638 (when (gnus-buffer-exists-p gnus-summary-buffer)
2639 (set-buffer gnus-summary-buffer))
2640 (let ((gnus-replied-mark 129)
2641 (gnus-score-below-mark 130)
2642 (gnus-score-over-mark 130)
2643 (gnus-download-mark 131)
2644 (spec gnus-summary-line-format-spec)
2647 (gnus-set-work-buffer)
2648 (let ((gnus-summary-line-format-spec spec)
2649 (gnus-newsgroup-downloadable '((0 . t))))
2650 (gnus-summary-insert-line
2651 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2652 (goto-char (point-min))
2653 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2655 (goto-char (point-min))
2656 (push (cons 'replied (and (search-forward "\201" nil t)
2659 (goto-char (point-min))
2660 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2662 (goto-char (point-min))
2663 (push (cons 'download
2664 (and (search-forward "\203" nil t) (- (point) 2)))
2666 (setq gnus-summary-mark-positions pos))))
2668 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2669 "Insert a dummy root in the summary buffer."
2671 (gnus-add-text-properties
2672 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2673 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2675 (defun gnus-summary-from-or-to-or-newsgroups (header)
2676 (let ((to (cdr (assq 'To (mail-header-extra header))))
2677 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2678 (mail-parse-charset gnus-newsgroup-charset)
2679 (mail-parse-ignored-charsets
2680 (save-excursion (set-buffer gnus-summary-buffer)
2681 gnus-newsgroup-ignored-charsets)))
2684 gnus-ignored-from-addresses
2685 (string-match gnus-ignored-from-addresses
2686 (mail-header-from header)))
2688 (or (car (funcall gnus-extract-address-components
2690 gnus-decode-encoded-word-function to)))
2691 (funcall gnus-decode-encoded-word-function to))))
2693 gnus-ignored-from-addresses
2694 (string-match gnus-ignored-from-addresses
2695 (mail-header-from header)))
2696 (concat "=> " newsgroups))
2698 (or (car (funcall gnus-extract-address-components
2699 (mail-header-from header)))
2700 (mail-header-from header))))))
2702 (defun gnus-summary-insert-line (gnus-tmp-header
2703 gnus-tmp-level gnus-tmp-current
2704 gnus-tmp-unread gnus-tmp-replied
2705 gnus-tmp-expirable gnus-tmp-subject-or-nil
2706 &optional gnus-tmp-dummy gnus-tmp-score
2708 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2709 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2710 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2711 (gnus-tmp-score-char
2712 (if (or (null gnus-summary-default-score)
2713 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2714 gnus-summary-zcore-fuzz))
2716 (if (< gnus-tmp-score gnus-summary-default-score)
2717 gnus-score-below-mark gnus-score-over-mark)))
2719 (cond (gnus-tmp-process gnus-process-mark)
2720 ((memq gnus-tmp-current gnus-newsgroup-cached)
2722 (gnus-tmp-replied gnus-replied-mark)
2723 ((memq gnus-tmp-current gnus-newsgroup-saved)
2725 (t gnus-unread-mark)))
2726 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2729 ((string-match "<[^>]+> *$" gnus-tmp-from)
2730 (let ((beg (match-beginning 0)))
2731 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2732 (substring gnus-tmp-from (1+ (match-beginning 0))
2733 (1- (match-end 0))))
2734 (substring gnus-tmp-from 0 beg))))
2735 ((string-match "(.+)" gnus-tmp-from)
2736 (substring gnus-tmp-from
2737 (1+ (match-beginning 0)) (1- (match-end 0))))
2739 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2740 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2741 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2742 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2743 (buffer-read-only nil))
2744 (when (string= gnus-tmp-name "")
2745 (setq gnus-tmp-name gnus-tmp-from))
2746 (unless (numberp gnus-tmp-lines)
2747 (setq gnus-tmp-lines 0))
2748 (gnus-put-text-property
2750 (progn (eval gnus-summary-line-format-spec) (point))
2751 'gnus-number gnus-tmp-number)
2752 (when (gnus-visual-p 'summary-highlight 'highlight)
2754 (gnus-run-hooks 'gnus-summary-update-hook)
2757 (defun gnus-summary-update-line (&optional dont-update)
2758 "Update summary line after change."
2759 (when (and gnus-summary-default-score
2760 (not gnus-summary-inhibit-highlight))
2761 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2762 (article (gnus-summary-article-number))
2763 (score (gnus-summary-article-score article)))
2765 (if (and gnus-summary-mark-below
2766 (< (gnus-summary-article-score)
2767 gnus-summary-mark-below))
2768 ;; This article has a low score, so we mark it as read.
2769 (when (memq article gnus-newsgroup-unreads)
2770 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2771 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2772 ;; This article was previously marked as read on account
2773 ;; of a low score, but now it has risen, so we mark it as
2775 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2776 (gnus-summary-update-mark
2777 (if (or (null gnus-summary-default-score)
2778 (<= (abs (- score gnus-summary-default-score))
2779 gnus-summary-zcore-fuzz))
2781 (if (< score gnus-summary-default-score)
2782 gnus-score-below-mark gnus-score-over-mark))
2784 ;; Do visual highlighting.
2785 (when (gnus-visual-p 'summary-highlight 'highlight)
2786 (gnus-run-hooks 'gnus-summary-update-hook)))))
2788 (defvar gnus-tmp-new-adopts nil)
2790 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2791 "Return the number of articles in THREAD.
2792 This may be 0 in some cases -- if none of the articles in
2793 the thread are to be displayed."
2795 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2797 ((not (listp thread))
2799 ((and (consp thread) (cdr thread))
2802 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2805 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2808 (when (and level (zerop level) gnus-tmp-new-adopts)
2811 'gnus-summary-number-of-articles-in-thread
2812 gnus-tmp-new-adopts))))
2814 (if (> number 1) gnus-not-empty-thread-mark
2815 gnus-empty-thread-mark)
2818 (defun gnus-summary-set-local-parameters (group)
2819 "Go through the local params of GROUP and set all variable specs in that list."
2820 (let ((params (gnus-group-find-parameter group))
2823 (setq elem (car params)
2824 params (cdr params))
2825 (and (consp elem) ; Has to be a cons.
2826 (consp (cdr elem)) ; The cdr has to be a list.
2827 (symbolp (car elem)) ; Has to be a symbol in there.
2828 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2829 (ignore-errors ; So we set it.
2830 (make-local-variable (car elem))
2831 (set (car elem) (eval (nth 1 elem))))))))
2833 (defun gnus-summary-read-group (group &optional show-all no-article
2834 kill-buffer no-display backward
2836 "Start reading news in newsgroup GROUP.
2837 If SHOW-ALL is non-nil, already read articles are also listed.
2838 If NO-ARTICLE is non-nil, no article is selected initially.
2839 If NO-DISPLAY, don't generate a summary buffer."
2843 (let ((gnus-auto-select-next nil))
2844 (or (gnus-summary-read-group-1
2845 group show-all no-article
2846 kill-buffer no-display
2849 select-articles nil)))))
2850 (eq gnus-auto-select-next 'quietly))
2851 (set-buffer gnus-group-buffer)
2852 ;; The entry function called above goes to the next
2853 ;; group automatically, so we go two groups back
2854 ;; if we are searching for the previous group.
2856 (gnus-group-prev-unread-group 2))
2857 (if (not (equal group (gnus-group-group-name)))
2858 (setq group (gnus-group-group-name))
2862 (defun gnus-summary-read-group-1 (group show-all no-article
2863 kill-buffer no-display
2864 &optional select-articles)
2865 ;; Killed foreign groups can't be entered.
2866 (when (and (not (gnus-group-native-p group))
2867 (not (gnus-gethash group gnus-newsrc-hashtb)))
2868 (error "Dead non-native groups can't be entered"))
2869 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2870 (let* ((new-group (gnus-summary-setup-buffer group))
2871 (quit-config (gnus-group-quit-config group))
2872 (did-select (and new-group (gnus-select-newsgroup
2873 group show-all select-articles))))
2875 ;; This summary buffer exists already, so we just select it.
2877 (gnus-set-global-variables)
2879 (gnus-kill-or-deaden-summary kill-buffer))
2880 (gnus-configure-windows 'summary 'force)
2881 (gnus-set-mode-line 'summary)
2882 (gnus-summary-position-point)
2885 ;; We couldn't select this group.
2887 (when (and (eq major-mode 'gnus-summary-mode)
2888 (not (equal (current-buffer) kill-buffer)))
2889 (kill-buffer (current-buffer))
2890 (if (not quit-config)
2892 ;; Update the info -- marks might need to be removed,
2894 (gnus-summary-update-info)
2895 (set-buffer gnus-group-buffer)
2896 (gnus-group-jump-to-group group)
2897 (gnus-group-next-unread-group 1))
2898 (gnus-handle-ephemeral-exit quit-config)))
2899 (gnus-message 3 "Can't select group")
2901 ;; The user did a `C-g' while prompting for number of articles,
2902 ;; so we exit this group.
2903 ((eq did-select 'quit)
2904 (and (eq major-mode 'gnus-summary-mode)
2905 (not (equal (current-buffer) kill-buffer))
2906 (kill-buffer (current-buffer)))
2908 (gnus-kill-or-deaden-summary kill-buffer))
2909 (if (not quit-config)
2911 (set-buffer gnus-group-buffer)
2912 (gnus-group-jump-to-group group)
2913 (gnus-group-next-unread-group 1)
2914 (gnus-configure-windows 'group 'force))
2915 (gnus-handle-ephemeral-exit quit-config))
2916 ;; Finally signal the quit.
2918 ;; The group was successfully selected.
2920 (gnus-set-global-variables)
2921 ;; Save the active value in effect when the group was entered.
2922 (setq gnus-newsgroup-active
2924 (gnus-active gnus-newsgroup-name)))
2925 ;; You can change the summary buffer in some way with this hook.
2926 (gnus-run-hooks 'gnus-select-group-hook)
2927 ;; Set any local variables in the group parameters.
2928 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2929 (gnus-update-format-specifications
2930 nil 'summary 'summary-mode 'summary-dummy)
2931 (gnus-update-summary-mark-positions)
2932 ;; Do score processing.
2933 (when gnus-use-scoring
2934 (gnus-possibly-score-headers))
2935 ;; Check whether to fill in the gaps in the threads.
2936 (when gnus-build-sparse-threads
2937 (gnus-build-sparse-threads))
2938 ;; Find the initial limit.
2939 (if gnus-show-threads
2941 (let ((gnus-newsgroup-dormant nil))
2942 (gnus-summary-initial-limit show-all))
2943 (gnus-summary-initial-limit show-all))
2944 ;; When untreaded, all articles are always shown.
2945 (setq gnus-newsgroup-limit
2947 (lambda (header) (mail-header-number header))
2948 gnus-newsgroup-headers)))
2949 ;; Generate the summary buffer.
2951 (gnus-summary-prepare))
2952 (when gnus-use-trees
2953 (gnus-tree-open group)
2954 (setq gnus-summary-highlight-line-function
2955 'gnus-tree-highlight-article))
2956 ;; If the summary buffer is empty, but there are some low-scored
2957 ;; articles or some excluded dormants, we include these in the
2959 (when (and (zerop (buffer-size))
2961 (cond (gnus-newsgroup-dormant
2962 (gnus-summary-limit-include-dormant))
2963 ((and gnus-newsgroup-scored show-all)
2964 (gnus-summary-limit-include-expunged t))))
2965 ;; Function `gnus-apply-kill-file' must be called in this hook.
2966 (gnus-run-hooks 'gnus-apply-kill-hook)
2967 (if (and (zerop (buffer-size))
2970 ;; This newsgroup is empty.
2971 (gnus-summary-catchup-and-exit nil t)
2972 (gnus-message 6 "No unread news")
2974 (gnus-kill-or-deaden-summary kill-buffer))
2975 ;; Return nil from this function.
2977 ;; Hide conversation thread subtrees. We cannot do this in
2978 ;; gnus-summary-prepare-hook since kill processing may not
2979 ;; work with hidden articles.
2980 (and gnus-show-threads
2981 gnus-thread-hide-subtree
2982 (gnus-summary-hide-all-threads))
2984 (gnus-kill-or-deaden-summary kill-buffer))
2985 ;; Show first unread article if requested.
2986 (if (and (not no-article)
2988 gnus-newsgroup-unreads
2989 gnus-auto-select-first)
2991 (gnus-configure-windows 'summary)
2993 ((eq gnus-auto-select-first 'best)
2994 (gnus-summary-best-unread-article))
2995 ((eq gnus-auto-select-first t)
2996 (gnus-summary-first-unread-article))
2997 ((gnus-functionp gnus-auto-select-first)
2998 (funcall gnus-auto-select-first))))
2999 ;; Don't select any articles, just move point to the first
3000 ;; article in the group.
3001 (goto-char (point-min))
3002 (gnus-summary-position-point)
3003 (gnus-configure-windows 'summary 'force)
3004 (gnus-set-mode-line 'summary))
3005 (when (get-buffer-window gnus-group-buffer t)
3006 ;; Gotta use windows, because recenter does weird stuff if
3007 ;; the current buffer ain't the displayed window.
3008 (let ((owin (selected-window)))
3009 (select-window (get-buffer-window gnus-group-buffer t))
3010 (when (gnus-group-goto-group group)
3012 (select-window owin)))
3013 ;; Mark this buffer as "prepared".
3014 (setq gnus-newsgroup-prepared t)
3015 (gnus-run-hooks 'gnus-summary-prepared-hook)
3018 (defun gnus-summary-prepare ()
3019 "Generate the summary buffer."
3021 (let ((buffer-read-only nil))
3023 (setq gnus-newsgroup-data nil
3024 gnus-newsgroup-data-reverse nil)
3025 (gnus-run-hooks 'gnus-summary-generate-hook)
3026 ;; Generate the buffer, either with threads or without.
3027 (when gnus-newsgroup-headers
3028 (gnus-summary-prepare-threads
3029 (if gnus-show-threads
3030 (gnus-sort-gathered-threads
3031 (funcall gnus-summary-thread-gathering-function
3033 (gnus-cut-threads (gnus-make-threads)))))
3034 ;; Unthreaded display.
3035 (gnus-sort-articles gnus-newsgroup-headers))))
3036 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3037 ;; Call hooks for modifying summary buffer.
3038 (goto-char (point-min))
3039 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3041 (defsubst gnus-general-simplify-subject (subject)
3042 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3045 ;; Truncate the subject.
3046 (gnus-simplify-subject-functions
3047 (gnus-map-function gnus-simplify-subject-functions subject))
3048 ((numberp gnus-summary-gather-subject-limit)
3049 (setq subject (gnus-simplify-subject-re subject))
3050 (if (> (length subject) gnus-summary-gather-subject-limit)
3051 (substring subject 0 gnus-summary-gather-subject-limit)
3053 ;; Fuzzily simplify it.
3054 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3055 (gnus-simplify-subject-fuzzy subject))
3056 ;; Just remove the leading "Re:".
3058 (gnus-simplify-subject-re subject))))
3060 (if (and gnus-summary-gather-exclude-subject
3061 (string-match gnus-summary-gather-exclude-subject subject))
3062 nil ; This article shouldn't be gathered
3065 (defun gnus-summary-simplify-subject-query ()
3066 "Query where the respool algorithm would put this article."
3068 (gnus-summary-select-article)
3069 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3071 (defun gnus-gather-threads-by-subject (threads)
3072 "Gather threads by looking at Subject headers."
3073 (if (not gnus-summary-make-false-root)
3075 (let ((hashtb (gnus-make-hashtable 1024))
3078 subject hthread whole-subject)
3080 (setq subject (gnus-general-simplify-subject
3081 (setq whole-subject (mail-header-subject
3084 (if (setq hthread (gnus-gethash subject hashtb))
3086 ;; We enter a dummy root into the thread, if we
3087 ;; haven't done that already.
3088 (unless (stringp (caar hthread))
3089 (setcar hthread (list whole-subject (car hthread))))
3090 ;; We add this new gathered thread to this gathered
3092 (setcdr (car hthread)
3093 (nconc (cdar hthread) (list (car threads))))
3094 ;; Remove it from the list of threads.
3095 (setcdr prev (cdr threads))
3096 (setq threads prev))
3097 ;; Enter this thread into the hash table.
3098 (gnus-sethash subject threads hashtb)))
3100 (setq threads (cdr threads)))
3103 (defun gnus-gather-threads-by-references (threads)
3104 "Gather threads by looking at References headers."
3105 (let ((idhashtb (gnus-make-hashtable 1024))
3106 (thhashtb (gnus-make-hashtable 1024))
3109 ids references id gthread gid entered ref)
3111 (when (setq references (mail-header-references (caar threads)))
3112 (setq id (mail-header-id (caar threads))
3113 ids (gnus-split-references references)
3115 (while (setq ref (pop ids))
3116 (setq ids (delete ref ids))
3117 (if (not (setq gid (gnus-gethash ref idhashtb)))
3119 (gnus-sethash ref id idhashtb)
3120 (gnus-sethash id threads thhashtb))
3121 (setq gthread (gnus-gethash gid thhashtb))
3123 ;; We enter a dummy root into the thread, if we
3124 ;; haven't done that already.
3125 (unless (stringp (caar gthread))
3126 (setcar gthread (list (mail-header-subject (caar gthread))
3128 ;; We add this new gathered thread to this gathered
3130 (setcdr (car gthread)
3131 (nconc (cdar gthread) (list (car threads)))))
3132 ;; Add it into the thread hash table.
3133 (gnus-sethash id gthread thhashtb)
3135 ;; Remove it from the list of threads.
3136 (setcdr prev (cdr threads))
3137 (setq threads prev))))
3139 (setq threads (cdr threads)))
3142 (defun gnus-sort-gathered-threads (threads)
3143 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3144 (let ((result threads))
3146 (when (stringp (caar threads))
3147 (setcdr (car threads)
3148 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3149 (setq threads (cdr threads)))
3152 (defun gnus-thread-loop-p (root thread)
3153 "Say whether ROOT is in THREAD."
3154 (let ((stack (list thread))
3157 (while (setq thread (pop stack))
3158 (setq th (cdr thread))
3160 (not (eq (caar th) root)))
3163 ;; We have found a loop.
3165 (setcdr thread (delq (car th) (cdr thread)))
3166 (if (boundp (setq ref-dep (intern "none"
3167 gnus-newsgroup-dependencies)))
3168 (setcdr (symbol-value ref-dep)
3169 (nconc (cdr (symbol-value ref-dep))
3171 (set ref-dep (list nil (car th))))
3174 ;; Push all the subthreads onto the stack.
3175 (push (cdr thread) stack)))
3178 (defun gnus-make-threads ()
3179 "Go through the dependency hashtb and find the roots. Return all threads."
3181 (while (catch 'infloop
3184 ;; Deal with self-referencing References loops.
3185 (when (and (car (symbol-value refs))
3192 (car (symbol-value refs)) thread))
3193 (cdr (symbol-value refs)))))))
3196 (unless (car (symbol-value refs))
3197 ;; These threads do not refer back to any other articles,
3198 ;; so they're roots.
3199 (setq threads (append (cdr (symbol-value refs)) threads))))
3200 gnus-newsgroup-dependencies)))
3203 ;; Build the thread tree.
3204 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3205 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3207 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3208 if it was already present.
3210 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3211 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3212 Message-IDs will be renamed be renamed to a unique Message-ID before
3215 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3216 (let* ((id (mail-header-id header))
3217 (id-dep (and id (intern id dependencies)))
3218 ref ref-dep ref-header)
3219 ;; Enter this `header' in the `dependencies' table.
3223 ;; The first two cases do the normal part: enter a new `header'
3224 ;; in the `dependencies' table.
3225 ((not (boundp id-dep))
3226 (set id-dep (list header)))
3227 ((null (car (symbol-value id-dep)))
3228 (setcar (symbol-value id-dep) header))
3230 ;; From here the `header' was already present in the
3231 ;; `dependencies' table.
3233 ;; Overrides an existing entry;
3234 ;; just set the header part of the entry.
3235 (setcar (symbol-value id-dep) header))
3237 ;; Renames the existing `header' to a unique Message-ID.
3238 ((not gnus-summary-ignore-duplicates)
3239 ;; An article with this Message-ID has already been seen.
3240 ;; We rename the Message-ID.
3241 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3243 (mail-header-set-id header id))
3245 ;; The last case ignores an existing entry, except it adds any
3246 ;; additional Xrefs (in case the two articles came from different
3248 ;; Also sets `header' to `nil' meaning that the `dependencies'
3249 ;; table was *not* modified.
3251 (mail-header-set-xref
3252 (car (symbol-value id-dep))
3253 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3255 (or (mail-header-xref header) "")))
3259 ;; First check if that we are not creating a References loop.
3260 (setq ref (gnus-parent-id (mail-header-references header)))
3262 (setq ref-dep (intern-soft ref dependencies))
3264 (setq ref-header (car (symbol-value ref-dep))))
3265 (if (string= id ref)
3266 ;; Yuk! This is a reference loop. Make the article be a
3269 (mail-header-set-references (car (symbol-value id-dep)) "none")
3271 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3272 (setq ref (gnus-parent-id (mail-header-references header)))
3273 (setq ref-dep (intern (or ref "none") dependencies))
3274 (if (boundp ref-dep)
3275 (setcdr (symbol-value ref-dep)
3276 (nconc (cdr (symbol-value ref-dep))
3277 (list (symbol-value id-dep))))
3278 (set ref-dep (list nil (symbol-value id-dep)))))
3281 (defun gnus-build-sparse-threads ()
3282 (let ((headers gnus-newsgroup-headers)
3283 (mail-parse-charset gnus-newsgroup-charset)
3284 (gnus-summary-ignore-duplicates t)
3285 header references generation relations
3286 subject child end new-child date)
3287 ;; First we create an alist of generations/relations, where
3288 ;; generations is how much we trust the relation, and the relation
3290 (gnus-message 7 "Making sparse threads...")
3292 (nnheader-set-temp-buffer " *gnus sparse threads*")
3293 (while (setq header (pop headers))
3294 (when (and (setq references (mail-header-references header))
3295 (not (string= references "")))
3297 (setq child (mail-header-id header)
3298 subject (mail-header-subject header)
3299 date (mail-header-date header)
3301 (while (search-backward ">" nil t)
3302 (setq end (1+ (point)))
3303 (when (search-backward "<" nil t)
3304 (setq new-child (buffer-substring (point) end))
3305 (push (list (incf generation)
3306 child (setq child new-child)
3310 (push (list (1+ generation) child nil subject) relations))
3312 (kill-buffer (current-buffer)))
3313 ;; Sort over trustworthiness.
3316 (when (gnus-dependencies-add-header
3317 (make-full-mail-header
3318 gnus-reffed-article-number
3319 (nth 3 relation) "" (or (nth 4 relation) "")
3321 (or (nth 2 relation) "") 0 0 "")
3322 gnus-newsgroup-dependencies nil)
3323 (push gnus-reffed-article-number gnus-newsgroup-limit)
3324 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3325 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3326 gnus-newsgroup-reads)
3327 (decf gnus-reffed-article-number)))
3328 (sort relations 'car-less-than-car))
3329 (gnus-message 7 "Making sparse threads...done")))
3331 (defun gnus-build-old-threads ()
3332 ;; Look at all the articles that refer back to old articles, and
3333 ;; fetch the headers for the articles that aren't there. This will
3334 ;; build complete threads - if the roots haven't been expired by the
3336 (let ((mail-parse-charset gnus-newsgroup-charset)
3340 (when (not (car (symbol-value refs)))
3341 (setq heads (cdr (symbol-value refs)))
3343 (if (memq (mail-header-number (caar heads))
3344 gnus-newsgroup-dormant)
3345 (setq heads (cdr heads))
3346 (setq id (symbol-name refs))
3347 (while (and (setq id (gnus-build-get-header id))
3348 (not (car (gnus-id-to-thread id)))))
3349 (setq heads nil)))))
3350 gnus-newsgroup-dependencies)))
3352 ;; This function has to be called with point after the article number
3353 ;; on the beginning of the line.
3354 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3355 (let ((eol (gnus-point-at-eol))
3356 (buffer (current-buffer))
3359 ;; overview: [num subject from date id refs chars lines misc]
3362 (narrow-to-region (point) eol)
3367 (make-full-mail-header
3369 (funcall gnus-decode-encoded-word-function
3370 (nnheader-nov-field)) ; subject
3371 (funcall gnus-decode-encoded-word-function
3372 (nnheader-nov-field)) ; from
3373 (nnheader-nov-field) ; date
3374 (nnheader-nov-read-message-id) ; id
3375 (nnheader-nov-field) ; refs
3376 (nnheader-nov-read-integer) ; chars
3377 (nnheader-nov-read-integer) ; lines
3379 (if (looking-at "Xref: ")
3380 (goto-char (match-end 0)))
3381 (nnheader-nov-field)) ; Xref
3382 (nnheader-nov-parse-extra)))) ; extra
3386 (when gnus-alter-header-function
3387 (funcall gnus-alter-header-function header))
3388 (gnus-dependencies-add-header header dependencies force-new)))
3390 (defun gnus-build-get-header (id)
3391 "Look through the buffer of NOV lines and find the header to ID.
3392 Enter this line into the dependencies hash table, and return
3393 the id of the parent article (if any)."
3394 (let ((deps gnus-newsgroup-dependencies)
3398 (set-buffer nntp-server-buffer)
3399 (let ((case-fold-search nil))
3400 (goto-char (point-min))
3401 (while (and (not found)
3402 (search-forward id nil t))
3404 (setq found (looking-at
3405 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3406 (regexp-quote id))))
3407 (or found (beginning-of-line 2)))
3411 (setq header (gnus-nov-parse-line
3412 (read (current-buffer)) deps))
3413 (gnus-parent-id (mail-header-references header))))))
3415 (let ((number (mail-header-number header)))
3416 (push number gnus-newsgroup-limit)
3417 (push header gnus-newsgroup-headers)
3418 (if (memq number gnus-newsgroup-unselected)
3420 (push number gnus-newsgroup-unreads)
3421 (setq gnus-newsgroup-unselected
3422 (delq number gnus-newsgroup-unselected)))
3423 (push number gnus-newsgroup-ancient)))))))
3425 (defun gnus-build-all-threads ()
3426 "Read all the headers."
3427 (let ((gnus-summary-ignore-duplicates t)
3428 (mail-parse-charset gnus-newsgroup-charset)
3429 (dependencies gnus-newsgroup-dependencies)
3432 (set-buffer nntp-server-buffer)
3433 (let ((case-fold-search nil))
3434 (goto-char (point-min))
3437 (setq article (read (current-buffer))
3438 header (gnus-nov-parse-line article dependencies)))
3441 (set-buffer gnus-summary-buffer)
3442 (push header gnus-newsgroup-headers)
3443 (if (memq (setq article (mail-header-number header))
3444 gnus-newsgroup-unselected)
3446 (push article gnus-newsgroup-unreads)
3447 (setq gnus-newsgroup-unselected
3448 (delq article gnus-newsgroup-unselected)))
3449 (push article gnus-newsgroup-ancient)))
3450 (forward-line 1)))))))
3452 (defun gnus-summary-update-article-line (article header)
3453 "Update the line for ARTICLE using HEADERS."
3454 (let* ((id (mail-header-id header))
3455 (thread (gnus-id-to-thread id)))
3457 (error "Article in no thread"))
3458 ;; Update the thread.
3459 (setcar thread header)
3460 (gnus-summary-goto-subject article)
3461 (let* ((datal (gnus-data-find-list article))
3463 (length (when (cdr datal)
3464 (- (gnus-data-pos data)
3465 (gnus-data-pos (cadr datal)))))
3466 (buffer-read-only nil)
3467 (level (gnus-summary-thread-level)))
3469 (gnus-summary-insert-line
3470 header level nil (gnus-article-mark article)
3471 (memq article gnus-newsgroup-replied)
3472 (memq article gnus-newsgroup-expirable)
3473 ;; Only insert the Subject string when it's different
3474 ;; from the previous Subject string.
3479 (mail-header-subject
3482 (gnus-data-find-list
3484 (gnus-data-list t)))))
3485 ;; Error on the side of excessive subjects.
3487 (mail-header-subject header)))
3489 (mail-header-subject header))
3490 nil (cdr (assq article gnus-newsgroup-scored))
3491 (memq article gnus-newsgroup-processable))
3493 (gnus-data-update-list
3494 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3496 (defun gnus-summary-update-article (article &optional iheader)
3497 "Update ARTICLE in the summary buffer."
3498 (set-buffer gnus-summary-buffer)
3499 (let* ((header (gnus-summary-article-header article))
3500 (id (mail-header-id header))
3501 (data (gnus-data-find article))
3502 (thread (gnus-id-to-thread id))
3503 (references (mail-header-references header))
3507 (when (and references
3508 (not (equal "" references)))
3511 (buffer-read-only nil)
3517 (delq thread parent)))
3518 (if (gnus-summary-insert-subject id header)
3519 ;; Set the (possibly) new article number in the data structure.
3520 (gnus-data-set-number data (gnus-id-to-article id))
3524 (defun gnus-rebuild-thread (id &optional line)
3525 "Rebuild the thread containing ID.
3526 If LINE, insert the rebuilt thread starting on line LINE."
3527 (let ((buffer-read-only nil)
3528 old-pos current thread data)
3529 (if (not gnus-show-threads)
3530 (setq thread (list (car (gnus-id-to-thread id))))
3531 ;; Get the thread this article is part of.
3532 (setq thread (gnus-remove-thread id)))
3533 (setq old-pos (gnus-point-at-bol))
3534 (setq current (save-excursion
3535 (and (zerop (forward-line -1))
3536 (gnus-summary-article-number))))
3537 ;; If this is a gathered thread, we have to go some re-gathering.
3538 (when (stringp (car thread))
3539 (let ((subject (car thread))
3541 (setq thread (cdr thread))
3543 (unless (memq (setq thr (gnus-id-to-thread
3545 (mail-header-id (caar thread)))))
3548 (setq thread (cdr thread)))
3549 ;; We now have all (unique) roots.
3550 (if (= (length roots) 1)
3551 ;; All the loose roots are now one solid root.
3552 (setq thread (car roots))
3553 (setq thread (cons subject (gnus-sort-threads roots))))))
3555 ;; We then insert this thread into the summary buffer.
3557 (goto-char (point-min))
3558 (forward-line (1- line)))
3559 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3560 (if gnus-show-threads
3561 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3562 (gnus-summary-prepare-unthreaded thread))
3563 (setq data (nreverse gnus-newsgroup-data))
3564 (setq threads gnus-newsgroup-threads))
3565 ;; We splice the new data into the data structure.
3566 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3567 ;;!!! then we want to insert at the beginning of the buffer.
3568 ;;!!! That happens to be true with Gnus now, but that may
3569 ;;!!! change in the future. Perhaps.
3570 (gnus-data-enter-list
3571 (if line nil current) data (- (point) old-pos))
3572 (setq gnus-newsgroup-threads
3573 (nconc threads gnus-newsgroup-threads))
3574 (gnus-data-compute-positions))))
3576 (defun gnus-number-to-header (number)
3577 "Return the header for article NUMBER."
3578 (let ((headers gnus-newsgroup-headers))
3580 (not (= number (mail-header-number (car headers)))))
3585 (defun gnus-parent-headers (in-headers &optional generation)
3586 "Return the headers of the GENERATIONeth parent of HEADERS."
3588 (setq generation 1))
3590 (headers in-headers)
3593 (not (zerop generation))
3594 (setq references (mail-header-references headers)))
3595 (setq headers (if (and references
3596 (setq parent (gnus-parent-id references)))
3597 (car (gnus-id-to-thread parent))
3600 (and (not (eq headers in-headers))
3603 (defun gnus-id-to-thread (id)
3604 "Return the (sub-)thread where ID appears."
3605 (gnus-gethash id gnus-newsgroup-dependencies))
3607 (defun gnus-id-to-article (id)
3608 "Return the article number of ID."
3609 (let ((thread (gnus-id-to-thread id)))
3612 (mail-header-number (car thread)))))
3614 (defun gnus-id-to-header (id)
3615 "Return the article headers of ID."
3616 (car (gnus-id-to-thread id)))
3618 (defun gnus-article-displayed-root-p (article)
3619 "Say whether ARTICLE is a root(ish) article."
3620 (let ((level (gnus-summary-thread-level article))
3621 (refs (mail-header-references (gnus-summary-article-header article)))
3627 ((null (gnus-parent-id refs)) t)
3629 (null (setq particle (gnus-id-to-article
3630 (gnus-parent-id refs))))
3631 (null (gnus-summary-thread-level particle)))))))
3633 (defun gnus-root-id (id)
3634 "Return the id of the root of the thread where ID appears."
3636 (while (and id (setq prev (car (gnus-id-to-thread id))))
3638 id (gnus-parent-id (mail-header-references prev))))
3641 (defun gnus-articles-in-thread (thread)
3642 "Return the list of articles in THREAD."
3643 (cons (mail-header-number (car thread))
3644 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3646 (defun gnus-remove-thread (id &optional dont-remove)
3647 "Remove the thread that has ID in it."
3648 (let (headers thread last-id)
3649 ;; First go up in this thread until we find the root.
3650 (setq last-id (gnus-root-id id)
3651 headers (message-flatten-list (gnus-id-to-thread last-id)))
3652 ;; We have now found the real root of this thread. It might have
3653 ;; been gathered into some loose thread, so we have to search
3654 ;; through the threads to find the thread we wanted.
3655 (let ((threads gnus-newsgroup-threads)
3658 (setq sub (car threads))
3659 (if (stringp (car sub))
3660 ;; This is a gathered thread, so we look at the roots
3661 ;; below it to find whether this article is in this
3664 (setq sub (cdr sub))
3666 (when (member (caar sub) headers)
3667 (setq thread (car threads)
3670 (setq sub (cdr sub))))
3671 ;; It's an ordinary thread, so we check it.
3672 (when (eq (car sub) (car headers))
3675 (setq threads (cdr threads)))
3676 ;; If this article is in no thread, then it's a root.
3679 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3680 (setq thread (gnus-id-to-thread last-id)))
3683 thread ; We return this thread.
3685 (if (stringp (car thread))
3687 ;; If we use dummy roots, then we have to remove the
3688 ;; dummy root as well.
3689 (when (eq gnus-summary-make-false-root 'dummy)
3690 ;; We go to the dummy root by going to
3691 ;; the first sub-"thread", and then one line up.
3692 (gnus-summary-goto-article
3693 (mail-header-number (caadr thread)))
3696 (gnus-data-compute-positions))
3697 (setq thread (cdr thread))
3699 (gnus-remove-thread-1 (car thread))
3700 (setq thread (cdr thread))))
3701 (gnus-remove-thread-1 thread))))))))
3703 (defun gnus-remove-thread-1 (thread)
3704 "Remove the thread THREAD recursively."
3705 (let ((number (mail-header-number (pop thread)))
3707 (setq thread (reverse thread))
3709 (gnus-remove-thread-1 (pop thread)))
3710 (when (setq d (gnus-data-find number))
3711 (goto-char (gnus-data-pos d))
3712 (gnus-summary-show-thread)
3715 (- (gnus-point-at-bol)
3717 (1+ (gnus-point-at-eol))
3718 (gnus-delete-line)))))))
3720 (defun gnus-sort-threads-1 (threads func)
3721 (sort (mapcar (lambda (thread)
3724 (gnus-sort-threads-1 (cdr thread) func))))
3727 (defun gnus-sort-threads (threads)
3729 (if (not gnus-thread-sort-functions)
3731 (gnus-message 8 "Sorting threads...")
3733 (gnus-sort-threads-1
3735 (gnus-make-sort-function gnus-thread-sort-functions))
3736 (gnus-message 8 "Sorting threads...done"))))
3738 (defun gnus-sort-articles (articles)
3740 (when gnus-article-sort-functions
3741 (gnus-message 7 "Sorting articles...")
3743 (setq gnus-newsgroup-headers
3744 (sort articles (gnus-make-sort-function
3745 gnus-article-sort-functions)))
3746 (gnus-message 7 "Sorting articles...done"))))
3748 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3749 (defmacro gnus-thread-header (thread)
3750 "Return header of first article in THREAD.
3751 Note that THREAD must never, ever be anything else than a variable -
3752 using some other form will lead to serious barfage."
3753 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3754 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3755 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
3758 (defsubst gnus-article-sort-by-number (h1 h2)
3759 "Sort articles by article number."
3760 (< (mail-header-number h1)
3761 (mail-header-number h2)))
3763 (defun gnus-thread-sort-by-number (h1 h2)
3764 "Sort threads by root article number."
3765 (gnus-article-sort-by-number
3766 (gnus-thread-header h1) (gnus-thread-header h2)))
3768 (defsubst gnus-article-sort-by-lines (h1 h2)
3769 "Sort articles by article Lines header."
3770 (< (mail-header-lines h1)
3771 (mail-header-lines h2)))
3773 (defun gnus-thread-sort-by-lines (h1 h2)
3774 "Sort threads by root article Lines header."
3775 (gnus-article-sort-by-lines
3776 (gnus-thread-header h1) (gnus-thread-header h2)))
3778 (defsubst gnus-article-sort-by-chars (h1 h2)
3779 "Sort articles by octet length."
3780 (< (mail-header-chars h1)
3781 (mail-header-chars h2)))
3783 (defun gnus-thread-sort-by-chars (h1 h2)
3784 "Sort threads by root article octet length."
3785 (gnus-article-sort-by-chars
3786 (gnus-thread-header h1) (gnus-thread-header h2)))
3788 (defsubst gnus-article-sort-by-author (h1 h2)
3789 "Sort articles by root author."
3791 (let ((extract (funcall
3792 gnus-extract-address-components
3793 (mail-header-from h1))))
3794 (or (car extract) (cadr extract) ""))
3795 (let ((extract (funcall
3796 gnus-extract-address-components
3797 (mail-header-from h2))))
3798 (or (car extract) (cadr extract) ""))))
3800 (defun gnus-thread-sort-by-author (h1 h2)
3801 "Sort threads by root author."
3802 (gnus-article-sort-by-author
3803 (gnus-thread-header h1) (gnus-thread-header h2)))
3805 (defsubst gnus-article-sort-by-subject (h1 h2)
3806 "Sort articles by root subject."
3808 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3809 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3811 (defun gnus-thread-sort-by-subject (h1 h2)
3812 "Sort threads by root subject."
3813 (gnus-article-sort-by-subject
3814 (gnus-thread-header h1) (gnus-thread-header h2)))
3816 (defsubst gnus-article-sort-by-date (h1 h2)
3817 "Sort articles by root article date."
3819 (gnus-date-get-time (mail-header-date h1))
3820 (gnus-date-get-time (mail-header-date h2))))
3822 (defun gnus-thread-sort-by-date (h1 h2)
3823 "Sort threads by root article date."
3824 (gnus-article-sort-by-date
3825 (gnus-thread-header h1) (gnus-thread-header h2)))
3827 (defsubst gnus-article-sort-by-score (h1 h2)
3828 "Sort articles by root article score.
3829 Unscored articles will be counted as having a score of zero."
3830 (> (or (cdr (assq (mail-header-number h1)
3831 gnus-newsgroup-scored))
3832 gnus-summary-default-score 0)
3833 (or (cdr (assq (mail-header-number h2)
3834 gnus-newsgroup-scored))
3835 gnus-summary-default-score 0)))
3837 (defun gnus-thread-sort-by-score (h1 h2)
3838 "Sort threads by root article score."
3839 (gnus-article-sort-by-score
3840 (gnus-thread-header h1) (gnus-thread-header h2)))
3842 (defun gnus-thread-sort-by-total-score (h1 h2)
3843 "Sort threads by the sum of all scores in the thread.
3844 Unscored articles will be counted as having a score of zero."
3845 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3847 (defun gnus-thread-total-score (thread)
3848 ;; This function find the total score of THREAD.
3849 (cond ((null thread)
3852 (if (stringp (car thread))
3853 (apply gnus-thread-score-function 0
3854 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3855 (gnus-thread-total-score-1 thread)))
3857 (gnus-thread-total-score-1 (list thread)))))
3859 (defun gnus-thread-total-score-1 (root)
3860 ;; This function find the total score of the thread below ROOT.
3861 (setq root (car root))
3862 (apply gnus-thread-score-function
3864 (mapcar 'gnus-thread-total-score
3865 (cdr (gnus-id-to-thread (mail-header-id root))))
3866 (when (> (mail-header-number root) 0)
3867 (list (or (cdr (assq (mail-header-number root)
3868 gnus-newsgroup-scored))
3869 gnus-summary-default-score 0))))
3870 (list gnus-summary-default-score)
3873 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3874 (defvar gnus-tmp-prev-subject nil)
3875 (defvar gnus-tmp-false-parent nil)
3876 (defvar gnus-tmp-root-expunged nil)
3877 (defvar gnus-tmp-dummy-line nil)
3879 (eval-when-compile (defvar gnus-tmp-header))
3880 (defun gnus-extra-header (type &optional header)
3881 "Return the extra header of TYPE."
3882 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3885 (defun gnus-summary-prepare-threads (threads)
3886 "Prepare summary buffer from THREADS and indentation LEVEL.
3887 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3888 or a straight list of headers."
3889 (gnus-message 7 "Generating summary...")
3891 (setq gnus-newsgroup-threads threads)
3894 (let ((gnus-tmp-level 0)
3895 (default-score (or gnus-summary-default-score 0))
3896 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3897 thread number subject stack state gnus-tmp-gathered beg-match
3898 new-roots gnus-tmp-new-adopts thread-end
3899 gnus-tmp-header gnus-tmp-unread
3900 gnus-tmp-replied gnus-tmp-subject-or-nil
3901 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3902 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3903 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3905 (setq gnus-tmp-prev-subject nil)
3907 (if (vectorp (car threads))
3908 ;; If this is a straight (sic) list of headers, then a
3909 ;; threaded summary display isn't required, so we just create
3910 ;; an unthreaded one.
3911 (gnus-summary-prepare-unthreaded threads)
3913 ;; Do the threaded display.
3915 (while (or threads stack gnus-tmp-new-adopts new-roots)
3917 (if (and (= gnus-tmp-level 0)
3920 (not gnus-tmp-false-parent)
3921 (or gnus-tmp-new-adopts new-roots))
3922 (if gnus-tmp-new-adopts
3923 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3924 thread (list (car gnus-tmp-new-adopts))
3925 gnus-tmp-header (caar thread)
3926 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3928 (setq thread (list (car new-roots))
3929 gnus-tmp-header (caar thread)
3930 new-roots (cdr new-roots))))
3933 ;; If there are some threads, we do them before the
3934 ;; threads on the stack.
3935 (setq thread threads
3936 gnus-tmp-header (caar thread))
3937 ;; There were no current threads, so we pop something off
3939 (setq state (car stack)
3940 gnus-tmp-level (car state)
3943 gnus-tmp-header (caar thread))))
3945 (setq gnus-tmp-false-parent nil)
3946 (setq gnus-tmp-root-expunged nil)
3947 (setq thread-end nil)
3949 (if (stringp gnus-tmp-header)
3950 ;; The header is a dummy root.
3952 ((eq gnus-summary-make-false-root 'adopt)
3953 ;; We let the first article adopt the rest.
3954 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3956 (setq gnus-tmp-gathered
3958 (lambda (h) (mail-header-number (car h)))
3961 (setq thread (cons (list (caar thread)
3964 (setq gnus-tmp-level -1
3965 gnus-tmp-false-parent t))
3966 ((eq gnus-summary-make-false-root 'empty)
3967 ;; We print adopted articles with empty subject fields.
3968 (setq gnus-tmp-gathered
3970 (lambda (h) (mail-header-number (car h)))
3973 (setq gnus-tmp-level -1))
3974 ((eq gnus-summary-make-false-root 'dummy)
3975 ;; We remember that we probably want to output a dummy
3977 (setq gnus-tmp-dummy-line gnus-tmp-header)
3978 (setq gnus-tmp-prev-subject gnus-tmp-header))
3980 ;; We do not make a root for the gathered
3981 ;; sub-threads at all.
3982 (setq gnus-tmp-level -1)))
3984 (setq number (mail-header-number gnus-tmp-header)
3985 subject (mail-header-subject gnus-tmp-header))
3988 ;; If the thread has changed subject, we might want to make
3989 ;; this subthread into a root.
3990 ((and (null gnus-thread-ignore-subject)
3991 (not (zerop gnus-tmp-level))
3992 gnus-tmp-prev-subject
3994 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3995 (setq new-roots (nconc new-roots (list (car thread)))
3997 gnus-tmp-header nil))
3998 ;; If the article lies outside the current limit,
3999 ;; then we do not display it.
4000 ((not (memq number gnus-newsgroup-limit))
4001 (setq gnus-tmp-gathered
4003 (lambda (h) (mail-header-number (car h)))
4006 (setq gnus-tmp-new-adopts (if (cdar thread)
4007 (append gnus-tmp-new-adopts
4009 gnus-tmp-new-adopts)
4011 gnus-tmp-header nil)
4012 (when (zerop gnus-tmp-level)
4013 (setq gnus-tmp-root-expunged t)))
4014 ;; Perhaps this article is to be marked as read?
4015 ((and gnus-summary-mark-below
4016 (< (or (cdr (assq number gnus-newsgroup-scored))
4018 gnus-summary-mark-below)
4019 ;; Don't touch sparse articles.
4020 (not (gnus-summary-article-sparse-p number))
4021 (not (gnus-summary-article-ancient-p number)))
4022 (setq gnus-newsgroup-unreads
4023 (delq number gnus-newsgroup-unreads))
4024 (if gnus-newsgroup-auto-expire
4025 (push number gnus-newsgroup-expirable)
4026 (push (cons number gnus-low-score-mark)
4027 gnus-newsgroup-reads))))
4029 (when gnus-tmp-header
4030 ;; We may have an old dummy line to output before this
4032 (when (and gnus-tmp-dummy-line
4035 (mail-header-subject gnus-tmp-header)))
4036 (gnus-summary-insert-dummy-line
4037 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4038 (setq gnus-tmp-dummy-line nil))
4040 ;; Compute the mark.
4041 (setq gnus-tmp-unread (gnus-article-mark number))
4043 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4044 gnus-tmp-header gnus-tmp-level)
4045 gnus-newsgroup-data)
4047 ;; Actually insert the line.
4049 gnus-tmp-subject-or-nil
4051 ((and gnus-thread-ignore-subject
4052 gnus-tmp-prev-subject
4053 (not (inline (gnus-subject-equal
4054 gnus-tmp-prev-subject subject))))
4056 ((zerop gnus-tmp-level)
4057 (if (and (eq gnus-summary-make-false-root 'empty)
4058 (memq number gnus-tmp-gathered)
4059 gnus-tmp-prev-subject
4060 (inline (gnus-subject-equal
4061 gnus-tmp-prev-subject subject)))
4062 gnus-summary-same-subject
4064 (t gnus-summary-same-subject)))
4065 (if (and (eq gnus-summary-make-false-root 'adopt)
4066 (= gnus-tmp-level 1)
4067 (memq number gnus-tmp-gathered))
4068 (setq gnus-tmp-opening-bracket ?\<
4069 gnus-tmp-closing-bracket ?\>)
4070 (setq gnus-tmp-opening-bracket ?\[
4071 gnus-tmp-closing-bracket ?\]))
4073 gnus-tmp-indentation
4074 (aref gnus-thread-indent-array gnus-tmp-level)
4075 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4076 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4077 gnus-summary-default-score 0)
4079 (if (or (null gnus-summary-default-score)
4080 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4081 gnus-summary-zcore-fuzz))
4083 (if (< gnus-tmp-score gnus-summary-default-score)
4084 gnus-score-below-mark gnus-score-over-mark))
4086 (cond ((memq number gnus-newsgroup-processable)
4088 ((memq number gnus-newsgroup-cached)
4090 ((memq number gnus-newsgroup-replied)
4092 ((memq number gnus-newsgroup-saved)
4094 (t gnus-unread-mark))
4095 gnus-tmp-from (mail-header-from gnus-tmp-header)
4098 ((string-match "<[^>]+> *$" gnus-tmp-from)
4099 (setq beg-match (match-beginning 0))
4100 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
4101 (substring gnus-tmp-from (1+ (match-beginning 0))
4102 (1- (match-end 0))))
4103 (substring gnus-tmp-from 0 beg-match)))
4104 ((string-match "(.+)" gnus-tmp-from)
4105 (substring gnus-tmp-from
4106 (1+ (match-beginning 0)) (1- (match-end 0))))
4108 (when (string= gnus-tmp-name "")
4109 (setq gnus-tmp-name gnus-tmp-from))
4110 (unless (numberp gnus-tmp-lines)
4111 (setq gnus-tmp-lines 0))
4112 (gnus-put-text-property
4114 (progn (eval gnus-summary-line-format-spec) (point))
4115 'gnus-number number)
4118 (gnus-run-hooks 'gnus-summary-update-hook)
4121 (setq gnus-tmp-prev-subject subject)))
4123 (when (nth 1 thread)
4124 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4125 (incf gnus-tmp-level)
4126 (setq threads (if thread-end nil (cdar thread)))
4128 (setq gnus-tmp-level 0)))))
4129 (gnus-message 7 "Generating summary...done"))
4131 (defun gnus-summary-prepare-unthreaded (headers)
4132 "Generate an unthreaded summary buffer based on HEADERS."
4133 (let (header number mark)
4138 ;; We may have to root out some bad articles...
4139 (when (memq (setq number (mail-header-number
4140 (setq header (pop headers))))
4141 gnus-newsgroup-limit)
4142 ;; Mark article as read when it has a low score.
4143 (when (and gnus-summary-mark-below
4144 (< (or (cdr (assq number gnus-newsgroup-scored))
4145 gnus-summary-default-score 0)
4146 gnus-summary-mark-below)
4147 (not (gnus-summary-article-ancient-p number)))
4148 (setq gnus-newsgroup-unreads
4149 (delq number gnus-newsgroup-unreads))
4150 (if gnus-newsgroup-auto-expire
4151 (push number gnus-newsgroup-expirable)
4152 (push (cons number gnus-low-score-mark)
4153 gnus-newsgroup-reads)))
4155 (setq mark (gnus-article-mark number))
4156 (push (gnus-data-make number mark (1+ (point)) header 0)
4157 gnus-newsgroup-data)
4158 (gnus-summary-insert-line
4160 mark (memq number gnus-newsgroup-replied)
4161 (memq number gnus-newsgroup-expirable)
4162 (mail-header-subject header) nil
4163 (cdr (assq number gnus-newsgroup-scored))
4164 (memq number gnus-newsgroup-processable))))))
4166 (defun gnus-summary-remove-list-identifiers ()
4167 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4168 (let ((regexp (if (stringp gnus-list-identifiers)
4169 gnus-list-identifiers
4170 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4171 (dolist (header gnus-newsgroup-headers)
4172 (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
4173 " *\\)\\)+\\(Re: +\\)?\\)")
4174 (mail-header-subject header))
4175 (mail-header-set-subject
4176 header (concat (substring (mail-header-subject header)
4177 0 (match-beginning 1))
4179 (match-string 3 (mail-header-subject header))
4180 (match-string 5 (mail-header-subject header)))
4181 (substring (mail-header-subject header)
4182 (match-end 1))))))))
4184 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4185 "Select newsgroup GROUP.
4186 If READ-ALL is non-nil, all articles in the group are selected.
4187 If SELECT-ARTICLES, only select those articles from GROUP."
4188 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4189 ;;!!! Dirty hack; should be removed.
4190 (gnus-summary-ignore-duplicates
4191 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4193 gnus-summary-ignore-duplicates))
4194 (info (nth 2 entry))
4195 articles fetched-articles cached)
4197 (unless (gnus-check-server
4198 (setq gnus-current-select-method
4199 (gnus-find-method-for-group group)))
4200 (error "Couldn't open server"))
4202 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4203 (gnus-activate-group group) ; Or we can activate it...
4204 (progn ; Or we bug out.
4205 (when (equal major-mode 'gnus-summary-mode)
4206 (kill-buffer (current-buffer)))
4207 (error "Couldn't request group %s: %s"
4208 group (gnus-status-message group))))
4210 (unless (gnus-request-group group t)
4211 (when (equal major-mode 'gnus-summary-mode)
4212 (kill-buffer (current-buffer)))
4213 (error "Couldn't request group %s: %s"
4214 group (gnus-status-message group)))
4216 (setq gnus-newsgroup-name group)
4217 (setq gnus-newsgroup-unselected nil)
4218 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4219 (gnus-summary-setup-default-charset)
4221 ;; Adjust and set lists of article marks.
4223 (gnus-adjust-marked-articles info))
4225 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4226 (when (gnus-virtual-group-p group)
4227 (setq cached gnus-newsgroup-cached))
4229 (setq gnus-newsgroup-unreads
4230 (gnus-set-difference
4231 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4232 gnus-newsgroup-dormant))
4234 (setq gnus-newsgroup-processable nil)
4236 (gnus-update-read-articles group gnus-newsgroup-unreads)
4238 (if (setq articles select-articles)
4239 (setq gnus-newsgroup-unselected
4240 (gnus-sorted-intersection
4241 gnus-newsgroup-unreads
4242 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4243 (setq articles (gnus-articles-to-read group read-all)))
4247 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4249 ((eq articles 0) nil)
4251 ;; Init the dependencies hash table.
4252 (setq gnus-newsgroup-dependencies
4253 (gnus-make-hashtable (length articles)))
4254 (gnus-set-global-variables)
4255 ;; Retrieve the headers and read them in.
4256 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4257 (setq gnus-newsgroup-headers
4259 (setq gnus-headers-retrieved-by
4260 (gnus-retrieve-headers
4261 articles gnus-newsgroup-name
4262 ;; We might want to fetch old headers, but
4263 ;; not if there is only 1 article.
4265 (not (eq gnus-fetch-old-headers 'some))
4266 (not (numberp gnus-fetch-old-headers)))
4267 (> (length articles) 1))
4268 gnus-fetch-old-headers))))
4269 (gnus-get-newsgroup-headers-xover
4270 articles nil nil gnus-newsgroup-name t)
4271 (gnus-get-newsgroup-headers)))
4272 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4274 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4276 (setq gnus-newsgroup-cached cached))
4278 ;; Suppress duplicates?
4279 (when gnus-suppress-duplicates
4280 (gnus-dup-suppress-articles))
4282 ;; Set the initial limit.
4283 (setq gnus-newsgroup-limit (copy-sequence articles))
4284 ;; Remove canceled articles from the list of unread articles.
4285 (setq gnus-newsgroup-unreads
4286 (gnus-set-sorted-intersection
4287 gnus-newsgroup-unreads
4288 (setq fetched-articles
4289 (mapcar (lambda (headers) (mail-header-number headers))
4290 gnus-newsgroup-headers))))
4291 ;; Removed marked articles that do not exist.
4292 (gnus-update-missing-marks
4293 (gnus-sorted-complement fetched-articles articles))
4294 ;; We might want to build some more threads first.
4295 (when (and gnus-fetch-old-headers
4296 (eq gnus-headers-retrieved-by 'nov))
4297 (if (eq gnus-fetch-old-headers 'invisible)
4298 (gnus-build-all-threads)
4299 (gnus-build-old-threads)))
4300 ;; Let the Gnus agent mark articles as read.
4302 (gnus-agent-get-undownloaded-list))
4303 ;; Remove list identifiers from subject
4304 (when gnus-list-identifiers
4305 (gnus-summary-remove-list-identifiers))
4306 ;; Check whether auto-expire is to be done in this group.
4307 (setq gnus-newsgroup-auto-expire
4308 (gnus-group-auto-expirable-p group))
4309 ;; Set up the article buffer now, if necessary.
4310 (unless gnus-single-article-buffer
4311 (gnus-article-setup-buffer))
4312 ;; First and last article in this newsgroup.
4313 (when gnus-newsgroup-headers
4314 (setq gnus-newsgroup-begin
4315 (mail-header-number (car gnus-newsgroup-headers))
4318 (gnus-last-element gnus-newsgroup-headers))))
4319 ;; GROUP is successfully selected.
4320 (or gnus-newsgroup-headers t)))))
4322 (defun gnus-articles-to-read (group &optional read-all)
4323 "Find out what articles the user wants to read."
4325 ;; Select all articles if `read-all' is non-nil, or if there
4326 ;; are no unread articles.
4328 (and (zerop (length gnus-newsgroup-marked))
4329 (zerop (length gnus-newsgroup-unreads)))
4330 (eq (gnus-group-find-parameter group 'display)
4333 (gnus-uncompress-range (gnus-active group))
4334 (gnus-cache-articles-in-group group))
4335 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4336 (copy-sequence gnus-newsgroup-unreads))
4338 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4339 (scored (length scored-list))
4340 (number (length articles))
4341 (marked (+ (length gnus-newsgroup-marked)
4342 (length gnus-newsgroup-dormant)))
4350 ((and (or (<= scored marked) (= scored number))
4351 (numberp gnus-large-newsgroup)
4352 (> number gnus-large-newsgroup))
4356 "How many articles from %s (default %d): "
4357 (gnus-limit-string gnus-newsgroup-name 35)
4359 (if (string-match "^[ \t]*$" input) number input)))
4360 ((and (> scored marked) (< scored number)
4361 (> (- scored number) 20))
4364 (format "%s %s (%d scored, %d total): "
4365 "How many articles from"
4366 group scored number))))
4367 (if (string-match "^[ \t]*$" input)
4371 (message "Quit getting the articles to read")
4373 (setq select (if (stringp select) (string-to-number select) select))
4374 (if (or (null select) (zerop select))
4376 (if (and (not (zerop scored)) (<= (abs select) scored))
4378 (setq articles (sort scored-list '<))
4379 (setq number (length articles)))
4380 (setq articles (copy-sequence articles)))
4382 (when (< (abs select) number)
4384 ;; Select the N oldest articles.
4385 (setcdr (nthcdr (1- (abs select)) articles) nil)
4386 ;; Select the N most recent articles.
4387 (setq articles (nthcdr (- number select) articles))))
4388 (setq gnus-newsgroup-unselected
4389 (gnus-sorted-intersection
4390 gnus-newsgroup-unreads
4391 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4392 (when gnus-alter-articles-to-read-function
4393 (setq gnus-newsgroup-unreads
4395 (funcall gnus-alter-articles-to-read-function
4396 gnus-newsgroup-name gnus-newsgroup-unreads)
4400 (defun gnus-killed-articles (killed articles)
4403 (when (inline (gnus-member-of-range (car articles) killed))
4404 (push (car articles) out))
4405 (setq articles (cdr articles)))
4408 (defun gnus-uncompress-marks (marks)
4409 "Uncompress the mark ranges in MARKS."
4410 (let ((uncompressed '(score bookmark))
4413 (if (memq (caar marks) uncompressed)
4414 (push (car marks) out)
4415 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4416 (setq marks (cdr marks)))
4419 (defun gnus-adjust-marked-articles (info)
4420 "Set all article lists and remove all marks that are no longer valid."
4421 (let* ((marked-lists (gnus-info-marks info))
4422 (active (gnus-active (gnus-info-group info)))
4425 (types gnus-article-mark-lists)
4426 (uncompressed '(score bookmark killed))
4427 marks var articles article mark)
4430 (setq marks (pop marked-lists))
4431 (set (setq var (intern (format "gnus-newsgroup-%s"
4432 (car (rassq (setq mark (car marks))
4434 (if (memq (car marks) uncompressed) (cdr marks)
4435 (gnus-uncompress-range (cdr marks))))
4437 (setq articles (symbol-value var))
4439 ;; All articles have to be subsets of the active articles.
4441 ;; Adjust "simple" lists.
4442 ((memq mark '(tick dormant expire reply save))
4444 (when (or (< (setq article (pop articles)) min) (> article max))
4445 (set var (delq article (symbol-value var))))))
4447 ((memq mark uncompressed)
4448 (when (not (listp (cdr (symbol-value var))))
4449 (set var (list (symbol-value var))))
4450 (when (not (listp (cdr articles)))
4451 (setq articles (list articles)))
4453 (when (or (not (consp (setq article (pop articles))))
4454 (< (car article) min)
4455 (> (car article) max))
4456 (set var (delq article (symbol-value var))))))))))
4458 (defun gnus-update-missing-marks (missing)
4459 "Go through the list of MISSING articles and remove them from the mark lists."
4461 (let ((types gnus-article-mark-lists)
4463 ;; Go through all types.
4465 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4466 (when (symbol-value var)
4467 ;; This list has articles. So we delete all missing articles
4471 (set var (delq (pop m) (symbol-value var)))))))))
4473 (defun gnus-update-marks ()
4474 "Enter the various lists of marked articles into the newsgroup info list."
4475 (let ((types gnus-article-mark-lists)
4476 (info (gnus-get-info gnus-newsgroup-name))
4477 (uncompressed '(score bookmark killed))
4478 type list newmarked symbol delta-marks)
4480 ;; Add all marks lists to the list of marks lists.
4481 (while (setq type (pop types))
4482 (setq list (symbol-value
4484 (intern (format "gnus-newsgroup-%s"
4488 ;; Get rid of the entries of the articles that have the
4490 (when (and (eq (cdr type) 'score)
4494 (prev (cons nil list))
4497 (if (or (not (consp (car arts)))
4498 (= (cdar arts) gnus-summary-default-score))
4499 (setcdr prev (cdr arts))
4501 (setq arts (cdr arts)))
4502 (setq list (cdr all)))))
4504 (unless (memq (cdr type) uncompressed)
4505 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4507 (when (gnus-check-backend-function
4508 'request-set-mark gnus-newsgroup-name)
4509 ;; propagate flags to server, with the following exceptions:
4510 ;; uncompressed:s are not proper flags (they are cons cells)
4511 ;; cache is a internal gnus flag
4512 ;; download are local to one gnus installation (well)
4513 ;; unsend are for nndraft groups only
4514 ;; xxx: generality of this? this suits nnimap anyway
4515 (unless (memq (cdr type) (append '(cache download unsend)
4517 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4518 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4519 (add (gnus-remove-from-range
4520 (gnus-copy-sequence list) old)))
4522 (push (list add 'add (list (cdr type))) delta-marks))
4524 (push (list del 'del (list (cdr type))) delta-marks)))))
4527 (push (cons (cdr type) list) newmarked)))
4530 (unless (gnus-check-group gnus-newsgroup-name)
4531 (error "Can't open server for %s" gnus-newsgroup-name))
4532 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4534 ;; Enter these new marks into the info of the group.
4536 (setcar (nthcdr 3 info) newmarked)
4537 ;; Add the marks lists to the end of the info.
4539 (setcdr (nthcdr 2 info) (list newmarked))))
4541 ;; Cut off the end of the info if there's nothing else there.
4545 (when (nthcdr (decf i) info)
4546 (setcdr (nthcdr i info) nil)))))))
4548 (defun gnus-set-mode-line (where)
4549 "Set the mode line of the article or summary buffers.
4550 If WHERE is `summary', the summary mode line format will be used."
4551 ;; Is this mode line one we keep updated?
4552 (when (and (memq where gnus-updated-mode-lines)
4554 (intern (format "gnus-%s-mode-line-format-spec" where))))
4557 ;; We evaluate this in the summary buffer since these
4558 ;; variables are buffer-local to that buffer.
4559 (set-buffer gnus-summary-buffer)
4560 ;; We bind all these variables that are used in the `eval' form
4562 (let* ((mformat (symbol-value
4564 (format "gnus-%s-mode-line-format-spec" where))))
4565 (gnus-tmp-group-name (gnus-group-name-decode
4567 (gnus-group-name-charset
4569 gnus-newsgroup-name)))
4570 (gnus-tmp-article-number (or gnus-current-article 0))
4571 (gnus-tmp-unread gnus-newsgroup-unreads)
4572 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4573 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4574 (gnus-tmp-unread-and-unselected
4575 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4576 (zerop gnus-tmp-unselected))
4578 ((zerop gnus-tmp-unselected)
4579 (format "{%d more}" gnus-tmp-unread-and-unticked))
4580 (t (format "{%d(+%d) more}"
4581 gnus-tmp-unread-and-unticked
4582 gnus-tmp-unselected))))
4584 (if (and gnus-current-headers
4585 (vectorp gnus-current-headers))
4586 (gnus-mode-string-quote
4587 (mail-header-subject gnus-current-headers))
4589 bufname-length max-len
4590 gnus-tmp-header);; passed as argument to any user-format-funcs
4591 (setq mode-string (eval mformat))
4592 (setq bufname-length (if (string-match "%b" mode-string)
4595 (if (eq where 'summary)
4597 (get-buffer gnus-article-buffer))))
4600 (setq max-len (max 4 (if gnus-mode-non-string-length
4602 gnus-mode-non-string-length
4604 (length mode-string))))
4605 ;; We might have to chop a bit of the string off...
4606 (when (> (length mode-string) max-len)
4608 (concat (truncate-string-to-width mode-string (- max-len 3))
4610 ;; Pad the mode string a bit.
4611 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4612 ;; Update the mode line.
4613 (setq mode-line-buffer-identification
4614 (gnus-mode-line-buffer-identification (list mode-string)))
4615 (set-buffer-modified-p t))))
4617 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4618 "Go through the HEADERS list and add all Xrefs to a hash table.
4619 The resulting hash table is returned, or nil if no Xrefs were found."
4620 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4621 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4622 (xref-hashtb (gnus-make-hashtable))
4623 start group entry number xrefs header)
4625 (setq header (pop headers))
4626 (when (and (setq xrefs (mail-header-xref header))
4627 (not (memq (setq number (mail-header-number header))
4630 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4631 (setq start (match-end 0))
4632 (setq group (if prefix
4633 (concat prefix (substring xrefs (match-beginning 1)
4635 (substring xrefs (match-beginning 1) (match-end 1))))
4637 (string-to-int (substring xrefs (match-beginning 2)
4639 (if (setq entry (gnus-gethash group xref-hashtb))
4640 (setcdr entry (cons number (cdr entry)))
4641 (gnus-sethash group (cons number nil) xref-hashtb)))))
4642 (and start xref-hashtb)))
4644 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4645 "Look through all the headers and mark the Xrefs as read."
4646 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4647 name entry info xref-hashtb idlist method nth4)
4649 (set-buffer gnus-group-buffer)
4650 (when (setq xref-hashtb
4651 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4654 (unless (string= from-newsgroup (setq name (symbol-name group)))
4655 (setq idlist (symbol-value group))
4656 ;; Dead groups are not updated.
4658 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4660 (when (stringp (setq nth4 (gnus-info-method info)))
4661 (setq nth4 (gnus-server-to-method nth4))))
4662 ;; Only do the xrefs if the group has the same
4663 ;; select method as the group we have just read.
4664 (or (gnus-methods-equal-p
4665 nth4 (gnus-find-method-for-group from-newsgroup))
4667 (equal nth4 (setq method (gnus-find-method-for-group
4669 (and (equal (car nth4) (car method))
4670 (equal (nth 1 nth4) (nth 1 method))))
4671 gnus-use-cross-reference
4672 (or (not (eq gnus-use-cross-reference t))
4674 ;; Only do cross-references on subscribed
4675 ;; groups, if that is what is wanted.
4676 (<= (gnus-info-level info) gnus-level-subscribed))
4677 (gnus-group-make-articles-read name idlist))))
4680 (defun gnus-compute-read-articles (group articles)
4681 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4682 (info (nth 2 entry))
4683 (active (gnus-active group))
4686 ;; First peel off all invalid article numbers.
4688 (let ((ids articles)
4690 (while (setq id (pop ids))
4691 (when (and first (> id (cdr active)))
4692 ;; We'll end up in this situation in one particular
4693 ;; obscure situation. If you re-scan a group and get
4694 ;; a new article that is cross-posted to a different
4695 ;; group that has not been re-scanned, you might get
4696 ;; crossposted article that has a higher number than
4697 ;; Gnus believes possible. So we re-activate this
4698 ;; group as well. This might mean doing the
4699 ;; crossposting thingy will *increase* the number
4700 ;; of articles in some groups. Tsk, tsk.
4701 (setq active (or (gnus-activate-group group) active)))
4702 (when (or (> id (cdr active))
4703 (< id (car active)))
4704 (setq articles (delq id articles))))))
4705 ;; If the read list is nil, we init it.
4707 (null (gnus-info-read info))
4709 (setq ninfo (cons 1 (1- (car active))))
4710 (setq ninfo (gnus-info-read info)))
4711 ;; Then we add the read articles to the range.
4713 ninfo (setq articles (sort articles '<))))))
4715 (defun gnus-group-make-articles-read (group articles)
4716 "Update the info of GROUP to say that ARTICLES are read."
4718 (entry (gnus-gethash group gnus-newsrc-hashtb))
4719 (info (nth 2 entry))
4720 (active (gnus-active group))
4723 (setq range (gnus-compute-read-articles group articles))
4725 (set-buffer gnus-group-buffer)
4728 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4729 (gnus-info-set-read ',info ',(gnus-info-read info))
4730 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4731 (gnus-group-update-group ,group t))))
4732 ;; Add the read articles to the range.
4733 (gnus-info-set-read info range)
4734 ;; Then we have to re-compute how many unread
4735 ;; articles there are in this group.
4739 (setq num (- (1+ (cdr active)) (car active))))
4740 ((not (listp (cdr range)))
4741 (setq num (- (cdr active) (- (1+ (cdr range))
4745 (if (numberp (car range))
4747 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4748 (setq range (cdr range)))
4749 (setq num (- (cdr active) num))))
4750 ;; Update the number of unread articles.
4752 ;; Update the group buffer.
4753 (gnus-group-update-group group t)))))
4755 (defvar gnus-newsgroup-none-id 0)
4757 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4758 (let ((cur nntp-server-buffer)
4761 (save-excursion (set-buffer gnus-summary-buffer)
4762 gnus-newsgroup-dependencies)))
4764 (mail-parse-charset gnus-newsgroup-charset)
4765 (mail-parse-ignored-charsets
4766 (save-excursion (condition-case nil
4767 (set-buffer gnus-summary-buffer)
4769 gnus-newsgroup-ignored-charsets)))
4771 (set-buffer nntp-server-buffer)
4772 ;; Translate all TAB characters into SPACE characters.
4773 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4774 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4775 (gnus-run-hooks 'gnus-parse-headers-hook)
4776 (let ((case-fold-search t)
4777 in-reply-to header p lines chars)
4778 (goto-char (point-min))
4779 ;; Search to the beginning of the next header. Error messages
4780 ;; do not begin with 2 or 3.
4781 (while (re-search-forward "^[23][0-9]+ " nil t)
4784 ;; This implementation of this function, with nine
4785 ;; search-forwards instead of the one re-search-forward and
4786 ;; a case (which basically was the old function) is actually
4787 ;; about twice as fast, even though it looks messier. You
4788 ;; can't have everything, I guess. Speed and elegance
4789 ;; doesn't always go hand in hand.
4798 (narrow-to-region (point)
4799 (or (and (search-forward "\n.\n" nil t)
4805 (if (search-forward "\nsubject: " nil t)
4806 (funcall gnus-decode-encoded-word-function
4807 (nnheader-header-value))
4812 (if (or (search-forward "\nfrom: " nil t)
4813 (search-forward "\nfrom:" nil t))
4814 (funcall gnus-decode-encoded-word-function
4815 (nnheader-header-value))
4820 (if (search-forward "\ndate: " nil t)
4821 (nnheader-header-value) ""))
4825 (setq id (if (re-search-forward
4826 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4827 ;; We do it this way to make sure the Message-ID
4828 ;; is (somewhat) syntactically valid.
4829 (buffer-substring (match-beginning 1)
4831 ;; If there was no message-id, we just fake one
4832 ;; to make subsequent routines simpler.
4833 (nnheader-generate-fake-message-id))))
4837 (if (search-forward "\nreferences: " nil t)
4841 (nnheader-header-value)
4846 (search-backward ">" end t)
4849 (search-backward "<" end t)
4851 ;; Get the references from the in-reply-to header if there
4852 ;; were no references and the in-reply-to header looks
4854 (if (and (search-forward "\nin-reply-to: " nil t)
4855 (setq in-reply-to (nnheader-header-value))
4856 (string-match "<[^>]+>" in-reply-to))
4858 (setq ref (substring in-reply-to (match-beginning 0)
4860 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4861 (setq ref2 (substring in-reply-to (match-beginning 0)
4863 (when (> (length ref2) (length ref))
4870 (if (search-forward "\nchars: " nil t)
4871 (if (numberp (setq chars (ignore-errors (read cur))))
4877 (if (search-forward "\nlines: " nil t)
4878 (if (numberp (setq lines (ignore-errors (read cur))))
4884 (and (search-forward "\nxref: " nil t)
4885 (nnheader-header-value)))
4887 (when gnus-extra-headers
4888 (let ((extra gnus-extra-headers)
4892 (when (search-forward
4893 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4894 (push (cons (car extra) (nnheader-header-value))
4898 (when (equal id ref)
4901 (when gnus-alter-header-function
4902 (funcall gnus-alter-header-function header)
4903 (setq id (mail-header-id header)
4904 ref (gnus-parent-id (mail-header-references header))))
4907 (gnus-dependencies-add-header
4908 header dependencies force-new))
4909 (push header headers))
4910 (goto-char (point-max))
4912 (nreverse headers)))))
4914 ;; Goes through the xover lines and returns a list of vectors
4915 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4916 force-new dependencies
4917 group also-fetch-heads)
4918 "Parse the news overview data in the server buffer.
4919 Return a list of headers that match SEQUENCE (see
4920 `nntp-retrieve-headers')."
4921 ;; Get the Xref when the users reads the articles since most/some
4922 ;; NNTP servers do not include Xrefs when using XOVER.
4923 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4924 (let ((mail-parse-charset gnus-newsgroup-charset)
4925 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4926 (cur nntp-server-buffer)
4927 (dependencies (or dependencies gnus-newsgroup-dependencies))
4928 number headers header)
4930 (set-buffer nntp-server-buffer)
4931 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4932 ;; Allow the user to mangle the headers before parsing them.
4933 (gnus-run-hooks 'gnus-parse-headers-hook)
4934 (goto-char (point-min))
4937 (while (and sequence (not (eobp)))
4938 (setq number (read cur))
4939 (while (and sequence
4940 (< (car sequence) number))
4941 (setq sequence (cdr sequence)))
4943 (eq number (car sequence))
4945 (setq sequence (cdr sequence))
4946 (setq header (inline
4947 (gnus-nov-parse-line
4948 number dependencies force-new))))
4949 (push header headers))
4952 (gnus-error 4 "Strange nov line (%d)"
4953 (count-lines (point-min) (point)))))
4955 ;; A common bug in inn is that if you have posted an article and
4956 ;; then retrieves the active file, it will answer correctly --
4957 ;; the new article is included. However, a NOV entry for the
4958 ;; article may not have been generated yet, so this may fail.
4959 ;; We work around this problem by retrieving the last few
4960 ;; headers using HEAD.
4961 (if (or (not also-fetch-heads)
4963 ;; We (probably) got all the headers.
4965 (let ((gnus-nov-is-evil t))
4968 (when (gnus-retrieve-headers sequence group)
4969 (gnus-get-newsgroup-headers))))))))
4971 (defun gnus-article-get-xrefs ()
4972 "Fill in the Xref value in `gnus-current-headers', if necessary.
4973 This is meant to be called in `gnus-article-internal-prepare-hook'."
4974 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4975 gnus-current-headers)))
4976 (or (not gnus-use-cross-reference)
4978 (and (mail-header-xref headers)
4979 (not (string= (mail-header-xref headers) "")))
4980 (let ((case-fold-search t)
4983 (nnheader-narrow-to-headers)
4984 (goto-char (point-min))
4985 (when (or (and (not (eobp))
4986 (eq (downcase (char-after)) ?x)
4987 (looking-at "Xref:"))
4988 (search-forward "\nXref:" nil t))
4989 (goto-char (1+ (match-end 0)))
4990 (setq xref (buffer-substring (point)
4991 (progn (end-of-line) (point))))
4992 (mail-header-set-xref headers xref)))))))
4994 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4995 "Find article ID and insert the summary line for that article.
4996 OLD-HEADER can either be a header or a line number to insert
4997 the subject line on."
4998 (let* ((line (and (numberp old-header) old-header))
4999 (old-header (and (vectorp old-header) old-header))
5000 (header (cond ((and old-header use-old-header)
5003 (gnus-number-to-header id))
5004 (gnus-number-to-header id))
5006 (gnus-read-header id))))
5007 (number (and (numberp id) id))
5010 ;; Rebuild the thread that this article is part of and go to the
5011 ;; article we have fetched.
5012 (when (and (not gnus-show-threads)
5015 (setq d (gnus-data-find (mail-header-number old-header))))
5016 (goto-char (gnus-data-pos d))
5019 (- (gnus-point-at-bol)
5021 (1+ (gnus-point-at-eol))
5022 (gnus-delete-line))))))
5024 (mail-header-set-number header (mail-header-number old-header)))
5025 (setq gnus-newsgroup-sparse
5026 (delq (setq number (mail-header-number header))
5027 gnus-newsgroup-sparse))
5028 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5029 (push number gnus-newsgroup-limit)
5030 (gnus-rebuild-thread (mail-header-id header) line)
5031 (gnus-summary-goto-subject number nil t))
5032 (when (and (numberp number)
5034 ;; We have to update the boundaries even if we can't fetch the
5035 ;; article if ID is a number -- so that the next `P' or `N'
5036 ;; command will fetch the previous (or next) article even
5037 ;; if the one we tried to fetch this time has been canceled.
5038 (when (> number gnus-newsgroup-end)
5039 (setq gnus-newsgroup-end number))
5040 (when (< number gnus-newsgroup-begin)
5041 (setq gnus-newsgroup-begin number))
5042 (setq gnus-newsgroup-unselected
5043 (delq number gnus-newsgroup-unselected)))
5044 ;; Report back a success?
5045 (and header (mail-header-number header))))
5047 ;;; Process/prefix in the summary buffer
5049 (defun gnus-summary-work-articles (n)
5050 "Return a list of articles to be worked upon.
5051 The prefix argument, the list of process marked articles, and the
5052 current article will be taken into consideration."
5054 (set-buffer gnus-summary-buffer)
5057 ;; A numerical prefix has been given.
5058 (setq n (prefix-numeric-value n))
5059 (let ((backward (< n 0))
5060 (n (abs (prefix-numeric-value n)))
5065 (push (setq article (gnus-summary-article-number))
5068 (gnus-summary-find-prev nil article)
5069 (gnus-summary-find-next nil article)))
5071 (nreverse articles)))
5072 ((and (gnus-region-active-p) (mark))
5073 (message "region active")
5074 ;; Work on the region between point and mark.
5075 (let ((max (max (point) (mark)))
5078 (goto-char (min (min (point) (mark))))
5081 (push (setq article (gnus-summary-article-number)) articles)
5082 (gnus-summary-find-next nil article)
5084 (nreverse articles))))
5085 (gnus-newsgroup-processable
5086 ;; There are process-marked articles present.
5087 ;; Save current state.
5088 (gnus-summary-save-process-mark)
5090 (reverse gnus-newsgroup-processable))
5092 ;; Just return the current article.
5093 (list (gnus-summary-article-number))))))
5095 (defmacro gnus-summary-iterate (arg &rest forms)
5096 "Iterate over the process/prefixed articles and do FORMS.
5097 ARG is the interactive prefix given to the command. FORMS will be
5098 executed with point over the summary line of the articles."
5099 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5100 `(let ((,articles (gnus-summary-work-articles ,arg)))
5102 (gnus-summary-goto-subject (car ,articles))
5106 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5107 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5109 (defun gnus-summary-save-process-mark ()
5110 "Push the current set of process marked articles on the stack."
5112 (push (copy-sequence gnus-newsgroup-processable)
5113 gnus-newsgroup-process-stack))
5115 (defun gnus-summary-kill-process-mark ()
5116 "Push the current set of process marked articles on the stack and unmark."
5118 (gnus-summary-save-process-mark)
5119 (gnus-summary-unmark-all-processable))
5121 (defun gnus-summary-yank-process-mark ()
5122 "Pop the last process mark state off the stack and restore it."
5124 (unless gnus-newsgroup-process-stack
5125 (error "Empty mark stack"))
5126 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5128 (defun gnus-summary-process-mark-set (set)
5129 "Make SET into the current process marked articles."
5130 (gnus-summary-unmark-all-processable)
5132 (gnus-summary-set-process-mark (pop set))))
5134 ;;; Searching and stuff
5136 (defun gnus-summary-search-group (&optional backward use-level)
5137 "Search for next unread newsgroup.
5138 If optional argument BACKWARD is non-nil, search backward instead."
5140 (set-buffer gnus-group-buffer)
5141 (when (gnus-group-search-forward
5142 backward nil (if use-level (gnus-group-group-level) nil))
5143 (gnus-group-group-name))))
5145 (defun gnus-summary-best-group (&optional exclude-group)
5146 "Find the name of the best unread group.
5147 If EXCLUDE-GROUP, do not go to this group."
5149 (set-buffer gnus-group-buffer)
5151 (gnus-group-best-unread-group exclude-group))))
5153 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5154 (if backward (gnus-summary-find-prev)
5155 (let* ((dummy (gnus-summary-article-intangible-p))
5156 (article (or article (gnus-summary-article-number)))
5157 (arts (gnus-data-find-list article))
5159 (when (and (not dummy)
5160 (or (not gnus-summary-check-current)
5162 (not (gnus-data-unread-p (car arts)))))
5163 (setq arts (cdr arts)))
5168 (when (or (and undownloaded
5169 (eq gnus-undownloaded-mark
5170 (gnus-data-mark (car arts))))
5171 (gnus-data-unread-p (car arts)))
5172 (setq result (car arts)
5174 (setq arts (cdr arts)))
5177 (goto-char (gnus-data-pos result))
5178 (gnus-data-number result)))))
5180 (defun gnus-summary-find-prev (&optional unread article)
5181 (let* ((eobp (eobp))
5182 (article (or article (gnus-summary-article-number)))
5183 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5185 (when (and (not eobp)
5186 (or (not gnus-summary-check-current)
5188 (not (gnus-data-unread-p (car arts)))))
5189 (setq arts (cdr arts)))
5194 (when (gnus-data-unread-p (car arts))
5195 (setq result (car arts)
5197 (setq arts (cdr arts)))
5200 (goto-char (gnus-data-pos result))
5201 (gnus-data-number result))))
5203 (defun gnus-summary-find-subject (subject &optional unread backward article)
5204 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5205 (article (or article (gnus-summary-article-number)))
5206 (articles (gnus-data-list backward))
5207 (arts (gnus-data-find-list article articles))
5209 (when (or (not gnus-summary-check-current)
5211 (not (gnus-data-unread-p (car arts))))
5212 (setq arts (cdr arts)))
5214 (and (or (not unread)
5215 (gnus-data-unread-p (car arts)))
5216 (vectorp (gnus-data-header (car arts)))
5218 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5219 (setq result (car arts)
5221 (setq arts (cdr arts)))
5223 (goto-char (gnus-data-pos result))
5224 (gnus-data-number result))))
5226 (defun gnus-summary-search-forward (&optional unread subject backward)
5227 "Search forward for an article.
5228 If UNREAD, look for unread articles. If SUBJECT, look for
5229 articles with that subject. If BACKWARD, search backward instead."
5230 (cond (subject (gnus-summary-find-subject subject unread backward))
5231 (backward (gnus-summary-find-prev unread))
5232 (t (gnus-summary-find-next unread))))
5234 (defun gnus-recenter (&optional n)
5235 "Center point in window and redisplay frame.
5236 Also do horizontal recentering."
5238 (when (and gnus-auto-center-summary
5239 (not (eq gnus-auto-center-summary 'vertical)))
5240 (gnus-horizontal-recenter))
5243 (defun gnus-summary-recenter ()
5244 "Center point in the summary window.
5245 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5246 displayed, no centering will be performed."
5247 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5248 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5250 (let* ((top (cond ((< (window-height) 4) 0)
5251 ((< (window-height) 7) 1)
5252 (t (if (numberp gnus-auto-center-summary)
5253 gnus-auto-center-summary
5255 (height (1- (window-height)))
5256 (bottom (save-excursion (goto-char (point-max))
5257 (forward-line (- height))
5259 (window (get-buffer-window (current-buffer))))
5260 ;; The user has to want it.
5261 (when gnus-auto-center-summary
5262 (when (get-buffer-window gnus-article-buffer)
5263 ;; Only do recentering when the article buffer is displayed,
5264 ;; Set the window start to either `bottom', which is the biggest
5265 ;; possible valid number, or the second line from the top,
5266 ;; whichever is the least.
5268 window (min bottom (save-excursion
5269 (forward-line (- top)) (point)))
5271 ;; Do horizontal recentering while we're at it.
5272 (when (and (get-buffer-window (current-buffer) t)
5273 (not (eq gnus-auto-center-summary 'vertical)))
5274 (let ((selected (selected-window)))
5275 (select-window (get-buffer-window (current-buffer) t))
5276 (gnus-summary-position-point)
5277 (gnus-horizontal-recenter)
5278 (select-window selected))))))
5280 (defun gnus-summary-jump-to-group (newsgroup)
5281 "Move point to NEWSGROUP in group mode buffer."
5282 ;; Keep update point of group mode buffer if visible.
5283 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5284 (save-window-excursion
5285 ;; Take care of tree window mode.
5286 (when (get-buffer-window gnus-group-buffer)
5287 (pop-to-buffer gnus-group-buffer))
5288 (gnus-group-jump-to-group newsgroup))
5290 ;; Take care of tree window mode.
5291 (if (get-buffer-window gnus-group-buffer)
5292 (pop-to-buffer gnus-group-buffer)
5293 (set-buffer gnus-group-buffer))
5294 (gnus-group-jump-to-group newsgroup))))
5296 ;; This function returns a list of article numbers based on the
5297 ;; difference between the ranges of read articles in this group and
5298 ;; the range of active articles.
5299 (defun gnus-list-of-unread-articles (group)
5300 (let* ((read (gnus-info-read (gnus-get-info group)))
5301 (active (or (gnus-active group) (gnus-activate-group group)))
5304 ;; If none are read, then all are unread.
5306 (setq first (car active))
5307 ;; If the range of read articles is a single range, then the
5308 ;; first unread article is the article after the last read
5309 ;; article. Sounds logical, doesn't it?
5310 (if (and (not (listp (cdr read)))
5311 (or (< (car read) (car active))
5312 (progn (setq read (list read))
5314 (setq first (max (car active) (1+ (cdr read))))
5315 ;; `read' is a list of ranges.
5316 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5319 (setq first (car active)))
5322 (while (< first nlast)
5324 (setq first (1+ first))))
5325 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5326 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5327 (setq read (cdr read)))))
5328 ;; And add the last unread articles.
5329 (while (<= first last)
5331 (setq first (1+ first)))
5332 ;; Return the list of unread articles.
5333 (delq 0 (nreverse unread))))
5335 (defun gnus-list-of-read-articles (group)
5336 "Return a list of unread, unticked and non-dormant articles."
5337 (let* ((info (gnus-get-info group))
5338 (marked (gnus-info-marks info))
5339 (active (gnus-active group)))
5341 (gnus-set-difference
5342 (gnus-sorted-complement
5343 (gnus-uncompress-range active)
5344 (gnus-list-of-unread-articles group))
5346 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5347 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5349 ;; Various summary commands
5351 (defun gnus-summary-select-article-buffer ()
5352 "Reconfigure windows to show article buffer."
5354 (if (not (gnus-buffer-live-p gnus-article-buffer))
5355 (error "There is no article buffer for this summary buffer")
5356 (gnus-configure-windows 'article)
5357 (select-window (get-buffer-window gnus-article-buffer))))
5359 (defun gnus-summary-universal-argument (arg)
5360 "Perform any operation on all articles that are process/prefixed."
5362 (let ((articles (gnus-summary-work-articles arg))
5369 (substitute-command-keys
5370 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
5372 (gnus-error 1 "Undefined key")
5375 (gnus-summary-goto-subject (setq article (pop articles)))
5376 (let (gnus-newsgroup-processable)
5377 (command-execute func))
5378 (gnus-summary-remove-process-mark article)))))
5379 (gnus-summary-position-point))
5381 (defun gnus-summary-toggle-truncation (&optional arg)
5382 "Toggle truncation of summary lines.
5383 With arg, turn line truncation on iff arg is positive."
5385 (setq truncate-lines
5386 (if (null arg) (not truncate-lines)
5387 (> (prefix-numeric-value arg) 0)))
5390 (defun gnus-summary-reselect-current-group (&optional all rescan)
5391 "Exit and then reselect the current newsgroup.
5392 The prefix argument ALL means to select all articles."
5394 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5395 (error "Ephemeral groups can't be reselected"))
5396 (let ((current-subject (gnus-summary-article-number))
5397 (group gnus-newsgroup-name))
5398 (setq gnus-newsgroup-begin nil)
5400 ;; We have to adjust the point of group mode buffer because
5401 ;; point was moved to the next unread newsgroup by exiting.
5402 (gnus-summary-jump-to-group group)
5405 (gnus-group-get-new-news-this-group 1)))
5406 (gnus-group-read-group all t)
5407 (gnus-summary-goto-subject current-subject nil t)))
5409 (defun gnus-summary-rescan-group (&optional all)
5410 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5412 (gnus-summary-reselect-current-group all t))
5414 (defun gnus-summary-update-info (&optional non-destructive)
5416 (let ((group gnus-newsgroup-name))
5418 (when gnus-newsgroup-kill-headers
5419 (setq gnus-newsgroup-killed
5420 (gnus-compress-sequence
5422 (gnus-set-sorted-intersection
5423 (gnus-uncompress-range gnus-newsgroup-killed)
5424 (setq gnus-newsgroup-unselected
5425 (sort gnus-newsgroup-unselected '<)))
5426 (setq gnus-newsgroup-unreads
5427 (sort gnus-newsgroup-unreads '<)))
5429 (unless (listp (cdr gnus-newsgroup-killed))
5430 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5431 (let ((headers gnus-newsgroup-headers))
5432 ;; Set the new ranges of read articles.
5434 (set-buffer gnus-group-buffer)
5435 (gnus-undo-force-boundary))
5436 (gnus-update-read-articles
5437 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5438 ;; Set the current article marks.
5439 (let ((gnus-newsgroup-scored
5440 (if (and (not gnus-save-score)
5441 (not non-destructive))
5443 gnus-newsgroup-scored)))
5445 (gnus-update-marks)))
5446 ;; Do the cross-ref thing.
5447 (when gnus-use-cross-reference
5448 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5449 ;; Do not switch windows but change the buffer to work.
5450 (set-buffer gnus-group-buffer)
5451 (unless (gnus-ephemeral-group-p group)
5452 (gnus-group-update-group group)))))))
5454 (defun gnus-summary-save-newsrc (&optional force)
5455 "Save the current number of read/marked articles in the dribble buffer.
5456 The dribble buffer will then be saved.
5457 If FORCE (the prefix), also save the .newsrc file(s)."
5459 (gnus-summary-update-info t)
5461 (gnus-save-newsrc-file)
5462 (gnus-dribble-save)))
5464 (defun gnus-summary-exit (&optional temporary)
5465 "Exit reading current newsgroup, and then return to group selection mode.
5466 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
5468 (gnus-set-global-variables)
5469 (when (gnus-buffer-live-p gnus-article-buffer)
5471 (set-buffer gnus-article-buffer)
5472 (mm-destroy-parts gnus-article-mime-handles)
5473 ;; Set it to nil for safety reason.
5474 (setq gnus-article-mime-handle-alist nil)
5475 (setq gnus-article-mime-handles nil)))
5476 (gnus-kill-save-kill-buffer)
5477 (gnus-async-halt-prefetch)
5478 (let* ((group gnus-newsgroup-name)
5479 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5482 (buf (current-buffer)))
5484 ;; Do adaptive scoring, and possibly save score files.
5485 (when gnus-newsgroup-adaptive
5486 (gnus-score-adaptive))
5487 (when gnus-use-scoring
5489 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5490 ;; If we have several article buffers, we kill them at exit.
5491 (unless gnus-single-article-buffer
5492 (gnus-kill-buffer gnus-original-article-buffer)
5493 (setq gnus-article-current nil))
5494 (when gnus-use-cache
5495 (gnus-cache-possibly-remove-articles)
5496 (gnus-cache-save-buffers))
5497 (gnus-async-prefetch-remove-group group)
5498 (when gnus-suppress-duplicates
5499 (gnus-dup-enter-articles))
5500 (when gnus-use-trees
5501 (gnus-tree-close group))
5502 (when gnus-use-cache
5503 (gnus-cache-write-active))
5504 ;; Remove entries for this group.
5505 (nnmail-purge-split-history (gnus-group-real-name group))
5506 ;; Make all changes in this group permanent.
5508 (gnus-run-hooks 'gnus-exit-group-hook)
5509 (gnus-summary-update-info))
5510 (gnus-close-group group)
5511 ;; Make sure where we were, and go to next newsgroup.
5512 (set-buffer gnus-group-buffer)
5514 (gnus-group-jump-to-group group))
5515 (gnus-run-hooks 'gnus-summary-exit-hook)
5516 (unless (or quit-config
5517 ;; If this group has disappeared from the summary
5518 ;; buffer, don't skip forwards.
5519 (not (string= group (gnus-group-group-name))))
5520 (gnus-group-next-unread-group 1))
5521 (setq group-point (point))
5524 ;; If we have several article buffers, we kill them at exit.
5525 (unless gnus-single-article-buffer
5526 (gnus-kill-buffer gnus-article-buffer)
5527 (gnus-kill-buffer gnus-original-article-buffer)
5528 (setq gnus-article-current nil))
5530 (if (not gnus-kill-summary-on-exit)
5531 (gnus-deaden-summary)
5532 ;; We set all buffer-local variables to nil. It is unclear why
5533 ;; this is needed, but if we don't, buffer-local variables are
5534 ;; not garbage-collected, it seems. This would the lead to en
5535 ;; ever-growing Emacs.
5536 (gnus-summary-clear-local-variables)
5537 (when (get-buffer gnus-article-buffer)
5538 (bury-buffer gnus-article-buffer))
5539 ;; We clear the global counterparts of the buffer-local
5540 ;; variables as well, just to be on the safe side.
5541 (set-buffer gnus-group-buffer)
5542 (gnus-summary-clear-local-variables)
5543 ;; Return to group mode buffer.
5544 (when (eq mode 'gnus-summary-mode)
5545 (gnus-kill-buffer buf)))
5546 (setq gnus-current-select-method gnus-select-method)
5547 (pop-to-buffer gnus-group-buffer)
5548 (if (not quit-config)
5550 (goto-char group-point)
5551 (gnus-configure-windows 'group 'force))
5552 (gnus-handle-ephemeral-exit quit-config))
5553 ;; Clear the current group name.
5555 (setq gnus-newsgroup-name nil)))))
5557 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5558 (defun gnus-summary-exit-no-update (&optional no-questions)
5559 "Quit reading current newsgroup without updating read article info."
5561 (let* ((group gnus-newsgroup-name)
5562 (quit-config (gnus-group-quit-config group)))
5563 (when (or no-questions
5565 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5566 (gnus-async-halt-prefetch)
5568 (delq 'gnus-summary-expire-articles
5569 (copy-sequence gnus-summary-prepare-exit-hook)))
5570 (when (gnus-buffer-live-p gnus-article-buffer)
5572 (set-buffer gnus-article-buffer)
5573 (mm-destroy-parts gnus-article-mime-handles)
5574 ;; Set it to nil for safety reason.
5575 (setq gnus-article-mime-handle-alist nil)
5576 (setq gnus-article-mime-handles nil)))
5577 ;; If we have several article buffers, we kill them at exit.
5578 (unless gnus-single-article-buffer
5579 (gnus-kill-buffer gnus-article-buffer)
5580 (gnus-kill-buffer gnus-original-article-buffer)
5581 (setq gnus-article-current nil))
5582 (if (not gnus-kill-summary-on-exit)
5583 (gnus-deaden-summary)
5584 (gnus-close-group group)
5585 (gnus-summary-clear-local-variables)
5586 (set-buffer gnus-group-buffer)
5587 (gnus-summary-clear-local-variables)
5588 (when (get-buffer gnus-summary-buffer)
5589 (kill-buffer gnus-summary-buffer)))
5590 (unless gnus-single-article-buffer
5591 (setq gnus-article-current nil))
5592 (when gnus-use-trees
5593 (gnus-tree-close group))
5594 (gnus-async-prefetch-remove-group group)
5595 (when (get-buffer gnus-article-buffer)
5596 (bury-buffer gnus-article-buffer))
5597 ;; Return to the group buffer.
5598 (gnus-configure-windows 'group 'force)
5599 ;; Clear the current group name.
5600 (setq gnus-newsgroup-name nil)
5601 (when (equal (gnus-group-group-name) group)
5602 (gnus-group-next-unread-group 1))
5604 (gnus-handle-ephemeral-exit quit-config)))))
5606 (defun gnus-handle-ephemeral-exit (quit-config)
5607 "Handle movement when leaving an ephemeral group.
5608 The state which existed when entering the ephemeral is reset."
5609 (if (not (buffer-name (car quit-config)))
5610 (gnus-configure-windows 'group 'force)
5611 (set-buffer (car quit-config))
5612 (cond ((eq major-mode 'gnus-summary-mode)
5613 (gnus-set-global-variables))
5614 ((eq major-mode 'gnus-article-mode)
5616 ;; The `gnus-summary-buffer' variable may point
5617 ;; to the old summary buffer when using a single
5619 (unless (gnus-buffer-live-p gnus-summary-buffer)
5620 (set-buffer gnus-group-buffer))
5621 (set-buffer gnus-summary-buffer)
5622 (gnus-set-global-variables))))
5623 (if (or (eq (cdr quit-config) 'article)
5624 (eq (cdr quit-config) 'pick))
5626 ;; The current article may be from the ephemeral group
5627 ;; thus it is best that we reload this article
5628 (gnus-summary-show-article)
5629 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5630 (gnus-configure-windows 'pick 'force)
5631 (gnus-configure-windows (cdr quit-config) 'force)))
5632 (gnus-configure-windows (cdr quit-config) 'force))
5633 (when (eq major-mode 'gnus-summary-mode)
5634 (gnus-summary-next-subject 1 nil t)
5635 (gnus-summary-recenter)
5636 (gnus-summary-position-point))))
5640 (defvar gnus-dead-summary-mode-map nil)
5642 (unless gnus-dead-summary-mode-map
5643 (setq gnus-dead-summary-mode-map (make-keymap))
5644 (suppress-keymap gnus-dead-summary-mode-map)
5645 (substitute-key-definition
5646 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5647 (let ((keys '("\C-d" "\r" "\177" [delete])))
5649 (define-key gnus-dead-summary-mode-map
5650 (pop keys
) 'gnus-summary-wake-up-the-dead
))))
5652 (defvar gnus-dead-summary-mode nil
5653 "Minor mode for Gnus summary buffers.")
5655 (defun gnus-dead-summary-mode (&optional arg
)
5656 "Minor mode for Gnus summary buffers."
5658 (when (eq major-mode
'gnus-summary-mode
)
5659 (make-local-variable 'gnus-dead-summary-mode
)
5660 (setq gnus-dead-summary-mode
5661 (if (null arg
) (not gnus-dead-summary-mode
)
5662 (> (prefix-numeric-value arg
) 0)))
5663 (when gnus-dead-summary-mode
5664 (gnus-add-minor-mode
5665 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
5667 (defun gnus-deaden-summary ()
5668 "Make the current summary buffer into a dead summary buffer."
5669 ;; Kill any previous dead summary buffer.
5670 (when (and gnus-dead-summary
5671 (buffer-name gnus-dead-summary
))
5673 (set-buffer gnus-dead-summary
)
5674 (when gnus-dead-summary-mode
5675 (kill-buffer (current-buffer)))))
5676 ;; Make this the current dead summary.
5677 (setq gnus-dead-summary
(current-buffer))
5678 (gnus-dead-summary-mode 1)
5679 (let ((name (buffer-name)))
5680 (when (string-match "Summary" name
)
5682 (concat (substring name
0 (match-beginning 0)) "Dead "
5683 (substring name
(match-beginning 0)))
5687 (defun gnus-kill-or-deaden-summary (buffer)
5688 "Kill or deaden the summary BUFFER."
5690 (when (and (buffer-name buffer
)
5691 (not gnus-single-article-buffer
))
5694 (gnus-kill-buffer gnus-article-buffer
)
5695 (gnus-kill-buffer gnus-original-article-buffer
)))
5696 (cond (gnus-kill-summary-on-exit
5697 (when (and gnus-use-trees
5698 (gnus-buffer-exists-p buffer
))
5701 (gnus-tree-close gnus-newsgroup-name
)))
5702 (gnus-kill-buffer buffer
))
5703 ((gnus-buffer-exists-p buffer
)
5706 (gnus-deaden-summary))))))
5708 (defun gnus-summary-wake-up-the-dead (&rest args
)
5709 "Wake up the dead summary buffer."
5711 (gnus-dead-summary-mode -
1)
5712 (let ((name (buffer-name)))
5713 (when (string-match "Dead " name
)
5715 (concat (substring name
0 (match-beginning 0))
5716 (substring name
(match-end 0)))
5718 (gnus-message 3 "This dead summary is now alive again"))
5720 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5721 (defun gnus-summary-fetch-faq (&optional faq-dir
)
5722 "Fetch the FAQ for the current group.
5723 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5727 (when current-prefix-arg
5729 "Faq dir: " (and (listp gnus-group-faq-directory
)
5730 (mapcar (lambda (file) (list file
))
5731 gnus-group-faq-directory
))))))
5732 (let (gnus-faq-buffer)
5733 (when (setq gnus-faq-buffer
5734 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
5735 (gnus-configure-windows 'summary-faq
))))
5737 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5738 (defun gnus-summary-describe-group (&optional force
)
5739 "Describe the current newsgroup."
5741 (gnus-group-describe-group force gnus-newsgroup-name
))
5743 (defun gnus-summary-describe-briefly ()
5744 "Describe summary mode commands briefly."
5746 (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")))
5748 ;; Walking around group mode buffer from summary mode.
5750 (defun gnus-summary-next-group (&optional no-article target-group backward
)
5751 "Exit current newsgroup and then select next unread newsgroup.
5752 If prefix argument NO-ARTICLE is non-nil, no article is selected
5753 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5754 previous group instead."
5756 ;; Stop pre-fetching.
5757 (gnus-async-halt-prefetch)
5758 (let ((current-group gnus-newsgroup-name
)
5759 (current-buffer (current-buffer))
5761 ;; First we semi-exit this group to update Xrefs and all variables.
5762 ;; We can't do a real exit, because the window conf must remain
5763 ;; the same in case the user is prompted for info, and we don't
5764 ;; want the window conf to change before that...
5765 (gnus-summary-exit t
)
5766 (while (not entered
)
5767 ;; Then we find what group we are supposed to enter.
5768 (set-buffer gnus-group-buffer
)
5769 (gnus-group-jump-to-group current-group
)
5772 (if (eq gnus-keep-same-level
'best
)
5773 (gnus-summary-best-group gnus-newsgroup-name
)
5774 (gnus-summary-search-group backward gnus-keep-same-level
))))
5775 (if (not target-group
)
5776 ;; There are no further groups, so we return to the group
5779 (gnus-message 5 "Returning to the group buffer")
5781 (when (gnus-buffer-live-p current-buffer
)
5782 (set-buffer current-buffer
)
5783 (gnus-summary-exit))
5784 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
5785 ;; We try to enter the target group.
5786 (gnus-group-jump-to-group target-group
)
5787 (let ((unreads (gnus-group-group-unread)))
5788 (if (and (or (eq t unreads
)
5789 (and unreads
(not (zerop unreads
))))
5790 (gnus-summary-read-group
5791 target-group nil no-article
5792 (and (buffer-name current-buffer
) current-buffer
)
5795 (setq current-group target-group
5796 target-group nil
)))))))
5798 (defun gnus-summary-prev-group (&optional no-article
)
5799 "Exit current newsgroup and then select previous unread newsgroup.
5800 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5802 (gnus-summary-next-group no-article nil t
))
5804 ;; Walking around summary lines.
5806 (defun gnus-summary-first-subject (&optional unread undownloaded
)
5807 "Go to the first unread subject.
5808 If UNREAD is non-nil, go to the first unread article.
5809 Returns the article selected or nil if there are no unread articles."
5814 ((null gnus-newsgroup-data
)
5815 (gnus-message 3 "No articles in the group")
5817 ;; Pick the first article.
5819 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
5820 (gnus-data-number (car gnus-newsgroup-data
)))
5821 ;; No unread articles.
5822 ((null gnus-newsgroup-unreads
)
5823 (gnus-message 3 "No more unread articles")
5825 ;; Find the first unread article.
5827 (let ((data gnus-newsgroup-data
))
5829 (and (not (and undownloaded
5830 (eq gnus-undownloaded-mark
5831 (gnus-data-mark (car data
)))))
5832 (not (gnus-data-unread-p (car data
)))))
5833 (setq data
(cdr data
)))
5835 (goto-char (gnus-data-pos (car data
)))
5836 (gnus-data-number (car data
))))))
5837 (gnus-summary-position-point)))
5839 (defun gnus-summary-next-subject (n &optional unread dont-display
)
5840 "Go to next N'th summary line.
5841 If N is negative, go to the previous N'th subject line.
5842 If UNREAD is non-nil, only unread articles are selected.
5843 The difference between N and the actual number of steps taken is
5846 (let ((backward (< n
0))
5850 (gnus-summary-find-prev unread
)
5851 (gnus-summary-find-next unread
)))
5852 (unless (zerop (setq n
(1- n
)))
5853 (gnus-summary-show-thread)))
5855 (gnus-message 7 "No more%s articles"
5856 (if unread
" unread" "")))
5857 (unless dont-display
5858 (gnus-summary-recenter)
5859 (gnus-summary-position-point))
5862 (defun gnus-summary-next-unread-subject (n)
5863 "Go to next N'th unread summary line."
5865 (gnus-summary-next-subject n t
))
5867 (defun gnus-summary-prev-subject (n &optional unread
)
5868 "Go to previous N'th summary line.
5869 If optional argument UNREAD is non-nil, only unread article is selected."
5871 (gnus-summary-next-subject (- n
) unread
))
5873 (defun gnus-summary-prev-unread-subject (n)
5874 "Go to previous N'th unread summary line."
5876 (gnus-summary-next-subject (- n
) t
))
5878 (defun gnus-summary-goto-subject (article &optional force silent
)
5879 "Go the subject line of ARTICLE.
5880 If FORCE, also allow jumping to articles not currently shown."
5881 (interactive "nArticle number: ")
5883 (data (gnus-data-find article
)))
5884 ;; We read in the article if we have to.
5887 (gnus-summary-insert-subject
5889 (if (or (numberp force
) (vectorp force
)) force
)
5891 (setq data
(gnus-data-find article
)))
5896 (gnus-message 3 "Can't find article %d" article
))
5898 (goto-char (gnus-data-pos data
))
5899 (gnus-summary-position-point)
5902 ;; Walking around summary lines with displaying articles.
5904 (defun gnus-summary-expand-window (&optional arg
)
5905 "Make the summary buffer take up the entire Emacs frame.
5906 Given a prefix, will force an `article' buffer configuration."
5909 (gnus-configure-windows 'article
'force
)
5910 (gnus-configure-windows 'summary
'force
)))
5912 (defun gnus-summary-display-article (article &optional all-header
)
5913 "Display ARTICLE in article buffer."
5914 (when (gnus-buffer-live-p gnus-article-buffer
)
5915 (with-current-buffer gnus-article-buffer
5916 (mm-enable-multibyte-mule4)))
5917 (gnus-set-global-variables)
5921 (if gnus-summary-display-article-function
5922 (funcall gnus-summary-display-article-function article all-header
)
5923 (gnus-article-prepare article all-header
))
5924 (gnus-run-hooks 'gnus-select-article-hook
)
5925 (when (and gnus-current-article
5926 (not (zerop gnus-current-article
)))
5927 (gnus-summary-goto-subject gnus-current-article
))
5928 (gnus-summary-recenter)
5929 (when (and gnus-use-trees gnus-show-threads
)
5930 (gnus-possibly-generate-tree article
)
5931 (gnus-highlight-selected-tree article
))
5932 ;; Successfully display article.
5933 (gnus-article-set-window-start
5934 (cdr (assq article gnus-newsgroup-bookmarks
))))))
5936 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
5937 "Select the current article.
5938 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5939 non-nil, the article will be re-fetched even if it already present in
5940 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5942 ;; Make sure we are in the summary buffer to work around bbdb bug.
5943 (unless (eq major-mode
'gnus-summary-mode
)
5944 (set-buffer gnus-summary-buffer
))
5945 (let ((article (or article
(gnus-summary-article-number)))
5946 (all-headers (not (not all-headers
))) ;Must be T or NIL.
5947 gnus-summary-display-article-function
)
5949 (gnus-summary-article-pseudo-p article
)
5950 (error "This is a pseudo-article"))
5952 (set-buffer gnus-summary-buffer
)
5953 (if (or (and gnus-single-article-buffer
5954 (or (null gnus-current-article
)
5955 (null gnus-article-current
)
5956 (null (get-buffer gnus-article-buffer
))
5957 (not (eq article
(cdr gnus-article-current
)))
5958 (not (equal (car gnus-article-current
)
5959 gnus-newsgroup-name
))))
5960 (and (not gnus-single-article-buffer
)
5961 (or (null gnus-current-article
)
5962 (not (eq gnus-current-article article
))))
5964 ;; The requested article is different from the current article.
5966 (gnus-summary-display-article article all-headers
)
5967 (when (gnus-buffer-live-p gnus-article-buffer
)
5968 (with-current-buffer gnus-article-buffer
5969 (if (not gnus-article-decoded-p
) ;; a local variable
5970 (mm-disable-multibyte-mule4))))
5971 (when (or all-headers gnus-show-all-headers
)
5972 (gnus-article-show-all-headers))
5973 (gnus-article-set-window-start
5974 (cdr (assq article gnus-newsgroup-bookmarks
)))
5976 (when (or all-headers gnus-show-all-headers
)
5977 (gnus-article-show-all-headers))
5980 (defun gnus-summary-set-current-mark (&optional current-mark
)
5981 "Obsolete function."
5984 (defun gnus-summary-next-article (&optional unread subject backward push
)
5985 "Select the next article.
5986 If UNREAD, only unread articles are selected.
5987 If SUBJECT, only articles with SUBJECT are selected.
5988 If BACKWARD, the previous article is selected instead of the next."
5991 ;; Is there such an article?
5992 ((and (gnus-summary-search-forward unread subject backward
)
5993 (or (gnus-summary-display-article (gnus-summary-article-number))
5994 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
5995 (gnus-summary-position-point))
5996 ;; If not, we try the first unread, if that is wanted.
5998 gnus-auto-select-same
5999 (gnus-summary-first-unread-article))
6000 (gnus-summary-position-point)
6001 (gnus-message 6 "Wrapped"))
6002 ;; Try to get next/previous article not displayed in this group.
6003 ((and gnus-auto-extend-newsgroup
6004 (not unread
) (not subject
))
6005 (gnus-summary-goto-article
6006 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
6007 nil
(count-lines (point-min) (point))))
6008 ;; Go to next/previous group.
6010 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
6011 (gnus-summary-jump-to-group gnus-newsgroup-name
))
6012 (let ((cmd last-command-char
)
6015 (set-buffer gnus-group-buffer
)
6018 (if (eq gnus-keep-same-level
'best
)
6019 (gnus-summary-best-group gnus-newsgroup-name
)
6020 (gnus-summary-search-group backward gnus-keep-same-level
))))
6021 ;; For some reason, the group window gets selected. We change
6023 (select-window (get-buffer-window (current-buffer)))
6024 ;; Select next unread newsgroup automagically.
6026 ((or (not gnus-auto-select-next
)
6028 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
6029 ((or (eq gnus-auto-select-next
'quietly
)
6030 (and (eq gnus-auto-select-next
'slightly-quietly
)
6032 (and (eq gnus-auto-select-next
'almost-quietly
)
6033 (gnus-summary-last-article-p)))
6035 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
6037 (gnus-message 7 "No more%s articles (%s)..."
6038 (if unread
" unread" "")
6039 (if group
(concat "selecting " group
)
6041 (gnus-summary-next-group nil group backward
)))
6043 (when (gnus-key-press-event-p last-input-event
)
6044 (gnus-summary-walk-group-buffer
6045 gnus-newsgroup-name cmd unread backward point
))))))))
6047 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
6048 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
6049 (?\C-p
(gnus-group-prev-unread-group 1))))
6050 (cursor-in-echo-area t
)
6051 keve key group ended
)
6053 (set-buffer gnus-group-buffer
)
6056 (if (eq gnus-keep-same-level
'best
)
6057 (gnus-summary-best-group gnus-newsgroup-name
)
6058 (gnus-summary-search-group backward gnus-keep-same-level
))))
6061 5 "No more%s articles%s" (if unread
" unread" "")
6063 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
6064 (format " (Type %s for %s [%s])"
6065 (single-key-description cmd
) group
6066 (car (gnus-gethash group gnus-newsrc-hashtb
)))
6067 (format " (Type %s to exit %s)"
6068 (single-key-description cmd
)
6069 gnus-newsgroup-name
)))
6070 ;; Confirm auto selection.
6071 (setq key
(car (setq keve
(gnus-read-event-char))))
6074 ((assq key keystrokes
)
6075 (let ((obuf (current-buffer)))
6076 (switch-to-buffer gnus-group-buffer
)
6078 (gnus-group-jump-to-group group
))
6079 (eval (cadr (assq key keystrokes
)))
6080 (setq group
(gnus-group-group-name))
6081 (switch-to-buffer obuf
))
6085 (gnus-ephemeral-group-p gnus-newsgroup-name
))
6087 (gnus-summary-next-group nil group backward
)))
6089 (push (cdr keve
) unread-command-events
))))))
6091 (defun gnus-summary-next-unread-article ()
6092 "Select unread article after current one."
6094 (gnus-summary-next-article
6095 (or (not (eq gnus-summary-goto-unread
'never
))
6096 (gnus-summary-last-article-p (gnus-summary-article-number)))
6097 (and gnus-auto-select-same
6098 (gnus-summary-article-subject))))
6100 (defun gnus-summary-prev-article (&optional unread subject
)
6101 "Select the article after the current one.
6102 If UNREAD is non-nil, only unread articles are selected."
6104 (gnus-summary-next-article unread subject t
))
6106 (defun gnus-summary-prev-unread-article ()
6107 "Select unread article before current one."
6109 (gnus-summary-prev-article
6110 (or (not (eq gnus-summary-goto-unread
'never
))
6111 (gnus-summary-first-article-p (gnus-summary-article-number)))
6112 (and gnus-auto-select-same
6113 (gnus-summary-article-subject))))
6115 (defun gnus-summary-next-page (&optional lines circular
)
6116 "Show next page of the selected article.
6117 If at the end of the current article, select the next article.
6118 LINES says how many lines should be scrolled up.
6120 If CIRCULAR is non-nil, go to the start of the article instead of
6121 selecting the next article when reaching the end of the current
6124 (setq gnus-summary-buffer
(current-buffer))
6125 (gnus-set-global-variables)
6126 (let ((article (gnus-summary-article-number))
6127 (article-window (get-buffer-window gnus-article-buffer t
))
6129 ;; If the buffer is empty, we have no article.
6131 (error "No article to select"))
6132 (gnus-configure-windows 'article
)
6133 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
6134 (if (and (eq gnus-summary-goto-unread
'never
)
6135 (not (gnus-summary-last-article-p article
)))
6136 (gnus-summary-next-article)
6137 (gnus-summary-next-unread-article))
6138 (if (or (null gnus-current-article
)
6139 (null gnus-article-current
)
6140 (/= article
(cdr gnus-article-current
))
6141 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6142 ;; Selected subject is different from current article's.
6143 (gnus-summary-display-article article
)
6144 (when article-window
6145 (gnus-eval-in-buffer-window gnus-article-buffer
6146 (setq endp
(gnus-article-next-page lines
)))
6149 (gnus-summary-beginning-of-article))
6151 (gnus-message 3 "End of message"))
6153 (if (and (eq gnus-summary-goto-unread
'never
)
6154 (not (gnus-summary-last-article-p article
)))
6155 (gnus-summary-next-article)
6156 (gnus-summary-next-unread-article))))))))
6157 (gnus-summary-recenter)
6158 (gnus-summary-position-point)))
6160 (defun gnus-summary-prev-page (&optional lines move
)
6161 "Show previous page of selected article.
6162 Argument LINES specifies lines to be scrolled down.
6163 If MOVE, move to the previous unread article if point is at
6164 the beginning of the buffer."
6166 (let ((article (gnus-summary-article-number))
6167 (article-window (get-buffer-window gnus-article-buffer t
))
6169 (gnus-configure-windows 'article
)
6170 (if (or (null gnus-current-article
)
6171 (null gnus-article-current
)
6172 (/= article
(cdr gnus-article-current
))
6173 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
6174 ;; Selected subject is different from current article's.
6175 (gnus-summary-display-article article
)
6176 (gnus-summary-recenter)
6177 (when article-window
6178 (gnus-eval-in-buffer-window gnus-article-buffer
6179 (setq endp
(gnus-article-prev-page lines
)))
6180 (when (and move endp
)
6182 (gnus-message 3 "Beginning of message"))
6184 (if (and (eq gnus-summary-goto-unread
'never
)
6185 (not (gnus-summary-first-article-p article
)))
6186 (gnus-summary-prev-article)
6187 (gnus-summary-prev-unread-article))))))))
6188 (gnus-summary-position-point))
6190 (defun gnus-summary-prev-page-or-article (&optional lines
)
6191 "Show previous page of selected article.
6192 Argument LINES specifies lines to be scrolled down.
6193 If at the beginning of the article, go to the next article."
6195 (gnus-summary-prev-page lines t
))
6197 (defun gnus-summary-scroll-up (lines)
6198 "Scroll up (or down) one line current article.
6199 Argument LINES specifies lines to be scrolled up (or down if negative)."
6201 (gnus-configure-windows 'article
)
6202 (gnus-summary-show-thread)
6203 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
6204 (gnus-eval-in-buffer-window gnus-article-buffer
6206 (when (gnus-article-next-page lines
)
6207 (gnus-message 3 "End of message")))
6209 (gnus-article-prev-page (- lines
))))))
6210 (gnus-summary-recenter)
6211 (gnus-summary-position-point))
6213 (defun gnus-summary-scroll-down (lines)
6214 "Scroll down (or up) one line current article.
6215 Argument LINES specifies lines to be scrolled down (or up if negative)."
6217 (gnus-summary-scroll-up (- lines
)))
6219 (defun gnus-summary-next-same-subject ()
6220 "Select next article which has the same subject as current one."
6222 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
6224 (defun gnus-summary-prev-same-subject ()
6225 "Select previous article which has the same subject as current one."
6227 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
6229 (defun gnus-summary-next-unread-same-subject ()
6230 "Select next unread article which has the same subject as current one."
6232 (gnus-summary-next-article t
(gnus-summary-article-subject)))
6234 (defun gnus-summary-prev-unread-same-subject ()
6235 "Select previous unread article which has the same subject as current one."
6237 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
6239 (defun gnus-summary-first-unread-article ()
6240 "Select the first unread article.
6241 Return nil if there are no unread articles."
6244 (when (gnus-summary-first-subject t
)
6245 (gnus-summary-show-thread)
6246 (gnus-summary-first-subject t
)
6247 (gnus-summary-display-article (gnus-summary-article-number)))
6248 (gnus-summary-position-point)))
6250 (defun gnus-summary-first-unread-subject ()
6251 "Place the point on the subject line of the first unread article.
6252 Return nil if there are no unread articles."
6255 (when (gnus-summary-first-subject t
)
6256 (gnus-summary-show-thread)
6257 (gnus-summary-first-subject t
))
6258 (gnus-summary-position-point)))
6260 (defun gnus-summary-first-article ()
6261 "Select the first article.
6262 Return nil if there are no articles."
6265 (when (gnus-summary-first-subject)
6266 (gnus-summary-show-thread)
6267 (gnus-summary-first-subject)
6268 (gnus-summary-display-article (gnus-summary-article-number)))
6269 (gnus-summary-position-point)))
6271 (defun gnus-summary-best-unread-article ()
6272 "Select the unread article with the highest score."
6274 (let ((best -
1000000)
6275 (data gnus-newsgroup-data
)
6278 (and (gnus-data-unread-p (car data
))
6280 (gnus-summary-article-score (gnus-data-number (car data
))))
6283 article
(gnus-data-number (car data
))))
6284 (setq data
(cdr data
)))
6287 (gnus-summary-goto-article article
)
6288 (error "No unread articles"))
6289 (gnus-summary-position-point))))
6291 (defun gnus-summary-last-subject ()
6292 "Go to the last displayed subject line in the group."
6293 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
6295 (gnus-summary-goto-subject article
))))
6297 (defun gnus-summary-goto-article (article &optional all-headers force
)
6298 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6299 If ALL-HEADERS is non-nil, no header lines are hidden.
6300 If FORCE, go to the article even if it isn't displayed. If FORCE
6301 is a number, it is the line the article is to be displayed on."
6305 "Article number or Message-ID: "
6306 (mapcar (lambda (number) (list (int-to-string number
)))
6307 gnus-newsgroup-limit
))
6311 (if (and (stringp article
)
6312 (string-match "@" article
))
6313 (gnus-summary-refer-article article
)
6314 (when (stringp article
)
6315 (setq article
(string-to-number article
)))
6316 (if (gnus-summary-goto-subject article force
)
6317 (gnus-summary-display-article article all-headers
)
6318 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
6319 (gnus-summary-position-point)))
6321 (defun gnus-summary-goto-last-article ()
6322 "Go to the previously read article."
6325 (when gnus-last-article
6326 (gnus-summary-goto-article gnus-last-article nil t
))
6327 (gnus-summary-position-point)))
6329 (defun gnus-summary-pop-article (number)
6330 "Pop one article off the history and go to the previous.
6331 NUMBER articles will be popped off."
6334 (setq gnus-newsgroup-history
6335 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
6337 (gnus-summary-goto-article (car to
) nil t
)
6338 (error "Article history empty")))
6339 (gnus-summary-position-point))
6341 ;; Summary commands and functions for limiting the summary buffer.
6343 (defun gnus-summary-limit-to-articles (n)
6344 "Limit the summary buffer to the next N articles.
6345 If not given a prefix, use the process marked articles instead."
6348 (let ((articles (gnus-summary-work-articles n
)))
6349 (setq gnus-newsgroup-processable nil
)
6350 (gnus-summary-limit articles
))
6351 (gnus-summary-position-point)))
6353 (defun gnus-summary-pop-limit (&optional total
)
6354 "Restore the previous limit.
6355 If given a prefix, remove all limits."
6358 (setq gnus-newsgroup-limits
6359 (list (mapcar (lambda (h) (mail-header-number h
))
6360 gnus-newsgroup-headers
))))
6361 (unless gnus-newsgroup-limits
6362 (error "No limit to pop"))
6364 (gnus-summary-limit nil
'pop
)
6365 (gnus-summary-position-point)))
6367 (defun gnus-summary-limit-to-subject (subject &optional header
)
6368 "Limit the summary buffer to articles that have subjects that match a regexp."
6369 (interactive "sLimit to subject (regexp): ")
6371 (setq header
"subject"))
6372 (when (not (equal "" subject
))
6374 (let ((articles (gnus-summary-find-matching
6375 (or header
"subject") subject
'all
)))
6377 (error "Found no matches for \"%s\"" subject
))
6378 (gnus-summary-limit articles
))
6379 (gnus-summary-position-point))))
6381 (defun gnus-summary-limit-to-author (from)
6382 "Limit the summary buffer to articles that have authors that match a regexp."
6383 (interactive "sLimit to author (regexp): ")
6384 (gnus-summary-limit-to-subject from
"from"))
6386 (defun gnus-summary-limit-to-age (age &optional younger-p
)
6387 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6388 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6389 articles that are younger than AGE days."
6391 (let ((younger current-prefix-arg
)
6394 (while (not days-got
)
6395 (setq days
(if younger
6396 (read-string "Limit to articles within (in days): ")
6397 (read-string "Limit to articles old than (in days): ")))
6398 (when (> (length days
) 0)
6399 (setq days
(read days
)))
6402 (message "Please enter a number.")
6404 (list days younger
)))
6406 (let ((data gnus-newsgroup-data
)
6407 (cutoff (days-to-time age
))
6408 articles d date is-younger
)
6409 (while (setq d
(pop data
))
6410 (when (and (vectorp (gnus-data-header d
))
6411 (setq date
(mail-header-date (gnus-data-header d
))))
6412 (setq is-younger
(time-less-p
6413 (time-since (condition-case ()
6420 (push (gnus-data-number d
) articles
))))
6421 (gnus-summary-limit (nreverse articles
)))
6422 (gnus-summary-position-point)))
6424 (defun gnus-summary-limit-to-extra (header regexp
)
6425 "Limit the summary buffer to articles that match an 'extra' header."
6429 (gnus-completing-read
6430 (symbol-name (car gnus-extra-headers
))
6431 "Limit extra header:"
6433 (cons (symbol-name x
) x
))
6438 (read-string (format "Limit to header %s (regexp): " header
)))))
6439 (when (not (equal "" regexp
))
6441 (let ((articles (gnus-summary-find-matching
6442 (cons 'extra header
) regexp
'all
)))
6444 (error "Found no matches for \"%s\"" regexp
))
6445 (gnus-summary-limit articles
))
6446 (gnus-summary-position-point))))
6448 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6450 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
6452 (defun gnus-summary-limit-to-unread (&optional all
)
6453 "Limit the summary buffer to articles that are not marked as read.
6454 If ALL is non-nil, limit strictly to unread articles."
6457 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
6458 (gnus-summary-limit-to-marks
6459 ;; Concat all the marks that say that an article is read and have
6461 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6462 gnus-killed-mark gnus-kill-file-mark
6463 gnus-low-score-mark gnus-expirable-mark
6464 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6465 gnus-duplicate-mark gnus-souped-mark
)
6468 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
6469 (make-obsolete 'gnus-summary-delete-marked-with
6470 'gnus-summary-limit-exlude-marks
)
6472 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
6473 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6474 If REVERSE, limit the summary buffer to articles that are marked
6475 with MARKS. MARKS can either be a string of marks or a list of marks.
6476 Returns how many articles were removed."
6477 (interactive "sMarks: ")
6478 (gnus-summary-limit-to-marks marks t
))
6480 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
6481 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6482 If REVERSE (the prefix), limit the summary buffer to articles that are
6483 not marked with MARKS. MARKS can either be a string of marks or a
6485 Returns how many articles were removed."
6486 (interactive "sMarks: \nP")
6488 (let ((data gnus-newsgroup-data
)
6489 (marks (if (listp marks
) marks
6490 (append marks nil
))) ; Transform to list.
6493 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
6494 (memq (gnus-data-mark (car data
)) marks
))
6495 (push (gnus-data-number (car data
)) articles
))
6496 (setq data
(cdr data
)))
6497 (gnus-summary-limit articles
))
6498 (gnus-summary-position-point)))
6500 (defun gnus-summary-limit-to-score (&optional score
)
6501 "Limit to articles with score at or above SCORE."
6503 (setq score
(if score
6504 (prefix-numeric-value score
)
6505 (or gnus-summary-default-score
0)))
6506 (let ((data gnus-newsgroup-data
)
6509 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
6511 (push (gnus-data-number (car data
)) articles
))
6512 (setq data
(cdr data
)))
6514 (gnus-summary-limit articles
)
6515 (gnus-summary-position-point))))
6517 (defun gnus-summary-limit-include-thread (id)
6518 "Display all the hidden articles that in the current thread."
6519 (interactive (list (mail-header-id (gnus-summary-article-header))))
6520 (let ((articles (gnus-articles-in-thread
6521 (gnus-id-to-thread (gnus-root-id id
)))))
6523 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
6524 (gnus-summary-position-point))))
6526 (defun gnus-summary-limit-include-dormant ()
6527 "Display all the hidden articles that are marked as dormant.
6528 Note that this command only works on a subset of the articles currently
6529 fetched for this group."
6531 (unless gnus-newsgroup-dormant
6532 (error "There are no dormant articles in this group"))
6534 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
6535 (gnus-summary-position-point)))
6537 (defun gnus-summary-limit-exclude-dormant ()
6538 "Hide all dormant articles."
6541 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
6542 (gnus-summary-position-point)))
6544 (defun gnus-summary-limit-exclude-childless-dormant ()
6545 "Hide all dormant articles that have no children."
6547 (let ((data (gnus-data-list t
))
6548 articles d children
)
6549 ;; Find all articles that are either not dormant or have
6551 (while (setq d
(pop data
))
6552 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
6554 (gnus-article-children (gnus-data-number d
)))
6557 (when (memq (car children
) articles
)
6562 (push (gnus-data-number d
) articles
)))
6565 (gnus-summary-limit articles
)
6566 (gnus-summary-position-point))))
6568 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
6569 "Mark all unread excluded articles as read.
6570 If ALL, mark even excluded ticked and dormants as read."
6572 (let ((articles (gnus-sorted-complement
6574 (mapcar (lambda (h) (mail-header-number h
))
6575 gnus-newsgroup-headers
)
6577 (sort gnus-newsgroup-limit
'<)))
6579 (setq gnus-newsgroup-unreads
6580 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit
))
6582 (setq gnus-newsgroup-dormant nil
6583 gnus-newsgroup-marked nil
6584 gnus-newsgroup-reads
6586 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
6587 gnus-newsgroup-reads
))
6588 (while (setq article
(pop articles
))
6589 (unless (or (memq article gnus-newsgroup-dormant
)
6590 (memq article gnus-newsgroup-marked
))
6591 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
6593 (defun gnus-summary-limit (articles &optional pop
)
6595 ;; We pop the previous limit off the stack and use that.
6596 (setq articles
(car gnus-newsgroup-limits
)
6597 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
6598 ;; We use the new limit, so we push the old limit on the stack.
6599 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
6601 (setq gnus-newsgroup-limit articles
)
6602 (let ((total (length gnus-newsgroup-data
))
6603 (data (gnus-data-find-list (gnus-summary-article-number)))
6604 (gnus-summary-mark-below nil
) ; Inhibit this.
6606 ;; This will do all the work of generating the new summary buffer
6607 ;; according to the new limit.
6608 (gnus-summary-prepare)
6609 ;; Hide any threads, possibly.
6610 (and gnus-show-threads
6611 gnus-thread-hide-subtree
6612 (gnus-summary-hide-all-threads))
6613 ;; Try to return to the article you were at, or one in the
6616 ;; We try to find some article after the current one.
6618 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
6621 (setq data
(cdr data
))))
6623 ;; If there is no data, that means that we were after the last
6624 ;; article. The same goes when we can't find any articles
6625 ;; after the current one.
6626 (goto-char (point-max))
6627 (gnus-summary-find-prev))
6628 (gnus-set-mode-line 'summary
)
6629 ;; We return how many articles were removed from the summary
6630 ;; buffer as a result of the new limit.
6631 (- total
(length gnus-newsgroup-data
))))
6633 (defsubst gnus-invisible-cut-children
(threads)
6636 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
6641 (defsubst gnus-cut-thread
(thread)
6642 "Go forwards in the thread until we find an article that we want to display."
6643 (when (or (eq gnus-fetch-old-headers
'some
)
6644 (eq gnus-fetch-old-headers
'invisible
)
6645 (numberp gnus-fetch-old-headers
)
6646 (eq gnus-build-sparse-threads
'some
)
6647 (eq gnus-build-sparse-threads
'more
))
6648 ;; Deal with old-fetched headers and sparse threads.
6652 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
6653 (gnus-summary-article-ancient-p
6654 (mail-header-number (car thread
))))
6655 (if (or (<= (length (cdr thread
)) 1)
6656 (eq gnus-fetch-old-headers
'invisible
))
6657 (setq gnus-newsgroup-limit
6658 (delq (mail-header-number (car thread
))
6659 gnus-newsgroup-limit
)
6660 thread
(cadr thread
))
6661 (when (gnus-invisible-cut-children (cdr thread
))
6662 (let ((th (cdr thread
)))
6664 (if (memq (mail-header-number (caar th
))
6665 gnus-newsgroup-limit
)
6666 (setq thread
(car th
)
6668 (setq th
(cdr th
))))))))))
6671 (defun gnus-cut-threads (threads)
6672 "Cut off all uninteresting articles from the beginning of threads."
6673 (when (or (eq gnus-fetch-old-headers
'some
)
6674 (eq gnus-fetch-old-headers
'invisible
)
6675 (numberp gnus-fetch-old-headers
)
6676 (eq gnus-build-sparse-threads
'some
)
6677 (eq gnus-build-sparse-threads
'more
))
6680 (setcar th
(gnus-cut-thread (car th
)))
6681 (setq th
(cdr th
)))))
6682 ;; Remove nixed out threads.
6685 (defun gnus-summary-initial-limit (&optional show-if-empty
)
6686 "Figure out what the initial limit is supposed to be on group entry.
6687 This entails weeding out unwanted dormants, low-scored articles,
6688 fetch-old-headers verbiage, and so on."
6689 ;; Most groups have nothing to remove.
6690 (if (or gnus-inhibit-limiting
6691 (and (null gnus-newsgroup-dormant
)
6692 (not (eq gnus-fetch-old-headers
'some
))
6693 (not (numberp gnus-fetch-old-headers
))
6694 (not (eq gnus-fetch-old-headers
'invisible
))
6695 (null gnus-summary-expunge-below
)
6696 (not (eq gnus-build-sparse-threads
'some
))
6697 (not (eq gnus-build-sparse-threads
'more
))
6698 (null gnus-thread-expunge-below
)
6699 (not gnus-use-nocem
)))
6701 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
6702 (setq gnus-newsgroup-limit nil
)
6705 (unless (car (symbol-value node
))
6706 ;; These threads have no parents -- they are roots.
6707 (let ((nodes (cdr (symbol-value node
)))
6710 (if (and gnus-thread-expunge-below
6711 (< (gnus-thread-total-score (car nodes
))
6712 gnus-thread-expunge-below
))
6713 (gnus-expunge-thread (pop nodes
))
6714 (setq thread
(pop nodes
))
6715 (gnus-summary-limit-children thread
))))))
6716 gnus-newsgroup-dependencies
)
6717 ;; If this limitation resulted in an empty group, we might
6718 ;; pop the previous limit and use it instead.
6719 (when (and (not gnus-newsgroup-limit
)
6721 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
6722 gnus-newsgroup-limit
))
6724 (defun gnus-summary-limit-children (thread)
6725 "Return 1 if this subthread is visible and 0 if it is not."
6726 ;; First we get the number of visible children to this thread. This
6727 ;; is done by recursing down the thread using this function, so this
6728 ;; will really go down to a leaf article first, before slowly
6729 ;; working its way up towards the root.
6733 (apply '+ (mapcar 'gnus-summary-limit-children
6736 (number (mail-header-number (car thread
)))
6739 (not (memq number gnus-newsgroup-marked
))
6741 ;; If this article is dormant and has absolutely no visible
6742 ;; children, then this article isn't visible.
6743 (and (memq number gnus-newsgroup-dormant
)
6745 ;; If this is "fetch-old-headered" and there is no
6746 ;; visible children, then we don't want this article.
6747 (and (or (eq gnus-fetch-old-headers
'some
)
6748 (numberp gnus-fetch-old-headers
))
6749 (gnus-summary-article-ancient-p number
)
6751 ;; If this is "fetch-old-headered" and `invisible', then
6752 ;; we don't want this article.
6753 (and (eq gnus-fetch-old-headers
'invisible
)
6754 (gnus-summary-article-ancient-p number
))
6755 ;; If this is a sparsely inserted article with no children,
6756 ;; we don't want it.
6757 (and (eq gnus-build-sparse-threads
'some
)
6758 (gnus-summary-article-sparse-p number
)
6760 ;; If we use expunging, and this article is really
6761 ;; low-scored, then we don't want this article.
6762 (when (and gnus-summary-expunge-below
6764 (or (cdr (assq number gnus-newsgroup-scored
))
6765 gnus-summary-default-score
))
6766 gnus-summary-expunge-below
))
6767 ;; We increase the expunge-tally here, but that has
6768 ;; nothing to do with the limits, really.
6769 (incf gnus-newsgroup-expunged-tally
)
6770 ;; We also mark as read here, if that's wanted.
6771 (when (and gnus-summary-mark-below
6772 (< score gnus-summary-mark-below
))
6773 (setq gnus-newsgroup-unreads
6774 (delq number gnus-newsgroup-unreads
))
6775 (if gnus-newsgroup-auto-expire
6776 (push number gnus-newsgroup-expirable
)
6777 (push (cons number gnus-low-score-mark
)
6778 gnus-newsgroup-reads
)))
6780 ;; Check NoCeM things.
6781 (if (and gnus-use-nocem
6782 (gnus-nocem-unwanted-article-p
6783 (mail-header-id (car thread
))))
6785 (setq gnus-newsgroup-unreads
6786 (delq number gnus-newsgroup-unreads
))
6788 ;; Nope, invisible article.
6790 ;; Ok, this article is to be visible, so we add it to the limit
6792 (push number gnus-newsgroup-limit
)
6795 (defun gnus-expunge-thread (thread)
6796 "Mark all articles in THREAD as read."
6797 (let* ((number (mail-header-number (car thread
))))
6798 (incf gnus-newsgroup-expunged-tally
)
6799 ;; We also mark as read here, if that's wanted.
6800 (setq gnus-newsgroup-unreads
6801 (delq number gnus-newsgroup-unreads
))
6802 (if gnus-newsgroup-auto-expire
6803 (push number gnus-newsgroup-expirable
)
6804 (push (cons number gnus-low-score-mark
)
6805 gnus-newsgroup-reads
)))
6806 ;; Go recursively through all subthreads.
6807 (mapcar 'gnus-expunge-thread
(cdr thread
)))
6809 ;; Summary article oriented commands
6811 (defun gnus-summary-refer-parent-article (n)
6812 "Refer parent article N times.
6813 If N is negative, go to ancestor -N instead.
6814 The difference between N and the number of articles fetched is returned."
6818 (when (not (natnump n
))
6823 (setq header
(gnus-summary-article-header))
6824 (if (and (eq (mail-header-number header
)
6825 (cdr gnus-article-current
))
6826 (equal gnus-newsgroup-name
6827 (car gnus-article-current
)))
6828 ;; If we try to find the parent of the currently
6829 ;; displayed article, then we take a look at the actual
6830 ;; References header, since this is slightly more
6831 ;; reliable than the References field we got from the
6834 (set-buffer gnus-original-article-buffer
)
6835 (nnheader-narrow-to-headers)
6836 (unless (setq ref
(message-fetch-field "references"))
6837 (setq ref
(message-fetch-field "in-reply-to")))
6840 ;; It's not the current article, so we take a bet on
6841 ;; the value we got from the server.
6842 (mail-header-references header
)))
6844 (not (equal ref
"")))
6845 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
6846 (gnus-message 1 "Couldn't find parent"))
6847 (gnus-message 1 "No references in article %d"
6848 (gnus-summary-article-number))
6851 (gnus-summary-position-point)
6854 (defun gnus-summary-refer-references ()
6855 "Fetch all articles mentioned in the References header.
6856 Return the number of articles fetched."
6858 (let ((ref (mail-header-references (gnus-summary-article-header)))
6859 (current (gnus-summary-article-number))
6863 (error "No References in the current article")
6864 ;; For each Message-ID in the References header...
6865 (while (string-match "<[^>]*>" ref
)
6867 ;; ... fetch that article.
6868 (gnus-summary-refer-article
6869 (prog1 (match-string 0 ref
)
6870 (setq ref
(substring ref
(match-end 0))))))
6871 (gnus-summary-goto-subject current
)
6872 (gnus-summary-position-point)
6875 (defun gnus-summary-refer-thread (&optional limit
)
6876 "Fetch all articles in the current thread.
6877 If LIMIT (the numerical prefix), fetch that many old headers instead
6878 of what's specified by the `gnus-refer-thread-limit' variable."
6880 (let ((id (mail-header-id (gnus-summary-article-header)))
6881 (limit (if limit
(prefix-numeric-value limit
)
6882 gnus-refer-thread-limit
)))
6883 ;; We want to fetch LIMIT *old* headers, but we also have to
6884 ;; re-fetch all the headers in the current buffer, because many of
6885 ;; them may be undisplayed. So we adjust LIMIT.
6886 (when (numberp limit
)
6887 (incf limit
(- gnus-newsgroup-end gnus-newsgroup-begin
)))
6888 (unless (eq gnus-fetch-old-headers
'invisible
)
6889 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
6890 ;; Retrieve the headers and read them in.
6891 (if (eq (gnus-retrieve-headers
6892 (list gnus-newsgroup-end
) gnus-newsgroup-name limit
)
6894 (gnus-build-all-threads)
6895 (error "Can't fetch thread from backends that don't support NOV"))
6896 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
6897 (gnus-summary-limit-include-thread id
)))
6899 (defun gnus-summary-refer-article (message-id)
6900 "Fetch an article specified by MESSAGE-ID."
6901 (interactive "sMessage-ID: ")
6902 (when (and (stringp message-id
)
6903 (not (zerop (length message-id
))))
6904 ;; Construct the correct Message-ID if necessary.
6905 ;; Suggested by tale@pawl.rpi.edu.
6906 (unless (string-match "^<" message-id
)
6907 (setq message-id
(concat "<" message-id
)))
6908 (unless (string-match ">$" message-id
)
6909 (setq message-id
(concat message-id
">")))
6910 (let* ((header (gnus-id-to-header message-id
))
6912 (gnus-summary-article-sparse-p
6913 (mail-header-number header
))
6914 (memq (mail-header-number header
)
6915 gnus-newsgroup-limit
)))
6918 ;; If the article is present in the buffer we just go to it.
6920 (or (not (gnus-summary-article-sparse-p
6921 (mail-header-number header
)))
6924 (gnus-summary-goto-article
6925 (mail-header-number header
) nil t
)
6927 (gnus-summary-update-article (mail-header-number header
)))))
6929 ;; We fetch the article.
6931 (dolist (gnus-override-method (gnus-refer-article-methods))
6932 (gnus-check-server gnus-override-method
)
6933 ;; Fetch the header, and display the article.
6934 (when (setq number
(gnus-summary-insert-subject message-id
))
6935 (gnus-summary-select-article nil nil nil number
)
6937 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
6939 (defun gnus-refer-article-methods ()
6940 "Return a list of referrable methods."
6942 ;; No method, so we default to current and native.
6943 ((null gnus-refer-article-method
)
6944 (list gnus-current-select-method gnus-select-method
))
6946 ((eq 'current gnus-refer-article-method
)
6947 (list gnus-current-select-method
))
6948 ;; List of select methods.
6949 ((not (and (symbolp (car gnus-refer-article-method
))
6950 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
6952 (dolist (method gnus-refer-article-method
)
6953 (push (if (eq 'current method
)
6954 gnus-current-select-method
6958 ;; One single select method.
6960 (list gnus-refer-article-method
))))
6962 (defun gnus-summary-edit-parameters ()
6963 "Edit the group parameters of the current group."
6965 (gnus-group-edit-group gnus-newsgroup-name
'params
))
6967 (defun gnus-summary-customize-parameters ()
6968 "Customize the group parameters of the current group."
6970 (gnus-group-customize gnus-newsgroup-name
))
6972 (defun gnus-summary-enter-digest-group (&optional force
)
6973 "Enter an nndoc group based on the current article.
6974 If FORCE, force a digest interpretation. If not, try
6975 to guess what the document format is."
6977 (let ((conf gnus-current-window-configuration
))
6979 (gnus-summary-select-article))
6980 (setq gnus-current-window-configuration conf
)
6981 (let* ((name (format "%s-%d"
6982 (gnus-group-prefixed-name
6983 gnus-newsgroup-name
(list 'nndoc
""))
6985 (set-buffer gnus-summary-buffer
)
6986 gnus-current-article
)))
6987 (ogroup gnus-newsgroup-name
)
6988 (params (append (gnus-info-params (gnus-get-info ogroup
))
6989 (list (cons 'to-group ogroup
))
6990 (list (cons 'save-article-group ogroup
))))
6991 (case-fold-search t
)
6992 (buf (current-buffer))
6995 (set-buffer gnus-original-article-buffer
)
6996 ;; Have the digest group inherit the main mail address of
6997 ;; the parent article.
6998 (when (setq to-address
(or (message-fetch-field "reply-to")
6999 (message-fetch-field "from")))
7000 (setq params
(append
7001 (list (cons 'to-address
7002 (funcall gnus-decode-encoded-word-function
7004 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
7005 (insert-buffer-substring gnus-original-article-buffer
)
7006 ;; Remove lines that may lead nndoc to misinterpret the
7009 (goto-char (point-min))
7010 (or (search-forward "\n\n" nil t
) (point)))
7011 (goto-char (point-min))
7012 (delete-matching-lines "^Path:\\|^From ")
7015 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
7016 (gnus-newsgroup-ephemeral-ignored-charsets
7017 gnus-newsgroup-ignored-charsets
))
7018 (gnus-group-read-ephemeral-group
7019 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
7021 ,(if force
'mbox
'guess
))) t
))
7022 ;; Make all postings to this group go to the parent group.
7023 (nconc (gnus-info-params (gnus-get-info name
))
7025 ;; Couldn't select this doc group.
7026 (switch-to-buffer buf
)
7027 (gnus-set-global-variables)
7028 (gnus-configure-windows 'summary
)
7029 (gnus-message 3 "Article couldn't be entered?"))
7030 (kill-buffer dig
)))))
7032 (defun gnus-summary-read-document (n)
7033 "Open a new group based on the current article(s).
7034 This will allow you to read digests and other similar
7035 documents as newsgroups.
7036 Obeys the standard process/prefix convention."
7038 (let* ((articles (gnus-summary-work-articles n
))
7039 (ogroup gnus-newsgroup-name
)
7040 (params (append (gnus-info-params (gnus-get-info ogroup
))
7041 (list (cons 'to-group ogroup
))))
7042 article group egroup groups vgroup
)
7043 (while (setq article
(pop articles
))
7044 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
7045 (gnus-summary-remove-process-mark article
)
7046 (when (gnus-summary-display-article article
)
7049 (insert-buffer-substring gnus-original-article-buffer
)
7050 ;; Remove some headers that may lead nndoc to make
7052 (message-narrow-to-head)
7053 (goto-char (point-min))
7054 (delete-matching-lines "^\\(Path\\):\\|^From ")
7057 (gnus-group-read-ephemeral-group
7058 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
7059 (nndoc-article-type guess
))
7062 ;; Make all postings to this group go to the parent group.
7063 (nconc (gnus-info-params (gnus-get-info egroup
))
7065 (push egroup groups
))
7066 ;; Couldn't select this doc group.
7067 (gnus-error 3 "Article couldn't be entered"))))))
7068 ;; Now we have selected all the documents.
7071 (error "None of the articles could be interpreted as documents"))
7072 ((gnus-group-read-ephemeral-group
7073 (setq vgroup
(format
7074 "nnvirtual:%s-%s" gnus-newsgroup-name
7075 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7076 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
7078 (cons (current-buffer) 'summary
)))
7080 (error "Couldn't select virtual nndoc group")))))
7082 (defun gnus-summary-isearch-article (&optional regexp-p
)
7083 "Do incremental search forward on the current article.
7084 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7086 (gnus-summary-select-article)
7087 (gnus-configure-windows 'article
)
7088 (gnus-eval-in-buffer-window gnus-article-buffer
7091 (isearch-forward regexp-p
))))
7093 (defun gnus-summary-search-article-forward (regexp &optional backward
)
7094 "Search for an article containing REGEXP forward.
7095 If BACKWARD, search backward instead."
7098 (format "Search article %s (regexp%s): "
7099 (if current-prefix-arg
"backward" "forward")
7100 (if gnus-last-search-regexp
7101 (concat ", default " gnus-last-search-regexp
)
7103 current-prefix-arg
))
7104 (if (string-equal regexp
"")
7105 (setq regexp
(or gnus-last-search-regexp
""))
7106 (setq gnus-last-search-regexp regexp
))
7107 (if (gnus-summary-search-article regexp backward
)
7108 (gnus-summary-show-thread)
7109 (error "Search failed: \"%s\"" regexp
)))
7111 (defun gnus-summary-search-article-backward (regexp)
7112 "Search for an article containing REGEXP backward."
7115 (format "Search article backward (regexp%s): "
7116 (if gnus-last-search-regexp
7117 (concat ", default " gnus-last-search-regexp
)
7119 (gnus-summary-search-article-forward regexp
'backward
))
7121 (defun gnus-summary-search-article (regexp &optional backward
)
7122 "Search for an article containing REGEXP.
7123 Optional argument BACKWARD means do search for backward.
7124 `gnus-select-article-hook' is not called during the search."
7125 ;; We have to require this here to make sure that the following
7126 ;; dynamic binding isn't shadowed by autoloading.
7127 (require 'gnus-async
)
7129 (let ((gnus-select-article-hook nil
) ;Disable hook.
7130 (gnus-article-prepare-hook nil
)
7131 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
7132 (gnus-use-article-prefetch nil
)
7133 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
7134 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
7135 (sum (current-buffer))
7136 (gnus-display-mime-function nil
)
7139 (gnus-save-hidden-threads
7140 (gnus-summary-select-article)
7141 (set-buffer gnus-article-buffer
)
7142 (goto-char (window-point (get-buffer-window (current-buffer))))
7146 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
7148 (re-search-backward regexp nil t
)
7149 (re-search-forward regexp nil t
))
7150 ;; We found the regexp.
7155 (get-buffer-window (current-buffer))
7159 (get-buffer-window (current-buffer))
7162 (setq point
(point)))
7163 ;; We didn't find it, so we go to the next article.
7166 (while (eq found
'not
)
7167 (if (not (if backward
(gnus-summary-find-prev)
7168 (gnus-summary-find-next)))
7169 ;; No more articles.
7171 ;; Select the next article and adjust point.
7172 (unless (gnus-summary-article-sparse-p
7173 (gnus-summary-article-number))
7175 (gnus-summary-select-article)
7176 (set-buffer gnus-article-buffer
)
7178 (goto-char (if backward
(point-max) (point-min))))))))
7179 (gnus-message 7 ""))
7180 ;; Return whether we found the regexp.
7181 (when (eq found
'found
)
7183 (gnus-summary-show-thread)
7184 (gnus-summary-goto-subject gnus-current-article
)
7185 (gnus-summary-position-point)
7188 (defun gnus-summary-find-matching (header regexp
&optional backward unread
7190 "Return a list of all articles that match REGEXP on HEADER.
7191 The search stars on the current article and goes forwards unless
7192 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7193 If UNREAD is non-nil, only unread articles will
7194 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7195 in the comparisons."
7196 (let ((data (if (eq backward
'all
) gnus-newsgroup-data
7197 (gnus-data-find-list
7198 (gnus-summary-article-number) (gnus-data-list backward
))))
7199 (case-fold-search (not not-case-fold
))
7202 (if (eq (car header
) 'extra
)
7205 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
7207 (error "%s is an invalid header" header
))
7208 (unless (fboundp (intern (concat "mail-header-" header
)))
7209 (error "%s is not a valid header" header
))
7210 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
7213 (and (or (not unread
) ; We want all articles...
7214 (gnus-data-unread-p d
)) ; Or just unreads.
7215 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
7216 (string-match regexp
(funcall func
(gnus-data-header d
))) ; Match.
7217 (push (gnus-data-number d
) articles
)) ; Success!
7218 (setq data
(cdr data
)))
7219 (nreverse articles
)))
7221 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
7222 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7223 If HEADER is an empty string (or nil), the match is done on the entire
7224 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7226 (list (let ((completion-ignore-case t
))
7229 (mapcar (lambda (string) (list string
))
7230 '("Number" "Subject" "From" "Lines" "Date"
7231 "Message-ID" "Xref" "References" "Body"))
7232 nil
'require-match
))
7233 (read-string "Regexp: ")
7234 (read-key-sequence "Command: ")
7235 current-prefix-arg
))
7236 (when (equal header
"Body")
7238 ;; Hidden thread subtrees must be searched as well.
7239 (gnus-summary-show-all-threads)
7240 ;; We don't want to change current point nor window configuration.
7242 (save-window-excursion
7243 (gnus-message 6 "Executing %s..." (key-description command
))
7244 ;; We'd like to execute COMMAND interactively so as to give arguments.
7245 (gnus-execute header regexp
7246 `(call-interactively ',(key-binding command
))
7248 (gnus-message 6 "Executing %s...done" (key-description command
)))))
7250 (defun gnus-summary-beginning-of-article ()
7251 "Scroll the article back to the beginning."
7253 (gnus-summary-select-article)
7254 (gnus-configure-windows 'article
)
7255 (gnus-eval-in-buffer-window gnus-article-buffer
7257 (goto-char (point-min))
7258 (when gnus-page-broken
7259 (gnus-narrow-to-page))))
7261 (defun gnus-summary-end-of-article ()
7262 "Scroll to the end of the article."
7264 (gnus-summary-select-article)
7265 (gnus-configure-windows 'article
)
7266 (gnus-eval-in-buffer-window gnus-article-buffer
7268 (goto-char (point-max))
7270 (when gnus-page-broken
7271 (gnus-narrow-to-page))))
7273 (defun gnus-summary-print-article (&optional filename n
)
7274 "Generate and print a PostScript image of the N next (mail) articles.
7276 If N is negative, print the N previous articles. If N is nil and articles
7277 have been marked with the process mark, print these instead.
7279 If the optional first argument FILENAME is nil, send the image to the
7280 printer. If FILENAME is a string, save the PostScript image in a file with
7281 that name. If FILENAME is a number, prompt the user for the name of the file
7283 (interactive (list (ps-print-preprint current-prefix-arg
)
7284 current-prefix-arg
))
7285 (dolist (article (gnus-summary-work-articles n
))
7286 (gnus-summary-select-article nil nil
'pseudo article
)
7287 (gnus-eval-in-buffer-window gnus-article-buffer
7288 (let ((buffer (generate-new-buffer " *print*")))
7291 (copy-to-buffer buffer
(point-min) (point-max))
7293 (gnus-article-delete-invisible-text)
7294 (let ((ps-left-header
7297 (mail-header-subject gnus-current-headers
) ")")
7299 (mail-header-from gnus-current-headers
) ")")))
7302 "/pagenumberstring load"
7304 (mail-header-date gnus-current-headers
) ")"))))
7305 (gnus-run-hooks 'gnus-ps-print-hook
)
7307 (ps-print-buffer-with-faces filename
))))
7308 (kill-buffer buffer
))))))
7310 (defun gnus-summary-show-article (&optional arg
)
7311 "Force re-fetching of the current article.
7312 If ARG (the prefix) is a number, show the article with the charset
7313 defined in `gnus-summary-show-article-charset-alist', or the charset
7315 If ARG (the prefix) is non-nil and not a number, show the raw article
7316 without any article massaging functions being run."
7320 (let ((gnus-newsgroup-charset
7321 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
7322 (read-coding-system "Charset: ")))
7323 (gnus-newsgroup-ignored-charsets 'gnus-all
))
7324 (gnus-summary-select-article nil
'force
)))
7326 ;; Select the article the normal way.
7327 (gnus-summary-select-article nil
'force
))
7329 ;; We have to require this here to make sure that the following
7330 ;; dynamic binding isn't shadowed by autoloading.
7331 (require 'gnus-async
)
7333 ;; Bind the article treatment functions to nil.
7334 (let ((gnus-have-all-headers t
)
7335 gnus-article-prepare-hook
7336 gnus-article-decode-hook
7337 gnus-display-mime-function
7339 ;; Destroy any MIME parts.
7340 (when (gnus-buffer-live-p gnus-article-buffer
)
7342 (set-buffer gnus-article-buffer
)
7343 (mm-destroy-parts gnus-article-mime-handles
)
7344 ;; Set it to nil for safety reason.
7345 (setq gnus-article-mime-handle-alist nil
)
7346 (setq gnus-article-mime-handles nil
)))
7347 (gnus-summary-select-article nil
'force
))))
7348 (gnus-summary-goto-subject gnus-current-article
)
7349 (gnus-summary-position-point))
7351 (defun gnus-summary-verbose-headers (&optional arg
)
7352 "Toggle permanent full header display.
7353 If ARG is a positive number, turn header display on.
7354 If ARG is a negative number, turn header display off."
7356 (setq gnus-show-all-headers
7357 (cond ((or (not (numberp arg
))
7359 (not gnus-show-all-headers
))
7362 (gnus-summary-show-article))
7364 (defun gnus-summary-toggle-header (&optional arg
)
7365 "Show the headers if they are hidden, or hide them if they are shown.
7366 If ARG is a positive number, show the entire header.
7367 If ARG is a negative number, hide the unwanted header lines."
7370 (set-buffer gnus-article-buffer
)
7372 (let* ((buffer-read-only nil
)
7373 (inhibit-point-motion-hooks t
)
7379 (article-narrow-to-head)
7380 (gnus-article-hidden-text-p 'headers
))))
7381 (goto-char (point-min))
7382 (when (search-forward "\n\n" nil t
)
7383 (delete-region (point-min) (1- (point))))
7384 (goto-char (point-min))
7386 (set-buffer gnus-original-article-buffer
)
7387 (goto-char (point-min))
7388 (setq e
(1- (or (search-forward "\n\n" nil t
) (point-max)))))
7389 (insert-buffer-substring gnus-original-article-buffer
1 e
)
7391 (narrow-to-region (point-min) (point))
7392 (article-decode-encoded-words)
7394 (let ((gnus-treat-hide-headers nil
)
7395 (gnus-treat-hide-boring-headers nil
))
7396 (setq gnus-article-wash-types
7397 (delq 'headers gnus-article-wash-types
))
7398 (gnus-treat-article 'head
))
7399 (gnus-treat-article 'head
)))
7400 (gnus-set-mode-line 'article
)))))
7402 (defun gnus-summary-show-all-headers ()
7403 "Make all header lines visible."
7405 (gnus-article-show-all-headers))
7407 (defun gnus-summary-caesar-message (&optional arg
)
7408 "Caesar rotate the current article by 13.
7409 The numerical prefix specifies how many places to rotate each letter
7412 (gnus-summary-select-article)
7413 (let ((mail-header-separator ""))
7414 (gnus-eval-in-buffer-window gnus-article-buffer
7417 (let ((start (window-start))
7419 (message-caesar-buffer-body arg
)
7420 (set-window-start (get-buffer-window (current-buffer)) start
))))))
7422 (defun gnus-summary-stop-page-breaking ()
7423 "Stop page breaking in the current article."
7425 (gnus-summary-select-article)
7426 (gnus-eval-in-buffer-window gnus-article-buffer
7428 (when (gnus-visual-p 'page-marker
)
7429 (let ((buffer-read-only nil
))
7430 (gnus-remove-text-with-property 'gnus-prev
)
7431 (gnus-remove-text-with-property 'gnus-next
))
7432 (setq gnus-page-broken nil
))))
7434 (defun gnus-summary-move-article (&optional n to-newsgroup
7435 select-method action
)
7436 "Move the current article to a different newsgroup.
7437 If N is a positive number, move the N next articles.
7438 If N is a negative number, move the N previous articles.
7439 If N is nil and any articles have been marked with the process mark,
7440 move those articles instead.
7441 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7442 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7443 re-spool using this method.
7445 For this function to work, both the current newsgroup and the
7446 newsgroup that you want to move to have to support the `request-move'
7447 and `request-accept' functions.
7449 ACTION can be either `move' (the default), `crosspost' or `copy'."
7452 (setq action
'move
))
7453 ;; Disable marking as read.
7454 (let (gnus-mark-article-hook)
7455 (save-window-excursion
7456 (gnus-summary-select-article)))
7457 ;; Check whether the source group supports the required functions.
7458 (cond ((and (eq action
'move
)
7459 (not (gnus-check-backend-function
7460 'request-move-article gnus-newsgroup-name
)))
7461 (error "The current group does not support article moving"))
7462 ((and (eq action
'crosspost
)
7463 (not (gnus-check-backend-function
7464 'request-replace-article gnus-newsgroup-name
)))
7465 (error "The current group does not support article editing")))
7466 (let ((articles (gnus-summary-work-articles n
))
7467 (prefix (if (gnus-check-backend-function
7468 'request-move-article gnus-newsgroup-name
)
7469 (gnus-group-real-prefix gnus-newsgroup-name
)
7471 (names '((move "Move" "Moving")
7472 (copy "Copy" "Copying")
7473 (crosspost "Crosspost" "Crossposting")))
7474 (copy-buf (save-excursion
7475 (nnheader-set-temp-buffer " *copy article*")))
7476 art-group to-method new-xref article to-groups
)
7477 (unless (assq action names
)
7478 (error "Unknown action %s" action
))
7479 ;; Read the newsgroup name.
7480 (when (and (not to-newsgroup
)
7481 (not select-method
))
7483 (gnus-read-move-group-name
7484 (cadr (assq action names
))
7485 (symbol-value (intern (format "gnus-current-%s-group" action
)))
7487 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
7488 (setq to-method
(or select-method
7489 (gnus-server-to-method
7490 (gnus-group-method to-newsgroup
))))
7491 ;; Check the method we are to move this article to...
7492 (unless (gnus-check-backend-function
7493 'request-accept-article
(car to-method
))
7494 (error "%s does not support article copying" (car to-method
)))
7495 (unless (gnus-check-server to-method
)
7496 (error "Can't open server %s" (car to-method
)))
7497 (gnus-message 6 "%s to %s: %s..."
7498 (caddr (assq action names
))
7499 (or (car select-method
) to-newsgroup
) articles
)
7501 (setq article
(pop articles
))
7505 ;; Move the article.
7507 ;; Remove this article from future suppression.
7508 (gnus-dup-unsuppress-article article
)
7509 (gnus-request-move-article
7510 article
; Article to move
7511 gnus-newsgroup-name
; From newsgroup
7512 (nth 1 (gnus-find-method-for-group
7513 gnus-newsgroup-name
)) ; Server
7514 (list 'gnus-request-accept-article
7515 to-newsgroup
(list 'quote select-method
)
7516 (not articles
) t
) ; Accept form
7517 (not articles
))) ; Only save nov last time
7518 ;; Copy the article.
7521 (set-buffer copy-buf
)
7522 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7523 (gnus-request-accept-article
7524 to-newsgroup select-method
(not articles
) t
))))
7525 ;; Crosspost the article.
7526 ((eq action
'crosspost
)
7527 (let ((xref (message-tokenize-header
7528 (mail-header-xref (gnus-summary-article-header article
))
7530 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
7533 (setq xref
(list (system-name))))
7536 (mapconcat 'identity
7537 (delete "Xref:" (delete new-xref xref
))
7541 (set-buffer copy-buf
)
7542 ;; First put the article in the destination group.
7543 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7544 (when (consp (setq art-group
7545 (gnus-request-accept-article
7546 to-newsgroup select-method
(not articles
))))
7547 (setq new-xref
(concat new-xref
" " (car art-group
)
7548 ":" (cdr art-group
)))
7549 ;; Now we have the new Xrefs header, so we insert
7550 ;; it and replace the new article.
7551 (nnheader-replace-header "Xref" new-xref
)
7552 (gnus-request-replace-article
7553 (cdr art-group
) to-newsgroup
(current-buffer))
7557 (gnus-message 1 "Couldn't %s article %s: %s"
7558 (cadr (assq action names
)) article
7559 (nnheader-get-report (car to-method
))))
7560 ((eq art-group
'junk
)
7561 (when (eq action
'move
)
7562 (gnus-summary-mark-article article gnus-canceled-mark
)
7563 (gnus-message 4 "Deleted article %s" article
)))
7565 (let* ((pto-group (gnus-group-prefixed-name
7566 (car art-group
) to-method
))
7568 (gnus-gethash pto-group gnus-newsrc-hashtb
))
7569 (info (nth 2 entry
))
7570 (to-group (gnus-info-group info
))
7572 ;; Update the group that has been moved to.
7574 (memq action
'(move copy
)))
7575 (unless (member to-group to-groups
)
7576 (push to-group to-groups
))
7578 (unless (memq article gnus-newsgroup-unreads
)
7579 (push 'read to-marks
)
7581 info
(gnus-add-to-range (gnus-info-read info
)
7582 (list (cdr art-group
)))))
7584 ;; See whether the article is to be put in the cache.
7585 (let ((marks gnus-article-mark-lists
)
7586 (to-article (cdr art-group
)))
7588 ;; Enter the article into the cache in the new group,
7589 ;; if that is required.
7590 (when gnus-use-cache
7591 (gnus-cache-possibly-enter-article
7593 (memq article gnus-newsgroup-marked
)
7594 (memq article gnus-newsgroup-dormant
)
7595 (memq article gnus-newsgroup-unreads
)))
7597 (when gnus-preserve-marks
7598 ;; Copy any marks over to the new group.
7599 (when (and (equal to-group gnus-newsgroup-name
)
7600 (not (memq article gnus-newsgroup-unreads
)))
7601 ;; Mark this article as read in this group.
7602 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
7603 (setcdr (gnus-active to-group
) to-article
)
7604 (setcdr gnus-newsgroup-active to-article
))
7607 (when (memq article
(symbol-value
7608 (intern (format "gnus-newsgroup-%s"
7610 (push (cdar marks
) to-marks
)
7611 ;; If the other group is the same as this group,
7612 ;; then we have to add the mark to the list.
7613 (when (equal to-group gnus-newsgroup-name
)
7614 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
7617 (intern (format "gnus-newsgroup-%s"
7619 ;; Copy the marks to other group.
7620 (gnus-add-marked-articles
7621 to-group
(cdar marks
) (list to-article
) info
))
7622 (setq marks
(cdr marks
)))
7624 (gnus-request-set-mark to-group
(list (list (list to-article
)
7629 (concat "(gnus-group-set-info '"
7630 (gnus-prin1-to-string (gnus-get-info to-group
))
7633 ;; Update the Xref header in this article to point to
7634 ;; the new crossposted article we have just created.
7635 (when (eq action
'crosspost
)
7637 (set-buffer copy-buf
)
7638 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
7639 (nnheader-replace-header "Xref" new-xref
)
7640 (gnus-request-replace-article
7641 article gnus-newsgroup-name
(current-buffer)))))
7643 ;;;!!!Why is this necessary?
7644 (set-buffer gnus-summary-buffer
)
7646 (gnus-summary-goto-subject article
)
7647 (when (eq action
'move
)
7648 (gnus-summary-mark-article article gnus-canceled-mark
))))
7649 (gnus-summary-remove-process-mark article
))
7650 ;; Re-activate all groups that have been moved to.
7653 (set-buffer gnus-group-buffer
)
7654 (when (gnus-group-goto-group (car to-groups
) t
)
7655 (gnus-group-get-new-news-this-group 1 t
))
7658 (gnus-kill-buffer copy-buf
)
7659 (gnus-summary-position-point)
7660 (gnus-set-mode-line 'summary
)))
7662 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
7663 "Move the current article to a different newsgroup.
7664 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7665 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7666 re-spool using this method."
7668 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
7670 (defun gnus-summary-crosspost-article (&optional n
)
7671 "Crosspost the current article to some other group."
7673 (gnus-summary-move-article n nil nil
'crosspost
))
7675 (defcustom gnus-summary-respool-default-method nil
7676 "Default method for respooling an article.
7677 If nil, use to the current newsgroup method."
7678 :type
'(choice (gnus-select-method :value
(nnml ""))
7680 :group
'gnus-summary-mail
)
7682 (defun gnus-summary-respool-article (&optional n method
)
7683 "Respool the current article.
7684 The article will be squeezed through the mail spooling process again,
7685 which means that it will be put in some mail newsgroup or other
7686 depending on `nnmail-split-methods'.
7687 If N is a positive number, respool the N next articles.
7688 If N is a negative number, respool the N previous articles.
7689 If N is nil and any articles have been marked with the process mark,
7690 respool those articles instead.
7692 Respooling can be done both from mail groups and \"real\" newsgroups.
7693 In the former case, the articles in question will be moved from the
7694 current group into whatever groups they are destined to. In the
7695 latter case, they will be copied into the relevant groups."
7697 (list current-prefix-arg
7698 (let* ((methods (gnus-methods-using 'respool
))
7700 (symbol-name (or gnus-summary-respool-default-method
7701 (car (gnus-find-method-for-group
7702 gnus-newsgroup-name
)))))
7704 (gnus-completing-read
7705 methname
"What backend do you want to use when respooling?"
7706 methods nil t nil
'gnus-mail-method-history
))
7709 ((zerop (length (setq ms
(gnus-servers-using-backend
7711 (list (intern method
) ""))
7715 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
7716 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
7719 (error "No method given for respooling"))
7720 (if (assoc (symbol-name
7721 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
7722 (gnus-methods-using 'respool
))
7723 (gnus-summary-move-article n nil method
)
7724 (gnus-summary-copy-article n nil method
)))
7726 (defun gnus-summary-import-article (file)
7727 "Import an arbitrary file into a mail newsgroup."
7728 (interactive "fImport file: ")
7729 (let ((group gnus-newsgroup-name
)
7730 (now (current-time))
7732 (unless (gnus-check-backend-function 'request-accept-article group
)
7733 (error "%s does not support article importing" group
))
7734 (or (file-readable-p file
)
7735 (not (file-regular-p file
))
7736 (error "Can't read %s" file
))
7738 (set-buffer (gnus-get-buffer-create " *import file*"))
7740 (nnheader-insert-file-contents file
)
7741 (goto-char (point-min))
7742 (unless (nnheader-article-p)
7743 ;; This doesn't look like an article, so we fudge some headers.
7744 (setq atts
(file-attributes file
)
7745 lines
(count-lines (point-min) (point-max)))
7746 (insert "From: " (read-string "From: ") "\n"
7747 "Subject: " (read-string "Subject: ") "\n"
7748 "Date: " (message-make-date (nth 5 atts
))
7750 "Message-ID: " (message-make-message-id) "\n"
7751 "Lines: " (int-to-string lines
) "\n"
7752 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
7753 (gnus-request-accept-article group nil t
)
7754 (kill-buffer (current-buffer)))))
7756 (defun gnus-summary-article-posted-p ()
7757 "Say whether the current (mail) article is available from news as well.
7758 This will be the case if the article has both been mailed and posted."
7760 (let ((id (mail-header-references (gnus-summary-article-header)))
7761 (gnus-override-method (car (gnus-refer-article-methods))))
7762 (if (gnus-request-head id
"")
7763 (gnus-message 2 "The current message was found on %s"
7764 gnus-override-method
)
7765 (gnus-message 2 "The current message couldn't be found on %s"
7766 gnus-override-method
)
7769 (defun gnus-summary-expire-articles (&optional now
)
7770 "Expire all articles that are marked as expirable in the current group."
7772 (when (gnus-check-backend-function
7773 'request-expire-articles gnus-newsgroup-name
)
7774 ;; This backend supports expiry.
7775 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
7776 (expirable (if total
7778 ;; We need to update the info for
7779 ;; this group for `gnus-list-of-read-articles'
7780 ;; to give us the right answer.
7781 (gnus-run-hooks 'gnus-exit-group-hook
)
7782 (gnus-summary-update-info)
7783 (gnus-list-of-read-articles gnus-newsgroup-name
))
7784 (setq gnus-newsgroup-expirable
7785 (sort gnus-newsgroup-expirable
'<))))
7786 (expiry-wait (if now
'immediate
7787 (gnus-group-find-parameter
7788 gnus-newsgroup-name
'expiry-wait
)))
7789 (nnmail-expiry-target
7790 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
7791 nnmail-expiry-target
))
7794 ;; There are expirable articles in this group, so we run them
7795 ;; through the expiry process.
7796 (gnus-message 6 "Expiring articles...")
7797 (unless (gnus-check-group gnus-newsgroup-name
)
7798 (error "Can't open server for %s" gnus-newsgroup-name
))
7799 ;; The list of articles that weren't expired is returned.
7802 (let ((nnmail-expiry-wait-function nil
)
7803 (nnmail-expiry-wait expiry-wait
))
7804 (setq es
(gnus-request-expire-articles
7805 expirable gnus-newsgroup-name
)))
7806 (setq es
(gnus-request-expire-articles
7807 expirable gnus-newsgroup-name
))))
7809 (setq gnus-newsgroup-expirable es
))
7810 ;; We go through the old list of expirable, and mark all
7811 ;; really expired articles as nonexistent.
7812 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
7813 (let ((gnus-use-cache nil
))
7815 (unless (memq (car expirable
) es
)
7816 (when (gnus-data-find (car expirable
))
7817 (gnus-summary-mark-article
7818 (car expirable
) gnus-canceled-mark
)))
7819 (setq expirable
(cdr expirable
)))))
7820 (gnus-message 6 "Expiring articles...done")))))
7822 (defun gnus-summary-expire-articles-now ()
7823 "Expunge all expirable articles in the current group.
7824 This means that *all* articles that are marked as expirable will be
7825 deleted forever, right now."
7827 (or gnus-expert-user
7829 "Are you really, really, really sure you want to delete all these messages? ")
7831 (gnus-summary-expire-articles t
))
7833 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7834 (defun gnus-summary-delete-article (&optional n
)
7835 "Delete the N next (mail) articles.
7836 This command actually deletes articles. This is not a marking
7837 command. The article will disappear forever from your life, never to
7839 If N is negative, delete backwards.
7840 If N is nil and articles have been marked with the process mark,
7841 delete these instead."
7843 (unless (gnus-check-backend-function 'request-expire-articles
7844 gnus-newsgroup-name
)
7845 (error "The current newsgroup does not support article deletion"))
7846 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
7847 (error "Couldn't open server"))
7848 ;; Compute the list of articles to delete.
7849 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
7851 (if (and gnus-novice-user
7852 (not (gnus-yes-or-no-p
7853 (format "Do you really want to delete %s forever? "
7854 (if (> (length articles
) 1)
7855 (format "these %s articles" (length articles
))
7858 ;; Delete the articles.
7859 (setq not-deleted
(gnus-request-expire-articles
7860 articles gnus-newsgroup-name
'force
))
7862 (gnus-summary-remove-process-mark (car articles
))
7863 ;; The backend might not have been able to delete the article
7865 (unless (memq (car articles
) not-deleted
)
7866 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
7867 (setq articles
(cdr articles
)))
7869 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
7870 (gnus-summary-position-point)
7871 (gnus-set-mode-line 'summary
)
7874 (defun gnus-summary-edit-article (&optional arg
)
7875 "Edit the current article.
7876 This will have permanent effect only in mail groups.
7877 If ARG is nil, edit the decoded articles.
7878 If ARG is 1, edit the raw articles.
7879 If ARG is 2, edit the raw articles even in read-only groups.
7880 Otherwise, allow editing of articles even in read-only
7886 ((eq arg
1) (setq raw t
))
7887 ((eq arg
2) (setq raw t
7890 (if (and raw
(not force
) (equal gnus-newsgroup-name
"nndraft:drafts"))
7891 (error "Can't edit the raw article in group nndraft:drafts."))
7893 (set-buffer gnus-summary-buffer
)
7894 (let ((mail-parse-charset gnus-newsgroup-charset
)
7895 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
7896 (gnus-set-global-variables)
7897 (when (and (not force
)
7898 (gnus-group-read-only-p))
7899 (error "The current newsgroup does not support article editing"))
7900 (gnus-summary-show-article t
)
7901 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
7902 (with-current-buffer gnus-article-buffer
7903 (mm-enable-multibyte-mule4)))
7904 (if (equal gnus-newsgroup-name
"nndraft:drafts")
7906 (gnus-article-edit-article
7909 (let ((mbl mml-buffer-list
))
7910 (setq mml-buffer-list nil
)
7912 (make-local-hook 'kill-buffer-hook
)
7913 (let ((mml-buffer-list mml-buffer-list
))
7914 (setq mml-buffer-list mbl
)
7915 (make-local-variable 'mml-buffer-list
))
7916 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
7917 `(lambda (no-highlight)
7918 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
7919 (mail-parse-ignored-charsets
7920 ',gnus-newsgroup-ignored-charsets
))
7921 ,(if (not raw
) '(progn
7923 (mml-destroy-buffers)
7924 (remove-hook 'kill-buffer-hook
7925 'mml-destroy-buffers t
)
7926 (kill-local-variable 'mml-buffer-list
)))
7927 (gnus-summary-edit-article-done
7928 ,(or (mail-header-references gnus-current-headers
) "")
7929 ,(gnus-group-read-only-p)
7930 ,gnus-summary-buffer no-highlight
))))))))
7932 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
7934 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7936 "Make edits to the current article permanent."
7938 ;; Replace the article.
7939 (let ((buf (current-buffer)))
7941 (insert-buffer-substring buf
)
7942 (if (and (not read-only
)
7943 (not (gnus-request-replace-article
7944 (cdr gnus-article-current
) (car gnus-article-current
)
7945 (current-buffer) t
)))
7946 (error "Couldn't replace article")
7947 ;; Update the summary buffer.
7949 (equal (message-tokenize-header references
" ")
7950 (message-tokenize-header
7951 (or (message-fetch-field "references") "") " ")))
7952 ;; We only have to update this line.
7955 (message-narrow-to-head)
7956 (let ((head (buffer-string))
7959 (insert (format "211 %d Article retrieved.\n"
7960 (cdr gnus-article-current
)))
7963 (let ((nntp-server-buffer (current-buffer)))
7964 (setq header
(car (gnus-get-newsgroup-headers
7966 (set-buffer gnus-summary-buffer
)
7967 gnus-newsgroup-dependencies
)
7970 (set-buffer gnus-summary-buffer
)
7971 (gnus-data-set-header
7972 (gnus-data-find (cdr gnus-article-current
))
7974 (gnus-summary-update-article-line
7975 (cdr gnus-article-current
) header
))))))
7977 (set-buffer (or buffer gnus-summary-buffer
))
7978 (gnus-summary-update-article (cdr gnus-article-current
)))
7979 ;; Prettify the article buffer again.
7980 (unless no-highlight
7982 (set-buffer gnus-article-buffer
)
7983 ;;;!!! Fix this -- article should be rehighlighted.
7984 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7985 (set-buffer gnus-original-article-buffer
)
7986 (gnus-request-article
7987 (cdr gnus-article-current
)
7988 (car gnus-article-current
) (current-buffer))))
7989 ;; Prettify the summary buffer line.
7990 (when (gnus-visual-p 'summary-highlight
'highlight
)
7991 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
7993 (defun gnus-summary-edit-wash (key)
7994 "Perform editing command KEY in the article buffer."
7998 (message "%s" (concat (this-command-keys) "- "))
8001 (gnus-summary-edit-article)
8002 (execute-kbd-macro (concat (this-command-keys) key
))
8003 (gnus-article-edit-done))
8007 (defun gnus-summary-respool-query (&optional silent trace
)
8008 "Query where the respool algorithm would put this article."
8010 (let (gnus-mark-article-hook)
8011 (gnus-summary-select-article)
8013 (set-buffer gnus-original-article-buffer
)
8015 (message-narrow-to-head)
8016 (let ((groups (nnmail-article-group 'identity trace
)))
8019 (message "This message would go to %s"
8020 (mapconcat 'car groups
", "))
8021 (message "This message would go to no groups"))
8024 (defun gnus-summary-respool-trace ()
8025 "Trace where the respool algorithm would put this article.
8026 Display a buffer showing all fancy splitting patterns which matched."
8028 (gnus-summary-respool-query nil t
))
8030 ;; Summary marking commands.
8032 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
8033 "Mark articles which has the same subject as read, and then select the next.
8034 If UNMARK is positive, remove any kind of mark.
8035 If UNMARK is negative, tick articles."
8038 (setq unmark
(prefix-numeric-value unmark
)))
8040 (gnus-summary-mark-same-subject
8041 (gnus-summary-article-subject) unmark
)))
8042 ;; Select next unread article. If auto-select-same mode, should
8043 ;; select the first unread article.
8044 (gnus-summary-next-article t
(and gnus-auto-select-same
8045 (gnus-summary-article-subject)))
8046 (gnus-message 7 "%d article%s marked as %s"
8047 count
(if (= count
1) " is" "s are")
8048 (if unmark
"unread" "read"))))
8050 (defun gnus-summary-kill-same-subject (&optional unmark
)
8051 "Mark articles which has the same subject as read.
8052 If UNMARK is positive, remove any kind of mark.
8053 If UNMARK is negative, tick articles."
8056 (setq unmark
(prefix-numeric-value unmark
)))
8058 (gnus-summary-mark-same-subject
8059 (gnus-summary-article-subject) unmark
)))
8060 ;; If marked as read, go to next unread subject.
8062 ;; Go to next unread subject.
8063 (gnus-summary-next-subject 1 t
))
8064 (gnus-message 7 "%d articles are marked as %s"
8065 count
(if unmark
"unread" "read"))))
8067 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
8068 "Mark articles with same SUBJECT as read, and return marked number.
8069 If optional argument UNMARK is positive, remove any kinds of marks.
8070 If optional argument UNMARK is negative, mark articles as unread instead."
8074 ((null unmark
) ; Mark as read.
8077 (gnus-summary-mark-article-as-read gnus-killed-mark
)
8078 (gnus-summary-show-thread) t
)
8079 (gnus-summary-find-subject subject
))
8080 (setq count
(1+ count
))))
8081 ((> unmark
0) ; Tick.
8084 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
8085 (gnus-summary-show-thread) t
)
8086 (gnus-summary-find-subject subject
))
8087 (setq count
(1+ count
))))
8088 (t ; Mark as unread.
8091 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
8092 (gnus-summary-show-thread) t
)
8093 (gnus-summary-find-subject subject
))
8094 (setq count
(1+ count
)))))
8095 (gnus-set-mode-line 'summary
)
8096 ;; Return the number of marked articles.
8099 (defun gnus-summary-mark-as-processable (n &optional unmark
)
8100 "Set the process mark on the next N articles.
8101 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8102 the process mark instead. The difference between N and the actual
8103 number of articles marked is returned."
8105 (let ((backward (< n
0))
8110 (gnus-summary-remove-process-mark
8111 (gnus-summary-article-number))
8112 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8113 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
8116 (gnus-message 7 "No more articles"))
8117 (gnus-summary-recenter)
8118 (gnus-summary-position-point)
8121 (defun gnus-summary-unmark-as-processable (n)
8122 "Remove the process mark from the next N articles.
8123 If N is negative, unmark backward instead. The difference between N and
8124 the actual number of articles unmarked is returned."
8126 (gnus-summary-mark-as-processable n t
))
8128 (defun gnus-summary-unmark-all-processable ()
8129 "Remove the process mark from all articles."
8132 (while gnus-newsgroup-processable
8133 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
8134 (gnus-summary-position-point))
8136 (defun gnus-summary-mark-as-expirable (n)
8137 "Mark N articles forward as expirable.
8138 If N is negative, mark backward instead. The difference between N and
8139 the actual number of articles marked is returned."
8141 (gnus-summary-mark-forward n gnus-expirable-mark
))
8143 (defun gnus-summary-mark-article-as-replied (article)
8144 "Mark ARTICLE replied and update the summary line."
8145 (push article gnus-newsgroup-replied
)
8146 (let ((buffer-read-only nil
))
8147 (when (gnus-summary-goto-subject article nil t
)
8148 (gnus-summary-update-secondary-mark article
))))
8150 (defun gnus-summary-set-bookmark (article)
8151 "Set a bookmark in current article."
8152 (interactive (list (gnus-summary-article-number)))
8153 (when (or (not (get-buffer gnus-article-buffer
))
8154 (not gnus-current-article
)
8155 (not gnus-article-current
)
8156 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
8157 (error "No current article selected"))
8158 ;; Remove old bookmark, if one exists.
8159 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8161 (setq gnus-newsgroup-bookmarks
8162 (delq old gnus-newsgroup-bookmarks
))))
8163 ;; Set the new bookmark, which is on the form
8164 ;; (article-number . line-number-in-body).
8168 (set-buffer gnus-article-buffer
)
8172 (goto-char (point-min))
8173 (search-forward "\n\n" nil t
)
8176 gnus-newsgroup-bookmarks
)
8177 (gnus-message 6 "A bookmark has been added to the current article."))
8179 (defun gnus-summary-remove-bookmark (article)
8180 "Remove the bookmark from the current article."
8181 (interactive (list (gnus-summary-article-number)))
8182 ;; Remove old bookmark, if one exists.
8183 (let ((old (assq article gnus-newsgroup-bookmarks
)))
8186 (setq gnus-newsgroup-bookmarks
8187 (delq old gnus-newsgroup-bookmarks
))
8188 (gnus-message 6 "Removed bookmark."))
8189 (gnus-message 6 "No bookmark in current article."))))
8191 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8192 (defun gnus-summary-mark-as-dormant (n)
8193 "Mark N articles forward as dormant.
8194 If N is negative, mark backward instead. The difference between N and
8195 the actual number of articles marked is returned."
8197 (gnus-summary-mark-forward n gnus-dormant-mark
))
8199 (defun gnus-summary-set-process-mark (article)
8200 "Set the process mark on ARTICLE and update the summary line."
8201 (setq gnus-newsgroup-processable
8203 (delq article gnus-newsgroup-processable
)))
8204 (when (gnus-summary-goto-subject article
)
8205 (gnus-summary-show-thread)
8206 (gnus-summary-goto-subject article
)
8207 (gnus-summary-update-secondary-mark article
)))
8209 (defun gnus-summary-remove-process-mark (article)
8210 "Remove the process mark from ARTICLE and update the summary line."
8211 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
8212 (when (gnus-summary-goto-subject article
)
8213 (gnus-summary-show-thread)
8214 (gnus-summary-goto-subject article
)
8215 (gnus-summary-update-secondary-mark article
)))
8217 (defun gnus-summary-set-saved-mark (article)
8218 "Set the process mark on ARTICLE and update the summary line."
8219 (push article gnus-newsgroup-saved
)
8220 (when (gnus-summary-goto-subject article
)
8221 (gnus-summary-update-secondary-mark article
)))
8223 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
8224 "Mark N articles as read forwards.
8225 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8226 The difference between N and the actual number of articles marked is
8228 Iff NO-EXPIRE, auto-expiry will be inhibited."
8230 (gnus-summary-show-thread)
8231 (let ((backward (< n
0))
8232 (gnus-summary-goto-unread
8233 (and gnus-summary-goto-unread
8234 (not (eq gnus-summary-goto-unread
'never
))
8235 (not (memq mark
(list gnus-unread-mark
8236 gnus-ticked-mark gnus-dormant-mark
)))))
8238 (mark (or mark gnus-del-mark
)))
8240 (gnus-summary-mark-article nil mark no-expire
)
8241 (zerop (gnus-summary-next-subject
8243 (and gnus-summary-goto-unread
8244 (not (eq gnus-summary-goto-unread
'never
)))
8248 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
8249 (gnus-summary-recenter)
8250 (gnus-summary-position-point)
8251 (gnus-set-mode-line 'summary
)
8254 (defun gnus-summary-mark-article-as-read (mark)
8255 "Mark the current article quickly as read with MARK."
8256 (let ((article (gnus-summary-article-number)))
8257 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8258 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8259 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8260 (push (cons article mark
) gnus-newsgroup-reads
)
8261 ;; Possibly remove from cache, if that is used.
8262 (when gnus-use-cache
8263 (gnus-cache-enter-remove-article article
))
8264 ;; Allow the backend to change the mark.
8265 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8266 ;; Check for auto-expiry.
8267 (when (and gnus-newsgroup-auto-expire
8268 (memq mark gnus-auto-expirable-marks
))
8269 (setq mark gnus-expirable-mark
)
8270 ;; Let the backend know about the mark change.
8271 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8272 (push article gnus-newsgroup-expirable
))
8273 ;; Set the mark in the buffer.
8274 (gnus-summary-update-mark mark
'unread
)
8277 (defun gnus-summary-mark-article-as-unread (mark)
8278 "Mark the current article quickly as unread with MARK."
8279 (let* ((article (gnus-summary-article-number))
8280 (old-mark (gnus-summary-article-mark article
)))
8281 ;; Allow the backend to change the mark.
8282 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8283 (if (eq mark old-mark
)
8287 (gnus-error 1 "Can't mark negative article numbers")
8289 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8290 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8291 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
8292 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
8293 (cond ((= mark gnus-ticked-mark
)
8294 (push article gnus-newsgroup-marked
))
8295 ((= mark gnus-dormant-mark
)
8296 (push article gnus-newsgroup-dormant
))
8298 (push article gnus-newsgroup-unreads
)))
8299 (gnus-pull article gnus-newsgroup-reads
)
8301 ;; See whether the article is to be put in the cache.
8303 (vectorp (gnus-summary-article-header article
))
8305 (gnus-cache-possibly-enter-article
8306 gnus-newsgroup-name article
8307 (= mark gnus-ticked-mark
)
8308 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8311 (gnus-summary-update-mark mark
'unread
)
8314 (defun gnus-summary-mark-article (&optional article mark no-expire
)
8315 "Mark ARTICLE with MARK. MARK can be any character.
8316 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8317 `??' (dormant) and `?E' (expirable).
8318 If MARK is nil, then the default character `?r' is used.
8319 If ARTICLE is nil, then the article on the current line will be
8321 Iff NO-EXPIRE, auto-expiry will be inhibited."
8322 ;; The mark might be a string.
8323 (when (stringp mark
)
8324 (setq mark
(aref mark
0)))
8325 ;; If no mark is given, then we check auto-expiring.
8327 (setq mark gnus-del-mark
))
8328 (when (and (not no-expire
)
8329 gnus-newsgroup-auto-expire
8330 (memq mark gnus-auto-expirable-marks
))
8331 (setq mark gnus-expirable-mark
))
8332 (let ((article (or article
(gnus-summary-article-number)))
8333 (old-mark (gnus-summary-article-mark article
)))
8334 ;; Allow the backend to change the mark.
8335 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
8336 (if (eq mark old-mark
)
8339 (error "No article on current line"))
8340 (if (not (if (or (= mark gnus-unread-mark
)
8341 (= mark gnus-ticked-mark
)
8342 (= mark gnus-dormant-mark
))
8343 (gnus-mark-article-as-unread article mark
)
8344 (gnus-mark-article-as-read article mark
)))
8346 ;; See whether the article is to be put in the cache.
8348 (not (= mark gnus-canceled-mark
))
8349 (vectorp (gnus-summary-article-header article
))
8351 (gnus-cache-possibly-enter-article
8352 gnus-newsgroup-name article
8353 (= mark gnus-ticked-mark
)
8354 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
8356 (when (gnus-summary-goto-subject article nil t
)
8357 (let ((buffer-read-only nil
))
8358 (gnus-summary-show-thread)
8360 (gnus-summary-update-mark mark
'unread
)
8363 (defun gnus-summary-update-secondary-mark (article)
8364 "Update the secondary (read, process, cache) mark."
8365 (gnus-summary-update-mark
8366 (cond ((memq article gnus-newsgroup-processable
)
8368 ((memq article gnus-newsgroup-cached
)
8370 ((memq article gnus-newsgroup-replied
)
8372 ((memq article gnus-newsgroup-saved
)
8374 (t gnus-unread-mark
))
8376 (when (gnus-visual-p 'summary-highlight
'highlight
)
8377 (gnus-run-hooks 'gnus-summary-update-hook
))
8380 (defun gnus-summary-update-mark (mark type
)
8381 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
8382 (buffer-read-only nil
))
8383 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
8385 (when (looking-at "\r")
8387 (when (<= (+ forward
(point)) (point-max))
8388 ;; Go to the right position on the line.
8389 (goto-char (+ forward
(point)))
8390 ;; Replace the old mark with the new mark.
8391 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
8392 ;; Optionally update the marks by some user rule.
8393 (when (eq type
'unread
)
8395 (gnus-data-find (gnus-summary-article-number)) mark
)
8396 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
8398 (defun gnus-mark-article-as-read (article &optional mark
)
8399 "Enter ARTICLE in the pertinent lists and remove it from others."
8400 ;; Make the article expirable.
8401 (let ((mark (or mark gnus-del-mark
)))
8402 (if (= mark gnus-expirable-mark
)
8403 (push article gnus-newsgroup-expirable
)
8404 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)))
8405 ;; Remove from unread and marked lists.
8406 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8407 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8408 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
8409 (push (cons article mark
) gnus-newsgroup-reads
)
8410 ;; Possibly remove from cache, if that is used.
8411 (when gnus-use-cache
8412 (gnus-cache-enter-remove-article article
))
8415 (defun gnus-mark-article-as-unread (article &optional mark
)
8416 "Enter ARTICLE in the pertinent lists and remove it from others."
8417 (let ((mark (or mark gnus-ticked-mark
)))
8420 (gnus-error 1 "Can't mark negative article numbers")
8422 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
8423 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
8424 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
8425 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8427 ;; Unsuppress duplicates?
8428 (when gnus-suppress-duplicates
8429 (gnus-dup-unsuppress-article article
))
8431 (cond ((= mark gnus-ticked-mark
)
8432 (push article gnus-newsgroup-marked
))
8433 ((= mark gnus-dormant-mark
)
8434 (push article gnus-newsgroup-dormant
))
8436 (push article gnus-newsgroup-unreads
)))
8437 (gnus-pull article gnus-newsgroup-reads
)
8440 (defalias 'gnus-summary-mark-as-unread-forward
8441 'gnus-summary-tick-article-forward
)
8442 (make-obsolete 'gnus-summary-mark-as-unread-forward
8443 'gnus-summary-tick-article-forward
)
8444 (defun gnus-summary-tick-article-forward (n)
8445 "Tick N articles forwards.
8446 If N is negative, tick backwards instead.
8447 The difference between N and the number of articles ticked is returned."
8449 (gnus-summary-mark-forward n gnus-ticked-mark
))
8451 (defalias 'gnus-summary-mark-as-unread-backward
8452 'gnus-summary-tick-article-backward
)
8453 (make-obsolete 'gnus-summary-mark-as-unread-backward
8454 'gnus-summary-tick-article-backward
)
8455 (defun gnus-summary-tick-article-backward (n)
8456 "Tick N articles backwards.
8457 The difference between N and the number of articles ticked is returned."
8459 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
8461 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8462 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
8463 (defun gnus-summary-tick-article (&optional article clear-mark
)
8464 "Mark current article as unread.
8465 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8466 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8468 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
8471 (defun gnus-summary-mark-as-read-forward (n)
8472 "Mark N articles as read forwards.
8473 If N is negative, mark backwards instead.
8474 The difference between N and the actual number of articles marked is
8477 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
8479 (defun gnus-summary-mark-as-read-backward (n)
8480 "Mark the N articles as read backwards.
8481 The difference between N and the actual number of articles marked is
8484 (gnus-summary-mark-forward
8485 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
8487 (defun gnus-summary-mark-as-read (&optional article mark
)
8488 "Mark current article as read.
8489 ARTICLE specifies the article to be marked as read.
8490 MARK specifies a string to be inserted at the beginning of the line."
8491 (gnus-summary-mark-article article mark
))
8493 (defun gnus-summary-clear-mark-forward (n)
8494 "Clear marks from N articles forward.
8495 If N is negative, clear backward instead.
8496 The difference between N and the number of marks cleared is returned."
8498 (gnus-summary-mark-forward n gnus-unread-mark
))
8500 (defun gnus-summary-clear-mark-backward (n)
8501 "Clear marks from N articles backward.
8502 The difference between N and the number of marks cleared is returned."
8504 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
8506 (defun gnus-summary-mark-unread-as-read ()
8507 "Intended to be used by `gnus-summary-mark-article-hook'."
8508 (when (memq gnus-current-article gnus-newsgroup-unreads
)
8509 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
8511 (defun gnus-summary-mark-read-and-unread-as-read ()
8512 "Intended to be used by `gnus-summary-mark-article-hook'."
8513 (let ((mark (gnus-summary-article-mark)))
8514 (when (or (gnus-unread-mark-p mark
)
8515 (gnus-read-mark-p mark
))
8516 (gnus-summary-mark-article gnus-current-article gnus-read-mark
))))
8518 (defun gnus-summary-mark-region-as-read (point mark all
)
8519 "Mark all unread articles between point and mark as read.
8520 If given a prefix, mark all articles between point and mark as read,
8521 even ticked and dormant ones."
8522 (interactive "r\nP")
8531 (memq (setq article
(gnus-summary-article-number))
8532 gnus-newsgroup-unreads
))
8533 (gnus-summary-mark-article article gnus-del-mark
))
8535 (gnus-summary-find-next))))))
8537 (defun gnus-summary-mark-below (score mark
)
8538 "Mark articles with score less than SCORE with MARK."
8539 (interactive "P\ncMark: ")
8540 (setq score
(if score
8541 (prefix-numeric-value score
)
8542 (or gnus-summary-default-score
0)))
8544 (set-buffer gnus-summary-buffer
)
8545 (goto-char (point-min))
8548 (and (< (gnus-summary-article-score) score
)
8549 (gnus-summary-mark-article nil mark
))
8550 (gnus-summary-find-next)))))
8552 (defun gnus-summary-kill-below (&optional score
)
8553 "Mark articles with score below SCORE as read."
8555 (gnus-summary-mark-below score gnus-killed-mark
))
8557 (defun gnus-summary-clear-above (&optional score
)
8558 "Clear all marks from articles with score above SCORE."
8560 (gnus-summary-mark-above score gnus-unread-mark
))
8562 (defun gnus-summary-tick-above (&optional score
)
8563 "Tick all articles with score above SCORE."
8565 (gnus-summary-mark-above score gnus-ticked-mark
))
8567 (defun gnus-summary-mark-above (score mark
)
8568 "Mark articles with score over SCORE with MARK."
8569 (interactive "P\ncMark: ")
8570 (setq score
(if score
8571 (prefix-numeric-value score
)
8572 (or gnus-summary-default-score
0)))
8574 (set-buffer gnus-summary-buffer
)
8575 (goto-char (point-min))
8577 (when (> (gnus-summary-article-score) score
)
8578 (gnus-summary-mark-article nil mark
))
8580 (gnus-summary-find-next)))))
8582 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8583 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
8584 (defun gnus-summary-limit-include-expunged (&optional no-error
)
8585 "Display all the hidden articles that were expunged for low scores."
8587 (let ((buffer-read-only nil
))
8588 (let ((scored gnus-newsgroup-scored
)
8591 (unless (gnus-summary-goto-subject (caar scored
))
8592 (and (setq h
(gnus-summary-article-header (caar scored
)))
8593 (< (cdar scored
) gnus-summary-expunge-below
)
8595 (setq scored
(cdr scored
)))
8597 (when (not no-error
)
8598 (error "No expunged articles hidden"))
8599 (goto-char (point-min))
8600 (gnus-summary-prepare-unthreaded (nreverse headers
))
8601 (goto-char (point-min))
8602 (gnus-summary-position-point)
8605 (defun gnus-summary-catchup (&optional all quietly to-here not-mark
)
8606 "Mark all unread articles in this newsgroup as read.
8607 If prefix argument ALL is non-nil, ticked and dormant articles will
8608 also be marked as read.
8609 If QUIETLY is non-nil, no questions will be asked.
8610 If TO-HERE is non-nil, it should be a point in the buffer. All
8611 articles before this point will be marked as read.
8612 Note that this function will only catch up the unread article
8613 in the current summary buffer limitation.
8614 The number of articles marked as read is returned."
8619 (not gnus-interactive-catchup
) ;Without confirmation?
8623 "Mark absolutely all articles as read? "
8624 "Mark all unread articles as read? ")))
8626 (not gnus-newsgroup-adaptive
)
8627 (not gnus-newsgroup-auto-expire
)
8628 (not gnus-suppress-duplicates
)
8629 (or (not gnus-use-cache
)
8630 (eq gnus-use-cache
'passive
)))
8633 (setq gnus-newsgroup-marked nil
8634 gnus-newsgroup-dormant nil
))
8635 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable
))
8636 ;; We actually mark all articles as canceled, which we
8637 ;; have to do when using auto-expiry or adaptive scoring.
8638 (gnus-summary-show-all-threads)
8639 (when (gnus-summary-first-subject (not all
) t
)
8641 (if to-here
(< (point) to-here
) t
)
8642 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
8643 (gnus-summary-find-next (not all
) nil nil t
))))
8644 (gnus-set-mode-line 'summary
))
8646 (gnus-summary-position-point)))
8648 (defun gnus-summary-catchup-to-here (&optional all
)
8649 "Mark all unticked articles before the current one as read.
8650 If ALL is non-nil, also mark ticked and dormant articles as read."
8653 (gnus-save-hidden-threads
8654 (let ((beg (point)))
8655 ;; We check that there are unread articles.
8656 (when (or all
(gnus-summary-find-prev))
8657 (gnus-summary-catchup all t beg
)))))
8658 (gnus-summary-position-point))
8660 (defun gnus-summary-catchup-all (&optional quietly
)
8661 "Mark all articles in this newsgroup as read."
8663 (gnus-summary-catchup t quietly
))
8665 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
8666 "Mark all unread articles in this group as read, then exit.
8667 If prefix argument ALL is non-nil, all articles are marked as read."
8669 (when (gnus-summary-catchup all quietly nil
'fast
)
8670 ;; Select next newsgroup or exit.
8671 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
8672 (eq gnus-auto-select-next
'quietly
))
8673 (gnus-summary-next-group nil
)
8674 (gnus-summary-exit))))
8676 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
8677 "Mark all articles in this newsgroup as read, and then exit."
8679 (gnus-summary-catchup-and-exit t quietly
))
8681 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
8682 "Mark all articles in this group as read and select the next group.
8683 If given a prefix, mark all articles, unread as well as ticked, as
8687 (gnus-summary-catchup all
))
8688 (gnus-summary-next-group))
8694 (defmacro gnus-with-article
(article &rest forms
)
8695 "Select ARTICLE and perform FORMS in the original article buffer.
8696 Then replace the article with the result."
8698 ;; We don't want the article to be marked as read.
8699 (let (gnus-mark-article-hook)
8700 (gnus-summary-select-article t t nil
,article
))
8701 (set-buffer gnus-original-article-buffer
)
8703 (if (not (gnus-check-backend-function
8704 'request-replace-article
(car gnus-article-current
)))
8705 (gnus-message 5 "Read-only group; not replacing")
8706 (unless (gnus-request-replace-article
8707 ,article
(car gnus-article-current
)
8709 (error "Couldn't replace article")))
8710 ;; The cache and backlog have to be flushed somewhat.
8711 (when gnus-keep-backlog
8712 (gnus-backlog-remove-article
8713 (car gnus-article-current
) (cdr gnus-article-current
)))
8714 (when gnus-use-cache
8715 (gnus-cache-update-article
8716 (car gnus-article-current
) (cdr gnus-article-current
)))))
8718 (put 'gnus-with-article
'lisp-indent-function
1)
8719 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
8721 ;; Thread-based commands.
8723 (defun gnus-summary-articles-in-thread (&optional article
)
8724 "Return a list of all articles in the current thread.
8725 If ARTICLE is non-nil, return all articles in the thread that starts
8727 (let* ((article (or article
(gnus-summary-article-number)))
8728 (data (gnus-data-find-list article
))
8729 (top-level (gnus-data-level (car data
)))
8731 (cond ((null gnus-thread-operation-ignore-subject
)
8732 (gnus-simplify-subject-re
8733 (mail-header-subject (gnus-data-header (car data
)))))
8734 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
8735 (gnus-simplify-subject-fuzzy
8736 (mail-header-subject (gnus-data-header (car data
)))))
8738 (end-point (save-excursion
8739 (if (gnus-summary-go-to-next-thread)
8740 (point) (point-max))))
8743 (< (gnus-data-pos (car data
)) end-point
))
8744 (when (or (not top-subject
)
8745 (string= top-subject
8746 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
8747 (gnus-simplify-subject-fuzzy
8748 (mail-header-subject
8749 (gnus-data-header (car data
))))
8750 (gnus-simplify-subject-re
8751 (mail-header-subject
8752 (gnus-data-header (car data
)))))))
8753 (push (gnus-data-number (car data
)) articles
))
8754 (unless (and (setq data
(cdr data
))
8755 (> (gnus-data-level (car data
)) top-level
))
8757 ;; Return the list of articles.
8758 (nreverse articles
)))
8760 (defun gnus-summary-rethread-current ()
8761 "Rethread the thread the current article is part of."
8763 (let* ((gnus-show-threads t
)
8764 (article (gnus-summary-article-number))
8765 (id (mail-header-id (gnus-summary-article-header)))
8766 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
8768 (error "No article on the current line"))
8769 (gnus-rebuild-thread id
)
8770 (gnus-summary-goto-subject article
)))
8772 (defun gnus-summary-reparent-thread ()
8773 "Make the current article child of the marked (or previous) article.
8775 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8776 is non-nil or the Subject: of both articles are the same."
8778 (unless (not (gnus-group-read-only-p))
8779 (error "The current newsgroup does not support article editing"))
8780 (unless (<= (length gnus-newsgroup-processable
) 1)
8781 (error "No more than one article may be marked"))
8782 (save-window-excursion
8783 (let ((gnus-article-buffer " *reparent*")
8784 (current-article (gnus-summary-article-number))
8785 ;; First grab the marked article, otherwise one line up.
8786 (parent-article (if (not (null gnus-newsgroup-processable
))
8787 (car gnus-newsgroup-processable
)
8789 (if (eq (forward-line -
1) 0)
8790 (gnus-summary-article-number)
8791 (error "Beginning of summary buffer"))))))
8792 (unless (not (eq current-article parent-article
))
8793 (error "An article may not be self-referential"))
8794 (let ((message-id (mail-header-id
8795 (gnus-summary-article-header parent-article
))))
8796 (unless (and message-id
(not (equal message-id
"")))
8797 (error "No message-id in desired parent"))
8798 (gnus-with-article current-article
8800 (goto-char (point-min))
8801 (message-narrow-to-head)
8802 (if (re-search-forward "^References: " nil t
)
8804 (re-search-forward "^[^ \t]" nil t
)
8807 (insert " " message-id
))
8808 (insert "References: " message-id
"\n"))))
8809 (set-buffer gnus-summary-buffer
)
8810 (gnus-summary-unmark-all-processable)
8811 (gnus-summary-update-article current-article
)
8812 (gnus-summary-rethread-current)
8813 (gnus-message 3 "Article %d is now the child of article %d"
8814 current-article parent-article
)))))
8816 (defun gnus-summary-toggle-threads (&optional arg
)
8817 "Toggle showing conversation threads.
8818 If ARG is positive number, turn showing conversation threads on."
8820 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
8821 (setq gnus-show-threads
8822 (if (null arg
) (not gnus-show-threads
)
8823 (> (prefix-numeric-value arg
) 0)))
8824 (gnus-summary-prepare)
8825 (gnus-summary-goto-subject current
)
8826 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
8827 (gnus-summary-position-point)))
8829 (defun gnus-summary-show-all-threads ()
8833 (let ((buffer-read-only nil
))
8834 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
8835 (gnus-summary-position-point))
8837 (defun gnus-summary-show-thread ()
8838 "Show thread subtrees.
8839 Returns nil if no thread was there to be shown."
8841 (let ((buffer-read-only nil
)
8843 ;; first goto end then to beg, to have point at beg after let
8844 (end (progn (end-of-line) (point)))
8845 (beg (progn (beginning-of-line) (point))))
8847 ;; Any hidden lines here?
8848 (search-forward "\r" end t
)
8849 (subst-char-in-region beg end ?\^M ?
\n t
)
8851 (gnus-summary-position-point))))
8853 (defun gnus-summary-hide-all-threads ()
8854 "Hide all thread subtrees."
8857 (goto-char (point-min))
8858 (gnus-summary-hide-thread)
8859 (while (zerop (gnus-summary-next-thread 1 t
))
8860 (gnus-summary-hide-thread)))
8861 (gnus-summary-position-point))
8863 (defun gnus-summary-hide-thread ()
8864 "Hide thread subtrees.
8865 Returns nil if no threads were there to be hidden."
8867 (let ((buffer-read-only nil
)
8869 (article (gnus-summary-article-number)))
8871 ;; Go forward until either the buffer ends or the subthread
8873 (when (and (not (eobp))
8874 (or (zerop (gnus-summary-next-thread 1 t
))
8875 (goto-char (point-max))))
8877 (if (and (> (point) start
)
8878 (search-backward "\n" start t
))
8880 (subst-char-in-region start
(point) ?
\n ?\^M
)
8881 (gnus-summary-goto-subject article
))
8885 (defun gnus-summary-go-to-next-thread (&optional previous
)
8886 "Go to the same level (or less) next thread.
8887 If PREVIOUS is non-nil, go to previous thread instead.
8888 Return the article number moved to, or nil if moving was impossible."
8889 (let ((level (gnus-summary-thread-level))
8890 (way (if previous -
1 1))
8893 (while (and (not (eobp))
8894 (< level
(gnus-summary-thread-level)))
8902 (gnus-summary-article-number)
8905 (defun gnus-summary-next-thread (n &optional silent
)
8906 "Go to the same level next N'th thread.
8907 If N is negative, search backward instead.
8908 Returns the difference between N and the number of skips actually
8911 If SILENT, don't output messages."
8913 (let ((backward (< n
0))
8916 (gnus-summary-go-to-next-thread backward
))
8919 (gnus-summary-position-point))
8920 (when (and (not silent
) (/= 0 n
))
8921 (gnus-message 7 "No more threads"))
8924 (defun gnus-summary-prev-thread (n)
8925 "Go to the same level previous N'th thread.
8926 Returns the difference between N and the number of skips actually
8929 (gnus-summary-next-thread (- n
)))
8931 (defun gnus-summary-go-down-thread ()
8932 "Go down one level in the current thread."
8933 (let ((children (gnus-summary-article-children)))
8935 (gnus-summary-goto-subject (car children
)))))
8937 (defun gnus-summary-go-up-thread ()
8938 "Go up one level in the current thread."
8939 (let ((parent (gnus-summary-article-parent)))
8941 (gnus-summary-goto-subject parent
))))
8943 (defun gnus-summary-down-thread (n)
8944 "Go down thread N steps.
8945 If N is negative, go up instead.
8946 Returns the difference between N and how many steps down that were
8952 (if up
(gnus-summary-go-up-thread)
8953 (gnus-summary-go-down-thread)))
8955 (gnus-summary-position-point)
8957 (gnus-message 7 "Can't go further"))
8960 (defun gnus-summary-up-thread (n)
8961 "Go up thread N steps.
8962 If N is negative, go up instead.
8963 Returns the difference between N and how many steps down that were
8966 (gnus-summary-down-thread (- n
)))
8968 (defun gnus-summary-top-thread ()
8969 "Go to the top of the thread."
8971 (while (gnus-summary-go-up-thread))
8972 (gnus-summary-article-number))
8974 (defun gnus-summary-kill-thread (&optional unmark
)
8975 "Mark articles under current thread as read.
8976 If the prefix argument is positive, remove any kinds of marks.
8977 If the prefix argument is negative, tick articles instead."
8980 (setq unmark
(prefix-numeric-value unmark
)))
8981 (let ((articles (gnus-summary-articles-in-thread)))
8983 ;; Expand the thread.
8984 (gnus-summary-show-thread)
8985 ;; Mark all the articles.
8987 (gnus-summary-goto-subject (car articles
))
8988 (cond ((null unmark
)
8989 (gnus-summary-mark-article-as-read gnus-killed-mark
))
8991 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
8993 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
8994 (setq articles
(cdr articles
))))
8995 ;; Hide killed subtrees.
8997 gnus-thread-hide-killed
8998 (gnus-summary-hide-thread))
8999 ;; If marked as read, go to next unread subject.
9001 ;; Go to next unread subject.
9002 (gnus-summary-next-subject 1 t
)))
9003 (gnus-set-mode-line 'summary
))
9005 ;; Summary sorting commands
9007 (defun gnus-summary-sort-by-number (&optional reverse
)
9008 "Sort the summary buffer by article number.
9009 Argument REVERSE means reverse order."
9011 (gnus-summary-sort 'number reverse
))
9013 (defun gnus-summary-sort-by-author (&optional reverse
)
9014 "Sort the summary buffer by author name alphabetically.
9015 If `case-fold-search' is non-nil, case of letters is ignored.
9016 Argument REVERSE means reverse order."
9018 (gnus-summary-sort 'author reverse
))
9020 (defun gnus-summary-sort-by-subject (&optional reverse
)
9021 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
9022 If `case-fold-search' is non-nil, case of letters is ignored.
9023 Argument REVERSE means reverse order."
9025 (gnus-summary-sort 'subject reverse
))
9027 (defun gnus-summary-sort-by-date (&optional reverse
)
9028 "Sort the summary buffer by date.
9029 Argument REVERSE means reverse order."
9031 (gnus-summary-sort 'date reverse
))
9033 (defun gnus-summary-sort-by-score (&optional reverse
)
9034 "Sort the summary buffer by score.
9035 Argument REVERSE means reverse order."
9037 (gnus-summary-sort 'score reverse
))
9039 (defun gnus-summary-sort-by-lines (&optional reverse
)
9040 "Sort the summary buffer by the number of lines.
9041 Argument REVERSE means reverse order."
9043 (gnus-summary-sort 'lines reverse
))
9045 (defun gnus-summary-sort-by-chars (&optional reverse
)
9046 "Sort the summary buffer by article length.
9047 Argument REVERSE means reverse order."
9049 (gnus-summary-sort 'chars reverse
))
9051 (defun gnus-summary-sort (predicate reverse
)
9052 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
9053 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
9054 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
9055 (gnus-thread-sort-functions
9060 (gnus-sort-gathered-threads-function
9061 gnus-thread-sort-functions
)
9062 (gnus-article-sort-functions
9068 (gnus-summary-prepare-hook nil
))
9069 ;; We do the sorting by regenerating the threads.
9070 (gnus-summary-prepare)
9071 ;; Hide subthreads if needed.
9072 (when (and gnus-show-threads gnus-thread-hide-subtree
)
9073 (gnus-summary-hide-all-threads))))
9075 ;; Summary saving commands.
9077 (defun gnus-summary-save-article (&optional n not-saved
)
9078 "Save the current article using the default saver function.
9079 If N is a positive number, save the N next articles.
9080 If N is a negative number, save the N previous articles.
9081 If N is nil and any articles have been marked with the process mark,
9082 save those articles instead.
9083 The variable `gnus-default-article-saver' specifies the saver function."
9085 (let* ((articles (gnus-summary-work-articles n
))
9086 (save-buffer (save-excursion
9087 (nnheader-set-temp-buffer " *Gnus Save*")))
9088 (num (length articles
))
9090 (dolist (article articles
)
9091 (setq header
(gnus-summary-article-header article
))
9092 (if (not (vectorp header
))
9093 ;; This is a pseudo-article.
9094 (if (assq 'name header
)
9095 (gnus-copy-file (cdr (assq 'name header
)))
9096 (gnus-message 1 "Article %d is unsaveable" article
))
9097 ;; This is a real article.
9098 (save-window-excursion
9099 (gnus-summary-select-article t nil nil article
))
9101 (set-buffer save-buffer
)
9103 (insert-buffer-substring gnus-original-article-buffer
))
9104 (setq file
(gnus-article-save save-buffer file num
))
9105 (gnus-summary-remove-process-mark article
)
9107 (gnus-summary-set-saved-mark article
))))
9108 (gnus-kill-buffer save-buffer
)
9109 (gnus-summary-position-point)
9110 (gnus-set-mode-line 'summary
)
9113 (defun gnus-summary-pipe-output (&optional arg
)
9114 "Pipe the current article to a subprocess.
9115 If N is a positive number, pipe the N next articles.
9116 If N is a negative number, pipe the N previous articles.
9117 If N is nil and any articles have been marked with the process mark,
9118 pipe those articles instead."
9120 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
))
9121 (gnus-summary-save-article arg t
))
9122 (gnus-configure-windows 'pipe
))
9124 (defun gnus-summary-save-article-mail (&optional arg
)
9125 "Append the current article to an mail file.
9126 If N is a positive number, save the N next articles.
9127 If N is a negative number, save the N previous articles.
9128 If N is nil and any articles have been marked with the process mark,
9129 save those articles instead."
9131 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
9132 (gnus-summary-save-article arg
)))
9134 (defun gnus-summary-save-article-rmail (&optional arg
)
9135 "Append the current article to an rmail file.
9136 If N is a positive number, save the N next articles.
9137 If N is a negative number, save the N previous articles.
9138 If N is nil and any articles have been marked with the process mark,
9139 save those articles instead."
9141 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
9142 (gnus-summary-save-article arg
)))
9144 (defun gnus-summary-save-article-file (&optional arg
)
9145 "Append the current article to a file.
9146 If N is a positive number, save the N next articles.
9147 If N is a negative number, save the N previous articles.
9148 If N is nil and any articles have been marked with the process mark,
9149 save those articles instead."
9151 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
9152 (gnus-summary-save-article arg
)))
9154 (defun gnus-summary-write-article-file (&optional arg
)
9155 "Write the current article to a file, deleting the previous file.
9156 If N is a positive number, save the N next articles.
9157 If N is a negative number, save the N previous articles.
9158 If N is nil and any articles have been marked with the process mark,
9159 save those articles instead."
9161 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
9162 (gnus-summary-save-article arg
)))
9164 (defun gnus-summary-save-article-body-file (&optional arg
)
9165 "Append the current article body to a file.
9166 If N is a positive number, save the N next articles.
9167 If N is a negative number, save the N previous articles.
9168 If N is nil and any articles have been marked with the process mark,
9169 save those articles instead."
9171 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
9172 (gnus-summary-save-article arg
)))
9174 (defun gnus-summary-pipe-message (program)
9175 "Pipe the current article through PROGRAM."
9176 (interactive "sProgram: ")
9177 (gnus-summary-select-article)
9178 (let ((mail-header-separator ""))
9179 (gnus-eval-in-buffer-window gnus-article-buffer
9182 (let ((start (window-start))
9184 (message-pipe-buffer-body program
)
9185 (set-window-start (get-buffer-window (current-buffer)) start
))))))
9187 (defun gnus-get-split-value (methods)
9188 "Return a value based on the split METHODS."
9189 (let (split-name method result match
)
9192 (set-buffer gnus-original-article-buffer
)
9194 (nnheader-narrow-to-headers)
9195 (while (and methods
(not split-name
))
9196 (goto-char (point-min))
9197 (setq method
(pop methods
))
9198 (setq match
(car method
))
9201 ;; Regular expression.
9203 (re-search-forward match nil t
)))
9204 ((gnus-functionp match
)
9208 (setq result
(funcall match gnus-newsgroup-name
))))
9213 (setq result
(eval match
)))))
9214 (setq split-name
(cdr method
))
9215 (cond ((stringp result
)
9216 (push (expand-file-name
9217 result gnus-article-save-directory
)
9220 (setq split-name
(append result split-name
)))))))))
9221 (nreverse split-name
)))
9223 (defun gnus-valid-move-group-p (group)
9226 (symbol-value group
)
9227 (gnus-get-function (gnus-find-method-for-group
9228 (symbol-name group
)) 'request-accept-article t
)))
9230 (defun gnus-read-move-group-name (prompt default articles prefix
)
9231 "Read a group name."
9232 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
9233 (minibuffer-confirm-incomplete nil
) ; XEmacs
9237 (if (> (length articles
) 1)
9238 (format "these %d articles" (length articles
))
9243 (gnus-completing-read default prom
9245 'gnus-valid-move-group-p
9247 'gnus-group-history
))
9248 ((= 1 (length split-name
))
9249 (gnus-completing-read (car split-name
) prom
9251 'gnus-valid-move-group-p
9253 'gnus-group-history
))
9255 (gnus-completing-read nil prom
9256 (mapcar (lambda (el) (list el
))
9257 (nreverse split-name
))
9259 'gnus-group-history
))))
9260 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
9262 (if (or (string= to-newsgroup
"")
9263 (string= to-newsgroup prefix
))
9264 (setq to-newsgroup default
))
9265 (unless to-newsgroup
9266 (error "No group name entered"))
9267 (or (gnus-active to-newsgroup
)
9268 (gnus-activate-group to-newsgroup nil nil to-method
)
9269 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9271 (or (and (gnus-request-create-group to-newsgroup to-method
)
9272 (gnus-activate-group
9273 to-newsgroup nil nil to-method
)
9274 (gnus-subscribe-group to-newsgroup
))
9275 (error "Couldn't create group %s" to-newsgroup
)))
9276 (error "No such group: %s" to-newsgroup
)))
9279 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
9280 "Save parts matching TYPE to DIR.
9281 If REVERSE, save parts that do not match TYPE."
9283 (list (read-string "Save parts of type: "
9284 (or (car gnus-summary-save-parts-type-history
)
9285 gnus-summary-save-parts-default-mime
)
9286 'gnus-summary-save-parts-type-history
)
9287 (setq gnus-summary-save-parts-last-directory
9288 (read-file-name "Save to directory: "
9289 gnus-summary-save-parts-last-directory
9291 current-prefix-arg
))
9292 (gnus-summary-iterate n
9293 (let ((gnus-display-mime-function nil
)
9294 (gnus-inhibit-treatment t
))
9295 (gnus-summary-select-article))
9297 (set-buffer gnus-article-buffer
)
9298 (let ((handles (or gnus-article-mime-handles
9299 (mm-dissect-buffer) (mm-uu-dissect))))
9301 (gnus-summary-save-parts-1 type dir handles reverse
)
9302 (unless gnus-article-mime-handles
;; Don't destroy this case.
9303 (mm-destroy-parts handles
)))))))
9305 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
9306 (if (stringp (car handle
))
9307 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
9310 (not (string-match type
(mm-handle-media-type handle
)))
9311 (string-match type
(mm-handle-media-type handle
)))
9312 (let ((file (expand-file-name
9313 (file-name-nondirectory
9315 (mail-content-type-get
9316 (mm-handle-disposition handle
) 'filename
)
9317 (concat gnus-newsgroup-name
9318 "." (number-to-string
9319 (cdr gnus-article-current
)))))
9321 (unless (file-exists-p file
)
9322 (mm-save-part-to-file handle file
))))))
9324 ;; Summary extract commands
9326 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
9327 (let ((buffer-read-only nil
)
9328 (article (gnus-summary-article-number))
9330 (unless (gnus-summary-goto-subject article
)
9331 (error "No such article: %d" article
))
9332 (gnus-summary-position-point)
9333 ;; If all commands are to be bunched up on one line, we collect
9335 (unless gnus-view-pseudos-separately
9336 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
9339 (setq action
(cdr (assq 'action
(car ps
))))
9340 (setq files
(list (cdr (assq 'name
(car ps
)))))
9341 (while (and ps
(cdr ps
)
9342 (string= (or action
"1")
9343 (or (cdr (assq 'action
(cadr ps
))) "2")))
9344 (push (cdr (assq 'name
(cadr ps
))) files
)
9345 (setcdr ps
(cddr ps
)))
9347 (when (not (string-match "%s" action
))
9350 (when (assq 'execute
(car ps
))
9351 (setcdr (assq 'execute
(car ps
))
9352 (funcall (if (string-match "%s" action
)
9361 (setq ps
(cdr ps
)))))
9362 (if (and gnus-view-pseudos
(not not-view
))
9364 (when (assq 'execute
(car pslist
))
9365 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
9366 (eq gnus-view-pseudos
'not-confirm
)))
9367 (setq pslist
(cdr pslist
)))
9370 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
9371 (gnus-summary-article-number)))
9372 (gnus-summary-goto-subject after-article
)
9375 (insert " " (file-name-nondirectory
9376 (cdr (assq 'name
(car pslist
))))
9377 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
9379 (forward-line -
1) ; back to `b'
9380 (gnus-add-text-properties
9381 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
9382 gnus-mouse-face-prop gnus-mouse-face
))
9384 after-article gnus-reffed-article-number
9385 gnus-unread-mark b
(car pslist
) 0 (- e b
))
9386 (push gnus-reffed-article-number gnus-newsgroup-unreads
)
9387 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
9388 (setq pslist
(cdr pslist
)))))))
9390 (defun gnus-pseudos< (p1 p2
)
9391 (let ((c1 (cdr (assq 'action p1
)))
9392 (c2 (cdr (assq 'action p2
))))
9393 (and c1 c2
(string< c1 c2
))))
9395 (defun gnus-request-pseudo-article (props)
9396 (cond ((assq 'execute props
)
9397 (gnus-execute-command (cdr (assq 'execute props
)))))
9398 (let ((gnus-current-article (gnus-summary-article-number)))
9399 (gnus-run-hooks 'gnus-mark-article-hook
)))
9401 (defun gnus-execute-command (command &optional automatic
)
9403 (gnus-article-setup-buffer)
9404 (set-buffer gnus-article-buffer
)
9405 (setq buffer-read-only nil
)
9406 (let ((command (if automatic command
9407 (read-string "Command: " (cons command
0)))))
9409 (insert "$ " command
"\n\n")
9410 (if gnus-view-pseudo-asynchronously
9411 (start-process "gnus-execute" (current-buffer) shell-file-name
9412 shell-command-switch command
)
9413 (call-process shell-file-name nil t nil
9414 shell-command-switch command
)))))
9416 ;; Summary kill commands.
9418 (defun gnus-summary-edit-global-kill (article)
9419 "Edit the \"global\" kill file."
9420 (interactive (list (gnus-summary-article-number)))
9421 (gnus-group-edit-global-kill article
))
9423 (defun gnus-summary-edit-local-kill ()
9424 "Edit a local kill file applied to the current newsgroup."
9426 (setq gnus-current-headers
(gnus-summary-article-header))
9427 (gnus-group-edit-local-kill
9428 (gnus-summary-article-number) gnus-newsgroup-name
))
9432 (defun gnus-read-header (id &optional header
)
9433 "Read the headers of article ID and enter them into the Gnus system."
9434 (let ((group gnus-newsgroup-name
)
9435 (gnus-override-method
9437 gnus-override-method
9438 (and (gnus-news-group-p gnus-newsgroup-name
)
9439 (car (gnus-refer-article-methods)))))
9441 ;; First we check to see whether the header in question is already
9444 ;; This is a Message-ID.
9445 (setq header
(or header
(gnus-id-to-header id
)))
9446 ;; This is an article number.
9447 (setq header
(or header
(gnus-summary-article-header id
))))
9449 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
9450 ;; We have found the header.
9452 ;; If this is a sparse article, we have to nix out its
9453 ;; previous entry in the thread hashtb.
9455 (gnus-summary-article-sparse-p (mail-header-number header
)))
9456 (let* ((parent (gnus-parent-id (mail-header-references header
)))
9457 (thread (and parent
(gnus-id-to-thread parent
))))
9459 (delq (assq header thread
) thread
))))
9460 ;; We have to really fetch the header to this article.
9462 (set-buffer nntp-server-buffer
)
9463 (when (setq where
(gnus-request-head id group
))
9464 (nnheader-fold-continuation-lines)
9465 (goto-char (point-max))
9467 (goto-char (point-min))
9471 ((cdr where
) (cdr where
))
9472 (header (mail-header-number header
))
9473 (t gnus-reffed-article-number
))
9475 (insert " Article retrieved.\n"))
9477 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
9478 () ; Malformed head.
9479 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
9480 (when (and (stringp id
)
9481 (not (string= (gnus-group-real-name group
)
9483 ;; If we fetched by Message-ID and the article came
9484 ;; from a different group, we fudge some bogus article
9485 ;; numbers for this article.
9486 (mail-header-set-number header gnus-reffed-article-number
))
9488 (set-buffer gnus-summary-buffer
)
9489 (decf gnus-reffed-article-number
)
9490 (gnus-remove-header (mail-header-number header
))
9491 (push header gnus-newsgroup-headers
)
9492 (setq gnus-current-headers header
)
9493 (push (mail-header-number header
) gnus-newsgroup-limit
)))
9496 (defun gnus-remove-header (number)
9497 "Remove header NUMBER from `gnus-newsgroup-headers'."
9498 (if (and gnus-newsgroup-headers
9499 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
9500 (pop gnus-newsgroup-headers
)
9501 (let ((headers gnus-newsgroup-headers
))
9502 (while (and (cdr headers
)
9503 (not (= number
(mail-header-number (cadr headers
)))))
9506 (setcdr headers
(cddr headers
))))))
9509 ;;; summary highlights
9512 (defun gnus-highlight-selected-summary ()
9513 "Highlight selected article in summary buffer."
9514 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9515 (when gnus-summary-selected-face
9517 (let* ((beg (progn (beginning-of-line) (point)))
9518 (end (progn (end-of-line) (point)))
9519 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9520 (from (if (get-text-property beg gnus-mouse-face-prop
)
9522 (or (next-single-property-change
9523 beg gnus-mouse-face-prop nil end
)
9528 (or (next-single-property-change
9529 from gnus-mouse-face-prop nil end
)
9531 ;; If no mouse-face prop on line we will have to = from = end,
9532 ;; so we highlight the entire line instead.
9533 (when (= (+ to
2) from
)
9536 (if gnus-newsgroup-selected-overlay
9537 ;; Move old overlay.
9539 gnus-newsgroup-selected-overlay from to
(current-buffer))
9540 ;; Create new overlay.
9542 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
9543 'face gnus-summary-selected-face
))))))
9545 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9546 (defun gnus-summary-highlight-line ()
9547 "Highlight current line according to `gnus-summary-highlight'."
9548 (let* ((list gnus-summary-highlight
)
9550 (end (progn (end-of-line) (point)))
9551 ;; now find out where the line starts and leave point there.
9552 (beg (progn (beginning-of-line) (point)))
9553 (article (gnus-summary-article-number))
9554 (score (or (cdr (assq (or article gnus-current-article
)
9555 gnus-newsgroup-scored
))
9556 gnus-summary-default-score
0))
9557 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
9558 (inhibit-read-only t
))
9559 ;; Eval the cars of the lists until we find a match.
9560 (let ((default gnus-summary-default-score
))
9562 (not (eval (caar list
))))
9563 (setq list
(cdr list
))))
9564 (let ((face (cdar list
)))
9565 (unless (eq face
(get-text-property beg
'face
))
9566 (gnus-put-text-property-excluding-characters-with-faces
9568 (setq face
(if (boundp face
) (symbol-value face
) face
)))
9569 (when gnus-summary-highlight-line-function
9570 (funcall gnus-summary-highlight-line-function article face
))))
9573 (defun gnus-update-read-articles (group unread
&optional compute
)
9574 "Update the list of read articles in GROUP."
9575 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
9576 (entry (gnus-gethash group gnus-newsrc-hashtb
))
9577 (info (nth 2 entry
))
9579 (unread (sort (copy-sequence unread
) '<))
9581 (if (or (not info
) (not active
))
9582 ;; There is no info on this group if it was, in fact,
9583 ;; killed. Gnus stores no information on killed groups, so
9584 ;; there's nothing to be done.
9585 ;; One could store the information somewhere temporarily,
9586 ;; perhaps... Hmmm...
9588 ;; Remove any negative articles numbers.
9589 (while (and unread
(< (car unread
) 0))
9590 (setq unread
(cdr unread
)))
9591 ;; Remove any expired article numbers
9592 (while (and unread
(< (car unread
) (car active
)))
9593 (setq unread
(cdr unread
)))
9594 ;; Compute the ranges of read articles by looking at the list of
9597 (when (/= (car unread
) prev
)
9598 (push (if (= prev
(1- (car unread
))) prev
9599 (cons prev
(1- (car unread
))))
9601 (setq prev
(1+ (car unread
)))
9602 (setq unread
(cdr unread
)))
9603 (when (<= prev
(cdr active
))
9604 (push (cons prev
(cdr active
)) read
))
9605 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
9610 ;; Propagate the read marks to the backend.
9611 (when (gnus-check-backend-function 'request-set-mark group
)
9612 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
9613 (add (gnus-remove-from-range read
(gnus-info-read info
))))
9615 (unless (gnus-check-group group
)
9616 (error "Can't open server for %s" group
))
9617 (gnus-request-set-mark
9618 group
(delq nil
(list (if add
(list add
'add
'(read)))
9619 (if del
(list del
'del
'(read))))))
9621 `(gnus-request-set-mark
9624 (if del
(list del
'add
'(read)))
9625 (if add
(list add
'del
'(read))))))))))
9626 (set-buffer gnus-group-buffer
)
9629 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
9630 (gnus-info-set-read ',info
',(gnus-info-read info
))
9631 (gnus-get-unread-articles-in-group ',info
9632 (gnus-active ,group
))
9633 (gnus-group-update-group ,group t
)
9635 ;; Enter this list into the group info.
9636 (gnus-info-set-read info read
)
9637 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9638 (gnus-get-unread-articles-in-group info
(gnus-active group
))
9641 (defun gnus-offer-save-summaries ()
9642 "Offer to save all active summary buffers."
9644 (let ((buflist (buffer-list))
9646 ;; Go through all buffers and find all summaries.
9648 (and (setq bufname
(buffer-name (car buflist
)))
9649 (string-match "Summary" bufname
)
9651 (set-buffer bufname
)
9652 ;; We check that this is, indeed, a summary buffer.
9653 (and (eq major-mode
'gnus-summary-mode
)
9654 ;; Also make sure this isn't bogus.
9655 gnus-newsgroup-prepared
9656 ;; Also make sure that this isn't a dead summary buffer.
9657 (not gnus-dead-summary-mode
)))
9658 (push bufname buffers
))
9659 (setq buflist
(cdr buflist
)))
9660 ;; Go through all these summary buffers and offer to save them.
9663 "Update summary buffer %s? "
9665 (switch-to-buffer buf
)
9666 (gnus-summary-exit))
9669 (defun gnus-summary-setup-default-charset ()
9670 "Setup newsgroup default charset."
9671 (if (equal gnus-newsgroup-name
"nndraft:drafts")
9672 (setq gnus-newsgroup-charset nil
)
9673 (let* ((name (and gnus-newsgroup-name
9674 (gnus-group-real-name gnus-newsgroup-name
)))
9676 (or gnus-newsgroup-ephemeral-ignored-charsets
9678 (and gnus-newsgroup-name
9679 (or (gnus-group-find-parameter gnus-newsgroup-name
9680 'ignored-charsets t
)
9681 (let ((alist gnus-group-ignored-charsets-alist
)
9682 elem
(charsets nil
))
9683 (while (setq elem
(pop alist
))
9685 (string-match (car elem
) name
))
9687 charsets
(cdr elem
))))
9689 gnus-newsgroup-ignored-charsets
))))
9690 (setq gnus-newsgroup-charset
9691 (or gnus-newsgroup-ephemeral-charset
9692 (and gnus-newsgroup-name
9693 (or (gnus-group-find-parameter gnus-newsgroup-name
'charset
)
9694 (let ((alist gnus-group-charset-alist
)
9696 (while (setq elem
(pop alist
))
9698 (string-match (car elem
) name
))
9700 charset
(cadr elem
))))
9702 gnus-default-charset
))
9703 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
9704 ignored-charsets
))))
9710 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
9711 "Display the current article buffer fully MIME-buttonized.
9712 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9713 treated as multipart/mixed."
9716 (let ((gnus-unbuttonized-mime-types nil
)
9717 (gnus-mime-display-multipart-as-mixed show-all-parts
))
9718 (gnus-summary-show-article)))
9720 (defun gnus-summary-repair-multipart (article)
9721 "Add a Content-Type header to a multipart article without one."
9722 (interactive (list (gnus-summary-article-number)))
9723 (gnus-with-article article
9724 (message-narrow-to-head)
9725 (goto-char (point-max))
9727 (when (search-forward "\n--" nil t
)
9728 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9729 (message-narrow-to-head)
9730 (message-remove-header "Mime-Version")
9731 (message-remove-header "Content-Type")
9732 (goto-char (point-max))
9733 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9735 (insert "Mime-Version: 1.0\n")
9737 (let (gnus-mark-article-hook)
9738 (gnus-summary-select-article t t nil article
)))
9740 (defun gnus-summary-toggle-display-buttonized ()
9741 "Toggle the buttonizing of the article buffer."
9744 (if (setq gnus-inhibit-mime-unbuttonizing
9745 (not gnus-inhibit-mime-unbuttonizing
))
9746 (let ((gnus-unbuttonized-mime-types nil
))
9747 (gnus-summary-show-article))
9748 (gnus-summary-show-article)))
9751 ;;; Generic summary marking commands
9754 (defvar gnus-summary-marking-alist
9755 '((read gnus-del-mark
"d")
9756 (unread gnus-unread-mark
"u")
9757 (ticked gnus-ticked-mark
"!")
9758 (dormant gnus-dormant-mark
"?")
9759 (expirable gnus-expirable-mark
"e"))
9760 "An alist of names/marks/keystrokes.")
9762 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
9763 (defvar gnus-summary-mark-map
)
9765 (defun gnus-summary-make-all-marking-commands ()
9766 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
9767 (dolist (elem gnus-summary-marking-alist
)
9768 (apply 'gnus-summary-make-marking-command elem
)))
9770 (defun gnus-summary-make-marking-command (name mark keystroke
)
9771 (let ((map (make-sparse-keymap)))
9772 (define-key gnus-summary-generic-mark-map keystroke map
)
9773 (dolist (lway `((next "next" next nil
"n")
9774 (next-unread "next unread" next t
"N")
9775 (prev "previous" prev nil
"p")
9776 (prev-unread "previous unread" prev t
"P")
9777 (nomove "" nil nil
,keystroke
)))
9778 (let ((func (gnus-summary-make-marking-command-1
9779 mark
(car lway
) lway name
)))
9780 (setq func
(eval func
))
9781 (define-key map
(nth 4 lway
) func
)))))
9783 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
9785 (format "gnus-summary-put-mark-as-%s%s"
9786 name
(if (eq way
'nomove
)
9788 (concat "-" (symbol-name way
)))))
9791 "Mark the current article as %s%s.
9792 If N, the prefix, then repeat N times.
9793 If N is negative, move in reverse order.
9794 The difference between N and the actual number of articles marked is
9798 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
9800 (defun gnus-summary-generic-mark (n mark move unread
)
9801 "Mark N articles with MARK."
9802 (unless (eq major-mode
'gnus-summary-mode
)
9803 (error "This command can only be used in the summary buffer"))
9804 (gnus-summary-show-thread)
9808 ((eq move
'prev
) -
1)
9814 nummove
(* -
1 nummove
))))
9816 (gnus-summary-mark-article nil mark
)
9817 (zerop (gnus-summary-next-subject nummove unread t
)))
9820 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
9821 (gnus-summary-recenter)
9822 (gnus-summary-position-point)
9823 (gnus-set-mode-line 'summary
)
9826 (gnus-summary-make-all-marking-commands)
9832 (run-hooks 'gnus-sum-load-hook
)
9834 ;;; gnus-sum.el ends here