Merge from emacs--devo--0
[gnus] / lisp / gnus-art.el
1 ;;; gnus-art.el --- article mode commands for Gnus
2
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;;   2005, 2006, 2007, 2008 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 of the License, or
14 ;; (at your option) 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.  If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Commentary:
25
26 ;;; Code:
27
28 ;; For Emacs < 22.2.
29 (eval-and-compile
30   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
31 (eval-when-compile
32   (require 'cl))
33 (defvar tool-bar-map)
34 (defvar w3m-minor-mode-map)
35
36 (require 'gnus)
37 ;; Avoid the "Recursive load suspected" error in Emacs 21.1.
38 (eval-and-compile
39   (let ((recursive-load-depth-limit 100))
40     (require 'gnus-sum)))
41 (require 'gnus-spec)
42 (require 'gnus-int)
43 (require 'gnus-win)
44 (require 'mm-bodies)
45 (require 'mail-parse)
46 (require 'mm-decode)
47 (require 'mm-view)
48 (require 'wid-edit)
49 (require 'mm-uu)
50 (require 'message)
51
52 (autoload 'gnus-msg-mail "gnus-msg" nil t)
53 (autoload 'gnus-button-mailto "gnus-msg")
54 (autoload 'gnus-button-reply "gnus-msg" nil t)
55 (autoload 'parse-time-string "parse-time" nil nil)
56 (autoload 'ansi-color-apply-on-region "ansi-color")
57 (autoload 'mm-url-insert-file-contents-external "mm-url")
58 (autoload 'mm-extern-cache-contents "mm-extern")
59
60 (defgroup gnus-article nil
61   "Article display."
62   :link '(custom-manual "(gnus)Article Buffer")
63   :group 'gnus)
64
65 (defgroup gnus-article-treat nil
66   "Treating article parts."
67   :link '(custom-manual "(gnus)Article Hiding")
68   :group 'gnus-article)
69
70 (defgroup gnus-article-hiding nil
71   "Hiding article parts."
72   :link '(custom-manual "(gnus)Article Hiding")
73   :group 'gnus-article)
74
75 (defgroup gnus-article-highlight nil
76   "Article highlighting."
77   :link '(custom-manual "(gnus)Article Highlighting")
78   :group 'gnus-article
79   :group 'gnus-visual)
80
81 (defgroup gnus-article-signature nil
82   "Article signatures."
83   :link '(custom-manual "(gnus)Article Signature")
84   :group 'gnus-article)
85
86 (defgroup gnus-article-headers nil
87   "Article headers."
88   :link '(custom-manual "(gnus)Hiding Headers")
89   :group 'gnus-article)
90
91 (defgroup gnus-article-washing nil
92   "Special commands on articles."
93   :link '(custom-manual "(gnus)Article Washing")
94   :group 'gnus-article)
95
96 (defgroup gnus-article-emphasis nil
97   "Fontisizing articles."
98   :link '(custom-manual "(gnus)Article Fontisizing")
99   :group 'gnus-article)
100
101 (defgroup gnus-article-saving nil
102   "Saving articles."
103   :link '(custom-manual "(gnus)Saving Articles")
104   :group 'gnus-article)
105
106 (defgroup gnus-article-mime nil
107   "Worshiping the MIME wonder."
108   :link '(custom-manual "(gnus)Using MIME")
109   :group 'gnus-article)
110
111 (defgroup gnus-article-buttons nil
112   "Pushable buttons in the article buffer."
113   :link '(custom-manual "(gnus)Article Buttons")
114   :group 'gnus-article)
115
116 (defgroup gnus-article-various nil
117   "Other article options."
118   :link '(custom-manual "(gnus)Misc Article")
119   :group 'gnus-article)
120
121 (defcustom gnus-ignored-headers
122   (mapcar
123    (lambda (header)
124      (concat "^" header ":"))
125    '("Path" "Expires" "Date-Received" "References" "Xref" "Lines"
126      "Relay-Version" "Message-ID" "Approved" "Sender" "Received"
127      "X-UIDL" "MIME-Version" "Return-Path" "In-Reply-To"
128      "Content-Type" "Content-Transfer-Encoding" "X-WebTV-Signature"
129      "X-MimeOLE" "X-MSMail-Priority" "X-Priority" "X-Loop"
130      "X-Authentication-Warning" "X-MIME-Autoconverted" "X-Face"
131      "X-Attribution" "X-Originating-IP" "Delivered-To"
132      "NNTP-[-A-Za-z]+" "Distribution" "X-no-archive" "X-Trace"
133      "X-Complaints-To" "X-NNTP-Posting-Host" "X-Orig.*"
134      "Abuse-Reports-To" "Cache-Post-Path" "X-Article-Creation-Date"
135      "X-Poster" "X-Mail2News-Path" "X-Server-Date" "X-Cache"
136      "Originator" "X-Problems-To" "X-Auth-User" "X-Post-Time"
137      "X-Admin" "X-UID" "Resent-[-A-Za-z]+" "X-Mailing-List"
138      "Precedence" "Original-[-A-Za-z]+" "X-filename" "X-Orcpt"
139      "Old-Received" "X-Pgp" "X-Auth" "X-From-Line"
140      "X-Gnus-Article-Number" "X-Majordomo" "X-Url" "X-Sender"
141      "MBOX-Line" "Priority" "X400-[-A-Za-z]+"
142      "Status" "X-Gnus-Mail-Source" "Cancel-Lock"
143      "X-FTN" "X-EXP32-SerialNo" "Encoding" "Importance"
144      "Autoforwarded" "Original-Encoded-Information-Types" "X-Ya-Pop3"
145      "X-Face-Version" "X-Vms-To" "X-ML-NAME" "X-ML-COUNT"
146      "Mailing-List" "X-finfo" "X-md5sum" "X-md5sum-Origin"
147      "X-Sun-Charset" "X-Accept-Language" "X-Envelope-Sender"
148      "List-[A-Za-z]+" "X-Listprocessor-Version"
149      "X-Received" "X-Distribute" "X-Sequence" "X-Juno-Line-Breaks"
150      "X-Notes-Item" "X-MS-TNEF-Correlator" "x-uunet-gateway"
151      "X-Received" "Content-length" "X-precedence"
152      "X-Authenticated-User" "X-Comment" "X-Report" "X-Abuse-Info"
153      "X-HTTP-Proxy" "X-Mydeja-Info" "X-Copyright" "X-No-Markup"
154      "X-Abuse-Info" "X-From_" "X-Accept-Language" "Errors-To"
155      "X-BeenThere" "X-Mailman-Version" "List-Help" "List-Post"
156      "List-Subscribe" "List-Id" "List-Unsubscribe" "List-Archive"
157      "X-Content-length" "X-Posting-Agent" "Original-Received"
158      "X-Request-PGP" "X-Fingerprint" "X-WRIEnvto" "X-WRIEnvfrom"
159      "X-Virus-Scanned" "X-Delivery-Agent" "Posted-Date" "X-Gateway"
160      "X-Local-Origin" "X-Local-Destination" "X-UserInfo1"
161      "X-Received-Date" "X-Hashcash" "Face" "X-DMCA-Notifications"
162      "X-Abuse-and-DMCA-Info" "X-Postfilter" "X-Gpg-.*" "X-Disclaimer"
163      "Envelope-To" "X-Spam-Score" "System-Type" "X-Injected-Via-Gmane"
164      "X-Gmane-NNTP-Posting-Host" "Jabber-ID" "Archived-At"
165      "Envelope-Sender" "Envelope-Recipients"))
166   "*All headers that start with this regexp will be hidden.
167 This variable can also be a list of regexps of headers to be ignored.
168 If `gnus-visible-headers' is non-nil, this variable will be ignored."
169   :type '(choice :custom-show nil
170                  regexp
171                  (repeat regexp))
172   :group 'gnus-article-hiding)
173
174 (defcustom gnus-visible-headers
175   "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^[BGF]?Cc:\\|^Posted-To:\\|^Mail-Copies-To:\\|^Mail-Followup-To:\\|^Apparently-To:\\|^Gnus-Warning:\\|^Resent-From:\\|^X-Sent:"
176   "*All headers that do not match this regexp will be hidden.
177 This variable can also be a list of regexp of headers to remain visible.
178 If this variable is non-nil, `gnus-ignored-headers' will be ignored."
179   :type '(choice
180           (repeat :value-to-internal (lambda (widget value)
181                                        (custom-split-regexp-maybe value))
182                   :match (lambda (widget value)
183                            (or (stringp value)
184                                (widget-editable-list-match widget value)))
185                   regexp)
186           (const :tag "Use gnus-ignored-headers" nil)
187           regexp)
188   :group 'gnus-article-hiding)
189
190 (defcustom gnus-sorted-header-list
191   '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:"
192     "^Followup-To:" "^To:" "^Cc:" "^Date:" "^Organization:")
193   "*This variable is a list of regular expressions.
194 If it is non-nil, headers that match the regular expressions will
195 be placed first in the article buffer in the sequence specified by
196 this list."
197   :type '(repeat regexp)
198   :group 'gnus-article-hiding)
199
200 (defcustom gnus-boring-article-headers '(empty followup-to reply-to)
201   "Headers that are only to be displayed if they have interesting data.
202 Possible values in this list are:
203
204   'empty       Headers with no content.
205   'newsgroups  Newsgroup identical to Gnus group.
206   'to-address  To identical to To-address.
207   'to-list     To identical to To-list.
208   'cc-list     CC identical to To-list.
209   'followup-to Followup-to identical to Newsgroups.
210   'reply-to    Reply-to identical to From.
211   'date        Date less than four days old.
212   'long-to     To and/or Cc longer than 1024 characters.
213   'many-to     Multiple To and/or Cc."
214   :type '(set (const :tag "Headers with no content." empty)
215               (const :tag "Newsgroups identical to Gnus group." newsgroups)
216               (const :tag "To identical to To-address." to-address)
217               (const :tag "To identical to To-list." to-list)
218               (const :tag "CC identical to To-list." cc-list)
219               (const :tag "Followup-to identical to Newsgroups." followup-to)
220               (const :tag "Reply-to identical to From." reply-to)
221               (const :tag "Date less than four days old." date)
222               (const :tag "To and/or Cc longer than 1024 characters." long-to)
223               (const :tag "Multiple To and/or Cc headers." many-to))
224   :group 'gnus-article-hiding)
225
226 (defcustom gnus-article-skip-boring nil
227   "Skip over text that is not worth reading.
228 By default, if you set this t, then Gnus will display citations and
229 signatures, but will never scroll down to show you a page consisting
230 only of boring text.  Boring text is controlled by
231 `gnus-article-boring-faces'."
232   :version "22.1"
233   :type 'boolean
234   :group 'gnus-article-hiding)
235
236 (defcustom gnus-signature-separator '("^-- $" "^-- *$")
237   "Regexp matching signature separator.
238 This can also be a list of regexps.  In that case, it will be checked
239 from head to tail looking for a separator.  Searches will be done from
240 the end of the buffer."
241   :type '(choice :format "%{%t%}: %[Value Menu%]\n%v"
242                  (regexp)
243                  (repeat :tag "List of regexp" regexp))
244   :group 'gnus-article-signature)
245
246 (defcustom gnus-signature-limit nil
247   "Provide a limit to what is considered a signature.
248 If it is a number, no signature may not be longer (in characters) than
249 that number.  If it is a floating point number, no signature may be
250 longer (in lines) than that number.  If it is a function, the function
251 will be called without any parameters, and if it returns nil, there is
252 no signature in the buffer.  If it is a string, it will be used as a
253 regexp.  If it matches, the text in question is not a signature.
254
255 This can also be a list of the above values."
256   :type '(choice (const nil)
257                  (integer :value 200)
258                  (number :value 4.0)
259                  function
260                  (regexp :value ".*"))
261   :group 'gnus-article-signature)
262
263 (defcustom gnus-hidden-properties '(invisible t intangible t)
264   "Property list to use for hiding text."
265   :type 'sexp
266   :group 'gnus-article-hiding)
267
268 ;; Fixme: This isn't the right thing for mixed graphical and non-graphical
269 ;; frames in a session.
270 (defcustom gnus-article-x-face-command
271   (if (featurep 'xemacs)
272       (if (or (gnus-image-type-available-p 'xface)
273               (gnus-image-type-available-p 'pbm))
274           'gnus-display-x-face-in-from
275         "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | ee -")
276     (if (gnus-image-type-available-p 'pbm)
277         'gnus-display-x-face-in-from
278       "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | \
279 display -"))
280   "*String or function to be executed to display an X-Face header.
281 If it is a string, the command will be executed in a sub-shell
282 asynchronously.  The compressed face will be piped to this command."
283   :type `(choice string
284                  (function-item gnus-display-x-face-in-from)
285                  function)
286   :version "21.1"
287   :group 'gnus-picon
288   :group 'gnus-article-washing)
289
290 (defcustom gnus-article-x-face-too-ugly nil
291   "Regexp matching posters whose face shouldn't be shown automatically."
292   :type '(choice regexp (const nil))
293   :group 'gnus-article-washing)
294
295 (defcustom gnus-article-banner-alist nil
296   "Banner alist for stripping.
297 For example,
298      ((egroups . \"^[ \\t\\n]*-------------------+\\\\( \\\\(e\\\\|Yahoo! \\\\)Groups Sponsor -+\\\\)?....\\n\\\\(.+\\n\\\\)+\"))"
299   :version "21.1"
300   :type '(repeat (cons symbol regexp))
301   :group 'gnus-article-washing)
302
303 (gnus-define-group-parameter
304  banner
305  :variable-document
306  "Alist of regexps (to match group names) and banner."
307  :variable-group gnus-article-washing
308  :parameter-type
309  '(choice :tag "Banner"
310           :value nil
311           (const :tag "Remove signature" signature)
312           (symbol :tag "Item in `gnus-article-banner-alist'" none)
313           regexp
314           (const :tag "None" nil))
315  :parameter-document
316  "If non-nil, specify how to remove `banners' from articles.
317
318 Symbol `signature' means to remove signatures delimited by
319 `gnus-signature-separator'.  Any other symbol is used to look up a
320 regular expression to match the banner in `gnus-article-banner-alist'.
321 A string is used as a regular expression to match the banner
322 directly.")
323
324 (defcustom gnus-article-address-banner-alist nil
325   "Alist of mail addresses and banners.
326 Each element has the form (ADDRESS . BANNER), where ADDRESS is a regexp
327 to match a mail address in the From: header, BANNER is one of a symbol
328 `signature', an item in `gnus-article-banner-alist', a regexp and nil.
329 If ADDRESS matches author's mail address, it will remove things like
330 advertisements.  For example:
331
332 \((\"@yoo-hoo\\\\.co\\\\.jp\\\\'\" . \"\\n_+\\nDo You Yoo-hoo!\\\\?\\n.*\\n.*\\n\"))
333 "
334   :type '(repeat
335           (cons
336            (regexp :tag "Address")
337            (choice :tag "Banner" :value nil
338                    (const :tag "Remove signature" signature)
339                    (symbol :tag "Item in `gnus-article-banner-alist'" none)
340                    regexp
341                    (const :tag "None" nil))))
342   :version "22.1"
343   :group 'gnus-article-washing)
344
345 (defmacro gnus-emphasis-custom-with-format (&rest body)
346   `(let ((format "\
347 \\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\
348 \\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)"))
349      ,@body))
350
351 (defun gnus-emphasis-custom-value-to-external (value)
352   (gnus-emphasis-custom-with-format
353    (if (consp (car value))
354        (list (format format (car (car value)) (cdr (car value)))
355              2
356              (if (nth 1 value) 2 3)
357              (nth 2 value))
358      value)))
359
360 (defun gnus-emphasis-custom-value-to-internal (value)
361   (gnus-emphasis-custom-with-format
362    (let ((regexp (concat "\\`"
363                          (format (regexp-quote format)
364                                  "\\([^()]+\\)" "\\([^()]+\\)")
365                          "\\'"))
366          pattern)
367      (if (string-match regexp (setq pattern (car value)))
368          (list (cons (match-string 1 pattern) (match-string 2 pattern))
369                (= (nth 2 value) 2)
370                (nth 3 value))
371        value))))
372
373 (defcustom gnus-emphasis-alist
374   (let ((types
375          '(("\\*" "\\*" bold nil 2)
376            ("_" "_" underline)
377            ("/" "/" italic)
378            ("_/" "/_" underline-italic)
379            ("_\\*" "\\*_" underline-bold)
380            ("\\*/" "/\\*" bold-italic)
381            ("_\\*/" "/\\*_" underline-bold-italic))))
382     (nconc
383      (gnus-emphasis-custom-with-format
384       (mapcar (lambda (spec)
385                 (list (format format (car spec) (cadr spec))
386                       (or (nth 3 spec) 2)
387                       (or (nth 4 spec) 3)
388                       (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
389               types))
390      '(;; I've never seen anyone use this strikethru convention whereas I've
391        ;; several times seen it triggered by normal text.  --Stef
392        ;; Miles suggests that this form is sometimes used but for italics,
393        ;; so maybe we should map it to `italic'.
394        ;; ("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)"
395        ;; 2 3 gnus-emphasis-strikethru)
396        ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
397         2 3 gnus-emphasis-underline))))
398   "*Alist that says how to fontify certain phrases.
399 Each item looks like this:
400
401   (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
402
403 The first element is a regular expression to be matched.  The second
404 is a number that says what regular expression grouping used to find
405 the entire emphasized word.  The third is a number that says what
406 regexp grouping should be displayed and highlighted.  The fourth
407 is the face used for highlighting."
408   :type
409   '(repeat
410     (menu-choice
411      :format "%[Customizing Style%]\n%v"
412      :indent 2
413      (group :tag "Default"
414             :value ("" 0 0 default)
415             :value-create
416             (lambda (widget)
417               (let ((value (widget-get
418                             (cadr (widget-get (widget-get widget :parent)
419                                               :args))
420                             :value)))
421                 (if (not (eq (nth 2 value) 'default))
422                     (widget-put
423                      widget
424                      :value
425                      (gnus-emphasis-custom-value-to-external value))))
426               (widget-group-value-create widget))
427             regexp
428             (integer :format "Match group: %v")
429             (integer :format "Emphasize group: %v")
430             face)
431      (group :tag "Simple"
432             :value (("_" . "_") nil default)
433             (cons :format "%v"
434                   (regexp :format "Start regexp: %v")
435                   (regexp :format "End regexp: %v"))
436             (boolean :format "Show start and end patterns: %[%v%]\n"
437                      :on " On " :off " Off ")
438             face)))
439   :get (lambda (symbol)
440          (mapcar 'gnus-emphasis-custom-value-to-internal
441                  (default-value symbol)))
442   :set (lambda (symbol value)
443          (set-default symbol (mapcar 'gnus-emphasis-custom-value-to-external
444                                      value)))
445   :group 'gnus-article-emphasis)
446
447 (defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
448   "A regexp to describe whitespace which should not be emphasized.
449 Typical values are \"^[ \\t]+\\\\|[ \\t]*\\n\" and \"[ \\t]+\\\\|[ \\t]*\\n\".
450 The former avoids underlining of leading and trailing whitespace,
451 and the latter avoids underlining any whitespace at all."
452   :version "21.1"
453   :group 'gnus-article-emphasis
454   :type 'regexp)
455
456 (defface gnus-emphasis-bold '((t (:bold t)))
457   "Face used for displaying strong emphasized text (*word*)."
458   :group 'gnus-article-emphasis)
459
460 (defface gnus-emphasis-italic '((t (:italic t)))
461   "Face used for displaying italic emphasized text (/word/)."
462   :group 'gnus-article-emphasis)
463
464 (defface gnus-emphasis-underline '((t (:underline t)))
465   "Face used for displaying underlined emphasized text (_word_)."
466   :group 'gnus-article-emphasis)
467
468 (defface gnus-emphasis-underline-bold '((t (:bold t :underline t)))
469   "Face used for displaying underlined bold emphasized text (_*word*_)."
470   :group 'gnus-article-emphasis)
471
472 (defface gnus-emphasis-underline-italic '((t (:italic t :underline t)))
473   "Face used for displaying underlined italic emphasized text (_/word/_)."
474   :group 'gnus-article-emphasis)
475
476 (defface gnus-emphasis-bold-italic '((t (:bold t :italic t)))
477   "Face used for displaying bold italic emphasized text (/*word*/)."
478   :group 'gnus-article-emphasis)
479
480 (defface gnus-emphasis-underline-bold-italic
481   '((t (:bold t :italic t :underline t)))
482   "Face used for displaying underlined bold italic emphasized text.
483 Example: (_/*word*/_)."
484   :group 'gnus-article-emphasis)
485
486 (defface gnus-emphasis-strikethru (if (featurep 'xemacs)
487                                       '((t (:strikethru t)))
488                                     '((t (:strike-through t))))
489   "Face used for displaying strike-through text (-word-)."
490   :group 'gnus-article-emphasis)
491
492 (defface gnus-emphasis-highlight-words
493   '((t (:background "black" :foreground "yellow")))
494   "Face used for displaying highlighted words."
495   :group 'gnus-article-emphasis)
496
497 (defcustom gnus-article-time-format "%a, %d %b %Y %T %Z"
498   "Format for display of Date headers in article bodies.
499 See `format-time-string' for the possible values.
500
501 The variable can also be function, which should return a complete Date
502 header.  The function is called with one argument, the time, which can
503 be fed to `format-time-string'."
504   :type '(choice string function)
505   :link '(custom-manual "(gnus)Article Date")
506   :group 'gnus-article-washing)
507
508 (defcustom gnus-save-all-headers t
509   "*If non-nil, don't remove any headers before saving.
510 This will be overridden by the `:headers' property that the symbol of
511 the saver function, which is specified by `gnus-default-article-saver',
512 might have."
513   :group 'gnus-article-saving
514   :type 'boolean)
515
516 (defcustom gnus-prompt-before-saving 'always
517   "*This variable says how much prompting is to be done when saving articles.
518 If it is nil, no prompting will be done, and the articles will be
519 saved to the default files.  If this variable is `always', each and
520 every article that is saved will be preceded by a prompt, even when
521 saving large batches of articles.  If this variable is neither nil not
522 `always', there the user will be prompted once for a file name for
523 each invocation of the saving commands."
524   :group 'gnus-article-saving
525   :type '(choice (item always)
526                  (item :tag "never" nil)
527                  (sexp :tag "once" :format "%t\n" :value t)))
528
529 (defcustom gnus-saved-headers gnus-visible-headers
530   "Headers to keep if `gnus-save-all-headers' is nil.
531 If `gnus-save-all-headers' is non-nil, this variable will be ignored.
532 If that variable is nil, however, all headers that match this regexp
533 will be kept while the rest will be deleted before saving.  This and
534 `gnus-save-all-headers' will be overridden by the `:headers' property
535 that the symbol of the saver function, which is specified by
536 `gnus-default-article-saver', might have."
537   :group 'gnus-article-saving
538   :type 'regexp)
539
540 (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail
541   "A function to save articles in your favourite format.
542 The function will be called by way of the `gnus-summary-save-article'
543 command, and friends such as `gnus-summary-save-article-rmail'.
544
545 Gnus provides the following functions:
546
547 * gnus-summary-save-in-rmail (Rmail format)
548 * gnus-summary-save-in-mail (Unix mail format)
549 * gnus-summary-save-in-folder (MH folder)
550 * gnus-summary-save-in-file (article format)
551 * gnus-summary-save-body-in-file (article body)
552 * gnus-summary-save-in-vm (use VM's folder format)
553 * gnus-summary-write-to-file (article format -- overwrite)
554 * gnus-summary-write-body-to-file (article body -- overwrite)
555
556 The symbol of each function may have the following properties:
557
558 * :decode
559 The value non-nil means save decoded articles.  This is meaningful
560 only with `gnus-summary-save-in-file', `gnus-summary-save-body-in-file',
561 `gnus-summary-write-to-file', and `gnus-summary-write-body-to-file'.
562
563 * :function
564 The value specifies an alternative function which appends, not
565 overwrites, articles to a file.  This implies that when saving many
566 articles at a time, `gnus-prompt-before-saving' is bound to t and all
567 articles are saved in a single file.  This is meaningful only with
568 `gnus-summary-write-to-file' and `gnus-summary-write-body-to-file'.
569
570 * :headers
571 The value specifies the symbol of a variable of which the value
572 specifies headers to be saved.  If it is omitted,
573 `gnus-save-all-headers' and `gnus-saved-headers' control what
574 headers should be saved."
575   :group 'gnus-article-saving
576   :type '(radio (function-item gnus-summary-save-in-rmail)
577                 (function-item gnus-summary-save-in-mail)
578                 (function-item gnus-summary-save-in-folder)
579                 (function-item gnus-summary-save-in-file)
580                 (function-item gnus-summary-save-body-in-file)
581                 (function-item gnus-summary-save-in-vm)
582                 (function-item gnus-summary-write-to-file)
583                 (function-item gnus-summary-write-body-to-file)
584                 (function)))
585
586 (defcustom gnus-article-save-coding-system
587   (or (and (mm-coding-system-p 'utf-8) 'utf-8)
588       (and (mm-coding-system-p 'iso-2022-7bit) 'iso-2022-7bit)
589       (and (mm-coding-system-p 'emacs-mule) 'emacs-mule)
590       (and (mm-coding-system-p 'escape-quoted) 'escape-quoted))
591   "Coding system used to save decoded articles to a file.
592
593 The recommended coding systems are `utf-8', `iso-2022-7bit' and so on,
594 which can safely encode any characters in text.  This is used by the
595 commands including:
596
597 * gnus-summary-save-article-file
598 * gnus-summary-save-article-body-file
599 * gnus-summary-write-article-file
600 * gnus-summary-write-article-body-file
601
602 and the functions to which you may set `gnus-default-article-saver':
603
604 * gnus-summary-save-in-file
605 * gnus-summary-save-body-in-file
606 * gnus-summary-write-to-file
607 * gnus-summary-write-body-to-file
608
609 Those commands and functions save just text displayed in the article
610 buffer to a file if the value of this variable is non-nil.  Note that
611 buttonized MIME parts will be lost in a saved file in that case.
612 Otherwise, raw articles will be saved."
613   :group 'gnus-article-saving
614   :type `(choice
615           :format "%{%t%}:\n %[Value Menu%] %v"
616           (const :tag "Save raw articles" nil)
617           ,@(delq nil
618                   (mapcar
619                    (lambda (arg) (if (mm-coding-system-p (nth 3 arg)) arg))
620                    '((const :tag "UTF-8" utf-8)
621                      (const :tag "iso-2022-7bit" iso-2022-7bit)
622                      (const :tag "Emacs internal" emacs-mule)
623                      (const :tag "escape-quoted" escape-quoted))))
624           (symbol :tag "Coding system")))
625
626 (defcustom gnus-rmail-save-name 'gnus-plain-save-name
627   "A function generating a file name to save articles in Rmail format.
628 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
629   :group 'gnus-article-saving
630   :type 'function)
631
632 (defcustom gnus-mail-save-name 'gnus-plain-save-name
633   "A function generating a file name to save articles in Unix mail format.
634 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
635   :group 'gnus-article-saving
636   :type 'function)
637
638 (defcustom gnus-folder-save-name 'gnus-folder-save-name
639   "A function generating a file name to save articles in MH folder.
640 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER."
641   :group 'gnus-article-saving
642   :type 'function)
643
644 (defcustom gnus-file-save-name 'gnus-numeric-save-name
645   "A function generating a file name to save articles in article format.
646 The function is called with NEWSGROUP, HEADERS, and optional
647 LAST-FILE."
648   :group 'gnus-article-saving
649   :type 'function)
650
651 (defcustom gnus-split-methods
652   '((gnus-article-archive-name)
653     (gnus-article-nndoc-name))
654   "*Variable used to suggest where articles are to be saved.
655 For instance, if you would like to save articles related to Gnus in
656 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
657 you could set this variable to something like:
658
659  '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
660    (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))
661
662 This variable is an alist where the key is the match and the
663 value is a list of possible files to save in if the match is
664 non-nil.
665
666 If the match is a string, it is used as a regexp match on the
667 article.  If the match is a symbol, that symbol will be funcalled
668 from the buffer of the article to be saved with the newsgroup as the
669 parameter.  If it is a list, it will be evaled in the same buffer.
670
671 If this form or function returns a string, this string will be used as a
672 possible file name; and if it returns a non-nil list, that list will be
673 used as possible file names."
674   :group 'gnus-article-saving
675   :type '(repeat (choice (list :value (fun) function)
676                          (cons :value ("" "") regexp (repeat string))
677                          (sexp :value nil))))
678
679 (defcustom gnus-page-delimiter "^\^L"
680   "*Regexp describing what to use as article page delimiters.
681 The default value is \"^\^L\", which is a form linefeed at the
682 beginning of a line."
683   :type 'regexp
684   :group 'gnus-article-various)
685
686 (defcustom gnus-article-mode-line-format "Gnus: %g [%w] %S%m"
687   "*The format specification for the article mode line.
688 See `gnus-summary-mode-line-format' for a closer description.
689
690 The following additional specs are available:
691
692 %w  The article washing status.
693 %m  The number of MIME parts in the article."
694   :type 'string
695   :group 'gnus-article-various)
696
697 (defcustom gnus-article-mode-hook nil
698   "*A hook for Gnus article mode."
699   :type 'hook
700   :group 'gnus-article-various)
701
702 (when (featurep 'xemacs)
703   ;; Extracted from gnus-xmas-define in order to preserve user settings
704   (when (fboundp 'turn-off-scroll-in-place)
705     (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
706   ;; Extracted from gnus-xmas-redefine in order to preserve user settings
707   (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add))
708
709 (defcustom gnus-article-menu-hook nil
710   "*Hook run after the creation of the article mode menu."
711   :type 'hook
712   :group 'gnus-article-various)
713
714 (defcustom gnus-article-prepare-hook nil
715   "*A hook called after an article has been prepared in the article buffer."
716   :type 'hook
717   :group 'gnus-article-various)
718
719 (defcustom gnus-copy-article-ignored-headers nil
720   "List of headers to be removed when copying an article.
721 Each element is a regular expression."
722   :version "23.1" ;; No Gnus
723   :type '(repeat regexp)
724   :group 'gnus-article-various)
725
726 (make-obsolete-variable 'gnus-article-hide-pgp-hook
727                         "This variable is obsolete in Gnus 5.10.")
728
729 (defface gnus-button
730   '((t (:weight bold)))
731   "Face used for highlighting a button in the article buffer."
732   :group 'gnus-article-buttons)
733
734 (defcustom gnus-article-button-face 'gnus-button
735   "Face used for highlighting buttons in the article buffer.
736
737 An article button is a piece of text that you can activate by pressing
738 `RET' or `mouse-2' above it."
739   :type 'face
740   :group 'gnus-article-buttons)
741
742 (defcustom gnus-article-mouse-face 'highlight
743   "Face used for mouse highlighting in the article buffer.
744
745 Article buttons will be displayed in this face when the cursor is
746 above them."
747   :type 'face
748   :group 'gnus-article-buttons)
749
750 (defcustom gnus-signature-face 'gnus-signature
751   "Face used for highlighting a signature in the article buffer.
752 Obsolete; use the face `gnus-signature' for customizations instead."
753   :type 'face
754   :group 'gnus-article-highlight
755   :group 'gnus-article-signature)
756
757 (defface gnus-signature
758   '((t
759      (:italic t)))
760   "Face used for highlighting a signature in the article buffer."
761   :group 'gnus-article-highlight
762   :group 'gnus-article-signature)
763 ;; backward-compatibility alias
764 (put 'gnus-signature-face 'face-alias 'gnus-signature)
765
766 (defface gnus-header-from
767   '((((class color)
768       (background dark))
769      (:foreground "PaleGreen1"))
770     (((class color)
771       (background light))
772      (:foreground "red3"))
773     (t
774      (:italic t)))
775   "Face used for displaying from headers."
776   :group 'gnus-article-headers
777   :group 'gnus-article-highlight)
778 ;; backward-compatibility alias
779 (put 'gnus-header-from-face 'face-alias 'gnus-header-from)
780
781 (defface gnus-header-subject
782   '((((class color)
783       (background dark))
784      (:foreground "SeaGreen1"))
785     (((class color)
786       (background light))
787      (:foreground "red4"))
788     (t
789      (:bold t :italic t)))
790   "Face used for displaying subject headers."
791   :group 'gnus-article-headers
792   :group 'gnus-article-highlight)
793 ;; backward-compatibility alias
794 (put 'gnus-header-subject-face 'face-alias 'gnus-header-subject)
795
796 (defface gnus-header-newsgroups
797   '((((class color)
798       (background dark))
799      (:foreground "yellow" :italic t))
800     (((class color)
801       (background light))
802      (:foreground "MidnightBlue" :italic t))
803     (t
804      (:italic t)))
805   "Face used for displaying newsgroups headers.
806 In the default setup this face is only used for crossposted
807 articles."
808   :group 'gnus-article-headers
809   :group 'gnus-article-highlight)
810 ;; backward-compatibility alias
811 (put 'gnus-header-newsgroups-face 'face-alias 'gnus-header-newsgroups)
812
813 (defface gnus-header-name
814   '((((class color)
815       (background dark))
816      (:foreground "SpringGreen2"))
817     (((class color)
818       (background light))
819      (:foreground "maroon"))
820     (t
821      (:bold t)))
822   "Face used for displaying header names."
823   :group 'gnus-article-headers
824   :group 'gnus-article-highlight)
825 ;; backward-compatibility alias
826 (put 'gnus-header-name-face 'face-alias 'gnus-header-name)
827
828 (defface gnus-header-content
829   '((((class color)
830       (background dark))
831      (:foreground "SpringGreen1" :italic t))
832     (((class color)
833       (background light))
834      (:foreground "indianred4" :italic t))
835     (t
836      (:italic t)))  "Face used for displaying header content."
837   :group 'gnus-article-headers
838   :group 'gnus-article-highlight)
839 ;; backward-compatibility alias
840 (put 'gnus-header-content-face 'face-alias 'gnus-header-content)
841
842 (defcustom gnus-header-face-alist
843   '(("From" nil gnus-header-from)
844     ("Subject" nil gnus-header-subject)
845     ("Newsgroups:.*," nil gnus-header-newsgroups)
846     ("" gnus-header-name gnus-header-content))
847   "*Controls highlighting of article headers.
848
849 An alist of the form (HEADER NAME CONTENT).
850
851 HEADER is a regular expression which should match the name of a
852 header and NAME and CONTENT are either face names or nil.
853
854 The name of each header field will be displayed using the face
855 specified by the first element in the list where HEADER matches
856 the header name and NAME is non-nil.  Similarly, the content will
857 be displayed by the first non-nil matching CONTENT face."
858   :group 'gnus-article-headers
859   :group 'gnus-article-highlight
860   :type '(repeat (list (regexp :tag "Header")
861                        (choice :tag "Name"
862                                (item :tag "skip" nil)
863                                (face :value default))
864                        (choice :tag "Content"
865                                (item :tag "skip" nil)
866                                (face :value default)))))
867
868 (defcustom gnus-face-properties-alist (if (featurep 'xemacs)
869                                           '((xface . (:face gnus-x-face)))
870                                         '((pbm . (:face gnus-x-face))
871                                           (png . nil)))
872   "Alist of image types and properties applied to Face and X-Face images.
873 Here are examples:
874
875 ;; Specify the altitude of Face images in the From header.
876 \(setq gnus-face-properties-alist
877       '((pbm . (:face gnus-x-face :ascent 80))
878         (png . (:ascent 80))))
879
880 ;; Show Face images as pressed buttons.
881 \(setq gnus-face-properties-alist
882       '((pbm . (:face gnus-x-face :relief -2))
883         (png . (:relief -2))))
884
885 See the manual for the valid properties for various image types.
886 Currently, `pbm' is used for X-Face images and `png' is used for Face
887 images in Emacs.  Only the `:face' property is effective on the `xface'
888 image type in XEmacs if it is built with the libcompface library."
889   :version "23.1" ;; No Gnus
890   :group 'gnus-article-headers
891   :type '(repeat (cons :format "%v" (symbol :tag "Image type") plist)))
892
893 (defcustom gnus-article-decode-hook
894   '(article-decode-charset article-decode-encoded-words
895                            article-decode-group-name article-decode-idna-rhs)
896   "*Hook run to decode charsets in articles."
897   :group 'gnus-article-headers
898   :type 'hook)
899
900 (defcustom gnus-display-mime-function 'gnus-display-mime
901   "Function to display MIME articles."
902   :group 'gnus-article-mime
903   :type 'function)
904
905 (defvar gnus-decode-header-function 'mail-decode-encoded-word-region
906   "Function used to decode headers.")
907
908 (defvar gnus-decode-address-function 'mail-decode-encoded-address-region
909   "Function used to decode addresses.")
910
911 (defvar gnus-article-dumbquotes-map
912   '(("\200" "EUR")
913     ("\202" ",")
914     ("\203" "f")
915     ("\204" ",,")
916     ("\205" "...")
917     ("\213" "<")
918     ("\214" "OE")
919     ("\221" "`")
920     ("\222" "'")
921     ("\223" "``")
922     ("\224" "\"")
923     ("\225" "*")
924     ("\226" "-")
925     ("\227" "--")
926     ("\230" "~")
927     ("\231" "(TM)")
928     ("\233" ">")
929     ("\234" "oe")
930     ("\264" "'"))
931   "Table for MS-to-Latin1 translation.")
932
933 (defcustom gnus-ignored-mime-types nil
934   "List of MIME types that should be ignored by Gnus."
935   :version "21.1"
936   :group 'gnus-article-mime
937   :type '(repeat regexp))
938
939 (defcustom gnus-unbuttonized-mime-types '(".*/.*")
940   "List of MIME types that should not be given buttons when rendered inline.
941 See also `gnus-buttonized-mime-types' which may override this variable.
942 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
943   :version "21.1"
944   :group 'gnus-article-mime
945   :type '(repeat regexp))
946
947 (defcustom gnus-buttonized-mime-types nil
948   "List of MIME types that should be given buttons when rendered inline.
949 If set, this variable overrides `gnus-unbuttonized-mime-types'.
950 To see e.g. security buttons you could set this to
951 `(\"multipart/signed\")'.  You could also add \"multipart/alternative\" to
952 this list to display radio buttons that allow you to choose one of two
953 media types those mails include.  See also `mm-discouraged-alternatives'.
954 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
955   :version "22.1"
956   :group 'gnus-article-mime
957   :type '(repeat regexp))
958
959 (defcustom gnus-inhibit-mime-unbuttonizing nil
960   "If non-nil, all MIME parts get buttons.
961 When nil (the default value), then some MIME parts do not get buttons,
962 as described by the variables `gnus-buttonized-mime-types' and
963 `gnus-unbuttonized-mime-types'."
964   :version "22.1"
965   :group 'gnus-article-mime
966   :type 'boolean)
967
968 (defcustom gnus-body-boundary-delimiter "_"
969   "String used to delimit header and body.
970 This variable is used by `gnus-article-treat-body-boundary' which can
971 be controlled by `gnus-treat-body-boundary'."
972   :version "22.1"
973   :group 'gnus-article-various
974   :type '(choice (item :tag "None" :value nil)
975                  string))
976
977 (defcustom gnus-picon-databases '("/usr/lib/picon" "/usr/local/faces"
978                                   "/usr/share/picons")
979   "Defines the location of the faces database.
980 For information on obtaining this database of pretty pictures, please
981 see http://www.cs.indiana.edu/picons/ftp/index.html"
982   :version "22.1"
983   :type '(repeat directory)
984   :link '(url-link :tag "download"
985                    "http://www.cs.indiana.edu/picons/ftp/index.html")
986   :link '(custom-manual "(gnus)Picons")
987   :group 'gnus-picon)
988
989 (defun gnus-picons-installed-p ()
990   "Say whether picons are installed on your machine."
991   (let ((installed nil))
992     (dolist (database gnus-picon-databases)
993       (when (file-exists-p database)
994         (setq installed t)))
995     installed))
996
997 (defcustom gnus-article-mime-part-function nil
998   "Function called with a MIME handle as the argument.
999 This is meant for people who want to do something automatic based
1000 on parts -- for instance, adding Vcard info to a database."
1001   :group 'gnus-article-mime
1002   :type '(choice (const nil)
1003                  function))
1004
1005 (defcustom gnus-mime-multipart-functions nil
1006   "An alist of MIME types to functions to display them."
1007   :version "21.1"
1008   :group 'gnus-article-mime
1009   :type '(repeat (cons :format "%v" (string :tag "MIME type") function)))
1010
1011 (defcustom gnus-article-date-lapsed-new-header nil
1012   "Whether the X-Sent and Date headers can coexist.
1013 When using `gnus-treat-date-lapsed', the \"X-Sent:\" header will
1014 either replace the old \"Date:\" header (if this variable is nil), or
1015 be added below it (otherwise)."
1016   :version "21.1"
1017   :group 'gnus-article-headers
1018   :type 'boolean)
1019
1020 (defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative
1021   "Function called with a MIME handle as the argument.
1022 This is meant for people who want to view first matched part.
1023 For `undisplayed-alternative' (default), the first undisplayed
1024 part or alternative part is used.  For `undisplayed', the first
1025 undisplayed part is used.  For a function, the first part which
1026 the function return t is used.  For nil, the first part is
1027 used."
1028   :version "21.1"
1029   :group 'gnus-article-mime
1030   :type '(choice
1031           (item :tag "first" :value nil)
1032           (item :tag "undisplayed" :value undisplayed)
1033           (item :tag "undisplayed or alternative"
1034                 :value undisplayed-alternative)
1035           (function)))
1036
1037 (defcustom gnus-mime-action-alist
1038   '(("save to file" . gnus-mime-save-part)
1039     ("save and strip" . gnus-mime-save-part-and-strip)
1040     ("replace with file" . gnus-mime-replace-part)
1041     ("delete part" . gnus-mime-delete-part)
1042     ("display as text" . gnus-mime-inline-part)
1043     ("view the part" . gnus-mime-view-part)
1044     ("pipe to command" . gnus-mime-pipe-part)
1045     ("toggle display" . gnus-article-press-button)
1046     ("toggle display" . gnus-article-view-part-as-charset)
1047     ("view as type" . gnus-mime-view-part-as-type)
1048     ("view internally" . gnus-mime-view-part-internally)
1049     ("view externally" . gnus-mime-view-part-externally))
1050   "An alist of actions that run on the MIME attachment."
1051   :group 'gnus-article-mime
1052   :type '(repeat (cons (string :tag "name")
1053                        (function))))
1054
1055 (defcustom gnus-auto-select-part 1
1056   "Advance to next MIME part when deleting or stripping parts.
1057
1058 When 0, point will be placed on the same part as before.  When
1059 positive (negative), move point forward (backwards) this many
1060 parts.  When nil, redisplay article."
1061   :version "23.1" ;; No Gnus
1062   :group 'gnus-article-mime
1063   :type '(choice (const nil :tag "Redisplay article.")
1064                  (const 1 :tag "Next part.")
1065                  (const 0 :tag "Current part.")
1066                  integer))
1067
1068 ;;;
1069 ;;; The treatment variables
1070 ;;;
1071
1072 (defvar gnus-part-display-hook nil
1073   "Hook called on parts that are to receive treatment.")
1074
1075 (defvar gnus-article-treat-custom
1076   '(choice (const :tag "Off" nil)
1077            (const :tag "On" t)
1078            (const :tag "Header" head)
1079            (const :tag "First" first)
1080            (const :tag "Last" last)
1081            (integer :tag "Less")
1082            (repeat :tag "Groups" regexp)
1083            (sexp :tag "Predicate")))
1084
1085 (defvar gnus-article-treat-head-custom
1086   '(choice (const :tag "Off" nil)
1087            (const :tag "Header" head)))
1088
1089 (defvar gnus-article-treat-types '("text/plain" "text/x-verbatim"
1090                                    "text/x-patch")
1091   "Parts to treat.")
1092
1093 (defvar gnus-inhibit-treatment nil
1094   "Whether to inhibit treatment.")
1095
1096 (defcustom gnus-treat-highlight-signature '(or t (typep "text/x-vcard"))
1097   "Highlight the signature.
1098 Valid values are nil, t, `head', `first', `last', an integer or a
1099 predicate.  See Info node `(gnus)Customizing Articles'."
1100   :group 'gnus-article-treat
1101   :link '(custom-manual "(gnus)Customizing Articles")
1102   :type gnus-article-treat-custom)
1103 (put 'gnus-treat-highlight-signature 'highlight t)
1104
1105 (defcustom gnus-treat-buttonize 100000
1106   "Add buttons.
1107 Valid values are nil, t, `head', `first', `last', an integer or a
1108 predicate.  See Info node `(gnus)Customizing Articles'."
1109   :group 'gnus-article-treat
1110   :link '(custom-manual "(gnus)Customizing Articles")
1111   :type gnus-article-treat-custom)
1112 (put 'gnus-treat-buttonize 'highlight t)
1113
1114 (defcustom gnus-treat-buttonize-head 'head
1115   "Add buttons to the head.
1116 Valid values are nil, t, `head', `first', `last', an integer or a
1117 predicate.  See Info node `(gnus)Customizing Articles'."
1118   :group 'gnus-article-treat
1119   :link '(custom-manual "(gnus)Customizing Articles")
1120   :type gnus-article-treat-head-custom)
1121 (put 'gnus-treat-buttonize-head 'highlight t)
1122
1123 (defcustom gnus-treat-emphasize 50000
1124   "Emphasize text.
1125 Valid values are nil, t, `head', `first', `last', an integer or a
1126 predicate.  See Info node `(gnus)Customizing Articles'."
1127   :group 'gnus-article-treat
1128   :link '(custom-manual "(gnus)Customizing Articles")
1129   :type gnus-article-treat-custom)
1130 (put 'gnus-treat-emphasize 'highlight t)
1131
1132 (defcustom gnus-treat-strip-cr nil
1133   "Remove carriage returns.
1134 Valid values are nil, t, `head', `first', `last', an integer or a
1135 predicate.  See Info node `(gnus)Customizing Articles'."
1136   :version "22.1"
1137   :group 'gnus-article-treat
1138   :link '(custom-manual "(gnus)Customizing Articles")
1139   :type gnus-article-treat-custom)
1140
1141 (defcustom gnus-treat-unsplit-urls nil
1142   "Remove newlines from within URLs.
1143 Valid values are nil, t, `head', `first', `last', an integer or a
1144 predicate.  See Info node `(gnus)Customizing Articles'."
1145   :version "22.1"
1146   :group 'gnus-article-treat
1147   :link '(custom-manual "(gnus)Customizing Articles")
1148   :type gnus-article-treat-custom)
1149
1150 (defcustom gnus-treat-leading-whitespace nil
1151   "Remove leading whitespace in headers.
1152 Valid values are nil, t, `head', `first', `last', an integer or a
1153 predicate.  See Info node `(gnus)Customizing Articles'."
1154   :version "22.1"
1155   :group 'gnus-article-treat
1156   :link '(custom-manual "(gnus)Customizing Articles")
1157   :type gnus-article-treat-custom)
1158
1159 (defcustom gnus-treat-hide-headers 'head
1160   "Hide headers.
1161 Valid values are nil, t, `head', `first', `last', an integer or a
1162 predicate.  See Info node `(gnus)Customizing Articles'."
1163   :group 'gnus-article-treat
1164   :link '(custom-manual "(gnus)Customizing Articles")
1165   :type gnus-article-treat-head-custom)
1166
1167 (defcustom gnus-treat-hide-boring-headers nil
1168   "Hide boring headers.
1169 Valid values are nil, t, `head', `first', `last', an integer or a
1170 predicate.  See Info node `(gnus)Customizing Articles'."
1171   :group 'gnus-article-treat
1172   :link '(custom-manual "(gnus)Customizing Articles")
1173   :type gnus-article-treat-head-custom)
1174
1175 (defcustom gnus-treat-hide-signature nil
1176   "Hide the signature.
1177 Valid values are nil, t, `head', `first', `last', an integer or a
1178 predicate.  See Info node `(gnus)Customizing Articles'."
1179   :group 'gnus-article-treat
1180   :link '(custom-manual "(gnus)Customizing Articles")
1181   :type gnus-article-treat-custom)
1182
1183 (defcustom gnus-treat-fill-article nil
1184   "Fill the article.
1185 Valid values are nil, t, `head', `first', `last', an integer or a
1186 predicate.  See Info node `(gnus)Customizing Articles'."
1187   :group 'gnus-article-treat
1188   :link '(custom-manual "(gnus)Customizing Articles")
1189   :type gnus-article-treat-custom)
1190
1191 (defcustom gnus-treat-hide-citation nil
1192   "Hide cited text.
1193 Valid values are nil, t, `head', `first', `last', an integer or a
1194 predicate.  See Info node `(gnus)Customizing Articles'."
1195   :group 'gnus-article-treat
1196   :link '(custom-manual "(gnus)Customizing Articles")
1197   :type gnus-article-treat-custom)
1198
1199 (defcustom gnus-treat-hide-citation-maybe nil
1200   "Hide cited text.
1201 Valid values are nil, t, `head', `first', `last', an integer or a
1202 predicate.  See Info node `(gnus)Customizing Articles'."
1203   :group 'gnus-article-treat
1204   :link '(custom-manual "(gnus)Customizing Articles")
1205   :type gnus-article-treat-custom)
1206
1207 (defcustom gnus-treat-strip-list-identifiers 'head
1208   "Strip list identifiers from `gnus-list-identifiers`.
1209 Valid values are nil, t, `head', `first', `last', an integer or a
1210 predicate.  See Info node `(gnus)Customizing Articles'."
1211   :version "21.1"
1212   :group 'gnus-article-treat
1213   :link '(custom-manual "(gnus)Customizing Articles")
1214   :type gnus-article-treat-custom)
1215
1216 (make-obsolete-variable 'gnus-treat-strip-pgp
1217                         "This option is obsolete in Gnus 5.10.")
1218
1219 (defcustom gnus-treat-strip-pem nil
1220   "Strip PEM signatures.
1221 Valid values are nil, t, `head', `first', `last', an integer or a
1222 predicate.  See Info node `(gnus)Customizing Articles'."
1223   :group 'gnus-article-treat
1224   :link '(custom-manual "(gnus)Customizing Articles")
1225   :type gnus-article-treat-custom)
1226
1227 (defcustom gnus-treat-strip-banner t
1228   "Strip banners from articles.
1229 The banner to be stripped is specified in the `banner' group parameter.
1230 Valid values are nil, t, `head', `first', `last', an integer or a
1231 predicate.  See Info node `(gnus)Customizing Articles'."
1232   :group 'gnus-article-treat
1233   :link '(custom-manual "(gnus)Customizing Articles")
1234   :type gnus-article-treat-custom)
1235
1236 (defcustom gnus-treat-highlight-headers 'head
1237   "Highlight the headers.
1238 Valid values are nil, t, `head', `first', `last', an integer or a
1239 predicate.  See Info node `(gnus)Customizing Articles'."
1240   :group 'gnus-article-treat
1241   :link '(custom-manual "(gnus)Customizing Articles")
1242   :type gnus-article-treat-head-custom)
1243 (put 'gnus-treat-highlight-headers 'highlight t)
1244
1245 (defcustom gnus-treat-highlight-citation t
1246   "Highlight cited text.
1247 Valid values are nil, t, `head', `first', `last', an integer or a
1248 predicate.  See Info node `(gnus)Customizing Articles'."
1249   :group 'gnus-article-treat
1250   :link '(custom-manual "(gnus)Customizing Articles")
1251   :type gnus-article-treat-custom)
1252 (put 'gnus-treat-highlight-citation 'highlight t)
1253
1254 (defcustom gnus-treat-date-ut nil
1255   "Display the Date in UT (GMT).
1256 Valid values are nil, t, `head', `first', `last', an integer or a
1257 predicate.  See Info node `(gnus)Customizing Articles'."
1258   :group 'gnus-article-treat
1259   :link '(custom-manual "(gnus)Customizing Articles")
1260   :type gnus-article-treat-head-custom)
1261
1262 (defcustom gnus-treat-date-local nil
1263   "Display the Date in the local timezone.
1264 Valid values are nil, t, `head', `first', `last', an integer or a
1265 predicate.  See Info node `(gnus)Customizing Articles'."
1266   :group 'gnus-article-treat
1267   :link '(custom-manual "(gnus)Customizing Articles")
1268   :type gnus-article-treat-head-custom)
1269
1270 (defcustom gnus-treat-date-english nil
1271   "Display the Date in a format that can be read aloud in English.
1272 Valid values are nil, t, `head', `first', `last', an integer or a
1273 predicate.  See Info node `(gnus)Customizing Articles'."
1274   :version "22.1"
1275   :group 'gnus-article-treat
1276   :link '(custom-manual "(gnus)Customizing Articles")
1277   :type gnus-article-treat-head-custom)
1278
1279 (defcustom gnus-treat-date-lapsed nil
1280   "Display the Date header in a way that says how much time has elapsed.
1281 Valid values are nil, t, `head', `first', `last', an integer or a
1282 predicate.  See Info node `(gnus)Customizing Articles'."
1283   :group 'gnus-article-treat
1284   :link '(custom-manual "(gnus)Customizing Articles")
1285   :type gnus-article-treat-head-custom)
1286
1287 (defcustom gnus-treat-date-original nil
1288   "Display the date in the original timezone.
1289 Valid values are nil, t, `head', `first', `last', an integer or a
1290 predicate.  See Info node `(gnus)Customizing Articles'."
1291   :group 'gnus-article-treat
1292   :link '(custom-manual "(gnus)Customizing Articles")
1293   :type gnus-article-treat-head-custom)
1294
1295 (defcustom gnus-treat-date-iso8601 nil
1296   "Display the date in the ISO8601 format.
1297 Valid values are nil, t, `head', `first', `last', an integer or a
1298 predicate.  See Info node `(gnus)Customizing Articles'."
1299   :version "21.1"
1300   :group 'gnus-article-treat
1301   :link '(custom-manual "(gnus)Customizing Articles")
1302   :type gnus-article-treat-head-custom)
1303
1304 (defcustom gnus-treat-date-user-defined nil
1305   "Display the date in a user-defined format.
1306 The format is defined by the `gnus-article-time-format' variable.
1307 Valid values are nil, t, `head', `first', `last', an integer or a
1308 predicate.  See Info node `(gnus)Customizing Articles'."
1309   :group 'gnus-article-treat
1310   :link '(custom-manual "(gnus)Customizing Articles")
1311   :type gnus-article-treat-head-custom)
1312
1313 (defcustom gnus-treat-strip-headers-in-body t
1314   "Strip the X-No-Archive header line from the beginning of the body.
1315 Valid values are nil, t, `head', `first', `last', an integer or a
1316 predicate.  See Info node `(gnus)Customizing Articles'."
1317   :version "21.1"
1318   :group 'gnus-article-treat
1319   :link '(custom-manual "(gnus)Customizing Articles")
1320   :type gnus-article-treat-custom)
1321
1322 (defcustom gnus-treat-strip-trailing-blank-lines nil
1323   "Strip trailing blank lines.
1324 Valid values are nil, t, `head', `first', `last', an integer or a
1325 predicate.  See Info node `(gnus)Customizing Articles'.
1326
1327 When set to t, it also strips trailing blanks in all MIME parts.
1328 Consider to use `last' instead."
1329   :group 'gnus-article-treat
1330   :link '(custom-manual "(gnus)Customizing Articles")
1331   :type gnus-article-treat-custom)
1332
1333 (defcustom gnus-treat-strip-leading-blank-lines nil
1334   "Strip leading blank lines.
1335 Valid values are nil, t, `head', `first', `last', an integer or a
1336 predicate.  See Info node `(gnus)Customizing Articles'.
1337
1338 When set to t, it also strips trailing blanks in all MIME parts."
1339   :group 'gnus-article-treat
1340   :link '(custom-manual "(gnus)Customizing Articles")
1341   :type gnus-article-treat-custom)
1342
1343 (defcustom gnus-treat-strip-multiple-blank-lines nil
1344   "Strip multiple blank lines.
1345 Valid values are nil, t, `head', `first', `last', an integer or a
1346 predicate.  See Info node `(gnus)Customizing Articles'."
1347   :group 'gnus-article-treat
1348   :link '(custom-manual "(gnus)Customizing Articles")
1349   :type gnus-article-treat-custom)
1350
1351 (defcustom gnus-treat-unfold-headers 'head
1352   "Unfold folded header lines.
1353 Valid values are nil, t, `head', `first', `last', an integer or a
1354 predicate.  See Info node `(gnus)Customizing Articles'."
1355   :version "22.1"
1356   :group 'gnus-article-treat
1357   :link '(custom-manual "(gnus)Customizing Articles")
1358   :type gnus-article-treat-custom)
1359
1360 (defcustom gnus-article-unfold-long-headers nil
1361   "If non-nil, allow unfolding headers even if the header is long.
1362 If it is a regexp, only long headers matching this regexp are unfolded.
1363 If it is t, all long headers are unfolded.
1364
1365 This variable has no effect if `gnus-treat-unfold-headers' is nil."
1366   :version "23.1" ;; No Gnus
1367   :group 'gnus-article-treat
1368   :type '(choice (const nil)
1369                  (const :tag "all" t)
1370                  (regexp)))
1371
1372 (defcustom gnus-treat-fold-headers nil
1373   "Fold headers.
1374 Valid values are nil, t, `head', `first', `last', an integer or a
1375 predicate.  See Info node `(gnus)Customizing Articles'."
1376   :version "22.1"
1377   :group 'gnus-article-treat
1378   :link '(custom-manual "(gnus)Customizing Articles")
1379   :type gnus-article-treat-custom)
1380
1381 (defcustom gnus-treat-fold-newsgroups 'head
1382   "Fold the Newsgroups and Followup-To headers.
1383 Valid values are nil, t, `head', `first', `last', an integer or a
1384 predicate.  See Info node `(gnus)Customizing Articles'."
1385   :version "22.1"
1386   :group 'gnus-article-treat
1387   :link '(custom-manual "(gnus)Customizing Articles")
1388   :type gnus-article-treat-custom)
1389
1390 (defcustom gnus-treat-overstrike t
1391   "Treat overstrike highlighting.
1392 Valid values are nil, t, `head', `first', `last', an integer or a
1393 predicate.  See Info node `(gnus)Customizing Articles'."
1394   :group 'gnus-article-treat
1395   :link '(custom-manual "(gnus)Customizing Articles")
1396   :type gnus-article-treat-custom)
1397 (put 'gnus-treat-overstrike 'highlight t)
1398
1399 (defcustom gnus-treat-ansi-sequences (if (locate-library "ansi-color") t)
1400   "Treat ANSI SGR control sequences.
1401 Valid values are nil, t, `head', `first', `last', an integer or a
1402 predicate.  See Info node `(gnus)Customizing Articles'."
1403   :group 'gnus-article-treat
1404   :link '(custom-manual "(gnus)Customizing Articles")
1405   :type gnus-article-treat-custom)
1406
1407 (make-obsolete-variable 'gnus-treat-display-xface
1408                         'gnus-treat-display-x-face)
1409
1410 (defcustom gnus-treat-display-x-face
1411   (and (not noninteractive)
1412        (gnus-image-type-available-p 'xbm)
1413        (if (featurep 'xemacs)
1414            (featurep 'xface)
1415          (and (string-match "^0x" (shell-command-to-string "uncompface"))
1416               (executable-find "icontopbm")))
1417        'head)
1418   "Display X-Face headers.
1419 Valid values are nil and `head'.
1420 See Info node `(gnus)Customizing Articles' and Info node
1421 `(gnus)X-Face' for details."
1422   :group 'gnus-article-treat
1423   :version "21.1"
1424   :link '(custom-manual "(gnus)Customizing Articles")
1425   :link '(custom-manual "(gnus)X-Face")
1426   :type gnus-article-treat-head-custom
1427   :set (lambda (symbol value)
1428          (set-default
1429           symbol
1430           (cond ((or (boundp symbol) (get symbol 'saved-value))
1431                  value)
1432                 ((boundp 'gnus-treat-display-xface)
1433                  (message "\
1434 ** gnus-treat-display-xface is an obsolete variable;\
1435  use gnus-treat-display-x-face instead")
1436                  (default-value 'gnus-treat-display-xface))
1437                 ((get 'gnus-treat-display-xface 'saved-value)
1438                  (message "\
1439 ** gnus-treat-display-xface is an obsolete variable;\
1440  use gnus-treat-display-x-face instead")
1441                  (eval (car (get 'gnus-treat-display-xface 'saved-value))))
1442                 (t
1443                  value)))))
1444 (put 'gnus-treat-display-x-face 'highlight t)
1445
1446 (defcustom gnus-treat-display-face
1447   (and (not noninteractive)
1448        (gnus-image-type-available-p 'png)
1449        'head)
1450   "Display Face headers.
1451 Valid values are nil, t, `head', `first', `last', an integer or a
1452 predicate.  See Info node `(gnus)Customizing Articles' and Info
1453 node `(gnus)X-Face' for details."
1454   :group 'gnus-article-treat
1455   :version "22.1"
1456   :link '(custom-manual "(gnus)Customizing Articles")
1457   :link '(custom-manual "(gnus)X-Face")
1458   :type gnus-article-treat-head-custom)
1459 (put 'gnus-treat-display-face 'highlight t)
1460
1461 (defcustom gnus-treat-display-smileys (gnus-image-type-available-p 'xpm)
1462   "Display smileys.
1463 Valid values are nil, t, `head', `first', `last', an integer or a
1464 predicate.  See Info node `(gnus)Customizing Articles' and Info
1465 node `(gnus)Smileys' for details."
1466   :group 'gnus-article-treat
1467   :version "21.1"
1468   :link '(custom-manual "(gnus)Customizing Articles")
1469   :link '(custom-manual "(gnus)Smileys")
1470   :type gnus-article-treat-custom)
1471 (put 'gnus-treat-display-smileys 'highlight t)
1472
1473 (defcustom gnus-treat-from-picon
1474   (if (and (gnus-image-type-available-p 'xpm)
1475            (gnus-picons-installed-p))
1476       'head nil)
1477   "Display picons in the From header.
1478 Valid values are nil, t, `head', `first', `last', an integer or a
1479 predicate.  See Info node `(gnus)Customizing Articles' and Info
1480 node `(gnus)Picons' for details."
1481   :version "22.1"
1482   :group 'gnus-article-treat
1483   :group 'gnus-picon
1484   :link '(custom-manual "(gnus)Customizing Articles")
1485   :link '(custom-manual "(gnus)Picons")
1486   :type gnus-article-treat-head-custom)
1487 (put 'gnus-treat-from-picon 'highlight t)
1488
1489 (defcustom gnus-treat-mail-picon
1490   (if (and (gnus-image-type-available-p 'xpm)
1491            (gnus-picons-installed-p))
1492       'head nil)
1493   "Display picons in To and Cc headers.
1494 Valid values are nil, t, `head', `first', `last', an integer or a
1495 predicate.  See Info node `(gnus)Customizing Articles' and Info
1496 node `(gnus)Picons' for details."
1497   :version "22.1"
1498   :group 'gnus-article-treat
1499   :group 'gnus-picon
1500   :link '(custom-manual "(gnus)Customizing Articles")
1501   :link '(custom-manual "(gnus)Picons")
1502   :type gnus-article-treat-head-custom)
1503 (put 'gnus-treat-mail-picon 'highlight t)
1504
1505 (defcustom gnus-treat-newsgroups-picon
1506   (if (and (gnus-image-type-available-p 'xpm)
1507            (gnus-picons-installed-p))
1508       'head nil)
1509   "Display picons in the Newsgroups and Followup-To headers.
1510 Valid values are nil, t, `head', `first', `last', an integer or a
1511 predicate.  See Info node `(gnus)Customizing Articles' and Info
1512 node `(gnus)Picons' for details."
1513   :version "22.1"
1514   :group 'gnus-article-treat
1515   :group 'gnus-picon
1516   :link '(custom-manual "(gnus)Customizing Articles")
1517   :link '(custom-manual "(gnus)Picons")
1518   :type gnus-article-treat-head-custom)
1519 (put 'gnus-treat-newsgroups-picon 'highlight t)
1520
1521 (defcustom gnus-treat-body-boundary
1522   (if (or gnus-treat-newsgroups-picon
1523           gnus-treat-mail-picon
1524           gnus-treat-from-picon)
1525       ;; If there's much decoration, the user might prefer a boundery.
1526       'head
1527     nil)
1528   "Draw a boundary at the end of the headers.
1529 Valid values are nil and `head'.
1530 See Info node `(gnus)Customizing Articles' for details."
1531   :version "22.1"
1532   :group 'gnus-article-treat
1533   :link '(custom-manual "(gnus)Customizing Articles")
1534   :type gnus-article-treat-head-custom)
1535
1536 (defcustom gnus-treat-capitalize-sentences nil
1537   "Capitalize sentence-starting words.
1538 Valid values are nil, t, `head', `first', `last', an integer or a
1539 predicate.  See Info node `(gnus)Customizing Articles'."
1540   :version "21.1"
1541   :group 'gnus-article-treat
1542   :link '(custom-manual "(gnus)Customizing Articles")
1543   :type gnus-article-treat-custom)
1544
1545 (defcustom gnus-treat-wash-html nil
1546   "Format as HTML.
1547 Valid values are nil, t, `head', `first', `last', an integer or a
1548 predicate.  See Info node `(gnus)Customizing Articles'."
1549   :version "22.1"
1550   :group 'gnus-article-treat
1551   :link '(custom-manual "(gnus)Customizing Articles")
1552   :type gnus-article-treat-custom)
1553
1554 (defcustom gnus-treat-fill-long-lines nil
1555   "Fill long lines.
1556 Valid values are nil, t, `head', `first', `last', an integer or a
1557 predicate.  See Info node `(gnus)Customizing Articles'."
1558   :group 'gnus-article-treat
1559   :link '(custom-manual "(gnus)Customizing Articles")
1560   :type gnus-article-treat-custom)
1561
1562 (defcustom gnus-treat-play-sounds nil
1563   "Play sounds.
1564 Valid values are nil, t, `head', `first', `last', an integer or a
1565 predicate.  See Info node `(gnus)Customizing Articles'."
1566   :version "21.1"
1567   :group 'gnus-article-treat
1568   :link '(custom-manual "(gnus)Customizing Articles")
1569   :type gnus-article-treat-custom)
1570
1571 (defcustom gnus-treat-translate nil
1572   "Translate articles from one language to another.
1573 Valid values are nil, t, `head', `first', `last', an integer or a
1574 predicate.  See Info node `(gnus)Customizing Articles'."
1575   :version "21.1"
1576   :group 'gnus-article-treat
1577   :link '(custom-manual "(gnus)Customizing Articles")
1578   :type gnus-article-treat-custom)
1579
1580 (defcustom gnus-treat-x-pgp-sig nil
1581   "Verify X-PGP-Sig.
1582 To automatically treat X-PGP-Sig, set it to head.
1583 Valid values are nil, t, `head', `first', `last', an integer or a
1584 predicate.  See Info node `(gnus)Customizing Articles'."
1585   :version "22.1"
1586   :group 'gnus-article-treat
1587   :group 'mime-security
1588   :link '(custom-manual "(gnus)Customizing Articles")
1589   :type gnus-article-treat-custom)
1590
1591 (defvar gnus-article-encrypt-protocol-alist
1592   '(("PGP" . mml2015-self-encrypt)))
1593
1594 ;; Set to nil if more than one protocol added to
1595 ;; gnus-article-encrypt-protocol-alist.
1596 (defcustom gnus-article-encrypt-protocol "PGP"
1597   "The protocol used for encrypt articles.
1598 It is a string, such as \"PGP\". If nil, ask user."
1599   :version "22.1"
1600   :type 'string
1601   :group 'mime-security)
1602
1603 (defvar gnus-article-wash-function nil
1604   "Function used for converting HTML into text.")
1605
1606 (defcustom gnus-use-idna (and (condition-case nil (require 'idna) (file-error))
1607                               (mm-coding-system-p 'utf-8)
1608                               (executable-find idna-program))
1609   "Whether IDNA decoding of headers is used when viewing messages.
1610 This requires GNU Libidn, and by default only enabled if it is found."
1611   :version "22.1"
1612   :group 'gnus-article-headers
1613   :type 'boolean)
1614
1615 (defcustom gnus-article-over-scroll nil
1616   "If non-nil, allow scrolling the article buffer even when there no more text."
1617   :version "22.1"
1618   :group 'gnus-article
1619   :type 'boolean)
1620
1621 ;;; Internal variables
1622
1623 (defvar gnus-english-month-names
1624   '("January" "February" "March" "April" "May" "June" "July" "August"
1625     "September" "October" "November" "December"))
1626
1627 (defvar article-goto-body-goes-to-point-min-p nil)
1628 (defvar gnus-article-wash-types nil)
1629 (defvar gnus-article-emphasis-alist nil)
1630 (defvar gnus-article-image-alist nil)
1631
1632 (defvar gnus-article-mime-handle-alist-1 nil)
1633 (defvar gnus-treatment-function-alist
1634   '((gnus-treat-x-pgp-sig gnus-article-verify-x-pgp-sig)
1635     (gnus-treat-strip-banner gnus-article-strip-banner)
1636     (gnus-treat-strip-headers-in-body gnus-article-strip-headers-in-body)
1637     (gnus-treat-highlight-signature gnus-article-highlight-signature)
1638     (gnus-treat-buttonize gnus-article-add-buttons)
1639     (gnus-treat-fill-article gnus-article-fill-cited-article)
1640     (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
1641     (gnus-treat-strip-cr gnus-article-remove-cr)
1642     (gnus-treat-unsplit-urls gnus-article-unsplit-urls)
1643     (gnus-treat-date-ut gnus-article-date-ut)
1644     (gnus-treat-date-local gnus-article-date-local)
1645     (gnus-treat-date-english gnus-article-date-english)
1646     (gnus-treat-date-original gnus-article-date-original)
1647     (gnus-treat-date-user-defined gnus-article-date-user)
1648     (gnus-treat-date-iso8601 gnus-article-date-iso8601)
1649     (gnus-treat-date-lapsed gnus-article-date-lapsed)
1650     (gnus-treat-display-x-face gnus-article-display-x-face)
1651     (gnus-treat-display-face gnus-article-display-face)
1652     (gnus-treat-hide-headers gnus-article-maybe-hide-headers)
1653     (gnus-treat-hide-boring-headers gnus-article-hide-boring-headers)
1654     (gnus-treat-hide-signature gnus-article-hide-signature)
1655     (gnus-treat-strip-list-identifiers gnus-article-hide-list-identifiers)
1656     (gnus-treat-leading-whitespace gnus-article-remove-leading-whitespace)
1657     (gnus-treat-strip-pem gnus-article-hide-pem)
1658     (gnus-treat-from-picon gnus-treat-from-picon)
1659     (gnus-treat-mail-picon gnus-treat-mail-picon)
1660     (gnus-treat-newsgroups-picon gnus-treat-newsgroups-picon)
1661     (gnus-treat-highlight-headers gnus-article-highlight-headers)
1662     (gnus-treat-highlight-signature gnus-article-highlight-signature)
1663     (gnus-treat-strip-trailing-blank-lines
1664      gnus-article-remove-trailing-blank-lines)
1665     (gnus-treat-strip-leading-blank-lines
1666      gnus-article-strip-leading-blank-lines)
1667     (gnus-treat-strip-multiple-blank-lines
1668      gnus-article-strip-multiple-blank-lines)
1669     (gnus-treat-overstrike gnus-article-treat-overstrike)
1670     (gnus-treat-ansi-sequences gnus-article-treat-ansi-sequences)
1671     (gnus-treat-unfold-headers gnus-article-treat-unfold-headers)
1672     (gnus-treat-fold-newsgroups gnus-article-treat-fold-newsgroups)
1673     (gnus-treat-fold-headers gnus-article-treat-fold-headers)
1674     (gnus-treat-buttonize-head gnus-article-add-buttons-to-head)
1675     (gnus-treat-display-smileys gnus-treat-smiley)
1676     (gnus-treat-capitalize-sentences gnus-article-capitalize-sentences)
1677     (gnus-treat-wash-html gnus-article-wash-html)
1678     (gnus-treat-emphasize gnus-article-emphasize)
1679     (gnus-treat-hide-citation gnus-article-hide-citation)
1680     (gnus-treat-hide-citation-maybe gnus-article-hide-citation-maybe)
1681     (gnus-treat-highlight-citation gnus-article-highlight-citation)
1682     (gnus-treat-body-boundary gnus-article-treat-body-boundary)
1683     (gnus-treat-play-sounds gnus-earcon-display)))
1684
1685 (defvar gnus-article-mime-handle-alist nil)
1686 (defvar article-lapsed-timer nil)
1687 (defvar gnus-article-current-summary nil)
1688
1689 (defvar gnus-article-mode-syntax-table
1690   (let ((table (copy-syntax-table text-mode-syntax-table)))
1691     ;; This causes the citation match run O(2^n).
1692     ;; (modify-syntax-entry ?- "w" table)
1693     (modify-syntax-entry ?> ")<" table)
1694     (modify-syntax-entry ?< "(>" table)
1695     ;; make M-. in article buffers work for `foo' strings
1696     (modify-syntax-entry ?' " " table)
1697     (modify-syntax-entry ?` " " table)
1698     table)
1699   "Syntax table used in article mode buffers.
1700 Initialized from `text-mode-syntax-table.")
1701
1702 (defvar gnus-save-article-buffer nil)
1703
1704 (defvar gnus-number-of-articles-to-be-saved nil)
1705
1706 (defvar gnus-inhibit-hiding nil)
1707
1708 (defvar gnus-article-edit-mode nil)
1709
1710 ;;; Macros for dealing with the article buffer.
1711
1712 (defmacro gnus-with-article-headers (&rest forms)
1713   `(with-current-buffer gnus-article-buffer
1714      (save-restriction
1715        (let ((inhibit-read-only t)
1716              (inhibit-point-motion-hooks t)
1717              (case-fold-search t))
1718          (article-narrow-to-head)
1719          ,@forms))))
1720
1721 (put 'gnus-with-article-headers 'lisp-indent-function 0)
1722 (put 'gnus-with-article-headers 'edebug-form-spec '(body))
1723
1724 (defmacro gnus-with-article-buffer (&rest forms)
1725   `(with-current-buffer gnus-article-buffer
1726      (let ((inhibit-read-only t))
1727        ,@forms)))
1728
1729 (put 'gnus-with-article-buffer 'lisp-indent-function 0)
1730 (put 'gnus-with-article-buffer 'edebug-form-spec '(body))
1731
1732 (defun gnus-article-goto-header (header)
1733   "Go to HEADER, which is a regular expression."
1734   (re-search-forward (concat "^\\(" header "\\):") nil t))
1735
1736 (defsubst gnus-article-hide-text (b e props)
1737   "Set text PROPS on the B to E region, extending `intangible' 1 past B."
1738   (gnus-add-text-properties-when 'article-type nil b e props)
1739   (when (memq 'intangible props)
1740     (put-text-property
1741      (max (1- b) (point-min))
1742      b 'intangible (cddr (memq 'intangible props)))))
1743
1744 (defsubst gnus-article-unhide-text (b e)
1745   "Remove hidden text properties from region between B and E."
1746   (remove-text-properties b e gnus-hidden-properties)
1747   (when (memq 'intangible gnus-hidden-properties)
1748     (put-text-property (max (1- b) (point-min))
1749                        b 'intangible nil)))
1750
1751 (defun gnus-article-hide-text-type (b e type)
1752   "Hide text of TYPE between B and E."
1753   (gnus-add-wash-type type)
1754   (gnus-article-hide-text
1755    b e (cons 'article-type (cons type gnus-hidden-properties))))
1756
1757 (defun gnus-article-unhide-text-type (b e type)
1758   "Unhide text of TYPE between B and E."
1759   (gnus-delete-wash-type type)
1760   (remove-text-properties
1761    b e (cons 'article-type (cons type gnus-hidden-properties)))
1762   (when (memq 'intangible gnus-hidden-properties)
1763     (put-text-property (max (1- b) (point-min))
1764                        b 'intangible nil)))
1765
1766 (defun gnus-article-hide-text-of-type (type)
1767   "Hide text of TYPE in the current buffer."
1768   (save-excursion
1769     (let ((b (point-min))
1770           (e (point-max)))
1771       (while (setq b (text-property-any b e 'article-type type))
1772         (add-text-properties b (incf b) gnus-hidden-properties)))))
1773
1774 (defun gnus-article-delete-text-of-type (type)
1775   "Delete text of TYPE in the current buffer."
1776   (save-excursion
1777     (let ((b (point-min)))
1778       (if (eq type 'multipart)
1779           ;; Remove MIME buttons associated with multipart/alternative parts.
1780           (progn
1781             (goto-char b)
1782             (while (if (get-text-property (point) 'gnus-part)
1783                        (setq b (point))
1784                      (when (setq b (next-single-property-change (point)
1785                                                                 'gnus-part))
1786                        (goto-char b)
1787                        t))
1788               (end-of-line)
1789               (skip-chars-forward "\n")
1790               (when (eq (get-text-property b 'article-type) 'multipart)
1791                 (delete-region b (point)))))
1792         (while (setq b (text-property-any b (point-max) 'article-type type))
1793           (delete-region
1794            b (or (text-property-not-all b (point-max) 'article-type type)
1795                  (point-max))))))))
1796
1797 (defun gnus-article-delete-invisible-text ()
1798   "Delete all invisible text in the current buffer."
1799   (save-excursion
1800     (let ((b (point-min)))
1801       (while (setq b (text-property-any b (point-max) 'invisible t))
1802         (delete-region
1803          b (or (text-property-not-all b (point-max) 'invisible t)
1804                (point-max)))))))
1805
1806 (defun gnus-article-text-type-exists-p (type)
1807   "Say whether any text of type TYPE exists in the buffer."
1808   (text-property-any (point-min) (point-max) 'article-type type))
1809
1810 (defsubst gnus-article-header-rank ()