(message-idna-inside-rhs-p): Removed.
[gnus] / lisp / gnus-sum.el
1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 ;;        Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news
7
8 ;; This file is part of GNU Emacs.
9
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)
13 ;; any later version.
14
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.
19
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.
24
25 ;;; Commentary:
26
27 ;;; Code:
28
29 (eval-when-compile
30   (require 'cl)
31   (defvar tool-bar-map))
32
33 (require 'gnus)
34 (require 'gnus-group)
35 (require 'gnus-spec)
36 (require 'gnus-range)
37 (require 'gnus-int)
38 (require 'gnus-undo)
39 (require 'gnus-util)
40 (require 'mm-decode)
41 (require 'nnoo)
42
43 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
44 (autoload 'gnus-cache-write-active "gnus-cache")
45 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
46 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
47 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
48 (autoload 'mm-uu-dissect "mm-uu")
49 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
50   "Deuglify broken Outlook (Express) articles and redisplay."
51   t)
52 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
53 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
54 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
55
56 (defcustom gnus-kill-summary-on-exit t
57   "*If non-nil, kill the summary buffer when you exit from it.
58 If nil, the summary will become a \"*Dead Summary*\" buffer, and
59 it will be killed sometime later."
60   :group 'gnus-summary-exit
61   :type 'boolean)
62
63 (defcustom gnus-fetch-old-headers nil
64   "*Non-nil means that Gnus will try to build threads by grabbing old headers.
65 If an unread article in the group refers to an older, already read (or
66 just marked as read) article, the old article will not normally be
67 displayed in the Summary buffer.  If this variable is non-nil, Gnus
68 will attempt to grab the headers to the old articles, and thereby
69 build complete threads.  If it has the value `some', only enough
70 headers to connect otherwise loose threads will be displayed.  This
71 variable can also be a number.  In that case, no more than that number
72 of old headers will be fetched.  If it has the value `invisible', all
73 old headers will be fetched, but none will be displayed.
74
75 The server has to support NOV for any of this to work."
76   :group 'gnus-thread
77   :type '(choice (const :tag "off" nil)
78                  (const some)
79                  number
80                  (sexp :menu-tag "other" t)))
81
82 (defcustom gnus-refer-thread-limit 200
83   "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
84 If t, fetch all the available old headers."
85   :group 'gnus-thread
86   :type '(choice number
87                  (sexp :menu-tag "other" t)))
88
89 (defcustom gnus-summary-make-false-root 'adopt
90   "*nil means that Gnus won't gather loose threads.
91 If the root of a thread has expired or been read in a previous
92 session, the information necessary to build a complete thread has been
93 lost.  Instead of having many small sub-threads from this original thread
94 scattered all over the summary buffer, Gnus can gather them.
95
96 If non-nil, Gnus will try to gather all loose sub-threads from an
97 original thread into one large thread.
98
99 If this variable is non-nil, it should be one of `none', `adopt',
100 `dummy' or `empty'.
101
102 If this variable is `none', Gnus will not make a false root, but just
103 present the sub-threads after another.
104 If this variable is `dummy', Gnus will create a dummy root that will
105 have all the sub-threads as children.
106 If this variable is `adopt', Gnus will make one of the \"children\"
107 the parent and mark all the step-children as such.
108 If this variable is `empty', the \"children\" are printed with empty
109 subject fields.  (Or rather, they will be printed with a string
110 given by the `gnus-summary-same-subject' variable.)"
111   :group 'gnus-thread
112   :type '(choice (const :tag "off" nil)
113                  (const none)
114                  (const dummy)
115                  (const adopt)
116                  (const empty)))
117
118 (defcustom gnus-summary-make-false-root-always nil
119   "Always make a false dummy root."
120   :group 'gnus-thread
121   :type 'boolean)
122
123 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
124   "*A regexp to match subjects to be excluded from loose thread gathering.
125 As loose thread gathering is done on subjects only, that means that
126 there can be many false gatherings performed.  By rooting out certain
127 common subjects, gathering might become saner."
128   :group 'gnus-thread
129   :type 'regexp)
130
131 (defcustom gnus-summary-gather-subject-limit nil
132   "*Maximum length of subject comparisons when gathering loose threads.
133 Use nil to compare full subjects.  Setting this variable to a low
134 number will help gather threads that have been corrupted by
135 newsreaders chopping off subject lines, but it might also mean that
136 unrelated articles that have subject that happen to begin with the
137 same few characters will be incorrectly gathered.
138
139 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
140 comparing subjects."
141   :group 'gnus-thread
142   :type '(choice (const :tag "off" nil)
143                  (const fuzzy)
144                  (sexp :menu-tag "on" t)))
145
146 (defcustom gnus-simplify-subject-functions nil
147   "List of functions taking a string argument that simplify subjects.
148 The functions are applied recursively.
149
150 Useful functions to put in this list include:
151 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
152 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
153   :group 'gnus-thread
154   :type '(repeat function))
155
156 (defcustom gnus-simplify-ignored-prefixes nil
157   "*Remove matches for this regexp from subject lines when simplifying fuzzily."
158   :group 'gnus-thread
159   :type '(choice (const :tag "off" nil)
160                  regexp))
161
162 (defcustom gnus-build-sparse-threads nil
163   "*If non-nil, fill in the gaps in threads.
164 If `some', only fill in the gaps that are needed to tie loose threads
165 together.  If `more', fill in all leaf nodes that Gnus can find.  If
166 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
167   :group 'gnus-thread
168   :type '(choice (const :tag "off" nil)
169                  (const some)
170                  (const more)
171                  (sexp :menu-tag "all" t)))
172
173 (defcustom gnus-summary-thread-gathering-function
174   'gnus-gather-threads-by-subject
175   "*Function used for gathering loose threads.
176 There are two pre-defined functions: `gnus-gather-threads-by-subject',
177 which only takes Subjects into consideration; and
178 `gnus-gather-threads-by-references', which compared the References
179 headers of the articles to find matches."
180   :group 'gnus-thread
181   :type '(radio (function-item gnus-gather-threads-by-subject)
182                 (function-item gnus-gather-threads-by-references)
183                 (function :tag "other")))
184
185 (defcustom gnus-summary-same-subject ""
186   "*String indicating that the current article has the same subject as the previous.
187 This variable will only be used if the value of
188 `gnus-summary-make-false-root' is `empty'."
189   :group 'gnus-summary-format
190   :type 'string)
191
192 (defcustom gnus-summary-goto-unread t
193   "*If t, many commands will go to the next unread article.
194 This applies to marking commands as well as other commands that
195 \"naturally\" select the next article, like, for instance, `SPC' at
196 the end of an article.
197
198 If nil, the marking commands do NOT go to the next unread article
199 \(they go to the next article instead).  If `never', commands that
200 usually go to the next unread article, will go to the next article,
201 whether it is read or not."
202   :group 'gnus-summary-marks
203   :link '(custom-manual "(gnus)Setting Marks")
204   :type '(choice (const :tag "off" nil)
205                  (const never)
206                  (sexp :menu-tag "on" t)))
207
208 (defcustom gnus-summary-default-score 0
209   "*Default article score level.
210 All scores generated by the score files will be added to this score.
211 If this variable is nil, scoring will be disabled."
212   :group 'gnus-score-default
213   :type '(choice (const :tag "disable")
214                  integer))
215
216 (defcustom gnus-summary-default-high-score 0
217   "*Default threshold for a high scored article.
218 An article will be highlighted as high scored if its score is greater
219 than this score."
220   :group 'gnus-score-default
221   :type 'integer)
222
223 (defcustom gnus-summary-default-low-score 0
224   "*Default threshold for a low scored article.
225 An article will be highlighted as low scored if its score is smaller
226 than this score."
227   :group 'gnus-score-default
228   :type 'integer)
229
230 (defcustom gnus-summary-zcore-fuzz 0
231   "*Fuzziness factor for the zcore in the summary buffer.
232 Articles with scores closer than this to `gnus-summary-default-score'
233 will not be marked."
234   :group 'gnus-summary-format
235   :type 'integer)
236
237 (defcustom gnus-simplify-subject-fuzzy-regexp nil
238   "*Strings to be removed when doing fuzzy matches.
239 This can either be a regular expression or list of regular expressions
240 that will be removed from subject strings if fuzzy subject
241 simplification is selected."
242   :group 'gnus-thread
243   :type '(repeat regexp))
244
245 (defcustom gnus-show-threads t
246   "*If non-nil, display threads in summary mode."
247   :group 'gnus-thread
248   :type 'boolean)
249
250 (defcustom gnus-thread-hide-subtree nil
251   "*If non-nil, hide all threads initially.
252 This can be a predicate specifier which says which threads to hide.
253 If threads are hidden, you have to run the command
254 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
255 to expose hidden threads."
256   :group 'gnus-thread
257   :type '(radio (sexp :format "Non-nil\n"
258                       :match (lambda (widget value)
259                                (not (or (consp value) (functionp value))))
260                       :value t)
261                 (const nil)
262                 (sexp :tag "Predicate specifier" :size 0)))
263
264 (defcustom gnus-thread-hide-killed t
265   "*If non-nil, hide killed threads automatically."
266   :group 'gnus-thread
267   :type 'boolean)
268
269 (defcustom gnus-thread-ignore-subject t
270   "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
271 If nil, articles that have different subjects from their parents will
272 start separate threads."
273   :group 'gnus-thread
274   :type 'boolean)
275
276 (defcustom gnus-thread-operation-ignore-subject t
277   "*If non-nil, subjects will be ignored when doing thread commands.
278 This affects commands like `gnus-summary-kill-thread' and
279 `gnus-summary-lower-thread'.
280
281 If this variable is nil, articles in the same thread with different
282 subjects will not be included in the operation in question.  If this
283 variable is `fuzzy', only articles that have subjects that are fuzzily
284 equal will be included."
285   :group 'gnus-thread
286   :type '(choice (const :tag "off" nil)
287                  (const fuzzy)
288                  (sexp :tag "on" t)))
289
290 (defcustom gnus-thread-indent-level 4
291   "*Number that says how much each sub-thread should be indented."
292   :group 'gnus-thread
293   :type 'integer)
294
295 (defcustom gnus-auto-extend-newsgroup t
296   "*If non-nil, extend newsgroup forward and backward when requested."
297   :group 'gnus-summary-choose
298   :type 'boolean)
299
300 (defcustom gnus-auto-select-first t
301   "*If non-nil, select the article under point.
302 Which article this is is controlled by the `gnus-auto-select-subject'
303 variable.
304
305 If you want to prevent automatic selection of articles in some
306 newsgroups, set the variable to nil in `gnus-select-group-hook'."
307   :group 'gnus-group-select
308   :type '(choice (const :tag "none" nil)
309                  (sexp :menu-tag "first" t)))
310
311 (defcustom gnus-auto-select-subject 'unread
312   "*Says what subject to place under point when entering a group.
313
314 This variable can either be the symbols `first' (place point on the
315 first subject), `unread' (place point on the subject line of the first
316 unread article), `best' (place point on the subject line of the
317 higest-scored article), `unseen' (place point on the subject line of
318 the first unseen article), 'unseen-or-unread' (place point on the subject
319 line of the first unseen article or, if all article have been seen, on the
320 subject line of the first unread article), or a function to be called to
321 place point on some subject line."
322   :group 'gnus-group-select
323   :type '(choice (const best)
324                  (const unread)
325                  (const first)
326                  (const unseen)
327                  (const unseen-or-unread)))
328
329 (defcustom gnus-auto-select-next t
330   "*If non-nil, offer to go to the next group from the end of the previous.
331 If the value is t and the next newsgroup is empty, Gnus will exit
332 summary mode and go back to group mode.  If the value is neither nil
333 nor t, Gnus will select the following unread newsgroup.  In
334 particular, if the value is the symbol `quietly', the next unread
335 newsgroup will be selected without any confirmation, and if it is
336 `almost-quietly', the next group will be selected without any
337 confirmation if you are located on the last article in the group.
338 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
339 will go to the next group without confirmation."
340   :group 'gnus-summary-maneuvering
341   :type '(choice (const :tag "off" nil)
342                  (const quietly)
343                  (const almost-quietly)
344                  (const slightly-quietly)
345                  (sexp :menu-tag "on" t)))
346
347 (defcustom gnus-auto-select-same nil
348   "*If non-nil, select the next article with the same subject.
349 If there are no more articles with the same subject, go to
350 the first unread article."
351   :group 'gnus-summary-maneuvering
352   :type 'boolean)
353
354 (defcustom gnus-auto-goto-ignores 'unfetched
355   "*Says how to handle unfetched articles when maneuvering.
356
357 This variable can either be the symbols nil (maneuver to any
358 article), `undownloaded' (maneuvering while unplugged ignores articles
359 that have not been fetched), `always-undownloaded' (maneuvering always
360 ignores articles that have not been fetched), `unfetched' (maneuvering
361 ignores articles whose headers have not been fetched).
362
363 NOTE: The list of unfetched articles will always be nil when plugged
364 and, when unplugged, a subset of the undownloaded article list."
365   :group 'gnus-summary-maneuvering
366   :type '(choice (const :tag "None" nil)
367                  (const :tag "Undownloaded when unplugged" undownloaded)
368                  (const :tag "Undownloaded" always-undownloaded)
369                  (const :tag "Unfetched" unfetched)))
370
371 (defcustom gnus-summary-check-current nil
372   "*If non-nil, consider the current article when moving.
373 The \"unread\" movement commands will stay on the same line if the
374 current article is unread."
375   :group 'gnus-summary-maneuvering
376   :type 'boolean)
377
378 (defcustom gnus-auto-center-summary t
379   "*If non-nil, always center the current summary buffer.
380 In particular, if `vertical' do only vertical recentering.  If non-nil
381 and non-`vertical', do both horizontal and vertical recentering."
382   :group 'gnus-summary-maneuvering
383   :type '(choice (const :tag "none" nil)
384                  (const vertical)
385                  (integer :tag "height")
386                  (sexp :menu-tag "both" t)))
387
388 (defvar gnus-auto-center-group t
389   "*If non-nil, always center the group buffer.")
390
391 (defcustom gnus-show-all-headers nil
392   "*If non-nil, don't hide any headers."
393   :group 'gnus-article-hiding
394   :group 'gnus-article-headers
395   :type 'boolean)
396
397 (defcustom gnus-summary-ignore-duplicates nil
398   "*If non-nil, ignore articles with identical Message-ID headers."
399   :group 'gnus-summary
400   :type 'boolean)
401
402 (defcustom gnus-single-article-buffer t
403   "*If non-nil, display all articles in the same buffer.
404 If nil, each group will get its own article buffer."
405   :group 'gnus-article-various
406   :type 'boolean)
407
408 (defcustom gnus-break-pages t
409   "*If non-nil, do page breaking on articles.
410 The page delimiter is specified by the `gnus-page-delimiter'
411 variable."
412   :group 'gnus-article-various
413   :type 'boolean)
414
415 (defcustom gnus-move-split-methods nil
416   "*Variable used to suggest where articles are to be moved to.
417 It uses the same syntax as the `gnus-split-methods' variable.
418 However, whereas `gnus-split-methods' specifies file names as targets,
419 this variable specifies group names."
420   :group 'gnus-summary-mail
421   :type '(repeat (choice (list :value (fun) function)
422                          (cons :value ("" "") regexp (repeat string))
423                          (sexp :value nil))))
424
425 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
426   "Function used to compute default prefix for article move/copy/etc prompts.
427 The function should take one argument, a group name, and return a
428 string with the suggested prefix."
429   :group 'gnus-summary-mail
430   :type 'function)
431
432 (defcustom gnus-unread-mark ?           ;Whitespace
433   "*Mark used for unread articles."
434   :group 'gnus-summary-marks
435   :type 'character)
436
437 (defcustom gnus-ticked-mark ?!
438   "*Mark used for ticked articles."
439   :group 'gnus-summary-marks
440   :type 'character)
441
442 (defcustom gnus-dormant-mark ??
443   "*Mark used for dormant articles."
444   :group 'gnus-summary-marks
445   :type 'character)
446
447 (defcustom gnus-del-mark ?r
448   "*Mark used for del'd articles."
449   :group 'gnus-summary-marks
450   :type 'character)
451
452 (defcustom gnus-read-mark ?R
453   "*Mark used for read articles."
454   :group 'gnus-summary-marks
455   :type 'character)
456
457 (defcustom gnus-expirable-mark ?E
458   "*Mark used for expirable articles."
459   :group 'gnus-summary-marks
460   :type 'character)
461
462 (defcustom gnus-killed-mark ?K
463   "*Mark used for killed articles."
464   :group 'gnus-summary-marks
465   :type 'character)
466
467 (defcustom gnus-spam-mark ?$
468   "*Mark used for spam articles."
469   :group 'gnus-summary-marks
470   :type 'character)
471
472 (defcustom gnus-souped-mark ?F
473   "*Mark used for souped articles."
474   :group 'gnus-summary-marks
475   :type 'character)
476
477 (defcustom gnus-kill-file-mark ?X
478   "*Mark used for articles killed by kill files."
479   :group 'gnus-summary-marks
480   :type 'character)
481
482 (defcustom gnus-low-score-mark ?Y
483   "*Mark used for articles with a low score."
484   :group 'gnus-summary-marks
485   :type 'character)
486
487 (defcustom gnus-catchup-mark ?C
488   "*Mark used for articles that are caught up."
489   :group 'gnus-summary-marks
490   :type 'character)
491
492 (defcustom gnus-replied-mark ?A
493   "*Mark used for articles that have been replied to."
494   :group 'gnus-summary-marks
495   :type 'character)
496
497 (defcustom gnus-forwarded-mark ?F
498   "*Mark used for articles that have been forwarded."
499   :group 'gnus-summary-marks
500   :type 'character)
501
502 (defcustom gnus-recent-mark ?N
503   "*Mark used for articles that are recent."
504   :group 'gnus-summary-marks
505   :type 'character)
506
507 (defcustom gnus-cached-mark ?*
508   "*Mark used for articles that are in the cache."
509   :group 'gnus-summary-marks
510   :type 'character)
511
512 (defcustom gnus-saved-mark ?S
513   "*Mark used for articles that have been saved."
514   :group 'gnus-summary-marks
515   :type 'character)
516
517 (defcustom gnus-unseen-mark ?.
518   "*Mark used for articles that haven't been seen."
519   :group 'gnus-summary-marks
520   :type 'character)
521
522 (defcustom gnus-no-mark ?               ;Whitespace
523   "*Mark used for articles that have no other secondary mark."
524   :group 'gnus-summary-marks
525   :type 'character)
526
527 (defcustom gnus-ancient-mark ?O
528   "*Mark used for ancient articles."
529   :group 'gnus-summary-marks
530   :type 'character)
531
532 (defcustom gnus-sparse-mark ?Q
533   "*Mark used for sparsely reffed articles."
534   :group 'gnus-summary-marks
535   :type 'character)
536
537 (defcustom gnus-canceled-mark ?G
538   "*Mark used for canceled articles."
539   :group 'gnus-summary-marks
540   :type 'character)
541
542 (defcustom gnus-duplicate-mark ?M
543   "*Mark used for duplicate articles."
544   :group 'gnus-summary-marks
545   :type 'character)
546
547 (defcustom gnus-undownloaded-mark ?-
548   "*Mark used for articles that weren't downloaded."
549   :group 'gnus-summary-marks
550   :type 'character)
551
552 (defcustom gnus-downloaded-mark ?+
553   "*Mark used for articles that were downloaded."
554   :group 'gnus-summary-marks
555   :type 'character)
556
557 (defcustom gnus-downloadable-mark ?%
558   "*Mark used for articles that are to be downloaded."
559   :group 'gnus-summary-marks
560   :type 'character)
561
562 (defcustom gnus-unsendable-mark ?=
563   "*Mark used for articles that won't be sent."
564   :group 'gnus-summary-marks
565   :type 'character)
566
567 (defcustom gnus-score-over-mark ?+
568   "*Score mark used for articles with high scores."
569   :group 'gnus-summary-marks
570   :type 'character)
571
572 (defcustom gnus-score-below-mark ?-
573   "*Score mark used for articles with low scores."
574   :group 'gnus-summary-marks
575   :type 'character)
576
577 (defcustom gnus-empty-thread-mark ?     ;Whitespace
578   "*There is no thread under the article."
579   :group 'gnus-summary-marks
580   :type 'character)
581
582 (defcustom gnus-not-empty-thread-mark ?=
583   "*There is a thread under the article."
584   :group 'gnus-summary-marks
585   :type 'character)
586
587 (defcustom gnus-view-pseudo-asynchronously nil
588   "*If non-nil, Gnus will view pseudo-articles asynchronously."
589   :group 'gnus-extract-view
590   :type 'boolean)
591
592 (defcustom gnus-auto-expirable-marks
593   (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
594         gnus-low-score-mark gnus-ancient-mark gnus-read-mark
595         gnus-souped-mark gnus-duplicate-mark)
596   "*The list of marks converted into expiration if a group is auto-expirable."
597   :version "21.1"
598   :group 'gnus-summary
599   :type '(repeat character))
600
601 (defcustom gnus-inhibit-user-auto-expire t
602   "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
603   :version "21.1"
604   :group 'gnus-summary
605   :type 'boolean)
606
607 (defcustom gnus-view-pseudos nil
608   "*If `automatic', pseudo-articles will be viewed automatically.
609 If `not-confirm', pseudos will be viewed automatically, and the user
610 will not be asked to confirm the command."
611   :group 'gnus-extract-view
612   :type '(choice (const :tag "off" nil)
613                  (const automatic)
614                  (const not-confirm)))
615
616 (defcustom gnus-view-pseudos-separately t
617   "*If non-nil, one pseudo-article will be created for each file to be viewed.
618 If nil, all files that use the same viewing command will be given as a
619 list of parameters to that command."
620   :group 'gnus-extract-view
621   :type 'boolean)
622
623 (defcustom gnus-insert-pseudo-articles t
624   "*If non-nil, insert pseudo-articles when decoding articles."
625   :group 'gnus-extract-view
626   :type 'boolean)
627
628 (defcustom gnus-summary-dummy-line-format
629   "   %(:                             :%) %S\n"
630   "*The format specification for the dummy roots in the summary buffer.
631 It works along the same lines as a normal formatting string,
632 with some simple extensions.
633
634 %S  The subject
635
636 General format specifiers can also be used.
637 See `(gnus)Formatting Variables'."
638   :link '(custom-manual "(gnus)Formatting Variables")
639   :group 'gnus-threading
640   :type 'string)
641
642 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
643   "*The format specification for the summary mode line.
644 It works along the same lines as a normal formatting string,
645 with some simple extensions:
646
647 %G  Group name
648 %p  Unprefixed group name
649 %A  Current article number
650 %z  Current article score
651 %V  Gnus version
652 %U  Number of unread articles in the group
653 %e  Number of unselected articles in the group
654 %Z  A string with unread/unselected article counts
655 %g  Shortish group name
656 %S  Subject of the current article
657 %u  User-defined spec
658 %s  Current score file name
659 %d  Number of dormant articles
660 %r  Number of articles that have been marked as read in this session
661 %E  Number of articles expunged by the score files"
662   :group 'gnus-summary-format
663   :type 'string)
664
665 (defcustom gnus-list-identifiers nil
666   "Regexp that matches list identifiers to be removed from subject.
667 This can also be a list of regexps."
668   :version "21.1"
669   :group 'gnus-summary-format
670   :group 'gnus-article-hiding
671   :type '(choice (const :tag "none" nil)
672                  (regexp :value ".*")
673                  (repeat :value (".*") regexp)))
674
675 (defcustom gnus-summary-mark-below 0
676   "*Mark all articles with a score below this variable as read.
677 This variable is local to each summary buffer and usually set by the
678 score file."
679   :group 'gnus-score-default
680   :type 'integer)
681
682 (defun gnus-widget-reversible-match (widget value)
683   "Ignoring WIDGET, convert VALUE to internal form.
684 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
685   ;; (debug value)
686   (or (symbolp value)
687       (and (listp value)
688            (eq (length value) 2)
689            (eq (nth 0 value) 'not)
690            (symbolp (nth 1 value)))))
691
692 (defun gnus-widget-reversible-to-internal (widget value)
693   "Ignoring WIDGET, convert VALUE to internal form.
694 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
695 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
696   ;; (debug value)
697   (if (atom value)
698       (list value nil)
699     (list (nth 1 value) t)))
700
701 (defun gnus-widget-reversible-to-external (widget value)
702   "Ignoring WIDGET, convert VALUE to external form.
703 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
704 \(FOO  nil) is converted to FOO and (FOO t) is converted to (not FOO)."
705   ;; (debug value)
706   (if (nth 1 value)
707       (list 'not (nth 0 value))
708     (nth 0 value)))
709
710 (define-widget 'gnus-widget-reversible 'group
711   "A `group' that convert values."
712   :match 'gnus-widget-reversible-match
713   :value-to-internal 'gnus-widget-reversible-to-internal
714   :value-to-external 'gnus-widget-reversible-to-external)
715                         
716
717 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
718   "*List of functions used for sorting articles in the summary buffer.
719
720 Each function takes two articles and returns non-nil if the first
721 article should be sorted before the other.  If you use more than one
722 function, the primary sort function should be the last.  You should
723 probably always include `gnus-article-sort-by-number' in the list of
724 sorting functions -- preferably first.  Also note that sorting by date
725 is often much slower than sorting by number, and the sorting order is
726 very similar.  (Sorting by date means sorting by the time the message
727 was sent, sorting by number means sorting by arrival time.)
728
729 Each item can also be a list `(not F)' where F is a function;
730 this reverses the sort order.
731
732 Ready-made functions include `gnus-article-sort-by-number',
733 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
734 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
735 and `gnus-article-sort-by-score'.
736
737 When threading is turned on, the variable `gnus-thread-sort-functions'
738 controls how articles are sorted."
739   :group 'gnus-summary-sort
740   :type '(repeat (gnus-widget-reversible
741                   (choice (function-item gnus-article-sort-by-number)
742                           (function-item gnus-article-sort-by-author)
743                           (function-item gnus-article-sort-by-subject)
744                           (function-item gnus-article-sort-by-date)
745                           (function-item gnus-article-sort-by-score)
746                           (function-item gnus-article-sort-by-random)
747                           (function :tag "other"))
748                   (boolean :tag "Reverse order"))))
749
750
751 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
752   "*List of functions used for sorting threads in the summary buffer.
753 By default, threads are sorted by article number.
754
755 Each function takes two threads and returns non-nil if the first
756 thread should be sorted before the other.  If you use more than one
757 function, the primary sort function should be the last.  You should
758 probably always include `gnus-thread-sort-by-number' in the list of
759 sorting functions -- preferably first.  Also note that sorting by date
760 is often much slower than sorting by number, and the sorting order is
761 very similar.  (Sorting by date means sorting by the time the message
762 was sent, sorting by number means sorting by arrival time.)
763
764 Each list item can also be a list `(not F)' where F is a
765 function; this specifies reversed sort order.
766
767 Ready-made functions include `gnus-thread-sort-by-number',
768 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
769 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
770 `gnus-thread-sort-by-most-recent-number',
771 `gnus-thread-sort-by-most-recent-date',
772 `gnus-thread-sort-by-random', and
773 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
774
775 When threading is turned off, the variable
776 `gnus-article-sort-functions' controls how articles are sorted."
777   :group 'gnus-summary-sort
778   :type '(repeat 
779           (gnus-widget-reversible
780            (choice (function-item gnus-thread-sort-by-number)
781                    (function-item gnus-thread-sort-by-author)
782                    (function-item gnus-thread-sort-by-subject)
783                    (function-item gnus-thread-sort-by-date)
784                    (function-item gnus-thread-sort-by-score)
785                    (function-item gnus-thread-sort-by-most-recent-number)
786                    (function-item gnus-thread-sort-by-most-recent-date)
787                    (function-item gnus-thread-sort-by-random)
788                    (function-item gnus-thread-sort-by-total-score)
789                    (function :tag "other"))
790            (boolean :tag "Reverse order"))))
791
792 (defcustom gnus-thread-score-function '+
793   "*Function used for calculating the total score of a thread.
794
795 The function is called with the scores of the article and each
796 subthread and should then return the score of the thread.
797
798 Some functions you can use are `+', `max', or `min'."
799   :group 'gnus-summary-sort
800   :type 'function)
801
802 (defcustom gnus-summary-expunge-below nil
803   "All articles that have a score less than this variable will be expunged.
804 This variable is local to the summary buffers."
805   :group 'gnus-score-default
806   :type '(choice (const :tag "off" nil)
807                  integer))
808
809 (defcustom gnus-thread-expunge-below nil
810   "All threads that have a total score less than this variable will be expunged.
811 See `gnus-thread-score-function' for en explanation of what a
812 \"thread score\" is.
813
814 This variable is local to the summary buffers."
815   :group 'gnus-threading
816   :group 'gnus-score-default
817   :type '(choice (const :tag "off" nil)
818                  integer))
819
820 (defcustom gnus-summary-mode-hook nil
821   "*A hook for Gnus summary mode.
822 This hook is run before any variables are set in the summary buffer."
823   :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
824   :group 'gnus-summary-various
825   :type 'hook)
826
827 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
828 (when (featurep 'xemacs)
829   (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
830   (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
831   (add-hook 'gnus-summary-mode-hook
832             'gnus-xmas-switch-horizontal-scrollbar-off))
833
834 (defcustom gnus-summary-menu-hook nil
835   "*Hook run after the creation of the summary mode menu."
836   :group 'gnus-summary-visual
837   :type 'hook)
838
839 (defcustom gnus-summary-exit-hook nil
840   "*A hook called on exit from the summary buffer.
841 It will be called with point in the group buffer."
842   :group 'gnus-summary-exit
843   :type 'hook)
844
845 (defcustom gnus-summary-prepare-hook nil
846   "*A hook called after the summary buffer has been generated.
847 If you want to modify the summary buffer, you can use this hook."
848   :group 'gnus-summary-various
849   :type 'hook)
850
851 (defcustom gnus-summary-prepared-hook nil
852   "*A hook called as the last thing after the summary buffer has been generated."
853   :group 'gnus-summary-various
854   :type 'hook)
855
856 (defcustom gnus-summary-generate-hook nil
857   "*A hook run just before generating the summary buffer.
858 This hook is commonly used to customize threading variables and the
859 like."
860   :group 'gnus-summary-various
861   :type 'hook)
862
863 (defcustom gnus-select-group-hook nil
864   "*A hook called when a newsgroup is selected.
865
866 If you'd like to simplify subjects like the
867 `gnus-summary-next-same-subject' command does, you can use the
868 following hook:
869
870  (add-hook gnus-select-group-hook
871            (lambda ()
872              (mapcar (lambda (header)
873                        (mail-header-set-subject
874                         header
875                         (gnus-simplify-subject
876                          (mail-header-subject header) 're-only)))
877                      gnus-newsgroup-headers)))"
878   :group 'gnus-group-select
879   :type 'hook)
880
881 (defcustom gnus-select-article-hook nil
882   "*A hook called when an article is selected."
883   :group 'gnus-summary-choose
884   :options '(gnus-agent-fetch-selected-article)
885   :type 'hook)
886
887 (defcustom gnus-visual-mark-article-hook
888   (list 'gnus-highlight-selected-summary)
889   "*Hook run after selecting an article in the summary buffer.
890 It is meant to be used for highlighting the article in some way.  It
891 is not run if `gnus-visual' is nil."
892   :group 'gnus-summary-visual
893   :type 'hook)
894
895 (defcustom gnus-parse-headers-hook nil
896   "*A hook called before parsing the headers."
897   :group 'gnus-various
898   :type 'hook)
899
900 (defcustom gnus-exit-group-hook nil
901   "*A hook called when exiting summary mode.
902 This hook is not called from the non-updating exit commands like `Q'."
903   :group 'gnus-various
904   :type 'hook)
905
906 (defcustom gnus-summary-update-hook
907   (list 'gnus-summary-highlight-line)
908   "*A hook called when a summary line is changed.
909 The hook will not be called if `gnus-visual' is nil.
910
911 The default function `gnus-summary-highlight-line' will
912 highlight the line according to the `gnus-summary-highlight'
913 variable."
914   :group 'gnus-summary-visual
915   :type 'hook)
916
917 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
918   "*A hook called when an article is selected for the first time.
919 The hook is intended to mark an article as read (or unread)
920 automatically when it is selected."
921   :group 'gnus-summary-choose
922   :type 'hook)
923
924 (defcustom gnus-group-no-more-groups-hook nil
925   "*A hook run when returning to group mode having no more (unread) groups."
926   :group 'gnus-group-select
927   :type 'hook)
928
929 (defcustom gnus-ps-print-hook nil
930   "*A hook run before ps-printing something from Gnus."
931   :group 'gnus-summary
932   :type 'hook)
933
934 (defcustom gnus-summary-article-move-hook nil
935   "*A hook called after an article is moved, copied, respooled, or crossposted."
936   :group 'gnus-summary
937   :type 'hook)
938
939 (defcustom gnus-summary-article-delete-hook nil
940   "*A hook called after an article is deleted."
941   :group 'gnus-summary
942   :type 'hook)
943
944 (defcustom gnus-summary-article-expire-hook nil
945   "*A hook called after an article is expired."
946   :group 'gnus-summary
947   :type 'hook)
948
949 (defcustom gnus-summary-display-arrow
950   (and (fboundp 'display-graphic-p)
951        (display-graphic-p))
952   "*If non-nil, display an arrow highlighting the current article."
953   :version "21.1"
954   :group 'gnus-summary
955   :type 'boolean)
956
957 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
958   "Face used for highlighting the current article in the summary buffer."
959   :group 'gnus-summary-visual
960   :type 'face)
961
962 (defvar gnus-tmp-downloaded nil)
963
964 (defcustom gnus-summary-highlight
965   '(((eq mark gnus-canceled-mark)
966      . gnus-summary-cancelled-face)
967     ((and uncached (> score default-high))
968      . gnus-summary-high-undownloaded-face)
969     ((and uncached (< score default-low))
970      . gnus-summary-low-undownloaded-face)
971     (uncached
972      . gnus-summary-normal-undownloaded-face)
973     ((and (> score default-high)
974           (or (eq mark gnus-dormant-mark)
975               (eq mark gnus-ticked-mark)))
976      . gnus-summary-high-ticked-face)
977     ((and (< score default-low)
978           (or (eq mark gnus-dormant-mark)
979               (eq mark gnus-ticked-mark)))
980      . gnus-summary-low-ticked-face)
981     ((or (eq mark gnus-dormant-mark)
982          (eq mark gnus-ticked-mark))
983      . gnus-summary-normal-ticked-face)
984     ((and (> score default-high) (eq mark gnus-ancient-mark))
985      . gnus-summary-high-ancient-face)
986     ((and (< score default-low) (eq mark gnus-ancient-mark))
987      . gnus-summary-low-ancient-face)
988     ((eq mark gnus-ancient-mark)
989      . gnus-summary-normal-ancient-face)
990     ((and (> score default-high) (eq mark gnus-unread-mark))
991      . gnus-summary-high-unread-face)
992     ((and (< score default-low) (eq mark gnus-unread-mark))
993      . gnus-summary-low-unread-face)
994     ((eq mark gnus-unread-mark)
995      . gnus-summary-normal-unread-face)
996     ((> score default-high)
997      . gnus-summary-high-read-face)
998     ((< score default-low)
999      . gnus-summary-low-read-face)
1000     (t
1001      . gnus-summary-normal-read-face))
1002   "*Controls the highlighting of summary buffer lines.
1003
1004 A list of (FORM . FACE) pairs.  When deciding how a a particular
1005 summary line should be displayed, each form is evaluated.  The content
1006 of the face field after the first true form is used.  You can change
1007 how those summary lines are displayed, by editing the face field.
1008
1009 You can use the following variables in the FORM field.
1010
1011 score:        The article's score
1012 default:      The default article score.
1013 default-high: The default score for high scored articles.
1014 default-low:  The default score for low scored articles.
1015 below:        The score below which articles are automatically marked as read.
1016 mark:         The article's mark.
1017 uncached:     Non-nil if the article is uncached."
1018   :group 'gnus-summary-visual
1019   :type '(repeat (cons (sexp :tag "Form" nil)
1020                        face)))
1021
1022 (defcustom gnus-alter-header-function nil
1023   "Function called to allow alteration of article header structures.
1024 The function is called with one parameter, the article header vector,
1025 which it may alter in any way."
1026   :type '(choice (const :tag "None" nil)
1027                  function)
1028   :group 'gnus-summary)
1029
1030 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1031   "Variable that says which function should be used to decode a string with encoded words.")
1032
1033 (defcustom gnus-extra-headers '(To Newsgroups)
1034   "*Extra headers to parse."
1035   :version "21.1"
1036   :group 'gnus-summary
1037   :type '(repeat symbol))
1038
1039 (defcustom gnus-ignored-from-addresses
1040   (and user-mail-address (regexp-quote user-mail-address))
1041   "*Regexp of From headers that may be suppressed in favor of To headers."
1042   :version "21.1"
1043   :group 'gnus-summary
1044   :type 'regexp)
1045
1046 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1047   "List of charsets that should be ignored.
1048 When these charsets are used in the \"charset\" parameter, the
1049 default charset will be used instead."
1050   :version "21.1"
1051   :type '(repeat symbol)
1052   :group 'gnus-charset)
1053
1054 (gnus-define-group-parameter
1055  ignored-charsets
1056  :type list
1057  :function-document
1058  "Return the ignored charsets of GROUP."
1059  :variable gnus-group-ignored-charsets-alist
1060  :variable-default
1061  '(("alt\\.chinese\\.text" iso-8859-1))
1062  :variable-document
1063  "Alist of regexps (to match group names) and charsets that should be ignored.
1064 When these charsets are used in the \"charset\" parameter, the
1065 default charset will be used instead."
1066  :variable-group gnus-charset
1067  :variable-type '(repeat (cons (regexp :tag "Group")
1068                                (repeat symbol)))
1069  :parameter-type '(choice :tag "Ignored charsets"
1070                           :value nil
1071                           (repeat (symbol)))
1072  :parameter-document       "\
1073 List of charsets that should be ignored.
1074
1075 When these charsets are used in the \"charset\" parameter, the
1076 default charset will be used instead.")
1077
1078 (defcustom gnus-group-highlight-words-alist nil
1079   "Alist of group regexps and highlight regexps.
1080 This variable uses the same syntax as `gnus-emphasis-alist'."
1081   :version "21.1"
1082   :type '(repeat (cons (regexp :tag "Group")
1083                        (repeat (list (regexp :tag "Highlight regexp")
1084                                      (number :tag "Group for entire word" 0)
1085                                      (number :tag "Group for displayed part" 0)
1086                                      (symbol :tag "Face"
1087                                              gnus-emphasis-highlight-words)))))
1088   :group 'gnus-summary-visual)
1089
1090 (defcustom gnus-summary-show-article-charset-alist
1091   nil
1092   "Alist of number and charset.
1093 The article will be shown with the charset corresponding to the
1094 numbered argument.
1095 For example: ((1 . cn-gb-2312) (2 . big5))."
1096   :version "21.1"
1097   :type '(repeat (cons (number :tag "Argument" 1)
1098                        (symbol :tag "Charset")))
1099   :group 'gnus-charset)
1100
1101 (defcustom gnus-preserve-marks t
1102   "Whether marks are preserved when moving, copying and respooling messages."
1103   :version "21.1"
1104   :type 'boolean
1105   :group 'gnus-summary-marks)
1106
1107 (defcustom gnus-alter-articles-to-read-function nil
1108   "Function to be called to alter the list of articles to be selected."
1109   :type '(choice (const nil) function)
1110   :group 'gnus-summary)
1111
1112 (defcustom gnus-orphan-score nil
1113   "*All orphans get this score added.  Set in the score file."
1114   :group 'gnus-score-default
1115   :type '(choice (const nil)
1116                  integer))
1117
1118 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1119   "*A regexp to match MIME parts when saving multiple parts of a
1120 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1121 This regexp will be used by default when prompting the user for which
1122 type of files to save."
1123   :group 'gnus-summary
1124   :type 'regexp)
1125
1126 (defcustom gnus-read-all-available-headers nil
1127   "Whether Gnus should parse all headers made available to it.
1128 This is mostly relevant for slow back ends where the user may
1129 wish to widen the summary buffer to include all headers
1130 that were fetched.  Say, for nnultimate groups."
1131   :group 'gnus-summary
1132   :type '(choice boolean regexp))
1133
1134 (defcustom gnus-summary-muttprint-program "muttprint"
1135   "Command (and optional arguments) used to run Muttprint."
1136   :version "21.3"
1137   :group 'gnus-summary
1138   :type 'string)
1139
1140 (defcustom gnus-article-loose-mime nil
1141   "If non-nil, don't require MIME-Version header.
1142 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1143 supply the MIME-Version header or deliberately strip it From the mail.
1144 Set it to non-nil, Gnus will treat some articles as MIME even if
1145 the MIME-Version header is missed."
1146   :version "21.3"
1147   :type 'boolean
1148   :group 'gnus-article-mime)
1149
1150 (defcustom gnus-article-emulate-mime t
1151   "If non-nil, use MIME emulation for uuencode and the like.
1152 This means that Gnus will search message bodies for text that look
1153 like uuencoded bits, yEncoded bits, and so on, and present that using
1154 the normal Gnus MIME machinery."
1155   :type 'boolean
1156   :group 'gnus-article-mime)
1157
1158 ;;; Internal variables
1159
1160 (defvar gnus-summary-display-cache nil)
1161 (defvar gnus-article-mime-handles nil)
1162 (defvar gnus-article-decoded-p nil)
1163 (defvar gnus-article-charset nil)
1164 (defvar gnus-article-ignored-charsets nil)
1165 (defvar gnus-scores-exclude-files nil)
1166 (defvar gnus-page-broken nil)
1167
1168 (defvar gnus-original-article nil)
1169 (defvar gnus-article-internal-prepare-hook nil)
1170 (defvar gnus-newsgroup-process-stack nil)
1171
1172 (defvar gnus-thread-indent-array nil)
1173 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1174 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1175   "Function called to sort the articles within a thread after it has been gathered together.")
1176
1177 (defvar gnus-summary-save-parts-type-history nil)
1178 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1179
1180 ;; Avoid highlighting in kill files.
1181 (defvar gnus-summary-inhibit-highlight nil)
1182 (defvar gnus-newsgroup-selected-overlay nil)
1183 (defvar gnus-inhibit-limiting nil)
1184 (defvar gnus-newsgroup-adaptive-score-file nil)
1185 (defvar gnus-current-score-file nil)
1186 (defvar gnus-current-move-group nil)
1187 (defvar gnus-current-copy-group nil)
1188 (defvar gnus-current-crosspost-group nil)
1189 (defvar gnus-newsgroup-display nil)
1190
1191 (defvar gnus-newsgroup-dependencies nil)
1192 (defvar gnus-newsgroup-adaptive nil)
1193 (defvar gnus-summary-display-article-function nil)
1194 (defvar gnus-summary-highlight-line-function nil
1195   "Function called after highlighting a summary line.")
1196
1197 (defvar gnus-summary-line-format-alist
1198   `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1199     (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1200     (?s gnus-tmp-subject-or-nil ?s)
1201     (?n gnus-tmp-name ?s)
1202     (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1203         ?s)
1204     (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1205             gnus-tmp-from) ?s)
1206     (?F gnus-tmp-from ?s)
1207     (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1208     (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1209     (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1210     (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1211     (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1212     (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1213     (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1214     (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1215     (?L gnus-tmp-lines ?s)
1216     (?O gnus-tmp-downloaded ?c)
1217     (?I gnus-tmp-indentation ?s)
1218     (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1219     (?R gnus-tmp-replied ?c)
1220     (?\[ gnus-tmp-opening-bracket ?c)
1221     (?\] gnus-tmp-closing-bracket ?c)
1222     (?\> (make-string gnus-tmp-level ? ) ?s)
1223     (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1224     (?i gnus-tmp-score ?d)
1225     (?z gnus-tmp-score-char ?c)
1226     (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1227     (?U gnus-tmp-unread ?c)
1228     (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1229         ?s)
1230     (?t (gnus-summary-number-of-articles-in-thread
1231          (and (boundp 'thread) (car thread)) gnus-tmp-level)
1232         ?d)
1233     (?e (gnus-summary-number-of-articles-in-thread
1234          (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1235         ?c)
1236     (?u gnus-tmp-user-defined ?s)
1237     (?P (gnus-pick-line-number) ?d)
1238     (?B gnus-tmp-thread-tree-header-string ?s)
1239     (user-date (gnus-user-date
1240                 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1241   "An alist of format specifications that can appear in summary lines.
1242 These are paired with what variables they correspond with, along with
1243 the type of the variable (string, integer, character, etc).")
1244
1245 (defvar gnus-summary-dummy-line-format-alist
1246   `((?S gnus-tmp-subject ?s)
1247     (?N gnus-tmp-number ?d)
1248     (?u gnus-tmp-user-defined ?s)))
1249
1250 (defvar gnus-summary-mode-line-format-alist
1251   `((?G gnus-tmp-group-name ?s)
1252     (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1253     (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1254     (?A gnus-tmp-article-number ?d)
1255     (?Z gnus-tmp-unread-and-unselected ?s)
1256     (?V gnus-version ?s)
1257     (?U gnus-tmp-unread-and-unticked ?d)
1258     (?S gnus-tmp-subject ?s)
1259     (?e gnus-tmp-unselected ?d)
1260     (?u gnus-tmp-user-defined ?s)
1261     (?d (length gnus-newsgroup-dormant) ?d)
1262     (?t (length gnus-newsgroup-marked) ?d)
1263     (?h (length gnus-newsgroup-spam-marked) ?d)
1264     (?r (length gnus-newsgroup-reads) ?d)
1265     (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1266     (?E gnus-newsgroup-expunged-tally ?d)
1267     (?s (gnus-current-score-file-nondirectory) ?s)))
1268
1269 (defvar gnus-last-search-regexp nil
1270   "Default regexp for article search command.")
1271
1272 (defvar gnus-last-shell-command nil
1273   "Default shell command on article.")
1274
1275 (defvar gnus-newsgroup-agentized nil
1276   "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1277 (defvar gnus-newsgroup-begin nil)
1278 (defvar gnus-newsgroup-end nil)
1279 (defvar gnus-newsgroup-last-rmail nil)
1280 (defvar gnus-newsgroup-last-mail nil)
1281 (defvar gnus-newsgroup-last-folder nil)
1282 (defvar gnus-newsgroup-last-file nil)
1283 (defvar gnus-newsgroup-auto-expire nil)
1284 (defvar gnus-newsgroup-active nil)
1285
1286 (defvar gnus-newsgroup-data nil)
1287 (defvar gnus-newsgroup-data-reverse nil)
1288 (defvar gnus-newsgroup-limit nil)
1289 (defvar gnus-newsgroup-limits nil)
1290 (defvar gnus-summary-use-undownloaded-faces nil)
1291
1292 (defvar gnus-newsgroup-unreads nil
1293   "Sorted list of unread articles in the current newsgroup.")
1294
1295 (defvar gnus-newsgroup-unselected nil
1296   "Sorted list of unselected unread articles in the current newsgroup.")
1297
1298 (defvar gnus-newsgroup-reads nil
1299   "Alist of read articles and article marks in the current newsgroup.")
1300
1301 (defvar gnus-newsgroup-expunged-tally nil)
1302
1303 (defvar gnus-newsgroup-marked nil
1304   "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1305
1306 (defvar gnus-newsgroup-spam-marked nil
1307   "List of ranges of articles that have been marked as spam.")
1308
1309 (defvar gnus-newsgroup-killed nil
1310   "List of ranges of articles that have been through the scoring process.")
1311
1312 (defvar gnus-newsgroup-cached nil
1313   "Sorted list of articles that come from the article cache.")
1314
1315 (defvar gnus-newsgroup-saved nil
1316   "List of articles that have been saved.")
1317
1318 (defvar gnus-newsgroup-kill-headers nil)
1319
1320 (defvar gnus-newsgroup-replied nil
1321   "List of articles that have been replied to in the current newsgroup.")
1322
1323 (defvar gnus-newsgroup-forwarded nil
1324   "List of articles that have been forwarded in the current newsgroup.")
1325
1326 (defvar gnus-newsgroup-recent nil
1327   "List of articles that have are recent in the current newsgroup.")
1328
1329 (defvar gnus-newsgroup-expirable nil
1330   "Sorted list of articles in the current newsgroup that can be expired.")
1331
1332 (defvar gnus-newsgroup-processable nil
1333   "List of articles in the current newsgroup that can be processed.")
1334
1335 (defvar gnus-newsgroup-downloadable nil
1336   "Sorted list of articles in the current newsgroup that can be processed.")
1337
1338 (defvar gnus-newsgroup-unfetched nil
1339   "Sorted list of articles in the current newsgroup whose headers have
1340 not been fetched into the agent.
1341
1342 This list will always be a subset of gnus-newsgroup-undownloaded.")
1343
1344 (defvar gnus-newsgroup-undownloaded nil
1345   "List of articles in the current newsgroup that haven't been downloaded.")
1346
1347 (defvar gnus-newsgroup-unsendable nil
1348   "List of articles in the current newsgroup that won't be sent.")
1349
1350 (defvar gnus-newsgroup-bookmarks nil
1351   "List of articles in the current newsgroup that have bookmarks.")
1352
1353 (defvar gnus-newsgroup-dormant nil
1354   "Sorted list of dormant articles in the current newsgroup.")
1355
1356 (defvar gnus-newsgroup-unseen nil
1357   "List of unseen articles in the current newsgroup.")
1358
1359 (defvar gnus-newsgroup-seen nil
1360   "Range of seen articles in the current newsgroup.")
1361
1362 (defvar gnus-newsgroup-articles nil
1363   "List of articles in the current newsgroup.")
1364
1365 (defvar gnus-newsgroup-scored nil
1366   "List of scored articles in the current newsgroup.")
1367
1368 (defvar gnus-newsgroup-headers nil
1369   "List of article headers in the current newsgroup.")
1370
1371 (defvar gnus-newsgroup-threads nil)
1372
1373 (defvar gnus-newsgroup-prepared nil
1374   "Whether the current group has been prepared properly.")
1375
1376 (defvar gnus-newsgroup-ancient nil
1377   "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1378
1379 (defvar gnus-newsgroup-sparse nil)
1380
1381 (defvar gnus-current-article nil)
1382 (defvar gnus-article-current nil)
1383 (defvar gnus-current-headers nil)
1384 (defvar gnus-have-all-headers nil)
1385 (defvar gnus-last-article nil)
1386 (defvar gnus-newsgroup-history nil)
1387 (defvar gnus-newsgroup-charset nil)
1388 (defvar gnus-newsgroup-ephemeral-charset nil)
1389 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1390
1391 (defvar gnus-article-before-search nil)
1392
1393 (defvar gnus-summary-local-variables
1394   '(gnus-newsgroup-name
1395     gnus-newsgroup-begin gnus-newsgroup-end
1396     gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1397     gnus-newsgroup-last-folder gnus-newsgroup-last-file
1398     gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1399     gnus-newsgroup-unselected gnus-newsgroup-marked
1400     gnus-newsgroup-spam-marked
1401     gnus-newsgroup-reads gnus-newsgroup-saved
1402     gnus-newsgroup-replied gnus-newsgroup-forwarded
1403     gnus-newsgroup-recent
1404     gnus-newsgroup-expirable
1405     gnus-newsgroup-processable gnus-newsgroup-killed
1406     gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1407     gnus-newsgroup-unfetched
1408     gnus-newsgroup-unsendable gnus-newsgroup-unseen
1409     gnus-newsgroup-seen gnus-newsgroup-articles
1410     gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1411     gnus-newsgroup-headers gnus-newsgroup-threads
1412     gnus-newsgroup-prepared gnus-summary-highlight-line-function
1413     gnus-current-article gnus-current-headers gnus-have-all-headers
1414     gnus-last-article gnus-article-internal-prepare-hook
1415     gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1416     gnus-newsgroup-scored gnus-newsgroup-kill-headers
1417     gnus-thread-expunge-below
1418     gnus-score-alist gnus-current-score-file
1419     (gnus-summary-expunge-below . global)
1420     (gnus-summary-mark-below . global)
1421     (gnus-orphan-score . global)
1422     gnus-newsgroup-active gnus-scores-exclude-files
1423     gnus-newsgroup-history gnus-newsgroup-ancient
1424     gnus-newsgroup-sparse gnus-newsgroup-process-stack
1425     (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1426     gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1427     (gnus-newsgroup-expunged-tally . 0)
1428     gnus-cache-removable-articles gnus-newsgroup-cached
1429     gnus-newsgroup-data gnus-newsgroup-data-reverse
1430     gnus-newsgroup-limit gnus-newsgroup-limits
1431     gnus-newsgroup-charset gnus-newsgroup-display
1432     gnus-summary-use-undownloaded-faces)
1433   "Variables that are buffer-local to the summary buffers.")
1434
1435 (defvar gnus-newsgroup-variables nil
1436   "A list of variables that have separate values in different newsgroups.
1437 A list of newsgroup (summary buffer) local variables, or cons of
1438 variables and their default expressions to be evalled (when the default
1439 values are not nil), that should be made global while the summary buffer
1440 is active.
1441
1442 Note: The default expressions will be evaluated (using function `eval')
1443 before assignment to the local variable rather than just assigned to it.
1444 If the default expression is the symbol `global', that symbol will not
1445 be evaluated but the global value of the local variable will be used
1446 instead.
1447
1448 These variables can be used to set variables in the group parameters
1449 while still allowing them to affect operations done in other buffers.
1450 For example:
1451
1452 \(setq gnus-newsgroup-variables
1453      '(message-use-followup-to
1454        (gnus-visible-headers .
1455          \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1456 ")
1457
1458 ;; Byte-compiler warning.
1459 (eval-when-compile
1460   ;; Bind features so that require will believe that gnus-sum has
1461   ;; already been loaded (avoids infinite recursion)
1462   (let ((features (cons 'gnus-sum features)))
1463     ;; Several of the declarations in gnus-sum are needed to load the
1464     ;; following files. Right now, these definitions have been
1465     ;; compiled but not defined (evaluated).  We could either do a
1466     ;; eval-and-compile about all of the declarations or evaluate the
1467     ;; source file.
1468     (if (boundp 'gnus-newsgroup-variables)
1469         nil
1470       (load "gnus-sum.el" t t t))
1471     (require 'gnus)
1472     (require 'gnus-agent)
1473     (require 'gnus-art)))
1474
1475 ;; MIME stuff.
1476
1477 (defvar gnus-decode-encoded-word-methods
1478   '(mail-decode-encoded-word-string)
1479   "List of methods used to decode encoded words.
1480
1481 This variable is a list of FUNCTION or (REGEXP . FUNCTION).  If item
1482 is FUNCTION, FUNCTION will be apply to all newsgroups.  If item is a
1483 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1484 whose names match REGEXP.
1485
1486 For example:
1487 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1488  mail-decode-encoded-word-string
1489  (\"chinese\" . rfc1843-decode-string))")
1490
1491 (defvar gnus-decode-encoded-word-methods-cache nil)
1492
1493 (defun gnus-multi-decode-encoded-word-string (string)
1494   "Apply the functions from `gnus-encoded-word-methods' that match."
1495   (unless (and gnus-decode-encoded-word-methods-cache
1496                (eq gnus-newsgroup-name
1497                    (car gnus-decode-encoded-word-methods-cache)))
1498     (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1499     (mapcar (lambda (x)
1500               (if (symbolp x)
1501                   (nconc gnus-decode-encoded-word-methods-cache (list x))
1502                 (if (and gnus-newsgroup-name
1503                          (string-match (car x) gnus-newsgroup-name))
1504                     (nconc gnus-decode-encoded-word-methods-cache
1505                            (list (cdr x))))))
1506             gnus-decode-encoded-word-methods))
1507   (let ((xlist gnus-decode-encoded-word-methods-cache))
1508     (pop xlist)
1509     (while xlist
1510       (setq string (funcall (pop xlist) string))))
1511   string)
1512
1513 ;; Subject simplification.
1514
1515 (defun gnus-simplify-whitespace (str)
1516   "Remove excessive whitespace from STR."
1517   ;; Multiple spaces.
1518   (while (string-match "[ \t][ \t]+" str)
1519     (setq str (concat (substring str 0 (match-beginning 0))
1520                         " "
1521                         (substring str (match-end 0)))))
1522   ;; Leading spaces.
1523   (when (string-match "^[ \t]+" str)
1524     (setq str (substring str (match-end 0))))
1525   ;; Trailing spaces.
1526   (when (string-match "[ \t]+$" str)
1527     (setq str (substring str 0 (match-beginning 0))))
1528   str)
1529
1530 (defun gnus-simplify-all-whitespace (str)
1531   "Remove all whitespace from STR."
1532   (while (string-match "[ \t\n]+" str)
1533     (setq str (replace-match "" nil nil str)))
1534   str)
1535
1536 (defsubst gnus-simplify-subject-re (subject)
1537   "Remove \"Re:\" from subject lines."
1538   (if (string-match message-subject-re-regexp subject)
1539       (substring subject (match-end 0))
1540     subject))
1541
1542 (defun gnus-simplify-subject (subject &optional re-only)
1543   "Remove `Re:' and words in parentheses.
1544 If RE-ONLY is non-nil, strip leading `Re:'s only."
1545   (let ((case-fold-search t))           ;Ignore case.
1546     ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1547     (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1548       (setq subject (substring subject (match-end 0))))
1549     ;; Remove uninteresting prefixes.
1550     (when (and (not re-only)
1551                gnus-simplify-ignored-prefixes
1552                (string-match gnus-simplify-ignored-prefixes subject))
1553       (setq subject (substring subject (match-end 0))))
1554     ;; Remove words in parentheses from end.
1555     (unless re-only
1556       (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1557         (setq subject (substring subject 0 (match-beginning 0)))))
1558     ;; Return subject string.
1559     subject))
1560
1561 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1562 ;; all whitespace.
1563 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1564   (goto-char (point-min))
1565   (while (re-search-forward regexp nil t)
1566     (replace-match (or newtext ""))))
1567
1568 (defun gnus-simplify-buffer-fuzzy ()
1569   "Simplify string in the buffer fuzzily.
1570 The string in the accessible portion of the current buffer is simplified.
1571 It is assumed to be a single-line subject.
1572 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1573 matter is removed.  Additional things can be deleted by setting
1574 `gnus-simplify-subject-fuzzy-regexp'."
1575   (let ((case-fold-search t)
1576         (modified-tick))
1577     (gnus-simplify-buffer-fuzzy-step "\t" " ")
1578
1579     (while (not (eq modified-tick (buffer-modified-tick)))
1580       (setq modified-tick (buffer-modified-tick))
1581       (cond
1582        ((listp gnus-simplify-subject-fuzzy-regexp)
1583         (mapcar 'gnus-simplify-buffer-fuzzy-step
1584                 gnus-simplify-subject-fuzzy-regexp))
1585        (gnus-simplify-subject-fuzzy-regexp
1586         (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1587       (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1588       (gnus-simplify-buffer-fuzzy-step
1589        "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1590       (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1591
1592     (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1593     (gnus-simplify-buffer-fuzzy-step "  +" " ")
1594     (gnus-simplify-buffer-fuzzy-step " $")
1595     (gnus-simplify-buffer-fuzzy-step "^ +")))
1596
1597 (defun gnus-simplify-subject-fuzzy (subject)
1598   "Simplify a subject string fuzzily.
1599 See `gnus-simplify-buffer-fuzzy' for details."
1600   (save-excursion
1601     (gnus-set-work-buffer)
1602     (let ((case-fold-search t))
1603       ;; Remove uninteresting prefixes.
1604       (when (and gnus-simplify-ignored-prefixes
1605                  (string-match gnus-simplify-ignored-prefixes subject))
1606         (setq subject (substring subject (match-end 0))))
1607       (insert subject)
1608       (inline (gnus-simplify-buffer-fuzzy))
1609       (buffer-string))))
1610
1611 (defsubst gnus-simplify-subject-fully (subject)
1612   "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1613   (cond
1614    (gnus-simplify-subject-functions
1615     (gnus-map-function gnus-simplify-subject-functions subject))
1616    ((null gnus-summary-gather-subject-limit)
1617     (gnus-simplify-subject-re subject))
1618    ((eq gnus-summary-gather-subject-limit 'fuzzy)
1619     (gnus-simplify-subject-fuzzy subject))
1620    ((numberp gnus-summary-gather-subject-limit)
1621     (gnus-limit-string (gnus-simplify-subject-re subject)
1622                        gnus-summary-gather-subject-limit))
1623    (t
1624     subject)))
1625
1626 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1627   "Check whether two subjects are equal.
1628 If optional argument SIMPLE-FIRST is t, first argument is already
1629 simplified."
1630   (cond
1631    ((null simple-first)
1632     (equal (gnus-simplify-subject-fully s1)
1633            (gnus-simplify-subject-fully s2)))
1634    (t
1635     (equal s1
1636            (gnus-simplify-subject-fully s2)))))
1637
1638 (defun gnus-summary-bubble-group ()
1639   "Increase the score of the current group.
1640 This is a handy function to add to `gnus-summary-exit-hook' to
1641 increase the score of each group you read."
1642   (gnus-group-add-score gnus-newsgroup-name))
1643
1644 \f
1645 ;;;
1646 ;;; Gnus summary mode
1647 ;;;
1648
1649 (put 'gnus-summary-mode 'mode-class 'special)
1650
1651 (defvar gnus-article-commands-menu)
1652
1653 ;; Non-orthogonal keys
1654
1655 (gnus-define-keys gnus-summary-mode-map
1656   " " gnus-summary-next-page
1657   "\177" gnus-summary-prev-page
1658   [delete] gnus-summary-prev-page
1659   [backspace] gnus-summary-prev-page
1660   "\r" gnus-summary-scroll-up
1661   "\M-\r" gnus-summary-scroll-down
1662   "n" gnus-summary-next-unread-article
1663   "p" gnus-summary-prev-unread-article
1664   "N" gnus-summary-next-article
1665   "P" gnus-summary-prev-article
1666   "\M-\C-n" gnus-summary-next-same-subject
1667   "\M-\C-p" gnus-summary-prev-same-subject
1668   "\M-n" gnus-summary-next-unread-subject
1669   "\M-p" gnus-summary-prev-unread-subject
1670   "." gnus-summary-first-unread-article
1671   "," gnus-summary-best-unread-article
1672   "\M-s" gnus-summary-search-article-forward
1673   "\M-r" gnus-summary-search-article-backward
1674   "<" gnus-summary-beginning-of-article
1675   ">" gnus-summary-end-of-article
1676   "j" gnus-summary-goto-article
1677   "^" gnus-summary-refer-parent-article
1678   "\M-^" gnus-summary-refer-article
1679   "u" gnus-summary-tick-article-forward
1680   "!" gnus-summary-tick-article-forward
1681   "U" gnus-summary-tick-article-backward
1682   "d" gnus-summary-mark-as-read-forward
1683   "D" gnus-summary-mark-as-read-backward
1684   "E" gnus-summary-mark-as-expirable
1685   "\M-u" gnus-summary-clear-mark-forward
1686   "\M-U" gnus-summary-clear-mark-backward
1687   "k" gnus-summary-kill-same-subject-and-select
1688   "\C-k" gnus-summary-kill-same-subject
1689   "\M-\C-k" gnus-summary-kill-thread
1690   "\M-\C-l" gnus-summary-lower-thread
1691   "e" gnus-summary-edit-article
1692   "#" gnus-summary-mark-as-processable
1693   "\M-#" gnus-summary-unmark-as-processable
1694   "\M-\C-t" gnus-summary-toggle-threads
1695   "\M-\C-s" gnus-summary-show-thread
1696   "\M-\C-h" gnus-summary-hide-thread
1697   "\M-\C-f" gnus-summary-next-thread
1698   "\M-\C-b" gnus-summary-prev-thread
1699   [(meta down)] gnus-summary-next-thread
1700   [(meta up)] gnus-summary-prev-thread
1701   "\M-\C-u" gnus-summary-up-thread
1702   "\M-\C-d" gnus-summary-down-thread
1703   "&" gnus-summary-execute-command
1704   "c" gnus-summary-catchup-and-exit
1705   "\C-w" gnus-summary-mark-region-as-read
1706   "\C-t" gnus-summary-toggle-truncation
1707   "?" gnus-summary-mark-as-dormant
1708   "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1709   "\C-c\C-s\C-n" gnus-summary-sort-by-number
1710   "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1711   "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1712   "\C-c\C-s\C-a" gnus-summary-sort-by-author
1713   "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1714   "\C-c\C-s\C-d" gnus-summary-sort-by-date
1715   "\C-c\C-s\C-i" gnus-summary-sort-by-score
1716   "\C-c\C-s\C-o" gnus-summary-sort-by-original
1717   "\C-c\C-s\C-r" gnus-summary-sort-by-random
1718   "=" gnus-summary-expand-window
1719   "\C-x\C-s" gnus-summary-reselect-current-group
1720   "\M-g" gnus-summary-rescan-group
1721   "w" gnus-summary-stop-page-breaking
1722   "\C-c\C-r" gnus-summary-caesar-message
1723   "f" gnus-summary-followup
1724   "F" gnus-summary-followup-with-original
1725   "C" gnus-summary-cancel-article
1726   "r" gnus-summary-reply
1727   "R" gnus-summary-reply-with-original
1728   "\C-c\C-f" gnus-summary-mail-forward
1729   "o" gnus-summary-save-article
1730   "\C-o" gnus-summary-save-article-mail
1731   "|" gnus-summary-pipe-output
1732   "\M-k" gnus-summary-edit-local-kill
1733   "\M-K" gnus-summary-edit-global-kill
1734   ;; "V" gnus-version
1735   "\C-c\C-d" gnus-summary-describe-group
1736   "q" gnus-summary-exit
1737   "Q" gnus-summary-exit-no-update
1738   "\C-c\C-i" gnus-info-find-node
1739   gnus-mouse-2 gnus-mouse-pick-article
1740   "m" gnus-summary-mail-other-window
1741   "a" gnus-summary-post-news
1742   "i" gnus-summary-news-other-window
1743   "x" gnus-summary-limit-to-unread
1744   "s" gnus-summary-isearch-article
1745   "t" gnus-summary-toggle-header
1746   "g" gnus-summary-show-article
1747   "l" gnus-summary-goto-last-article
1748   "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1749   "\C-d" gnus-summary-enter-digest-group
1750   "\M-\C-d" gnus-summary-read-document
1751   "\M-\C-e" gnus-summary-edit-parameters
1752   "\M-\C-a" gnus-summary-customize-parameters
1753   "\C-c\C-b" gnus-bug
1754   "*" gnus-cache-enter-article
1755   "\M-*" gnus-cache-remove-article
1756   "\M-&" gnus-summary-universal-argument
1757   "\C-l" gnus-recenter
1758   "I" gnus-summary-increase-score
1759   "L" gnus-summary-lower-score
1760   "\M-i" gnus-symbolic-argument
1761   "h" gnus-summary-select-article-buffer
1762
1763   "b" gnus-article-view-part
1764   "\M-t" gnus-summary-toggle-display-buttonized
1765
1766   "V" gnus-summary-score-map
1767   "X" gnus-uu-extract-map
1768   "S" gnus-summary-send-map)
1769
1770 ;; Sort of orthogonal keymap
1771 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1772   "t" gnus-summary-tick-article-forward
1773   "!" gnus-summary-tick-article-forward
1774   "d" gnus-summary-mark-as-read-forward
1775   "r" gnus-summary-mark-as-read-forward
1776   "c" gnus-summary-clear-mark-forward
1777   " " gnus-summary-clear-mark-forward
1778   "e" gnus-summary-mark-as-expirable
1779   "x" gnus-summary-mark-as-expirable
1780   "?" gnus-summary-mark-as-dormant
1781   "b" gnus-summary-set-bookmark
1782   "B" gnus-summary-remove-bookmark
1783   "#" gnus-summary-mark-as-processable
1784   "\M-#" gnus-summary-unmark-as-processable
1785   "S" gnus-summary-limit-include-expunged
1786   "C" gnus-summary-catchup
1787   "H" gnus-summary-catchup-to-here
1788   "h" gnus-summary-catchup-from-here
1789   "\C-c" gnus-summary-catchup-all
1790   "k" gnus-summary-kill-same-subject-and-select
1791   "K" gnus-summary-kill-same-subject
1792   "P" gnus-uu-mark-map)
1793
1794 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1795   "c" gnus-summary-clear-above
1796   "u" gnus-summary-tick-above
1797   "m" gnus-summary-mark-above
1798   "k" gnus-summary-kill-below)
1799
1800 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1801   "/" gnus-summary-limit-to-subject
1802   "n" gnus-summary-limit-to-articles
1803   "w" gnus-summary-pop-limit
1804   "s" gnus-summary-limit-to-subject
1805   "a" gnus-summary-limit-to-author
1806   "u" gnus-summary-limit-to-unread
1807   "m" gnus-summary-limit-to-marks
1808   "M" gnus-summary-limit-exclude-marks
1809   "v" gnus-summary-limit-to-score
1810   "*" gnus-summary-limit-include-cached
1811   "D" gnus-summary-limit-include-dormant
1812   "T" gnus-summary-limit-include-thread
1813   "d" gnus-summary-limit-exclude-dormant
1814   "t" gnus-summary-limit-to-age
1815   "." gnus-summary-limit-to-unseen
1816   "x" gnus-summary-limit-to-extra
1817   "p" gnus-summary-limit-to-display-predicate
1818   "E" gnus-summary-limit-include-expunged
1819   "c" gnus-summary-limit-exclude-childless-dormant
1820   "C" gnus-summary-limit-mark-excluded-as-read
1821   "o" gnus-summary-insert-old-articles
1822   "N" gnus-summary-insert-new-articles
1823   "r" gnus-summary-limit-to-replied)
1824
1825 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1826   "n" gnus-summary-next-unread-article
1827   "p" gnus-summary-prev-unread-article
1828   "N" gnus-summary-next-article
1829   "P" gnus-summary-prev-article
1830   "\C-n" gnus-summary-next-same-subject
1831   "\C-p" gnus-summary-prev-same-subject
1832   "\M-n" gnus-summary-next-unread-subject
1833   "\M-p" gnus-summary-prev-unread-subject
1834   "f" gnus-summary-first-unread-article
1835   "b" gnus-summary-best-unread-article
1836   "j" gnus-summary-goto-article
1837   "g" gnus-summary-goto-subject
1838   "l" gnus-summary-goto-last-article
1839   "o" gnus-summary-pop-article)
1840
1841 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1842   "k" gnus-summary-kill-thread
1843   "l" gnus-summary-lower-thread
1844   "i" gnus-summary-raise-thread
1845   "T" gnus-summary-toggle-threads
1846   "t" gnus-summary-rethread-current
1847   "^" gnus-summary-reparent-thread
1848   "s" gnus-summary-show-thread
1849   "S" gnus-summary-show-all-threads
1850   "h" gnus-summary-hide-thread
1851   "H" gnus-summary-hide-all-threads
1852   "n" gnus-summary-next-thread
1853   "p" gnus-summary-prev-thread
1854   "u" gnus-summary-up-thread
1855   "o" gnus-summary-top-thread
1856   "d" gnus-summary-down-thread
1857   "#" gnus-uu-mark-thread
1858   "\M-#" gnus-uu-unmark-thread)
1859
1860 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1861   "g" gnus-summary-prepare
1862   "c" gnus-summary-insert-cached-articles
1863   "d" gnus-summary-insert-dormant-articles)
1864
1865 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1866   "c" gnus-summary-catchup-and-exit
1867   "C" gnus-summary-catchup-all-and-exit
1868   "E" gnus-summary-exit-no-update
1869   "Q" gnus-summary-exit
1870   "Z" gnus-summary-exit
1871   "n" gnus-summary-catchup-and-goto-next-group
1872   "R" gnus-summary-reselect-current-group
1873   "G" gnus-summary-rescan-group
1874   "N" gnus-summary-next-group
1875   "s" gnus-summary-save-newsrc
1876   "P" gnus-summary-prev-group)
1877
1878 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1879   " " gnus-summary-next-page
1880   "n" gnus-summary-next-page
1881   "\177" gnus-summary-prev-page
1882   [delete] gnus-summary-prev-page
1883   "p" gnus-summary-prev-page
1884   "\r" gnus-summary-scroll-up
1885   "\M-\r" gnus-summary-scroll-down
1886   "<" gnus-summary-beginning-of-article
1887   ">" gnus-summary-end-of-article
1888   "b" gnus-summary-beginning-of-article
1889   "e" gnus-summary-end-of-article
1890   "^" gnus-summary-refer-parent-article
1891   "r" gnus-summary-refer-parent-article
1892   "D" gnus-summary-enter-digest-group
1893   "R" gnus-summary-refer-references
1894   "T" gnus-summary-refer-thread
1895   "g" gnus-summary-show-article
1896   "s" gnus-summary-isearch-article
1897   "P" gnus-summary-print-article
1898   "M" gnus-mailing-list-insinuate
1899   "t" gnus-article-babel)
1900
1901 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1902   "b" gnus-article-add-buttons
1903   "B" gnus-article-add-buttons-to-head
1904   "o" gnus-article-treat-overstrike
1905   "e" gnus-article-emphasize
1906   "w" gnus-article-fill-cited-article
1907   "Q" gnus-article-fill-long-lines
1908   "C" gnus-article-capitalize-sentences
1909   "c" gnus-article-remove-cr
1910   "q" gnus-article-de-quoted-unreadable
1911   "6" gnus-article-de-base64-unreadable
1912   "Z" gnus-article-decode-HZ
1913   "A" gnus-article-treat-ansi-sequences
1914   "h" gnus-article-wash-html
1915   "u" gnus-article-unsplit-urls
1916   "s" gnus-summary-force-verify-and-decrypt
1917   "f" gnus-article-display-x-face
1918   "l" gnus-summary-stop-page-breaking
1919   "r" gnus-summary-caesar-message
1920   "m" gnus-summary-morse-message
1921   "t" gnus-summary-toggle-header
1922   "g" gnus-treat-smiley
1923   "v" gnus-summary-verbose-headers
1924   "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1925   "p" gnus-article-verify-x-pgp-sig
1926   "d" gnus-article-treat-dumbquotes)
1927
1928 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1929   ;; mnemonic: deuglif*Y*
1930   "u" gnus-article-outlook-unwrap-lines
1931   "a" gnus-article-outlook-repair-attribution
1932   "c" gnus-article-outlook-rearrange-citation
1933   "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1934
1935 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1936   "a" gnus-article-hide
1937   "h" gnus-article-hide-headers
1938   "b" gnus-article-hide-boring-headers
1939   "s" gnus-article-hide-signature
1940   "c" gnus-article-hide-citation
1941   "C" gnus-article-hide-citation-in-followups
1942   "l" gnus-article-hide-list-identifiers
1943   "B" gnus-article-strip-banner
1944   "P" gnus-article-hide-pem
1945   "\C-c" gnus-article-hide-citation-maybe)
1946
1947 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1948   "a" gnus-article-highlight
1949   "h" gnus-article-highlight-headers
1950   "c" gnus-article-highlight-citation
1951   "s" gnus-article-highlight-signature)
1952
1953 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1954   "f" gnus-article-treat-fold-headers
1955   "u" gnus-article-treat-unfold-headers
1956   "n" gnus-article-treat-fold-newsgroups)
1957
1958 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1959   "x" gnus-article-display-x-face
1960   "d" gnus-article-display-face
1961   "s" gnus-treat-smiley
1962   "D" gnus-article-remove-images
1963   "f" gnus-treat-from-picon
1964   "m" gnus-treat-mail-picon
1965   "n" gnus-treat-newsgroups-picon)
1966
1967 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1968   "w" gnus-article-decode-mime-words
1969   "c" gnus-article-decode-charset
1970   "v" gnus-mime-view-all-parts
1971   "b" gnus-article-view-part)
1972
1973 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1974   "z" gnus-article-date-ut
1975   "u" gnus-article-date-ut
1976   "l" gnus-article-date-local
1977   "p" gnus-article-date-english
1978   "e" gnus-article-date-lapsed
1979   "o" gnus-article-date-original
1980   "i" gnus-article-date-iso8601
1981   "s" gnus-article-date-user)
1982
1983 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1984   "t" gnus-article-remove-trailing-blank-lines
1985   "l" gnus-article-strip-leading-blank-lines
1986   "m" gnus-article-strip-multiple-blank-lines
1987   "a" gnus-article-strip-blank-lines
1988   "A" gnus-article-strip-all-blank-lines
1989   "s" gnus-article-strip-leading-space
1990   "e" gnus-article-strip-trailing-space
1991   "w" gnus-article-remove-leading-whitespace)
1992
1993 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1994   "v" gnus-version
1995   "f" gnus-summary-fetch-faq
1996   "d" gnus-summary-describe-group
1997   "h" gnus-summary-describe-briefly
1998   "i" gnus-info-find-node
1999   "c" gnus-group-fetch-charter
2000   "C" gnus-group-fetch-control)
2001
2002 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2003   "e" gnus-summary-expire-articles
2004   "\M-\C-e" gnus-summary-expire-articles-now
2005   "\177" gnus-summary-delete-article
2006   [delete] gnus-summary-delete-article
2007   [backspace] gnus-summary-delete-article
2008   "m" gnus-summary-move-article
2009   "r" gnus-summary-respool-article
2010   "w" gnus-summary-edit-article
2011   "c" gnus-summary-copy-article
2012   "B" gnus-summary-crosspost-article
2013   "q" gnus-summary-respool-query
2014   "t" gnus-summary-respool-trace
2015   "i" gnus-summary-import-article
2016   "I" gnus-summary-create-article
2017   "p" gnus-summary-article-posted-p)
2018
2019 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2020   "o" gnus-summary-save-article
2021   "m" gnus-summary-save-article-mail
2022   "F" gnus-summary-write-article-file
2023   "r" gnus-summary-save-article-rmail
2024   "f" gnus-summary-save-article-file
2025   "b" gnus-summary-save-article-body-file
2026   "h" gnus-summary-save-article-folder
2027   "v" gnus-summary-save-article-vm
2028   "p" gnus-summary-pipe-output
2029   "P" gnus-summary-muttprint
2030   "s" gnus-soup-add-article)
2031
2032 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2033   "b" gnus-summary-display-buttonized
2034   "m" gnus-summary-repair-multipart
2035   "v" gnus-article-view-part
2036   "o" gnus-article-save-part
2037   "c" gnus-article-copy-part
2038   "C" gnus-article-view-part-as-charset
2039   "e" gnus-article-view-part-externally
2040   "E" gnus-article-encrypt-body
2041   "i" gnus-article-inline-part
2042   "|" gnus-article-pipe-part)
2043
2044 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2045   "p" gnus-summary-mark-as-processable
2046   "u" gnus-summary-unmark-as-processable
2047   "U" gnus-summary-unmark-all-processable
2048   "v" gnus-uu-mark-over
2049   "s" gnus-uu-mark-series
2050   "r" gnus-uu-mark-region
2051   "g" gnus-uu-unmark-region
2052   "R" gnus-uu-mark-by-regexp
2053   "G" gnus-uu-unmark-by-regexp
2054   "t" gnus-uu-mark-thread
2055   "T" gnus-uu-unmark-thread
2056   "a" gnus-uu-mark-all
2057   "b" gnus-uu-mark-buffer
2058   "S" gnus-uu-mark-sparse
2059   "k" gnus-summary-kill-process-mark
2060   "y" gnus-summary-yank-process-mark
2061   "w" gnus-summary-save-process-mark
2062   "i" gnus-uu-invert-processable)
2063
2064 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2065   ;;"x" gnus-uu-extract-any
2066   "m" gnus-summary-save-parts
2067   "u" gnus-uu-decode-uu
2068   "U" gnus-uu-decode-uu-and-save
2069   "s" gnus-uu-decode-unshar
2070   "S" gnus-uu-decode-unshar-and-save
2071   "o" gnus-uu-decode-save
2072   "O" gnus-uu-decode-save
2073   "b" gnus-uu-decode-binhex
2074   "B" gnus-uu-decode-binhex
2075   "p" gnus-uu-decode-postscript
2076   "P" gnus-uu-decode-postscript-and-save)
2077
2078 (gnus-define-keys
2079     (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2080   "u" gnus-uu-decode-uu-view
2081   "U" gnus-uu-decode-uu-and-save-view
2082   "s" gnus-uu-decode-unshar-view
2083   "S" gnus-uu-decode-unshar-and-save-view
2084   "o" gnus-uu-decode-save-view
2085   "O" gnus-uu-decode-save-view
2086   "b" gnus-uu-decode-binhex-view
2087   "B" gnus-uu-decode-binhex-view
2088   "p" gnus-uu-decode-postscript-view
2089   "P" gnus-uu-decode-postscript-and-save-view)
2090
2091 (defvar gnus-article-post-menu nil)
2092
2093 (defconst gnus-summary-menu-maxlen 20)
2094
2095 (defun gnus-summary-menu-split (menu)
2096   ;; If we have lots of elements, divide them into groups of 20
2097   ;; and make a pane (or submenu) for each one.
2098   (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2099       (let ((menu menu) sublists next
2100             (i 1))
2101         (while menu
2102           ;; Pull off the next gnus-summary-menu-maxlen elements
2103           ;; and make them the next element of sublist.
2104           (setq next (nthcdr gnus-summary-menu-maxlen menu))
2105           (if next
2106               (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2107                       nil))
2108           (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2109                                              (aref (car (last menu)) 0)) menu)
2110                                sublists))
2111           (setq i (1+ i))
2112           (setq menu next))
2113         (nreverse sublists))
2114     ;; Few elements--put them all in one pane.
2115     menu))
2116
2117 (defun gnus-summary-make-menu-bar ()
2118   (gnus-turn-off-edit-menu 'summary)
2119
2120   (unless (boundp 'gnus-summary-misc-menu)
2121
2122     (easy-menu-define
2123       gnus-summary-kill-menu gnus-summary-mode-map ""
2124       (cons
2125        "Score"
2126        (nconc
2127         (list
2128          ["Customize" gnus-score-customize t])
2129         (gnus-make-score-map 'increase)
2130         (gnus-make-score-map 'lower)
2131         '(("Mark"
2132            ["Kill below" gnus-summary-kill-below t]
2133            ["Mark above" gnus-summary-mark-above t]
2134            ["Tick above" gnus-summary-tick-above t]
2135            ["Clear above" gnus-summary-clear-above t])
2136           ["Current score" gnus-summary-current-score t]
2137           ["Set score" gnus-summary-set-score t]
2138           ["Switch current score file..." gnus-score-change-score-file t]
2139           ["Set mark below..." gnus-score-set-mark-below t]
2140           ["Set expunge below..." gnus-score-set-expunge-below t]
2141           ["Edit current score file" gnus-score-edit-current-scores t]
2142           ["Edit score file" gnus-score-edit-file t]
2143           ["Trace score" gnus-score-find-trace t]
2144           ["Find words" gnus-score-find-favourite-words t]
2145           ["Rescore buffer" gnus-summary-rescore t]
2146           ["Increase score..." gnus-summary-increase-score t]
2147           ["Lower score..." gnus-summary-lower-score t]))))
2148
2149     ;; Define both the Article menu in the summary buffer and the
2150     ;; equivalent Commands menu in the article buffer here for
2151     ;; consistency.
2152     (let ((innards
2153            `(("Hide"
2154               ["All" gnus-article-hide t]
2155               ["Headers" gnus-article-hide-headers t]
2156               ["Signature" gnus-article-hide-signature t]
2157               ["Citation" gnus-article-hide-citation t]
2158               ["List identifiers" gnus-article-hide-list-identifiers t]
2159               ["Banner" gnus-article-strip-banner t]
2160               ["Boring headers" gnus-article-hide-boring-headers t])
2161              ("Highlight"
2162               ["All" gnus-article-highlight t]
2163               ["Headers" gnus-article-highlight-headers t]
2164               ["Signature" gnus-article-highlight-signature t]
2165               ["Citation" gnus-article-highlight-citation t])
2166              ("MIME"
2167               ["Words" gnus-article-decode-mime-words t]
2168               ["Charset" gnus-article-decode-charset t]
2169               ["QP" gnus-article-de-quoted-unreadable t]
2170               ["Base64" gnus-article-de-base64-unreadable t]
2171               ["View MIME buttons" gnus-summary-display-buttonized t]
2172               ["View all" gnus-mime-view-all-parts t]
2173               ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2174               ["Encrypt body" gnus-article-encrypt-body
2175                :active (not (gnus-group-read-only-p))
2176                ,@(if (featurep 'xemacs) nil
2177                    '(:help "Encrypt the message body on disk"))]
2178               ["Extract all parts..." gnus-summary-save-parts t]
2179               ("Multipart"
2180                ["Repair multipart" gnus-summary-repair-multipart t]
2181                ["Pipe part..." gnus-article-pipe-part t]
2182                ["Inline part" gnus-article-inline-part t]
2183                ["Encrypt body" gnus-article-encrypt-body
2184                 :active (not (gnus-group-read-only-p))
2185                ,@(if (featurep 'xemacs) nil
2186                    '(:help "Encrypt the message body on disk"))]
2187                ["View part externally" gnus-article-view-part-externally t]
2188                ["View part with charset..." gnus-article-view-part-as-charset t]
2189                ["Copy part" gnus-article-copy-part t]
2190                ["Save part..." gnus-article-save-part t]
2191                ["View part" gnus-article-view-part t]))
2192              ("Date"
2193               ["Local" gnus-article-date-local t]
2194               ["ISO8601" gnus-article-date-iso8601 t]
2195               ["UT" gnus-article-date-ut t]
2196               ["Original" gnus-article-date-original t]
2197               ["Lapsed" gnus-article-date-lapsed t]
2198               ["User-defined" gnus-article-date-user t])
2199              ("Display"
2200               ["Remove images" gnus-article-remove-images t]
2201               ["Toggle smiley" gnus-treat-smiley t]
2202               ["Show X-Face" gnus-article-display-x-face t]
2203               ["Show picons in From" gnus-treat-from-picon t]
2204               ["Show picons in mail headers" gnus-treat-mail-picon t]
2205               ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2206               ("View as different encoding"
2207                ,@(gnus-summary-menu-split
2208                   (mapcar
2209                    (lambda (cs)
2210                      ;; Since easymenu under Emacs doesn't allow
2211                      ;; lambda forms for menu commands, we should
2212                      ;; provide intern'ed function symbols.
2213                      (let ((command (intern (format "\
2214 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2215                        (fset command
2216                              `(lambda ()
2217                                 (interactive)
2218                                 (let ((gnus-summary-show-article-charset-alist
2219                                        '((1 . ,cs))))
2220                                   (gnus-summary-show-article 1))))
2221                        `[,(symbol-name cs) ,command t]))
2222                    (sort (if (fboundp 'coding-system-list)
2223                              (coding-system-list)
2224                            (mapcar 'car mm-mime-mule-charset-alist))
2225                          'string<)))))
2226              ("Washing"
2227               ("Remove Blanks"
2228                ["Leading" gnus-article-strip-leading-blank-lines t]
2229                ["Multiple" gnus-article-strip-multiple-blank-lines t]
2230                ["Trailing" gnus-article-remove-trailing-blank-lines t]
2231                ["All of the above" gnus-article-strip-blank-lines t]
2232                ["All" gnus-article-strip-all-blank-lines t]
2233                ["Leading space" gnus-article-strip-leading-space t]
2234                ["Trailing space" gnus-article-strip-trailing-space t]
2235                ["Leading space in headers"
2236                 gnus-article-remove-leading-whitespace t])
2237               ["Overstrike" gnus-article-treat-overstrike t]
2238               ["Dumb quotes" gnus-article-treat-dumbquotes t]
2239               ["Emphasis" gnus-article-emphasize t]
2240               ["Word wrap" gnus-article-fill-cited-article t]
2241               ["Fill long lines" gnus-article-fill-long-lines t]
2242               ["Capitalize sentences" gnus-article-capitalize-sentences t]
2243               ["Remove CR" gnus-article-remove-cr t]
2244               ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2245               ["Base64" gnus-article-de-base64-unreadable t]
2246               ["Rot 13" gnus-summary-caesar-message
2247                ,@(if (featurep 'xemacs) '(t)
2248                    '(:help "\"Caesar rotate\" article by 13"))]
2249               ["Morse decode" gnus-summary-morse-message t]
2250               ["Unix pipe..." gnus-summary-pipe-message t]
2251               ["Add buttons" gnus-article-add-buttons t]
2252               ["Add buttons to head" gnus-article-add-buttons-to-head t]
2253               ["Stop page breaking" gnus-summary-stop-page-breaking t]
2254               ["Verbose header" gnus-summary-verbose-headers t]
2255               ["Toggle header" gnus-summary-toggle-header t]
2256               ["Unfold headers" gnus-article-treat-unfold-headers t]
2257               ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2258               ["Html" gnus-article-wash-html t]
2259               ["Unsplit URLs" gnus-article-unsplit-urls t]
2260               ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2261               ["Decode HZ" gnus-article-decode-HZ t]
2262               ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2263               ("(Outlook) Deuglify"
2264                ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2265                ["Repair attribution" gnus-article-outlook-repair-attribution t]
2266                ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2267                ["Full (Outlook) deuglify"
2268                 gnus-article-outlook-deuglify-article t])
2269               )
2270              ("Output"
2271               ["Save in default format..." gnus-summary-save-article
2272                ,@(if (featurep 'xemacs) '(t)
2273                    '(:help "Save article using default method"))]
2274               ["Save in file..." gnus-summary-save-article-file
2275                ,@(if (featurep 'xemacs) '(t)
2276                    '(:help "Save article in file"))]
2277               ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2278               ["Save in MH folder..." gnus-summary-save-article-folder t]
2279               ["Save in VM folder..." gnus-summary-save-article-vm t]
2280               ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2281               ["Save body in file..." gnus-summary-save-article-body-file t]
2282               ["Pipe through a filter..." gnus-summary-pipe-output t]
2283               ["Add to SOUP packet" gnus-soup-add-article t]
2284               ["Print with Muttprint..." gnus-summary-muttprint t]
2285               ["Print" gnus-summary-print-article t])
2286              ("Backend"
2287               ["Respool article..." gnus-summary-respool-article t]
2288               ["Move article..." gnus-summary-move-article
2289                (gnus-check-backend-function
2290                 'request-move-article gnus-newsgroup-name)]
2291               ["Copy article..." gnus-summary-copy-article t]
2292               ["Crosspost article..." gnus-summary-crosspost-article
2293                (gnus-check-backend-function
2294                 'request-replace-article gnus-newsgroup-name)]
2295               ["Import file..." gnus-summary-import-article
2296                (gnus-check-backend-function
2297                 'request-accept-article gnus-newsgroup-name)]
2298               ["Create article..." gnus-summary-create-article
2299                (gnus-check-backend-function
2300                 'request-accept-article gnus-newsgroup-name)]
2301               ["Check if posted" gnus-summary-article-posted-p t]
2302               ["Edit article" gnus-summary-edit-article
2303                (not (gnus-group-read-only-p))]
2304               ["Delete article" gnus-summary-delete-article
2305                (gnus-check-backend-function
2306                 'request-expire-articles gnus-newsgroup-name)]
2307               ["Query respool" gnus-summary-respool-query t]
2308               ["Trace respool" gnus-summary-respool-trace t]
2309               ["Delete expirable articles" gnus-summary-expire-articles-now
2310                (gnus-check-backend-function
2311                 'request-expire-articles gnus-newsgroup-name)])
2312              ("Extract"
2313               ["Uudecode" gnus-uu-decode-uu
2314                ,@(if (featurep 'xemacs) '(t)
2315                    '(:help "Decode uuencoded article(s)"))]
2316               ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2317               ["Unshar" gnus-uu-decode-unshar t]
2318               ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2319               ["Save" gnus-uu-decode-save t]
2320               ["Binhex" gnus-uu-decode-binhex t]
2321               ["Postscript" gnus-uu-decode-postscript t]
2322               ["All MIME parts" gnus-summary-save-parts t])
2323              ("Cache"
2324               ["Enter article" gnus-cache-enter-article t]
2325               ["Remove article" gnus-cache-remove-article t])
2326              ["Translate" gnus-article-babel t]
2327              ["Select article buffer" gnus-summary-select-article-buffer t]
2328              ["Enter digest buffer" gnus-summary-enter-digest-group t]
2329              ["Isearch article..." gnus-summary-isearch-article t]
2330              ["Beginning of the article" gnus-summary-beginning-of-article t]
2331              ["End of the article" gnus-summary-end-of-article t]
2332              ["Fetch parent of article" gnus-summary-refer-parent-article t]
2333              ["Fetch referenced articles" gnus-summary-refer-references t]
2334              ["Fetch current thread" gnus-summary-refer-thread t]
2335              ["Fetch article with id..." gnus-summary-refer-article t]
2336              ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2337              ["Redisplay" gnus-summary-show-article t]
2338              ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2339       (easy-menu-define
2340         gnus-summary-article-menu gnus-summary-mode-map ""
2341         (cons "Article" innards))
2342
2343       (if (not (keymapp gnus-summary-article-menu))
2344           (easy-menu-define
2345             gnus-article-commands-menu gnus-article-mode-map ""
2346             (cons "Commands" innards))
2347         ;; in Emacs, don't share menu.
2348         (setq gnus-article-commands-menu
2349               (copy-keymap gnus-summary-article-menu))
2350         (define-key gnus-article-mode-map [menu-bar commands]
2351           (cons "Commands" gnus-article-commands-menu))))
2352
2353     (easy-menu-define
2354       gnus-summary-thread-menu gnus-summary-mode-map ""
2355       '("Threads"
2356         ["Find all messages in thread" gnus-summary-refer-thread t]
2357         ["Toggle threading" gnus-summary-toggle-threads t]
2358         ["Hide threads" gnus-summary-hide-all-threads t]
2359         ["Show threads" gnus-summary-show-all-threads t]
2360         ["Hide thread" gnus-summary-hide-thread t]
2361         ["Show thread" gnus-summary-show-thread t]
2362         ["Go to next thread" gnus-summary-next-thread t]
2363         ["Go to previous thread" gnus-summary-prev-thread t]
2364         ["Go down thread" gnus-summary-down-thread t]
2365         ["Go up thread" gnus-summary-up-thread t]
2366         ["Top of thread" gnus-summary-top-thread t]
2367         ["Mark thread as read" gnus-summary-kill-thread t]
2368         ["Lower thread score" gnus-summary-lower-thread t]
2369         ["Raise thread score" gnus-summary-raise-thread t]
2370         ["Rethread current" gnus-summary-rethread-current t]))
2371
2372     (easy-menu-define
2373       gnus-summary-post-menu gnus-summary-mode-map ""
2374       `("Post"
2375         ["Send a message (mail or news)" gnus-summary-post-news
2376          ,@(if (featurep 'xemacs) '(t)
2377              '(:help "Post an article"))]
2378         ["Followup" gnus-summary-followup
2379          ,@(if (featurep 'xemacs) '(t)
2380              '(:help "Post followup to this article"))]
2381         ["Followup and yank" gnus-summary-followup-with-original
2382          ,@(if (featurep 'xemacs) '(t)
2383              '(:help "Post followup to this article, quoting its contents"))]
2384         ["Supersede article" gnus-summary-supersede-article t]
2385         ["Cancel article" gnus-summary-cancel-article
2386          ,@(if (featurep 'xemacs) '(t)
2387              '(:help "Cancel an article you posted"))]
2388         ["Reply" gnus-summary-reply t]
2389         ["Reply and yank" gnus-summary-reply-with-original t]
2390         ["Wide reply" gnus-summary-wide-reply t]
2391         ["Wide reply and yank" gnus-summary-wide-reply-with-original
2392          ,@(if (featurep 'xemacs) '(t)
2393              '(:help "Mail a reply, quoting this article"))]
2394         ["Very wide reply" gnus-summary-very-wide-reply t]
2395         ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2396          ,@(if (featurep 'xemacs) '(t)
2397              '(:help "Mail a very wide reply, quoting this article"))]
2398         ["Mail forward" gnus-summary-mail-forward t]
2399         ["Post forward" gnus-summary-post-forward t]
2400         ["Digest and mail" gnus-uu-digest-mail-forward t]
2401         ["Digest and post" gnus-uu-digest-post-forward t]
2402         ["Resend message" gnus-summary-resend-message t]
2403         ["Resend message edit" gnus-summary-resend-message-edit t]
2404         ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2405         ["Send a mail" gnus-summary-mail-other-window t]
2406         ["Create a local message" gnus-summary-news-other-window t]
2407         ["Uuencode and post" gnus-uu-post-news
2408          ,@(if (featurep 'xemacs) '(t)
2409              '(:help "Post a uuencoded article"))]
2410         ["Followup via news" gnus-summary-followup-to-mail t]
2411         ["Followup via news and yank"
2412          gnus-summary-followup-to-mail-with-original t]
2413         ;;("Draft"
2414         ;;["Send" gnus-summary-send-draft t]
2415         ;;["Send bounced" gnus-resend-bounced-mail t])
2416         ))
2417
2418     (cond
2419      ((not (keymapp gnus-summary-post-menu))
2420       (setq gnus-article-post-menu gnus-summary-post-menu))
2421      ((not gnus-article-post-menu)
2422       ;; Don't share post menu.
2423       (setq gnus-article-post-menu
2424             (copy-keymap gnus-summary-post-menu))))
2425     (define-key gnus-article-mode-map [menu-bar post]
2426       (cons "Post" gnus-article-post-menu))
2427
2428     (easy-menu-define
2429       gnus-summary-misc-menu gnus-summary-mode-map ""
2430       `("Gnus"
2431         ("Mark Read"
2432          ["Mark as read" gnus-summary-mark-as-read-forward t]
2433          ["Mark same subject and select"
2434           gnus-summary-kill-same-subject-and-select t]
2435          ["Mark same subject" gnus-summary-kill-same-subject t]
2436          ["Catchup" gnus-summary-catchup
2437           ,@(if (featurep 'xemacs) '(t)
2438               '(:help "Mark unread articles in this group as read"))]
2439          ["Catchup all" gnus-summary-catchup-all t]
2440          ["Catchup to here" gnus-summary-catchup-to-here t]
2441          ["Catchup from here" gnus-summary-catchup-from-here t]
2442          ["Catchup region" gnus-summary-mark-region-as-read
2443           (gnus-mark-active-p)]
2444          ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2445         ("Mark Various"
2446          ["Tick" gnus-summary-tick-article-forward t]
2447          ["Mark as dormant" gnus-summary-mark-as-dormant t]
2448          ["Remove marks" gnus-summary-clear-mark-forward t]
2449          ["Set expirable mark" gnus-summary-mark-as-expirable t]
2450          ["Set bookmark" gnus-summary-set-bookmark t]
2451          ["Remove bookmark" gnus-summary-remove-bookmark t])
2452         ("Limit to"
2453          ["Marks..." gnus-summary-limit-to-marks t]
2454          ["Subject..." gnus-summary-limit-to-subject t]
2455          ["Author..." gnus-summary-limit-to-author t]
2456          ["Age..." gnus-summary-limit-to-age t]
2457          ["Extra..." gnus-summary-limit-to-extra t]
2458          ["Score..." gnus-summary-limit-to-score t]
2459          ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2460          ["Unread" gnus-summary-limit-to-unread t]
2461          ["Unseen" gnus-summary-limit-to-unseen t]
2462          ["Replied" gnus-summary-limit-to-replied t]
2463          ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2464          ["Next articles" gnus-summary-limit-to-articles t]
2465          ["Pop limit" gnus-summary-pop-limit t]
2466          ["Show dormant" gnus-summary-limit-include-dormant t]
2467          ["Hide childless dormant"
2468           gnus-summary-limit-exclude-childless-dormant t]
2469          ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2470          ["Hide marked" gnus-summary-limit-exclude-marks t]
2471          ["Show expunged" gnus-summary-limit-include-expunged t])
2472         ("Process Mark"
2473          ["Set mark" gnus-summary-mark-as-processable t]
2474          ["Remove mark" gnus-summary-unmark-as-processable t]
2475          ["Remove all marks" gnus-summary-unmark-all-processable t]
2476          ["Mark above" gnus-uu-mark-over t]
2477          ["Mark series" gnus-uu-mark-series t]
2478          ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2479          ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2480          ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2481          ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2482          ["Mark all" gnus-uu-mark-all t]
2483          ["Mark buffer" gnus-uu-mark-buffer t]
2484          ["Mark sparse" gnus-uu-mark-sparse t]
2485          ["Mark thread" gnus-uu-mark-thread t]
2486          ["Unmark thread" gnus-uu-unmark-thread t]
2487          ("Process Mark Sets"
2488           ["Kill" gnus-summary-kill-process-mark t]
2489           ["Yank" gnus-summary-yank-process-mark
2490            gnus-newsgroup-process-stack]
2491           ["Save" gnus-summary-save-process-mark t]
2492           ["Run command on marked..." gnus-summary-universal-argument t]))
2493         ("Scroll article"
2494          ["Page forward" gnus-summary-next-page
2495           ,@(if (featurep 'xemacs) '(t)
2496               '(:help "Show next page of article"))]
2497          ["Page backward" gnus-summary-prev-page
2498           ,@(if (featurep 'xemacs) '(t)
2499               '(:help "Show previous page of article"))]
2500          ["Line forward" gnus-summary-scroll-up t])
2501         ("Move"
2502          ["Next unread article" gnus-summary-next-unread-article t]
2503          ["Previous unread article" gnus-summary-prev-unread-article t]
2504          ["Next article" gnus-summary-next-article t]
2505          ["Previous article" gnus-summary-prev-article t]
2506          ["Next unread subject" gnus-summary-next-unread-subject t]
2507          ["Previous unread subject" gnus-summary-prev-unread-subject t]
2508          ["Next article same subject" gnus-summary-next-same-subject t]
2509          ["Previous article same subject" gnus-summary-prev-same-subject t]
2510          ["First unread article" gnus-summary-first-unread-article t]
2511          ["Best unread article" gnus-summary-best-unread-article t]
2512          ["Go to subject number..." gnus-summary-goto-subject t]
2513          ["Go to article number..." gnus-summary-goto-article t]
2514          ["Go to the last article" gnus-summary-goto-last-article t]
2515          ["Pop article off history" gnus-summary-pop-article t])
2516         ("Sort"
2517          ["Sort by number" gnus-summary-sort-by-number t]
2518          ["Sort by author" gnus-summary-sort-by-author t]
2519          ["Sort by subject" gnus-summary-sort-by-subject t]
2520          ["Sort by date" gnus-summary-sort-by-date t]
2521          ["Sort by score" gnus-summary-sort-by-score t]
2522          ["Sort by lines" gnus-summary-sort-by-lines t]
2523          ["Sort by characters" gnus-summary-sort-by-chars t]
2524          ["Randomize" gnus-summary-sort-by-random t]
2525          ["Original sort" gnus-summary-sort-by-original t])
2526         ("Help"
2527          ["Fetch group FAQ" gnus-summary-fetch-faq t]
2528          ["Describe group" gnus-summary-describe-group t]
2529          ["Fetch charter" gnus-group-fetch-charter
2530           ,@(if (featurep 'xemacs) nil
2531               '(:help "Display the charter of the current group"))]
2532          ["Fetch control message" gnus-group-fetch-control
2533           ,@(if (featurep 'xemacs) nil
2534               '(:help "Display the archived control message for the current group"))]
2535          ["Read manual" gnus-info-find-node t])
2536         ("Modes"
2537          ["Pick and read" gnus-pick-mode t]
2538          ["Binary" gnus-binary-mode t])
2539         ("Regeneration"
2540          ["Regenerate" gnus-summary-prepare t]
2541          ["Insert cached articles" gnus-summary-insert-cached-articles t]
2542          ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2543          ["Toggle threading" gnus-summary-toggle-threads t])
2544         ["See old articles" gnus-summary-insert-old-articles t]
2545         ["See new articles" gnus-summary-insert-new-articles t]
2546         ["Filter articles..." gnus-summary-execute-command t]
2547         ["Run command on articles..." gnus-summary-universal-argument t]
2548         ["Search articles forward..." gnus-summary-search-article-forward t]
2549         ["Search articles backward..." gnus-summary-search-article-backward t]
2550         ["Toggle line truncation" gnus-summary-toggle-truncation t]
2551         ["Expand window" gnus-summary-expand-window t]
2552         ["Expire expirable articles" gnus-summary-expire-articles
2553          (gnus-check-backend-function
2554           'request-expire-articles gnus-newsgroup-name)]
2555         ["Edit local kill file" gnus-summary-edit-local-kill t]
2556         ["Edit main kill file" gnus-summary-edit-global-kill t]
2557         ["Edit group parameters" gnus-summary-edit-parameters t]
2558         ["Customize group parameters" gnus-summary-customize-parameters t]
2559         ["Send a bug report" gnus-bug t]
2560         ("Exit"
2561          ["Catchup and exit" gnus-summary-catchup-and-exit
2562           ,@(if (featurep 'xemacs) '(t)
2563               '(:help "Mark unread articles in this group as read, then exit"))]
2564          ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2565          ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2566          ["Exit group" gnus-summary-exit
2567           ,@(if (featurep 'xemacs) '(t)
2568               '(:help "Exit current group, return to group selection mode"))]
2569          ["Exit group without updating" gnus-summary-exit-no-update t]
2570          ["Exit and goto next group" gnus-summary-next-group t]
2571          ["Exit and goto prev group" gnus-summary-prev-group t]
2572          ["Reselect group" gnus-summary-reselect-current-group t]
2573          ["Rescan group" gnus-summary-rescan-group t]
2574          ["Update dribble" gnus-summary-save-newsrc t])))
2575
2576     (gnus-run-hooks 'gnus-summary-menu-hook)))
2577
2578 (defvar gnus-summary-tool-bar-map nil)
2579
2580 ;; Emacs 21 tool bar.  Should be no-op otherwise.
2581 (defun gnus-summary-make-tool-bar ()
2582   (if (and (fboundp 'tool-bar-add-item-from-menu)
2583            (default-value 'tool-bar-mode)
2584            (not gnus-summary-tool-bar-map))
2585       (setq gnus-summary-tool-bar-map
2586             (let ((tool-bar-map (make-sparse-keymap))
2587                   (load-path (mm-image-load-path)))
2588               (tool-bar-add-item-from-menu
2589                'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2590               (tool-bar-add-item-from-menu
2591                'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2592               (tool-bar-add-item-from-menu
2593                'gnus-summary-post-news "post" gnus-summary-mode-map)
2594               (tool-bar-add-item-from-menu
2595                'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2596               (tool-bar-add-item-from-menu
2597                'gnus-summary-followup "followup" gnus-summary-mode-map)
2598               (tool-bar-add-item-from-menu
2599                'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2600               (tool-bar-add-item-from-menu
2601                'gnus-summary-reply "reply" gnus-summary-mode-map)
2602               (tool-bar-add-item-from-menu
2603                'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2604               (tool-bar-add-item-from-menu
2605                'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2606               (tool-bar-add-item-from-menu
2607                'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2608               (tool-bar-add-item-from-menu
2609                'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2610               (tool-bar-add-item-from-menu
2611                'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2612               (tool-bar-add-item-from-menu
2613                'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2614               (tool-bar-add-item-from-menu
2615                'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2616               (tool-bar-add-item-from-menu
2617                'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2618               tool-bar-map)))
2619   (if gnus-summary-tool-bar-map
2620       (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2621
2622 (defun gnus-score-set-default (var value)
2623   "A version of set that updates the GNU Emacs menu-bar."
2624   (set var value)
2625   ;; It is the message that forces the active status to be updated.
2626   (message ""))
2627
2628 (defun gnus-make-score-map (type)
2629   "Make a summary score map of type TYPE."
2630   (if t
2631       nil
2632     (let ((headers '(("author" "from" string)
2633                      ("subject" "subject" string)
2634                      ("article body" "body" string)
2635                      ("article head" "head" string)
2636                      ("xref" "xref" string)
2637                      ("extra header" "extra" string)
2638                      ("lines" "lines" number)
2639                      ("followups to author" "followup" string)))
2640           (types '((number ("less than" <)
2641                            ("greater than" >)
2642                            ("equal" =))
2643                    (string ("substring" s)
2644                            ("exact string" e)
2645                            ("fuzzy string" f)
2646                            ("regexp" r))))
2647           (perms '(("temporary" (current-time-string))
2648                    ("permanent" nil)
2649                    ("immediate" now)))
2650           header)
2651       (list
2652        (apply
2653         'nconc
2654         (list
2655          (if (eq type 'lower)
2656              "Lower score"
2657            "Increase score"))
2658         (let (outh)
2659           (while headers
2660             (setq header (car headers))
2661             (setq outh
2662                   (cons
2663                    (apply
2664                     'nconc
2665                     (list (car header))
2666                     (let ((ts (cdr (assoc (nth 2 header) types)))
2667                           outt)
2668                       (while ts
2669                         (setq outt
2670                               (cons
2671                                (apply
2672                                 'nconc
2673                                 (list (caar ts))
2674                                 (let ((ps perms)
2675                                       outp)
2676                                   (while ps
2677                                     (setq outp
2678                                           (cons
2679                                            (vector
2680                                             (caar ps)
2681                                             (list
2682                                              'gnus-summary-score-entry
2683                                              (nth 1 header)
2684                                              (if (or (string= (nth 1 header)
2685                                                               "head")
2686                                                      (string= (nth 1 header)
2687                                                               "body"))
2688                                                  ""
2689                                                (list 'gnus-summary-header
2690                                                      (nth 1 header)))
2691                                              (list 'quote (nth 1 (car ts)))
2692                                              (list 'gnus-score-delta-default
2693                                                    nil)
2694                                              (nth 1 (car ps))
2695                                              t)
2696                                             t)
2697                                            outp))
2698                                     (setq ps (cdr ps)))
2699                                   (list (nreverse outp))))
2700                                outt))
2701                         (setq ts (cdr ts)))
2702                       (list (nreverse outt))))
2703                    outh))
2704             (setq headers (cdr headers)))
2705           (list (nreverse outh))))))))
2706
2707 \f
2708
2709 (defun gnus-summary-mode (&optional group)
2710   "Major mode for reading articles.
2711
2712 All normal editing commands are switched off.
2713 \\<gnus-summary-mode-map>
2714 Each line in this buffer represents one article.  To read an
2715 article, you can, for instance, type `\\[gnus-summary-next-page]'.  To move forwards
2716 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2717 respectively.
2718
2719 You can also post articles and send mail from this buffer.  To
2720 follow up an article, type `\\[gnus-summary-followup]'.  To mail a reply to the author
2721 of an article, type `\\[gnus-summary-reply]'.
2722
2723 There are approx. one gazillion commands you can execute in this
2724 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2725
2726 The following commands are available:
2727
2728 \\{gnus-summary-mode-map}"
2729   (interactive)
2730   (kill-all-local-variables)
2731   (when (gnus-visual-p 'summary-menu 'menu)
2732     (gnus-summary-make-menu-bar)
2733     (gnus-summary-make-tool-bar))
2734   (gnus-summary-make-local-variables)
2735   (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2736     (gnus-summary-make-local-variables))
2737   (gnus-make-thread-indent-array)
2738   (gnus-simplify-mode-line)
2739   (setq major-mode 'gnus-summary-mode)
2740   (setq mode-name "Summary")
2741   (make-local-variable 'minor-mode-alist)
2742   (use-local-map gnus-summary-mode-map)
2743   (buffer-disable-undo)
2744   (setq buffer-read-only t)             ;Disable modification
2745   (setq truncate-lines t)
2746   (setq selective-display t)
2747   (setq selective-display-ellipses t)   ;Display `...'
2748   (gnus-summary-set-display-table)
2749   (gnus-set-default-directory)
2750   (setq gnus-newsgroup-name group)
2751   (make-local-variable 'gnus-summary-line-format)
2752   (make-local-variable 'gnus-summary-line-format-spec)
2753   (make-local-variable 'gnus-summary-dummy-line-format)
2754   (make-local-variable 'gnus-summary-dummy-line-format-spec)
2755   (make-local-variable 'gnus-summary-mark-positions)
2756   (gnus-make-local-hook 'pre-command-hook)
2757   (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2758   (gnus-run-hooks 'gnus-summary-mode-hook)
2759   (turn-on-gnus-mailing-list-mode)
2760   (mm-enable-multibyte)
2761   (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2762   (gnus-update-summary-mark-positions))
2763
2764 (defun gnus-summary-make-local-variables ()
2765   "Make all the local summary buffer variables."
2766   (let (global)
2767     (dolist (local gnus-summary-local-variables)
2768       (if (consp local)
2769           (progn
2770             (if (eq (cdr local) 'global)
2771                 ;; Copy the global value of the variable.
2772                 (setq global (symbol-value (car local)))
2773               ;; Use the value from the list.
2774               (setq global (eval (cdr local))))
2775             (set (make-local-variable (car local)) global))
2776         ;; Simple nil-valued local variable.
2777         (set (make-local-variable local) nil)))))
2778
2779 (defun gnus-summary-clear-local-variables ()
2780   (let ((locals gnus-summary-local-variables))
2781     (while locals
2782       (if (consp (car locals))
2783           (and (vectorp (caar locals))
2784                (set (caar locals) nil))
2785         (and (vectorp (car locals))
2786              (set (car locals) nil)))
2787       (setq locals (cdr locals)))))
2788
2789 ;; Summary data functions.
2790
2791 (defmacro gnus-data-number (data)
2792   `(car ,data))
2793
2794 (defmacro gnus-data-set-number (data number)
2795   `(setcar ,data ,number))
2796
2797 (defmacro gnus-data-mark (data)
2798   `(nth 1 ,data))
2799
2800 (defmacro gnus-data-set-mark (data mark)
2801   `(setcar (nthcdr 1 ,data) ,mark))
2802
2803 (defmacro gnus-data-pos (data)
2804   `(nth 2 ,data))
2805
2806 (defmacro gnus-data-set-pos (data pos)
2807   `(setcar (nthcdr 2 ,data) ,pos))
2808
2809 (defmacro gnus-data-header (data)
2810   `(nth 3 ,data))
2811
2812 (defmacro gnus-data-set-header (data header)
2813   `(setf (nth 3 ,data) ,header))
2814
2815 (defmacro gnus-data-level (data)
2816   `(nth 4 ,data))
2817
2818 (defmacro gnus-data-unread-p (data)
2819   `(= (nth 1 ,data) gnus-unread-mark))
2820
2821 (defmacro gnus-data-read-p (data)
2822   `(/= (nth 1 ,data) gnus-unread-mark))
2823
2824 (defmacro gnus-data-pseudo-p (data)
2825   `(consp (nth 3 ,data)))
2826
2827 (defmacro gnus-data-find (number)
2828   `(assq ,number gnus-newsgroup-data))
2829
2830 (defmacro gnus-data-find-list (number &optional data)
2831   `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2832      (memq (assq ,number bdata)
2833            bdata)))
2834
2835 (defmacro gnus-data-make (number mark pos header level)
2836   `(list ,number ,mark ,pos ,header ,level))
2837
2838 (defun gnus-data-enter (after-article number mark pos header level offset)
2839   (let ((data (gnus-data-find-list after-article)))
2840     (unless data
2841       (error "No such article: %d" after-article))
2842     (setcdr data (cons (gnus-data-make number mark pos header level)
2843                        (cdr data)))
2844     (setq gnus-newsgroup-data-reverse nil)
2845     (gnus-data-update-list (cddr data) offset)))
2846
2847 (defun gnus-data-enter-list (after-article list &optional offset)
2848   (when list
2849     (let ((data (and after-article (gnus-data-find-list after-article)))
2850           (ilist list))
2851       (if (not (or data
2852                    after-article))
2853           (let ((odata gnus-newsgroup-data))
2854             (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2855             (when offset
2856               (gnus-data-update-list odata offset)))
2857       ;; Find the last element in the list to be spliced into the main
2858         ;; list.
2859         (while (cdr list)
2860           (setq list (cdr list)))
2861         (if (not data)
2862             (progn
2863               (setcdr list gnus-newsgroup-data)
2864               (setq gnus-newsgroup-data ilist)
2865               (when offset
2866                 (gnus-data-update-list (cdr list) offset)))
2867           (setcdr list (cdr data))
2868           (setcdr data ilist)
2869           (when offset
2870             (gnus-data-update-list (cdr list) offset))))
2871       (setq gnus-newsgroup-data-reverse nil))))
2872
2873 (defun gnus-data-remove (article &optional offset)
2874   (let ((data gnus-newsgroup-data))
2875     (if (= (gnus-data-number (car data)) article)
2876         (progn
2877           (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2878                 gnus-newsgroup-data-reverse nil)
2879           (when offset
2880             (gnus-data-update-list gnus-newsgroup-data offset)))
2881       (while (cdr data)
2882         (when (= (gnus-data-number (cadr data)) article)
2883           (setcdr data (cddr data))
2884           (when offset
2885             (gnus-data-update-list (cdr data) offset))
2886           (setq data nil
2887                 gnus-newsgroup-data-reverse nil))
2888         (setq data (cdr data))))))
2889
2890 (defmacro gnus-data-list (backward)
2891   `(if ,backward
2892        (or gnus-newsgroup-data-reverse
2893            (setq gnus-newsgroup-data-reverse
2894                  (reverse gnus-newsgroup-data)))
2895      gnus-newsgroup-data))
2896
2897 (defun gnus-data-update-list (data offset)
2898   "Add OFFSET to the POS of all data entries in DATA."
2899   (setq gnus-newsgroup-data-reverse nil)
2900   (while data
2901     (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2902     (setq data (cdr data))))
2903
2904 (defun gnus-summary-article-pseudo-p (article)
2905   "Say whether this article is a pseudo article or not."
2906   (not (vectorp (gnus-data-header (gnus-data-find article)))))
2907
2908 (defmacro gnus-summary-article-sparse-p (article)
2909   "Say whether this article is a sparse article or not."
2910   `(memq ,article gnus-newsgroup-sparse))
2911
2912 (defmacro gnus-summary-article-ancient-p (article)
2913   "Say whether this article is a sparse article or not."
2914   `(memq ,article gnus-newsgroup-ancient))
2915
2916 (defun gnus-article-parent-p (number)
2917   "Say whether this article is a parent or not."
2918   (let ((data (gnus-data-find-list number)))
2919     (and (cdr data)              ; There has to be an article after...
2920          (< (gnus-data-level (car data)) ; And it has to have a higher level.
2921             (gnus-data-level (nth 1 data))))))
2922
2923 (defun gnus-article-children (number)
2924   "Return a list of all children to NUMBER."
2925   (let* ((data (gnus-data-find-list number))
2926          (level (gnus-data-level (car data)))
2927          children)
2928     (setq data (cdr data))
2929     (while (and data
2930                 (= (gnus-data-level (car data)) (1+ level)))
2931       (push (gnus-data-number (car data)) children)
2932       (setq data (cdr data)))
2933     children))
2934
2935 (defmacro gnus-summary-skip-intangible ()
2936   "If the current article is intangible, then jump to a different article."
2937   '(let ((to (get-text-property (point) 'gnus-intangible)))
2938      (and to (gnus-summary-goto-subject to))))
2939
2940 (defmacro gnus-summary-article-intangible-p ()
2941   "Say whether this article is intangible or not."
2942   '(get-text-property (point) 'gnus-intangible))
2943
2944 (defun gnus-article-read-p (article)
2945   "Say whether ARTICLE is read or not."
2946   (not (or (memq article gnus-newsgroup-marked)
2947            (memq article gnus-newsgroup-spam-marked)
2948            (memq article gnus-newsgroup-unreads)
2949            (memq article gnus-newsgroup-unselected)
2950            (memq article gnus-newsgroup-dormant))))
2951
2952 ;; Some summary mode macros.
2953
2954 (defmacro gnus-summary-article-number ()
2955   "The article number of the article on the current line.
2956 If there isn't an article number here, then we return the current
2957 article number."
2958   '(progn
2959      (gnus-summary-skip-intangible)
2960      (or (get-text-property (point) 'gnus-number)
2961          (gnus-summary-last-subject))))
2962
2963 (defmacro gnus-summary-article-header (&optional number)
2964   "Return the header of article NUMBER."
2965   `(gnus-data-header (gnus-data-find
2966                       ,(or number '(gnus-summary-article-number)))))
2967
2968 (defmacro gnus-summary-thread-level (&optional number)
2969   "Return the level of thread that starts with article NUMBER."
2970   `(if (and (eq gnus-summary-make-false-root 'dummy)
2971             (get-text-property (point) 'gnus-intangible))
2972        0
2973      (gnus-data-level (gnus-data-find
2974                        ,(or number '(gnus-summary-article-number))))))
2975
2976 (defmacro gnus-summary-article-mark (&optional number)
2977   "Return the mark of article NUMBER."
2978   `(gnus-data-mark (gnus-data-find
2979                     ,(or number '(gnus-summary-article-number)))))
2980
2981 (defmacro gnus-summary-article-pos (&optional number)
2982   "Return the position of the line of article NUMBER."
2983   `(gnus-data-pos (gnus-data-find
2984                    ,(or number '(gnus-summary-article-number)))))
2985
2986 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2987 (defmacro gnus-summary-article-subject (&optional number)
2988   "Return current subject string or nil if nothing."
2989   `(let ((headers
2990           ,(if number
2991                `(gnus-data-header (assq ,number gnus-newsgroup-data))
2992              '(gnus-data-header (assq (gnus-summary-article-number)
2993                                       gnus-newsgroup-data)))))
2994      (and headers
2995           (vectorp headers)
2996           (mail-header-subject headers))))
2997
2998 (defmacro gnus-summary-article-score (&optional number)
2999   "Return current article score."
3000   `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3001                   gnus-newsgroup-scored))
3002        gnus-summary-default-score 0))
3003
3004 (defun gnus-summary-article-children (&optional number)
3005   "Return a list of article numbers that are children of article NUMBER."
3006   (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3007          (level (gnus-data-level (car data)))
3008          l children)
3009     (while (and (setq data (cdr data))
3010                 (> (setq l (gnus-data-level (car data))) level))
3011       (and (= (1+ level) l)
3012            (push (gnus-data-number (car data))
3013                  children)))
3014     (nreverse children)))
3015
3016 (defun gnus-summary-article-parent (&optional number)
3017   "Return the article number of the parent of article NUMBER."
3018   (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3019                                     (gnus-data-list t)))
3020          (level (gnus-data-level (car data))))
3021     (if (zerop level)
3022         ()                              ; This is a root.
3023       ;; We search until we find an article with a level less than
3024       ;; this one.  That function has to be the parent.
3025       (while (and (setq data (cdr data))
3026                   (not (< (gnus-data-level (car data)) level))))
3027       (and data (gnus-data-number (car data))))))
3028
3029 (defun gnus-unread-mark-p (mark)
3030   "Say whether MARK is the unread mark."
3031   (= mark gnus-unread-mark))
3032
3033 (defun gnus-read-mark-p (mark)
3034   "Say whether MARK is one of the marks that mark as read.
3035 This is all marks except unread, ticked, dormant, and expirable."
3036   (not (or (= mark gnus-unread-mark)
3037            (= mark gnus-ticked-mark)
3038            (= mark gnus-spam-mark)
3039            (= mark gnus-dormant-mark)
3040            (= mark gnus-expirable-mark))))
3041
3042 (defmacro gnus-article-mark (number)
3043   "Return the MARK of article NUMBER.
3044 This macro should only be used when computing the mark the \"first\"
3045 time; i.e., when generating the summary lines.  After that,
3046 `gnus-summary-article-mark' should be used to examine the
3047 marks of articles."
3048   `(cond
3049     ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3050     ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3051     ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3052     ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3053     ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3054     ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3055     ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3056     (t (or (cdr (assq ,number gnus-newsgroup-reads))
3057            gnus-ancient-mark))))
3058
3059 ;; Saving hidden threads.
3060
3061 (defmacro gnus-save-hidden-threads (&rest forms)
3062   "Save hidden threads, eval FORMS, and restore the hidden threads."
3063   (let ((config (make-symbol "config")))
3064     `(let ((,config (gnus-hidden-threads-configuration)))
3065        (unwind-protect
3066            (save-excursion
3067              ,@forms)
3068          (gnus-restore-hidden-threads-configuration ,config)))))
3069 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3070 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3071
3072 (defun gnus-data-compute-positions ()
3073   "Compute the positions of all articles."
3074   (setq gnus-newsgroup-data-reverse nil)
3075   (let ((data gnus-newsgroup-data))
3076     (save-excursion
3077       (gnus-save-hidden-threads
3078         (gnus-summary-show-all-threads)
3079         (goto-char (point-min))
3080         (while data
3081           (while (get-text-property (point) 'gnus-intangible)
3082             (forward-line 1))
3083           (gnus-data-set-pos (car data) (+ (point) 3))
3084           (setq data (cdr data))
3085           (forward-line 1))))))
3086
3087 (defun gnus-hidden-threads-configuration ()
3088   "Return the current hidden threads configuration."
3089   (save-excursion
3090     (let (config)
3091       (goto-char (point-min))
3092       (while (search-forward "\r" nil t)
3093         (push (1- (point)) config))
3094       config)))
3095
3096 (defun gnus-restore-hidden-threads-configuration (config)
3097   "Restore hidden threads configuration from CONFIG."
3098   (save-excursion
3099     (let (point buffer-read-only)
3100       (while (setq point (pop config))
3101         (when (and (< point (point-max))
3102                    (goto-char point)
3103                    (eq (char-after) ?\n))
3104           (subst-char-in-region point (1+ point) ?\n ?\r))))))
3105
3106 ;; Various summary mode internalish functions.
3107
3108 (defun gnus-mouse-pick-article (e)
3109   (interactive "e")
3110   (mouse-set-point e)
3111   (gnus-summary-next-page nil t))
3112
3113 (defun gnus-summary-set-display-table ()
3114   "Change the display table.
3115 Odd characters have a tendency to mess
3116 up nicely formatted displays - we make all possible glyphs
3117 display only a single character."
3118
3119   ;; We start from the standard display table, if any.
3120   (let ((table (or (copy-sequence standard-display-table)
3121                    (make-display-table)))
3122         (i 32))
3123     ;; Nix out all the control chars...
3124     (while (>= (setq i (1- i)) 0)
3125       (aset table i [??]))
3126    ;; ... but not newline and cr, of course.  (cr is necessary for the
3127     ;; selective display).
3128     (aset table ?\n nil)
3129     (aset table ?\r nil)