lisp/ChangeLog addition:
[gnus] / lisp / gnus-sum.el
1 ;;; gnus-sum.el --- summary mode commands for Gnus
2
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;;   2005, 2006, 2007 Free Software Foundation, Inc.
5
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Keywords: news
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
25
26 ;;; Commentary:
27
28 ;;; Code:
29
30 (eval-when-compile
31   (require 'cl)
32   (defvar tool-bar-mode))
33
34 (require 'gnus)
35 (require 'gnus-group)
36 (require 'gnus-spec)
37 (require 'gnus-range)
38 (require 'gnus-int)
39 (require 'gnus-undo)
40 (require 'gnus-util)
41 (require 'gmm-utils)
42 (require 'mm-decode)
43 (require 'nnoo)
44
45 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
46 (autoload 'gnus-cache-write-active "gnus-cache")
47 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
48 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
49 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
50 (autoload 'mm-uu-dissect "mm-uu")
51 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
52   "Deuglify broken Outlook (Express) articles and redisplay."
53   t)
54 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
55 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
56 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
57
58 (defcustom gnus-kill-summary-on-exit t
59   "*If non-nil, kill the summary buffer when you exit from it.
60 If nil, the summary will become a \"*Dead Summary*\" buffer, and
61 it will be killed sometime later."
62   :group 'gnus-summary-exit
63   :type 'boolean)
64
65 (defcustom gnus-fetch-old-headers nil
66   "*Non-nil means that Gnus will try to build threads by grabbing old headers.
67 If an unread article in the group refers to an older, already
68 read (or just marked as read) article, the old article will not
69 normally be displayed in the Summary buffer.  If this variable is
70 t, Gnus will attempt to grab the headers to the old articles, and
71 thereby build complete threads.  If it has the value `some', all
72 old headers will be fetched but only enough headers to connect
73 otherwise loose threads will be displayed.  This variable can
74 also be a number.  In that case, no more than that number of old
75 headers will be fetched.  If it has the value `invisible', all
76 old headers will be fetched, but none will be displayed.
77
78 The server has to support NOV for any of this to work.
79
80 This feature can seriously impact performance it ignores all
81 locally cached header entries."
82   :group 'gnus-thread
83   :type '(choice (const :tag "off" nil)
84                  (const :tag "on" t)
85                  (const some)
86                  (const invisible)
87                  number
88                  (sexp :menu-tag "other" t)))
89
90 (defcustom gnus-refer-thread-limit 500
91   "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
92 If t, fetch all the available old headers."
93   :group 'gnus-thread
94   :type '(choice number
95                  (sexp :menu-tag "other" t)))
96
97 (defcustom gnus-summary-make-false-root 'adopt
98   "*nil means that Gnus won't gather loose threads.
99 If the root of a thread has expired or been read in a previous
100 session, the information necessary to build a complete thread has been
101 lost.  Instead of having many small sub-threads from this original thread
102 scattered all over the summary buffer, Gnus can gather them.
103
104 If non-nil, Gnus will try to gather all loose sub-threads from an
105 original thread into one large thread.
106
107 If this variable is non-nil, it should be one of `none', `adopt',
108 `dummy' or `empty'.
109
110 If this variable is `none', Gnus will not make a false root, but just
111 present the sub-threads after another.
112 If this variable is `dummy', Gnus will create a dummy root that will
113 have all the sub-threads as children.
114 If this variable is `adopt', Gnus will make one of the \"children\"
115 the parent and mark all the step-children as such.
116 If this variable is `empty', the \"children\" are printed with empty
117 subject fields.  (Or rather, they will be printed with a string
118 given by the `gnus-summary-same-subject' variable.)"
119   :group 'gnus-thread
120   :type '(choice (const :tag "off" nil)
121                  (const none)
122                  (const dummy)
123                  (const adopt)
124                  (const empty)))
125
126 (defcustom gnus-summary-make-false-root-always nil
127   "Always make a false dummy root."
128   :version "22.1"
129   :group 'gnus-thread
130   :type 'boolean)
131
132 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
133   "*A regexp to match subjects to be excluded from loose thread gathering.
134 As loose thread gathering is done on subjects only, that means that
135 there can be many false gatherings performed.  By rooting out certain
136 common subjects, gathering might become saner."
137   :group 'gnus-thread
138   :type 'regexp)
139
140 (defcustom gnus-summary-gather-subject-limit nil
141   "*Maximum length of subject comparisons when gathering loose threads.
142 Use nil to compare full subjects.  Setting this variable to a low
143 number will help gather threads that have been corrupted by
144 newsreaders chopping off subject lines, but it might also mean that
145 unrelated articles that have subject that happen to begin with the
146 same few characters will be incorrectly gathered.
147
148 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
149 comparing subjects."
150   :group 'gnus-thread
151   :type '(choice (const :tag "off" nil)
152                  (const fuzzy)
153                  (sexp :menu-tag "on" t)))
154
155 (defcustom gnus-simplify-subject-functions nil
156   "List of functions taking a string argument that simplify subjects.
157 The functions are applied recursively.
158
159 Useful functions to put in this list include:
160 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
161 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
162   :group 'gnus-thread
163   :type '(repeat function))
164
165 (defcustom gnus-simplify-ignored-prefixes nil
166   "*Remove matches for this regexp from subject lines when simplifying fuzzily."
167   :group 'gnus-thread
168   :type '(choice (const :tag "off" nil)
169                  regexp))
170
171 (defcustom gnus-build-sparse-threads nil
172   "*If non-nil, fill in the gaps in threads.
173 If `some', only fill in the gaps that are needed to tie loose threads
174 together.  If `more', fill in all leaf nodes that Gnus can find.  If
175 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
176   :group 'gnus-thread
177   :type '(choice (const :tag "off" nil)
178                  (const some)
179                  (const more)
180                  (sexp :menu-tag "all" t)))
181
182 (defcustom gnus-summary-thread-gathering-function
183   'gnus-gather-threads-by-subject
184   "*Function used for gathering loose threads.
185 There are two pre-defined functions: `gnus-gather-threads-by-subject',
186 which only takes Subjects into consideration; and
187 `gnus-gather-threads-by-references', which compared the References
188 headers of the articles to find matches."
189   :group 'gnus-thread
190   :type '(radio (function-item gnus-gather-threads-by-subject)
191                 (function-item gnus-gather-threads-by-references)
192                 (function :tag "other")))
193
194 (defcustom gnus-summary-same-subject ""
195   "*String indicating that the current article has the same subject as the previous.
196 This variable will only be used if the value of
197 `gnus-summary-make-false-root' is `empty'."
198   :group 'gnus-summary-format
199   :type 'string)
200
201 (defcustom gnus-summary-goto-unread t
202   "*If t, many commands will go to the next unread article.
203 This applies to marking commands as well as other commands that
204 \"naturally\" select the next article, like, for instance, `SPC' at
205 the end of an article.
206
207 If nil, the marking commands do NOT go to the next unread article
208 \(they go to the next article instead).  If `never', commands that
209 usually go to the next unread article, will go to the next article,
210 whether it is read or not."
211   :group 'gnus-summary-marks
212   :link '(custom-manual "(gnus)Setting Marks")
213   :type '(choice (const :tag "off" nil)
214                  (const never)
215                  (sexp :menu-tag "on" t)))
216
217 (defcustom gnus-summary-default-score 0
218   "*Default article score level.
219 All scores generated by the score files will be added to this score.
220 If this variable is nil, scoring will be disabled."
221   :group 'gnus-score-default
222   :type '(choice (const :tag "disable")
223                  integer))
224
225 (defcustom gnus-summary-default-high-score 0
226   "*Default threshold for a high scored article.
227 An article will be highlighted as high scored if its score is greater
228 than this score."
229   :version "22.1"
230   :group 'gnus-score-default
231   :type 'integer)
232
233 (defcustom gnus-summary-default-low-score 0
234   "*Default threshold for a low scored article.
235 An article will be highlighted as low scored if its score is smaller
236 than this score."
237   :version "22.1"
238   :group 'gnus-score-default
239   :type 'integer)
240
241 (defcustom gnus-summary-zcore-fuzz 0
242   "*Fuzziness factor for the zcore in the summary buffer.
243 Articles with scores closer than this to `gnus-summary-default-score'
244 will not be marked."
245   :group 'gnus-summary-format
246   :type 'integer)
247
248 (defcustom gnus-simplify-subject-fuzzy-regexp nil
249   "*Strings to be removed when doing fuzzy matches.
250 This can either be a regular expression or list of regular expressions
251 that will be removed from subject strings if fuzzy subject
252 simplification is selected."
253   :group 'gnus-thread
254   :type '(repeat regexp))
255
256 (defcustom gnus-show-threads t
257   "*If non-nil, display threads in summary mode."
258   :group 'gnus-thread
259   :type 'boolean)
260
261 (defcustom gnus-thread-hide-subtree nil
262   "*If non-nil, hide all threads initially.
263 This can be a predicate specifier which says which threads to hide.
264 If threads are hidden, you have to run the command
265 `gnus-summary-show-thread' by hand or select an article."
266   :group 'gnus-thread
267   :type '(radio (sexp :format "Non-nil\n"
268                       :match (lambda (widget value)
269                                (not (or (consp value) (functionp value))))
270                       :value t)
271                 (const nil)
272                 (sexp :tag "Predicate specifier")))
273
274 (defcustom gnus-thread-hide-killed t
275   "*If non-nil, hide killed threads automatically."
276   :group 'gnus-thread
277   :type 'boolean)
278
279 (defcustom gnus-thread-ignore-subject t
280   "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
281 If nil, articles that have different subjects from their parents will
282 start separate threads."
283   :group 'gnus-thread
284   :type 'boolean)
285
286 (defcustom gnus-thread-operation-ignore-subject t
287   "*If non-nil, subjects will be ignored when doing thread commands.
288 This affects commands like `gnus-summary-kill-thread' and
289 `gnus-summary-lower-thread'.
290
291 If this variable is nil, articles in the same thread with different
292 subjects will not be included in the operation in question.  If this
293 variable is `fuzzy', only articles that have subjects that are fuzzily
294 equal will be included."
295   :group 'gnus-thread
296   :type '(choice (const :tag "off" nil)
297                  (const fuzzy)
298                  (sexp :tag "on" t)))
299
300 (defcustom gnus-thread-indent-level 4
301   "*Number that says how much each sub-thread should be indented."
302   :group 'gnus-thread
303   :type 'integer)
304
305 (defcustom gnus-auto-extend-newsgroup t
306   "*If non-nil, extend newsgroup forward and backward when requested."
307   :group 'gnus-summary-choose
308   :type 'boolean)
309
310 (defcustom gnus-auto-select-first t
311   "If non-nil, select an article on group entry.
312 An article is selected automatically when entering a group
313 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
314 `gnus-summary-catchup-and-goto-next-group'.
315
316 Which article is selected is controlled by the variable
317 `gnus-auto-select-subject'.
318
319 If you want to prevent automatic selection of articles in some
320 newsgroups, set the variable to nil in `gnus-select-group-hook'."
321   ;; Commands include...
322   ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
323   ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
324   ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
325   :group 'gnus-group-select
326   :type '(choice (const :tag "none" nil)
327                  (sexp :menu-tag "first" t)))
328
329 (defcustom gnus-auto-select-subject 'unread
330   "*Says what subject to place under point when entering a group.
331
332 This variable can either be the symbols `first' (place point on the
333 first subject), `unread' (place point on the subject line of the first
334 unread article), `best' (place point on the subject line of the
335 higest-scored article), `unseen' (place point on the subject line of
336 the first unseen article), `unseen-or-unread' (place point on the subject
337 line of the first unseen article or, if all article have been seen, on the
338 subject line of the first unread article), or a function to be called to
339 place point on some subject line."
340   :version "22.1"
341   :group 'gnus-group-select
342   :type '(choice (const best)
343                  (const unread)
344                  (const first)
345                  (const unseen)
346                  (const unseen-or-unread)))
347
348 (defcustom gnus-auto-select-next t
349   "*If non-nil, offer to go to the next group from the end of the previous.
350 If the value is t and the next newsgroup is empty, Gnus will exit
351 summary mode and go back to group mode.  If the value is neither nil
352 nor t, Gnus will select the following unread newsgroup.  In
353 particular, if the value is the symbol `quietly', the next unread
354 newsgroup will be selected without any confirmation, and if it is
355 `almost-quietly', the next group will be selected without any
356 confirmation if you are located on the last article in the group.
357 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
358 will go to the next group without confirmation."
359   :group 'gnus-summary-maneuvering
360   :type '(choice (const :tag "off" nil)
361                  (const quietly)
362                  (const almost-quietly)
363                  (const slightly-quietly)
364                  (sexp :menu-tag "on" t)))
365
366 (defcustom gnus-auto-select-same nil
367   "*If non-nil, select the next article with the same subject.
368 If there are no more articles with the same subject, go to
369 the first unread article."
370   :group 'gnus-summary-maneuvering
371   :type 'boolean)
372
373 (defcustom gnus-auto-goto-ignores 'unfetched
374   "*Says how to handle unfetched articles when maneuvering.
375
376 This variable can either be the symbols nil (maneuver to any
377 article), `undownloaded' (maneuvering while unplugged ignores articles
378 that have not been fetched), `always-undownloaded' (maneuvering always
379 ignores articles that have not been fetched), `unfetched' (maneuvering
380 ignores articles whose headers have not been fetched).
381
382 NOTE: The list of unfetched articles will always be nil when plugged
383 and, when unplugged, a subset of the undownloaded article list."
384   :version "22.1"
385   :group 'gnus-summary-maneuvering
386   :type '(choice (const :tag "None" nil)
387                  (const :tag "Undownloaded when unplugged" undownloaded)
388                  (const :tag "Undownloaded" always-undownloaded)
389                  (const :tag "Unfetched" unfetched)))
390
391 (defcustom gnus-summary-check-current nil
392   "*If non-nil, consider the current article when moving.
393 The \"unread\" movement commands will stay on the same line if the
394 current article is unread."
395   :group 'gnus-summary-maneuvering
396   :type 'boolean)
397
398 (defcustom gnus-auto-center-summary 2
399   "*If non-nil, always center the current summary buffer.
400 In particular, if `vertical' do only vertical recentering.  If non-nil
401 and non-`vertical', do both horizontal and vertical recentering."
402   :group 'gnus-summary-maneuvering
403   :type '(choice (const :tag "none" nil)
404                  (const vertical)
405                  (integer :tag "height")
406                  (sexp :menu-tag "both" t)))
407
408 (defvar gnus-auto-center-group t
409   "*If non-nil, always center the group buffer.")
410
411 (defcustom gnus-show-all-headers nil
412   "*If non-nil, don't hide any headers."
413   :group 'gnus-article-hiding
414   :group 'gnus-article-headers
415   :type 'boolean)
416
417 (defcustom gnus-summary-ignore-duplicates nil
418   "*If non-nil, ignore articles with identical Message-ID headers."
419   :group 'gnus-summary
420   :type 'boolean)
421
422 (defcustom gnus-single-article-buffer t
423   "*If non-nil, display all articles in the same buffer.
424 If nil, each group will get its own article buffer."
425   :group 'gnus-article-various
426   :type 'boolean)
427
428 (defcustom gnus-break-pages t
429   "*If non-nil, do page breaking on articles.
430 The page delimiter is specified by the `gnus-page-delimiter'
431 variable."
432   :group 'gnus-article-various
433   :type 'boolean)
434
435 (defcustom gnus-move-split-methods nil
436   "*Variable used to suggest where articles are to be moved to.
437 It uses the same syntax as the `gnus-split-methods' variable.
438 However, whereas `gnus-split-methods' specifies file names as targets,
439 this variable specifies group names."
440   :group 'gnus-summary-mail
441   :type '(repeat (choice (list :value (fun) function)
442                          (cons :value ("" "") regexp (repeat string))
443                          (sexp :value nil))))
444
445 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
446   "Function used to compute default prefix for article move/copy/etc prompts.
447 The function should take one argument, a group name, and return a
448 string with the suggested prefix."
449   :group 'gnus-summary-mail
450   :type 'function)
451
452 ;; FIXME: Although the custom type is `character' for the following variables,
453 ;; using multibyte characters (Latin-1, UTF-8) doesn't work.  -- rs
454
455 (defcustom gnus-unread-mark ?           ;Whitespace
456   "*Mark used for unread articles."
457   :group 'gnus-summary-marks
458   :type 'character)
459
460 (defcustom gnus-ticked-mark ?!
461   "*Mark used for ticked articles."
462   :group 'gnus-summary-marks
463   :type 'character)
464
465 (defcustom gnus-dormant-mark ??
466   "*Mark used for dormant articles."
467   :group 'gnus-summary-marks
468   :type 'character)
469
470 (defcustom gnus-del-mark ?r
471   "*Mark used for del'd articles."
472   :group 'gnus-summary-marks
473   :type 'character)
474
475 (defcustom gnus-read-mark ?R
476   "*Mark used for read articles."
477   :group 'gnus-summary-marks
478   :type 'character)
479
480 (defcustom gnus-expirable-mark ?E
481   "*Mark used for expirable articles."
482   :group 'gnus-summary-marks
483   :type 'character)
484
485 (defcustom gnus-killed-mark ?K
486   "*Mark used for killed articles."
487   :group 'gnus-summary-marks
488   :type 'character)
489
490 (defcustom gnus-spam-mark ?$
491   "*Mark used for spam articles."
492   :version "22.1"
493   :group 'gnus-summary-marks
494   :type 'character)
495
496 (defcustom gnus-souped-mark ?F
497   "*Mark used for souped articles."
498   :group 'gnus-summary-marks
499   :type 'character)
500
501 (defcustom gnus-kill-file-mark ?X
502   "*Mark used for articles killed by kill files."
503   :group 'gnus-summary-marks
504   :type 'character)
505
506 (defcustom gnus-low-score-mark ?Y
507   "*Mark used for articles with a low score."
508   :group 'gnus-summary-marks
509   :type 'character)
510
511 (defcustom gnus-catchup-mark ?C
512   "*Mark used for articles that are caught up."
513   :group 'gnus-summary-marks
514   :type 'character)
515
516 (defcustom gnus-replied-mark ?A
517   "*Mark used for articles that have been replied to."
518   :group 'gnus-summary-marks
519   :type 'character)
520
521 (defcustom gnus-forwarded-mark ?F
522   "*Mark used for articles that have been forwarded."
523   :version "22.1"
524   :group 'gnus-summary-marks
525   :type 'character)
526
527 (defcustom gnus-recent-mark ?N
528   "*Mark used for articles that are recent."
529   :version "22.1"
530   :group 'gnus-summary-marks
531   :type 'character)
532
533 (defcustom gnus-cached-mark ?*
534   "*Mark used for articles that are in the cache."
535   :group 'gnus-summary-marks
536   :type 'character)
537
538 (defcustom gnus-saved-mark ?S
539   "*Mark used for articles that have been saved."
540   :group 'gnus-summary-marks
541   :type 'character)
542
543 (defcustom gnus-unseen-mark ?.
544   "*Mark used for articles that haven't been seen."
545   :version "22.1"
546   :group 'gnus-summary-marks
547   :type 'character)
548
549 (defcustom gnus-no-mark ?               ;Whitespace
550   "*Mark used for articles that have no other secondary mark."
551   :version "22.1"
552   :group 'gnus-summary-marks
553   :type 'character)
554
555 (defcustom gnus-ancient-mark ?O
556   "*Mark used for ancient articles."
557   :group 'gnus-summary-marks
558   :type 'character)
559
560 (defcustom gnus-sparse-mark ?Q
561   "*Mark used for sparsely reffed articles."
562   :group 'gnus-summary-marks
563   :type 'character)
564
565 (defcustom gnus-canceled-mark ?G
566   "*Mark used for canceled articles."
567   :group 'gnus-summary-marks
568   :type 'character)
569
570 (defcustom gnus-duplicate-mark ?M
571   "*Mark used for duplicate articles."
572   :group 'gnus-summary-marks
573   :type 'character)
574
575 (defcustom gnus-undownloaded-mark ?-
576   "*Mark used for articles that weren't downloaded."
577   :version "22.1"
578   :group 'gnus-summary-marks
579   :type 'character)
580
581 (defcustom gnus-downloaded-mark ?+
582   "*Mark used for articles that were downloaded."
583   :group 'gnus-summary-marks
584   :type 'character)
585
586 (defcustom gnus-downloadable-mark ?%
587   "*Mark used for articles that are to be downloaded."
588   :group 'gnus-summary-marks
589   :type 'character)
590
591 (defcustom gnus-unsendable-mark ?=
592   "*Mark used for articles that won't be sent."
593   :group 'gnus-summary-marks
594   :type 'character)
595
596 (defcustom gnus-score-over-mark ?+
597   "*Score mark used for articles with high scores."
598   :group 'gnus-summary-marks
599   :type 'character)
600
601 (defcustom gnus-score-below-mark ?-
602   "*Score mark used for articles with low scores."
603   :group 'gnus-summary-marks
604   :type 'character)
605
606 (defcustom gnus-empty-thread-mark ?     ;Whitespace
607   "*There is no thread under the article."
608   :group 'gnus-summary-marks
609   :type 'character)
610
611 (defcustom gnus-not-empty-thread-mark ?=
612   "*There is a thread under the article."
613   :group 'gnus-summary-marks
614   :type 'character)
615
616 (defcustom gnus-view-pseudo-asynchronously nil
617   "*If non-nil, Gnus will view pseudo-articles asynchronously."
618   :group 'gnus-extract-view
619   :type 'boolean)
620
621 (defcustom gnus-auto-expirable-marks
622   (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
623         gnus-low-score-mark gnus-ancient-mark gnus-read-mark
624         gnus-souped-mark gnus-duplicate-mark)
625   "*The list of marks converted into expiration if a group is auto-expirable."
626   :version "21.1"
627   :group 'gnus-summary
628   :type '(repeat character))
629
630 (defcustom gnus-inhibit-user-auto-expire t
631   "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
632   :version "21.1"
633   :group 'gnus-summary
634   :type 'boolean)
635
636 (defcustom gnus-view-pseudos nil
637   "*If `automatic', pseudo-articles will be viewed automatically.
638 If `not-confirm', pseudos will be viewed automatically, and the user
639 will not be asked to confirm the command."
640   :group 'gnus-extract-view
641   :type '(choice (const :tag "off" nil)
642                  (const automatic)
643                  (const not-confirm)))
644
645 (defcustom gnus-view-pseudos-separately t
646   "*If non-nil, one pseudo-article will be created for each file to be viewed.
647 If nil, all files that use the same viewing command will be given as a
648 list of parameters to that command."
649   :group 'gnus-extract-view
650   :type 'boolean)
651
652 (defcustom gnus-insert-pseudo-articles t
653   "*If non-nil, insert pseudo-articles when decoding articles."
654   :group 'gnus-extract-view
655   :type 'boolean)
656
657 (defcustom gnus-summary-dummy-line-format
658   "   %(:                             :%) %S\n"
659   "*The format specification for the dummy roots in the summary buffer.
660 It works along the same lines as a normal formatting string,
661 with some simple extensions.
662
663 %S  The subject
664
665 General format specifiers can also be used.
666 See `(gnus)Formatting Variables'."
667   :link '(custom-manual "(gnus)Formatting Variables")
668   :group 'gnus-threading
669   :type 'string)
670
671 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
672   "*The format specification for the summary mode line.
673 It works along the same lines as a normal formatting string,
674 with some simple extensions:
675
676 %G  Group name
677 %p  Unprefixed group name
678 %A  Current article number
679 %z  Current article score
680 %V  Gnus version
681 %U  Number of unread articles in the group
682 %e  Number of unselected articles in the group
683 %Z  A string with unread/unselected article counts
684 %g  Shortish group name
685 %S  Subject of the current article
686 %u  User-defined spec
687 %s  Current score file name
688 %d  Number of dormant articles
689 %r  Number of articles that have been marked as read in this session
690 %E  Number of articles expunged by the score files"
691   :group 'gnus-summary-format
692   :type 'string)
693
694 (defcustom gnus-list-identifiers nil
695   "Regexp that matches list identifiers to be removed from subject.
696 This can also be a list of regexps."
697   :version "21.1"
698   :group 'gnus-summary-format
699   :group 'gnus-article-hiding
700   :type '(choice (const :tag "none" nil)
701                  (regexp :value ".*")
702                  (repeat :value (".*") regexp)))
703
704 (defcustom gnus-summary-mark-below 0
705   "*Mark all articles with a score below this variable as read.
706 This variable is local to each summary buffer and usually set by the
707 score file."
708   :group 'gnus-score-default
709   :type 'integer)
710
711 (defun gnus-widget-reversible-match (widget value)
712   "Ignoring WIDGET, convert VALUE to internal form.
713 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
714   ;; (debug value)
715   (or (symbolp value)
716       (and (listp value)
717            (eq (length value) 2)
718            (eq (nth 0 value) 'not)
719            (symbolp (nth 1 value)))))
720
721 (defun gnus-widget-reversible-to-internal (widget value)
722   "Ignoring WIDGET, convert VALUE to internal form.
723 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
724 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
725   ;; (debug value)
726   (if (atom value)
727       (list value nil)
728     (list (nth 1 value) t)))
729
730 (defun gnus-widget-reversible-to-external (widget value)
731   "Ignoring WIDGET, convert VALUE to external form.
732 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
733 \(FOO  nil) is converted to FOO and (FOO t) is converted to (not FOO)."
734   ;; (debug value)
735   (if (nth 1 value)
736       (list 'not (nth 0 value))
737     (nth 0 value)))
738
739 (define-widget 'gnus-widget-reversible 'group
740   "A `group' that convert values."
741   :match 'gnus-widget-reversible-match
742   :value-to-internal 'gnus-widget-reversible-to-internal
743   :value-to-external 'gnus-widget-reversible-to-external)
744
745 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
746   "*List of functions used for sorting articles in the summary buffer.
747
748 Each function takes two articles and returns non-nil if the first
749 article should be sorted before the other.  If you use more than one
750 function, the primary sort function should be the last.  You should
751 probably always include `gnus-article-sort-by-number' in the list of
752 sorting functions -- preferably first.  Also note that sorting by date
753 is often much slower than sorting by number, and the sorting order is
754 very similar.  (Sorting by date means sorting by the time the message
755 was sent, sorting by number means sorting by arrival time.)
756
757 Each item can also be a list `(not F)' where F is a function;
758 this reverses the sort order.
759
760 Ready-made functions include `gnus-article-sort-by-number',
761 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
762 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
763 and `gnus-article-sort-by-score'.
764
765 When threading is turned on, the variable `gnus-thread-sort-functions'
766 controls how articles are sorted."
767   :group 'gnus-summary-sort
768   :type '(repeat (gnus-widget-reversible
769                   (choice (function-item gnus-article-sort-by-number)
770                           (function-item gnus-article-sort-by-author)
771                           (function-item gnus-article-sort-by-subject)
772                           (function-item gnus-article-sort-by-date)
773                           (function-item gnus-article-sort-by-score)
774                           (function-item gnus-article-sort-by-random)
775                           (function :tag "other"))
776                   (boolean :tag "Reverse order"))))
777
778
779 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
780   "*List of functions used for sorting threads in the summary buffer.
781 By default, threads are sorted by article number.
782
783 Each function takes two threads and returns non-nil if the first
784 thread should be sorted before the other.  If you use more than one
785 function, the primary sort function should be the last.  You should
786 probably always include `gnus-thread-sort-by-number' in the list of
787 sorting functions -- preferably first.  Also note that sorting by date
788 is often much slower than sorting by number, and the sorting order is
789 very similar.  (Sorting by date means sorting by the time the message
790 was sent, sorting by number means sorting by arrival time.)
791
792 Each list item can also be a list `(not F)' where F is a
793 function; this specifies reversed sort order.
794
795 Ready-made functions include `gnus-thread-sort-by-number',
796 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
797 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
798 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
799 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
800 and `gnus-thread-sort-by-total-score' (see
801 `gnus-thread-score-function').
802
803 When threading is turned off, the variable
804 `gnus-article-sort-functions' controls how articles are sorted."
805   :group 'gnus-summary-sort
806   :type '(repeat
807           (gnus-widget-reversible
808            (choice (function-item gnus-thread-sort-by-number)
809                    (function-item gnus-thread-sort-by-author)
810                    (function-item gnus-thread-sort-by-recipient)
811                    (function-item gnus-thread-sort-by-subject)
812                    (function-item gnus-thread-sort-by-date)
813                    (function-item gnus-thread-sort-by-score)
814                    (function-item gnus-thread-sort-by-most-recent-number)
815                    (function-item gnus-thread-sort-by-most-recent-date)
816                    (function-item gnus-thread-sort-by-random)
817                    (function-item gnus-thread-sort-by-total-score)
818                    (function :tag "other"))
819            (boolean :tag "Reverse order"))))
820
821 (defcustom gnus-thread-score-function '+
822   "*Function used for calculating the total score of a thread.
823
824 The function is called with the scores of the article and each
825 subthread and should then return the score of the thread.
826
827 Some functions you can use are `+', `max', or `min'."
828   :group 'gnus-summary-sort
829   :type 'function)
830
831 (defcustom gnus-summary-expunge-below nil
832   "All articles that have a score less than this variable will be expunged.
833 This variable is local to the summary buffers."
834   :group 'gnus-score-default
835   :type '(choice (const :tag "off" nil)
836                  integer))
837
838 (defcustom gnus-thread-expunge-below nil
839   "All threads that have a total score less than this variable will be expunged.
840 See `gnus-thread-score-function' for en explanation of what a
841 \"thread score\" is.
842
843 This variable is local to the summary buffers."
844   :group 'gnus-threading
845   :group 'gnus-score-default
846   :type '(choice (const :tag "off" nil)
847                  integer))
848
849 (defcustom gnus-summary-mode-hook nil
850   "*A hook for Gnus summary mode.
851 This hook is run before any variables are set in the summary buffer."
852   :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
853   :group 'gnus-summary-various
854   :type 'hook)
855
856 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
857 (when (featurep 'xemacs)
858   (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
859   (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
860   (add-hook 'gnus-summary-mode-hook
861             'gnus-xmas-switch-horizontal-scrollbar-off))
862
863 (defcustom gnus-summary-menu-hook nil
864   "*Hook run after the creation of the summary mode menu."
865   :group 'gnus-summary-visual
866   :type 'hook)
867
868 (defcustom gnus-summary-exit-hook nil
869   "*A hook called on exit from the summary buffer.
870 It will be called with point in the group buffer."
871   :group 'gnus-summary-exit
872   :type 'hook)
873
874 (defcustom gnus-summary-prepare-hook nil
875   "*A hook called after the summary buffer has been generated.
876 If you want to modify the summary buffer, you can use this hook."
877   :group 'gnus-summary-various
878   :type 'hook)
879
880 (defcustom gnus-summary-prepared-hook nil
881   "*A hook called as the last thing after the summary buffer has been generated."
882   :group 'gnus-summary-various
883   :type 'hook)
884
885 (defcustom gnus-summary-generate-hook nil
886   "*A hook run just before generating the summary buffer.
887 This hook is commonly used to customize threading variables and the
888 like."
889   :group 'gnus-summary-various
890   :type 'hook)
891
892 (defcustom gnus-select-group-hook nil
893   "*A hook called when a newsgroup is selected.
894
895 If you'd like to simplify subjects like the
896 `gnus-summary-next-same-subject' command does, you can use the
897 following hook:
898
899  (add-hook gnus-select-group-hook
900            (lambda ()
901              (mapcar (lambda (header)
902                        (mail-header-set-subject
903                         header
904                         (gnus-simplify-subject
905                          (mail-header-subject header) 're-only)))
906                      gnus-newsgroup-headers)))"
907   :group 'gnus-group-select
908   :type 'hook)
909
910 (defcustom gnus-select-article-hook nil
911   "*A hook called when an article is selected."
912   :group 'gnus-summary-choose
913   :options '(gnus-agent-fetch-selected-article)
914   :type 'hook)
915
916 (defcustom gnus-visual-mark-article-hook
917   (list 'gnus-highlight-selected-summary)
918   "*Hook run after selecting an article in the summary buffer.
919 It is meant to be used for highlighting the article in some way.  It
920 is not run if `gnus-visual' is nil."
921   :group 'gnus-summary-visual
922   :type 'hook)
923
924 (defcustom gnus-parse-headers-hook nil
925   "*A hook called before parsing the headers."
926   :group 'gnus-various
927   :type 'hook)
928
929 (defcustom gnus-exit-group-hook nil
930   "*A hook called when exiting summary mode.
931 This hook is not called from the non-updating exit commands like `Q'."
932   :group 'gnus-various
933   :type 'hook)
934
935 (defcustom gnus-summary-update-hook
936   (list 'gnus-summary-highlight-line)
937   "*A hook called when a summary line is changed.
938 The hook will not be called if `gnus-visual' is nil.
939
940 The default function `gnus-summary-highlight-line' will
941 highlight the line according to the `gnus-summary-highlight'
942 variable."
943   :group 'gnus-summary-visual
944   :type 'hook)
945
946 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
947   "*A hook called when an article is selected for the first time.
948 The hook is intended to mark an article as read (or unread)
949 automatically when it is selected."
950   :group 'gnus-summary-choose
951   :type 'hook)
952
953 (defcustom gnus-group-no-more-groups-hook nil
954   "*A hook run when returning to group mode having no more (unread) groups."
955   :group 'gnus-group-select
956   :type 'hook)
957
958 (defcustom gnus-ps-print-hook nil
959   "*A hook run before ps-printing something from Gnus."
960   :group 'gnus-summary
961   :type 'hook)
962
963 (defcustom gnus-summary-article-move-hook nil
964   "*A hook called after an article is moved, copied, respooled, or crossposted."
965   :version "22.1"
966   :group 'gnus-summary
967   :type 'hook)
968
969 (defcustom gnus-summary-article-delete-hook nil
970   "*A hook called after an article is deleted."
971   :version "22.1"
972   :group 'gnus-summary
973   :type 'hook)
974
975 (defcustom gnus-summary-article-expire-hook nil
976   "*A hook called after an article is expired."
977   :version "22.1"
978   :group 'gnus-summary
979   :type 'hook)
980
981 (defcustom gnus-summary-display-arrow
982   (and (fboundp 'display-graphic-p)
983        (display-graphic-p))
984   "*If non-nil, display an arrow highlighting the current article."
985   :version "22.1"
986   :group 'gnus-summary
987   :type 'boolean)
988
989 (defcustom gnus-summary-selected-face 'gnus-summary-selected
990   "Face used for highlighting the current article in the summary buffer."
991   :group 'gnus-summary-visual
992   :type 'face)
993
994 (defvar gnus-tmp-downloaded nil)
995
996 (defcustom gnus-summary-highlight
997   '(((eq mark gnus-canceled-mark)
998      . gnus-summary-cancelled)
999     ((and uncached (> score default-high))
1000      . gnus-summary-high-undownloaded)
1001     ((and uncached (< score default-low))
1002      . gnus-summary-low-undownloaded)
1003     (uncached
1004      . gnus-summary-normal-undownloaded)
1005     ((and (> score default-high)
1006           (or (eq mark gnus-dormant-mark)
1007               (eq mark gnus-ticked-mark)))
1008      . gnus-summary-high-ticked)
1009     ((and (< score default-low)
1010           (or (eq mark gnus-dormant-mark)
1011               (eq mark gnus-ticked-mark)))
1012      . gnus-summary-low-ticked)
1013     ((or (eq mark gnus-dormant-mark)
1014          (eq mark gnus-ticked-mark))
1015      . gnus-summary-normal-ticked)
1016     ((and (> score default-high) (eq mark gnus-ancient-mark))
1017      . gnus-summary-high-ancient)
1018     ((and (< score default-low) (eq mark gnus-ancient-mark))
1019      . gnus-summary-low-ancient)
1020     ((eq mark gnus-ancient-mark)
1021      . gnus-summary-normal-ancient)
1022     ((and (> score default-high) (eq mark gnus-unread-mark))
1023      . gnus-summary-high-unread)
1024     ((and (< score default-low) (eq mark gnus-unread-mark))
1025      . gnus-summary-low-unread)
1026     ((eq mark gnus-unread-mark)
1027      . gnus-summary-normal-unread)
1028     ((> score default-high)
1029      . gnus-summary-high-read)
1030     ((< score default-low)
1031      . gnus-summary-low-read)
1032     (t
1033      . gnus-summary-normal-read))
1034   "*Controls the highlighting of summary buffer lines.
1035
1036 A list of (FORM . FACE) pairs.  When deciding how a a particular
1037 summary line should be displayed, each form is evaluated.  The content
1038 of the face field after the first true form is used.  You can change
1039 how those summary lines are displayed, by editing the face field.
1040
1041 You can use the following variables in the FORM field.
1042
1043 score:        The article's score
1044 default:      The default article score.
1045 default-high: The default score for high scored articles.
1046 default-low:  The default score for low scored articles.
1047 below:        The score below which articles are automatically marked as read.
1048 mark:         The article's mark.
1049 uncached:     Non-nil if the article is uncached."
1050   :group 'gnus-summary-visual
1051   :type '(repeat (cons (sexp :tag "Form" nil)
1052                        face)))
1053
1054 (defcustom gnus-alter-header-function nil
1055   "Function called to allow alteration of article header structures.
1056 The function is called with one parameter, the article header vector,
1057 which it may alter in any way."
1058   :type '(choice (const :tag "None" nil)
1059                  function)
1060   :group 'gnus-summary)
1061
1062 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1063   "Function used to decode a string with encoded words.")
1064
1065 (defvar gnus-decode-encoded-address-function
1066   'mail-decode-encoded-address-string
1067   "Function used to decode addresses with encoded words.")
1068
1069 (defcustom gnus-extra-headers '(To Newsgroups)