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