1 ;;; gnus-art.el --- article mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
31 (defvar tool-bar-map))
34 ;; Avoid the "Recursive load suspected" error in Emacs 21.1.
36 (let ((recursive-load-depth-limit 100))
49 (autoload 'gnus-msg-mail "gnus-msg" nil t)
50 (autoload 'gnus-button-mailto "gnus-msg")
51 (autoload 'gnus-button-reply "gnus-msg" nil t)
52 (autoload 'ansi-color-apply-on-region "ansi-color")
54 (defgroup gnus-article nil
56 :link '(custom-manual "(gnus)Article Buffer")
59 (defgroup gnus-article-treat nil
60 "Treating article parts."
61 :link '(custom-manual "(gnus)Article Hiding")
64 (defgroup gnus-article-hiding nil
65 "Hiding article parts."
66 :link '(custom-manual "(gnus)Article Hiding")
69 (defgroup gnus-article-highlight nil
70 "Article highlighting."
71 :link '(custom-manual "(gnus)Article Highlighting")
75 (defgroup gnus-article-signature nil
77 :link '(custom-manual "(gnus)Article Signature")
80 (defgroup gnus-article-headers nil
82 :link '(custom-manual "(gnus)Hiding Headers")
85 (defgroup gnus-article-washing nil
86 "Special commands on articles."
87 :link '(custom-manual "(gnus)Article Washing")
90 (defgroup gnus-article-emphasis nil
91 "Fontisizing articles."
92 :link '(custom-manual "(gnus)Article Fontisizing")
95 (defgroup gnus-article-saving nil
97 :link '(custom-manual "(gnus)Saving Articles")
100 (defgroup gnus-article-mime nil
101 "Worshiping the MIME wonder."
102 :link '(custom-manual "(gnus)Using MIME")
103 :group 'gnus-article)
105 (defgroup gnus-article-buttons nil
106 "Pushable buttons in the article buffer."
107 :link '(custom-manual "(gnus)Article Buttons")
108 :group 'gnus-article)
110 (defgroup gnus-article-various nil
111 "Other article options."
112 :link '(custom-manual "(gnus)Misc Article")
113 :group 'gnus-article)
115 (defcustom gnus-ignored-headers
118 (concat "^" header ":"))
119 '("Path" "Expires" "Date-Received" "References" "Xref" "Lines"
120 "Relay-Version" "Message-ID" "Approved" "Sender" "Received"
121 "X-UIDL" "MIME-Version" "Return-Path" "In-Reply-To"
122 "Content-Type" "Content-Transfer-Encoding" "X-WebTV-Signature"
123 "X-MimeOLE" "X-MSMail-Priority" "X-Priority" "X-Loop"
124 "X-Authentication-Warning" "X-MIME-Autoconverted" "X-Face"
125 "X-Attribution" "X-Originating-IP" "Delivered-To"
126 "NNTP-[-A-Za-z]+" "Distribution" "X-no-archive" "X-Trace"
127 "X-Complaints-To" "X-NNTP-Posting-Host" "X-Orig.*"
128 "Abuse-Reports-To" "Cache-Post-Path" "X-Article-Creation-Date"
129 "X-Poster" "X-Mail2News-Path" "X-Server-Date" "X-Cache"
130 "Originator" "X-Problems-To" "X-Auth-User" "X-Post-Time"
131 "X-Admin" "X-UID" "Resent-[-A-Za-z]+" "X-Mailing-List"
132 "Precedence" "Original-[-A-Za-z]+" "X-filename" "X-Orcpt"
133 "Old-Received" "X-Pgp" "X-Auth" "X-From-Line"
134 "X-Gnus-Article-Number" "X-Majordomo" "X-Url" "X-Sender"
135 "MBOX-Line" "Priority" "X400-[-A-Za-z]+"
136 "Status" "X-Gnus-Mail-Source" "Cancel-Lock"
137 "X-FTN" "X-EXP32-SerialNo" "Encoding" "Importance"
138 "Autoforwarded" "Original-Encoded-Information-Types" "X-Ya-Pop3"
139 "X-Face-Version" "X-Vms-To" "X-ML-NAME" "X-ML-COUNT"
140 "Mailing-List" "X-finfo" "X-md5sum" "X-md5sum-Origin"
141 "X-Sun-Charset" "X-Accept-Language" "X-Envelope-Sender"
142 "List-[A-Za-z]+" "X-Listprocessor-Version"
143 "X-Received" "X-Distribute" "X-Sequence" "X-Juno-Line-Breaks"
144 "X-Notes-Item" "X-MS-TNEF-Correlator" "x-uunet-gateway"
145 "X-Received" "Content-length" "X-precedence"
146 "X-Authenticated-User" "X-Comment" "X-Report" "X-Abuse-Info"
147 "X-HTTP-Proxy" "X-Mydeja-Info" "X-Copyright" "X-No-Markup"
148 "X-Abuse-Info" "X-From_" "X-Accept-Language" "Errors-To"
149 "X-BeenThere" "X-Mailman-Version" "List-Help" "List-Post"
150 "List-Subscribe" "List-Id" "List-Unsubscribe" "List-Archive"
151 "X-Content-length" "X-Posting-Agent" "Original-Received"
152 "X-Request-PGP" "X-Fingerprint" "X-WRIEnvto" "X-WRIEnvfrom"
153 "X-Virus-Scanned" "X-Delivery-Agent" "Posted-Date" "X-Gateway"
154 "X-Local-Origin" "X-Local-Destination" "X-UserInfo1"
155 "X-Received-Date" "X-Hashcash" "Face" "X-DMCA-Notifications"
156 "X-Abuse-and-DMCA-Info" "X-Postfilter" "X-Gpg-.*" "X-Disclaimer"))
157 "*All headers that start with this regexp will be hidden.
158 This variable can also be a list of regexps of headers to be ignored.
159 If `gnus-visible-headers' is non-nil, this variable will be ignored."
160 :type '(choice :custom-show nil
163 :group 'gnus-article-hiding)
165 (defcustom gnus-visible-headers
166 "^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:"
167 "*All headers that do not match this regexp will be hidden.
168 This variable can also be a list of regexp of headers to remain visible.
169 If this variable is non-nil, `gnus-ignored-headers' will be ignored."
170 :type '(repeat :value-to-internal (lambda (widget value)
171 (custom-split-regexp-maybe value))
172 :match (lambda (widget value)
174 (widget-editable-list-match widget value)))
176 :group 'gnus-article-hiding)
178 (defcustom gnus-sorted-header-list
179 '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:"
180 "^Followup-To:" "^To:" "^Cc:" "^Date:" "^Organization:")
181 "*This variable is a list of regular expressions.
182 If it is non-nil, headers that match the regular expressions will
183 be placed first in the article buffer in the sequence specified by
185 :type '(repeat regexp)
186 :group 'gnus-article-hiding)
188 (defcustom gnus-boring-article-headers '(empty followup-to reply-to)
189 "Headers that are only to be displayed if they have interesting data.
190 Possible values in this list are:
192 'empty Headers with no content.
193 'newsgroups Newsgroup identical to Gnus group.
194 'to-address To identical to To-address.
195 'to-list To identical to To-list.
196 'cc-list CC identical to To-list.
197 'followup-to Followup-to identical to Newsgroups.
198 'reply-to Reply-to identical to From.
199 'date Date less than four days old.
200 'long-to To and/or Cc longer than 1024 characters.
201 'many-to Multiple To and/or Cc."
202 :type '(set (const :tag "Headers with no content." empty)
203 (const :tag "Newsgroups identical to Gnus group." newsgroups)
204 (const :tag "To identical to To-address." to-address)
205 (const :tag "To identical to To-list." to-list)
206 (const :tag "CC identical to To-list." cc-list)
207 (const :tag "Followup-to identical to Newsgroups." followup-to)
208 (const :tag "Reply-to identical to From." reply-to)
209 (const :tag "Date less than four days old." date)
210 (const :tag "To and/or Cc longer than 1024 characters." long-to)
211 (const :tag "Multiple To and/or Cc headers." many-to))
212 :group 'gnus-article-hiding)
214 (defcustom gnus-article-skip-boring nil
215 "Skip over text that is not worth reading.
216 By default, if you set this t, then Gnus will display citations and
217 signatures, but will never scroll down to show you a page consisting
218 only of boring text. Boring text is controlled by
219 `gnus-article-boring-faces'."
222 :group 'gnus-article-hiding)
224 (defcustom gnus-signature-separator '("^-- $" "^-- *$")
225 "Regexp matching signature separator.
226 This can also be a list of regexps. In that case, it will be checked
227 from head to tail looking for a separator. Searches will be done from
228 the end of the buffer."
229 :type '(repeat string)
230 :group 'gnus-article-signature)
232 (defcustom gnus-signature-limit nil
233 "Provide a limit to what is considered a signature.
234 If it is a number, no signature may not be longer (in characters) than
235 that number. If it is a floating point number, no signature may be
236 longer (in lines) than that number. If it is a function, the function
237 will be called without any parameters, and if it returns nil, there is
238 no signature in the buffer. If it is a string, it will be used as a
239 regexp. If it matches, the text in question is not a signature.
241 This can also be a list of the above values."
242 :type '(choice (integer :value 200)
244 (function :value fun)
245 (regexp :value ".*"))
246 :group 'gnus-article-signature)
248 (defcustom gnus-hidden-properties '(invisible t intangible t)
249 "Property list to use for hiding text."
251 :group 'gnus-article-hiding)
253 ;; Fixme: This isn't the right thing for mixed graphical and non-graphical
254 ;; frames in a session.
255 (defcustom gnus-article-x-face-command
256 (if (featurep 'xemacs)
257 (if (or (gnus-image-type-available-p 'xface)
258 (gnus-image-type-available-p 'pbm))
259 'gnus-display-x-face-in-from
260 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | ee -")
261 (if (gnus-image-type-available-p 'pbm)
262 'gnus-display-x-face-in-from
263 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | \
265 "*String or function to be executed to display an X-Face header.
266 If it is a string, the command will be executed in a sub-shell
267 asynchronously. The compressed face will be piped to this command."
268 :type `(choice string
269 (function-item gnus-display-x-face-in-from)
273 :group 'gnus-article-washing)
275 (defcustom gnus-article-x-face-too-ugly nil
276 "Regexp matching posters whose face shouldn't be shown automatically."
277 :type '(choice regexp (const nil))
278 :group 'gnus-article-washing)
280 (defcustom gnus-article-banner-alist nil
281 "Banner alist for stripping.
283 ((egroups . \"^[ \\t\\n]*-------------------+\\\\( \\\\(e\\\\|Yahoo! \\\\)Groups Sponsor -+\\\\)?....\\n\\\\(.+\\n\\\\)+\"))"
285 :type '(repeat (cons symbol regexp))
286 :group 'gnus-article-washing)
288 (gnus-define-group-parameter
291 "Alist of regexps (to match group names) and banner."
292 :variable-group gnus-article-washing
294 '(choice :tag "Banner"
296 (const :tag "Remove signature" signature)
297 (symbol :tag "Item in `gnus-article-banner-alist'" none)
299 (const :tag "None" nil))
301 "If non-nil, specify how to remove `banners' from articles.
303 Symbol `signature' means to remove signatures delimited by
304 `gnus-signature-separator'. Any other symbol is used to look up a
305 regular expression to match the banner in `gnus-article-banner-alist'.
306 A string is used as a regular expression to match the banner
309 (defcustom gnus-article-address-banner-alist nil
310 "Alist of mail addresses and banners.
311 Each element has the form (ADDRESS . BANNER), where ADDRESS is a regexp
312 to match a mail address in the From: header, BANNER is one of a symbol
313 `signature', an item in `gnus-article-banner-alist', a regexp and nil.
314 If ADDRESS matches author's mail address, it will remove things like
315 advertisements. For example:
317 \((\"@yoo-hoo\\\\.co\\\\.jp\\\\'\" . \"\\n_+\\nDo You Yoo-hoo!\\\\?\\n.*\\n.*\\n\"))
321 (regexp :tag "Address")
322 (choice :tag "Banner" :value nil
323 (const :tag "Remove signature" signature)
324 (symbol :tag "Item in `gnus-article-banner-alist'" none)
326 (const :tag "None" nil))))
328 :group 'gnus-article-washing)
330 (defmacro gnus-emphasis-custom-with-format (&rest body)
332 \\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\
333 \\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)"))
336 (defun gnus-emphasis-custom-value-to-external (value)
337 (gnus-emphasis-custom-with-format
338 (if (consp (car value))
339 (list (format format (car (car value)) (cdr (car value)))
341 (if (nth 1 value) 2 3)
345 (defun gnus-emphasis-custom-value-to-internal (value)
346 (gnus-emphasis-custom-with-format
347 (let ((regexp (concat "\\`"
348 (format (regexp-quote format)
349 "\\([^()]+\\)" "\\([^()]+\\)")
352 (if (string-match regexp (setq pattern (car value)))
353 (list (cons (match-string 1 pattern) (match-string 2 pattern))
358 (defcustom gnus-emphasis-alist
360 '(("\\*" "\\*" bold nil 2)
363 ("_/" "/_" underline-italic)
364 ("_\\*" "\\*_" underline-bold)
365 ("\\*/" "/\\*" bold-italic)
366 ("_\\*/" "/\\*_" underline-bold-italic))))
368 (gnus-emphasis-custom-with-format
369 (mapcar (lambda (spec)
370 (list (format format (car spec) (cadr spec))
373 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
375 '(("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
376 2 3 gnus-emphasis-underline))))
377 "*Alist that says how to fontify certain phrases.
378 Each item looks like this:
380 (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
382 The first element is a regular expression to be matched. The second
383 is a number that says what regular expression grouping used to find
384 the entire emphasized word. The third is a number that says what
385 regexp grouping should be displayed and highlighted. The fourth
386 is the face used for highlighting."
390 :format "%[Customizing Style%]\n%v"
392 (group :tag "Default"
393 :value ("" 0 0 default)
396 (let ((value (widget-get
397 (cadr (widget-get (widget-get widget :parent)
400 (if (not (eq (nth 2 value) 'default))
404 (gnus-emphasis-custom-value-to-external value))))
405 (widget-group-value-create widget))
407 (integer :format "Match group: %v")
408 (integer :format "Emphasize group: %v")
411 :value (("_" . "_") nil default)
413 (regexp :format "Start regexp: %v")
414 (regexp :format "End regexp: %v"))
415 (boolean :format "Show start and end patterns: %[%v%]\n"
416 :on " On " :off " Off ")
418 :get (lambda (symbol)
419 (mapcar 'gnus-emphasis-custom-value-to-internal
420 (default-value symbol)))
421 :set (lambda (symbol value)
422 (set-default symbol (mapcar 'gnus-emphasis-custom-value-to-external
424 :group 'gnus-article-emphasis)
426 (defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
427 "A regexp to describe whitespace which should not be emphasized.
428 Typical values are \"^[ \\t]+\\\\|[ \\t]*\\n\" and \"[ \\t]+\\\\|[ \\t]*\\n\".
429 The former avoids underlining of leading and trailing whitespace,
430 and the latter avoids underlining any whitespace at all."
432 :group 'gnus-article-emphasis
435 (defface gnus-emphasis-bold '((t (:bold t)))
436 "Face used for displaying strong emphasized text (*word*)."
437 :group 'gnus-article-emphasis)
439 (defface gnus-emphasis-italic '((t (:italic t)))
440 "Face used for displaying italic emphasized text (/word/)."
441 :group 'gnus-article-emphasis)
443 (defface gnus-emphasis-underline '((t (:underline t)))
444 "Face used for displaying underlined emphasized text (_word_)."
445 :group 'gnus-article-emphasis)
447 (defface gnus-emphasis-underline-bold '((t (:bold t :underline t)))
448 "Face used for displaying underlined bold emphasized text (_*word*_)."
449 :group 'gnus-article-emphasis)
451 (defface gnus-emphasis-underline-italic '((t (:italic t :underline t)))
452 "Face used for displaying underlined italic emphasized text (_/word/_)."
453 :group 'gnus-article-emphasis)
455 (defface gnus-emphasis-bold-italic '((t (:bold t :italic t)))
456 "Face used for displaying bold italic emphasized text (/*word*/)."
457 :group 'gnus-article-emphasis)
459 (defface gnus-emphasis-underline-bold-italic
460 '((t (:bold t :italic t :underline t)))
461 "Face used for displaying underlined bold italic emphasized text.
462 Example: (_/*word*/_)."
463 :group 'gnus-article-emphasis)
465 (defface gnus-emphasis-strikethru (if (featurep 'xemacs)
466 '((t (:strikethru t)))
467 '((t (:strike-through t))))
468 "Face used for displaying strike-through text (-word-)."
469 :group 'gnus-article-emphasis)
471 (defface gnus-emphasis-highlight-words
472 '((t (:background "black" :foreground "yellow")))
473 "Face used for displaying highlighted words."
474 :group 'gnus-article-emphasis)
476 (defcustom gnus-article-time-format "%a, %d %b %Y %T %Z"
477 "Format for display of Date headers in article bodies.
478 See `format-time-string' for the possible values.
480 The variable can also be function, which should return a complete Date
481 header. The function is called with one argument, the time, which can
482 be fed to `format-time-string'."
483 :type '(choice string function)
484 :link '(custom-manual "(gnus)Article Date")
485 :group 'gnus-article-washing)
488 (autoload 'mail-extract-address-components "mail-extr"))
490 (defcustom gnus-save-all-headers t
491 "*If non-nil, don't remove any headers before saving."
492 :group 'gnus-article-saving
495 (defcustom gnus-prompt-before-saving 'always
496 "*This variable says how much prompting is to be done when saving articles.
497 If it is nil, no prompting will be done, and the articles will be
498 saved to the default files. If this variable is `always', each and
499 every article that is saved will be preceded by a prompt, even when
500 saving large batches of articles. If this variable is neither nil not
501 `always', there the user will be prompted once for a file name for
502 each invocation of the saving commands."
503 :group 'gnus-article-saving
504 :type '(choice (item always)
505 (item :tag "never" nil)
506 (sexp :tag "once" :format "%t\n" :value t)))
508 (defcustom gnus-saved-headers gnus-visible-headers
509 "Headers to keep if `gnus-save-all-headers' is nil.
510 If `gnus-save-all-headers' is non-nil, this variable will be ignored.
511 If that variable is nil, however, all headers that match this regexp
512 will be kept while the rest will be deleted before saving."
513 :group 'gnus-article-saving
516 (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail
517 "A function to save articles in your favourite format.
518 The function must be interactively callable (in other words, it must
519 be an Emacs command).
521 Gnus provides the following functions:
523 * gnus-summary-save-in-rmail (Rmail format)
524 * gnus-summary-save-in-mail (Unix mail format)
525 * gnus-summary-save-in-folder (MH folder)
526 * gnus-summary-save-in-file (article format)
527 * gnus-summary-save-body-in-file (article body)
528 * gnus-summary-save-in-vm (use VM's folder format)
529 * gnus-summary-write-to-file (article format -- overwrite)."
530 :group 'gnus-article-saving
531 :type '(radio (function-item gnus-summary-save-in-rmail)
532 (function-item gnus-summary-save-in-mail)
533 (function-item gnus-summary-save-in-folder)
534 (function-item gnus-summary-save-in-file)
535 (function-item gnus-summary-save-body-in-file)
536 (function-item gnus-summary-save-in-vm)
537 (function-item gnus-summary-write-to-file)))
539 (defcustom gnus-rmail-save-name 'gnus-plain-save-name
540 "A function generating a file name to save articles in Rmail format.
541 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
542 :group 'gnus-article-saving
545 (defcustom gnus-mail-save-name 'gnus-plain-save-name
546 "A function generating a file name to save articles in Unix mail format.
547 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
548 :group 'gnus-article-saving
551 (defcustom gnus-folder-save-name 'gnus-folder-save-name
552 "A function generating a file name to save articles in MH folder.
553 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER."
554 :group 'gnus-article-saving
557 (defcustom gnus-file-save-name 'gnus-numeric-save-name
558 "A function generating a file name to save articles in article format.
559 The function is called with NEWSGROUP, HEADERS, and optional
561 :group 'gnus-article-saving
564 (defcustom gnus-split-methods
565 '((gnus-article-archive-name)
566 (gnus-article-nndoc-name))
567 "*Variable used to suggest where articles are to be saved.
568 For instance, if you would like to save articles related to Gnus in
569 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
570 you could set this variable to something like:
572 '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
573 (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))
575 This variable is an alist where the key is the match and the
576 value is a list of possible files to save in if the match is
579 If the match is a string, it is used as a regexp match on the
580 article. If the match is a symbol, that symbol will be funcalled
581 from the buffer of the article to be saved with the newsgroup as
582 the parameter. If it is a list, it will be evaled in the same
585 If this form or function returns a string, this string will be
586 used as a possible file name; and if it returns a non-nil list,
587 that list will be used as possible file names."
588 :group 'gnus-article-saving
589 :type '(repeat (choice (list :value (fun) function)
590 (cons :value ("" "") regexp (repeat string))
593 (defcustom gnus-page-delimiter "^\^L"
594 "*Regexp describing what to use as article page delimiters.
595 The default value is \"^\^L\", which is a form linefeed at the
596 beginning of a line."
598 :group 'gnus-article-various)
600 (defcustom gnus-article-mode-line-format "Gnus: %g [%w] %S%m"
601 "*The format specification for the article mode line.
602 See `gnus-summary-mode-line-format' for a closer description.
604 The following additional specs are available:
606 %w The article washing status.
607 %m The number of MIME parts in the article."
609 :group 'gnus-article-various)
611 (defcustom gnus-article-mode-hook nil
612 "*A hook for Gnus article mode."
614 :group 'gnus-article-various)
616 (when (featurep 'xemacs)
617 ;; Extracted from gnus-xmas-define in order to preserve user settings
618 (when (fboundp 'turn-off-scroll-in-place)
619 (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
620 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
621 (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add))
623 (defcustom gnus-article-menu-hook nil
624 "*Hook run after the creation of the article mode menu."
626 :group 'gnus-article-various)
628 (defcustom gnus-article-prepare-hook nil
629 "*A hook called after an article has been prepared in the article buffer."
631 :group 'gnus-article-various)
633 (defcustom gnus-copy-article-ignored-headers nil
634 "List of headers to be removed when copying an article.
635 Each element is a regular expression."
636 :version "23.0" ;; No Gnus
637 :type '(repeat regexp)
638 :group 'gnus-article-various)
640 (make-obsolete-variable 'gnus-article-hide-pgp-hook
641 "This variable is obsolete in Gnus 5.10.")
643 (defcustom gnus-article-button-face 'bold
644 "Face used for highlighting buttons in the article buffer.
646 An article button is a piece of text that you can activate by pressing
647 `RET' or `mouse-2' above it."
649 :group 'gnus-article-buttons)
651 (defcustom gnus-article-mouse-face 'highlight
652 "Face used for mouse highlighting in the article buffer.
654 Article buttons will be displayed in this face when the cursor is
657 :group 'gnus-article-buttons)
659 (defcustom gnus-signature-face 'gnus-signature-face
660 "Face used for highlighting a signature in the article buffer.
661 Obsolete; use the face `gnus-signature-face' for customizations instead."
663 :group 'gnus-article-highlight
664 :group 'gnus-article-signature)
666 (defface gnus-signature-face
669 "Face used for highlighting a signature in the article buffer."
670 :group 'gnus-article-highlight
671 :group 'gnus-article-signature)
673 (defface gnus-header-from-face
676 (:foreground "spring green"))
679 (:foreground "red3"))
682 "Face used for displaying from headers."
683 :group 'gnus-article-headers
684 :group 'gnus-article-highlight)
686 (defface gnus-header-subject-face
689 (:foreground "SeaGreen3"))
692 (:foreground "red4"))
694 (:bold t :italic t)))
695 "Face used for displaying subject headers."
696 :group 'gnus-article-headers
697 :group 'gnus-article-highlight)
699 (defface gnus-header-newsgroups-face
702 (:foreground "yellow" :italic t))
705 (:foreground "MidnightBlue" :italic t))
708 "Face used for displaying newsgroups headers.
709 In the default setup this face is only used for crossposted
711 :group 'gnus-article-headers
712 :group 'gnus-article-highlight)
714 (defface gnus-header-name-face
717 (:foreground "SeaGreen"))
720 (:foreground "maroon"))
723 "Face used for displaying header names."
724 :group 'gnus-article-headers
725 :group 'gnus-article-highlight)
727 (defface gnus-header-content-face
730 (:foreground "forest green" :italic t))
733 (:foreground "indianred4" :italic t))
735 (:italic t))) "Face used for displaying header content."
736 :group 'gnus-article-headers
737 :group 'gnus-article-highlight)
739 (defcustom gnus-header-face-alist
740 '(("From" nil gnus-header-from-face)
741 ("Subject" nil gnus-header-subject-face)
742 ("Newsgroups:.*," nil gnus-header-newsgroups-face)
743 ("" gnus-header-name-face gnus-header-content-face))
744 "*Controls highlighting of article headers.
746 An alist of the form (HEADER NAME CONTENT).
748 HEADER is a regular expression which should match the name of a
749 header and NAME and CONTENT are either face names or nil.
751 The name of each header field will be displayed using the face
752 specified by the first element in the list where HEADER matches
753 the header name and NAME is non-nil. Similarly, the content will
754 be displayed by the first non-nil matching CONTENT face."
755 :group 'gnus-article-headers
756 :group 'gnus-article-highlight
757 :type '(repeat (list (regexp :tag "Header")
759 (item :tag "skip" nil)
760 (face :value default))
761 (choice :tag "Content"
762 (item :tag "skip" nil)
763 (face :value default)))))
765 (defcustom gnus-article-decode-hook
766 '(article-decode-charset article-decode-encoded-words
767 article-decode-group-name article-decode-idna-rhs)
768 "*Hook run to decode charsets in articles."
769 :group 'gnus-article-headers
772 (defcustom gnus-display-mime-function 'gnus-display-mime
773 "Function to display MIME articles."
774 :group 'gnus-article-mime
777 (defvar gnus-decode-header-function 'mail-decode-encoded-word-region
778 "Function used to decode headers.")
780 (defvar gnus-article-dumbquotes-map
800 "Table for MS-to-Latin1 translation.")
802 (defcustom gnus-ignored-mime-types nil
803 "List of MIME types that should be ignored by Gnus."
805 :group 'gnus-article-mime
806 :type '(repeat regexp))
808 (defcustom gnus-unbuttonized-mime-types '(".*/.*")
809 "List of MIME types that should not be given buttons when rendered inline.
810 See also `gnus-buttonized-mime-types' which may override this variable.
811 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
813 :group 'gnus-article-mime
814 :type '(repeat regexp))
816 (defcustom gnus-buttonized-mime-types nil
817 "List of MIME types that should be given buttons when rendered inline.
818 If set, this variable overrides `gnus-unbuttonized-mime-types'.
819 To see e.g. security buttons you could set this to
820 `(\"multipart/signed\")'.
821 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
823 :group 'gnus-article-mime
824 :type '(repeat regexp))
826 (defcustom gnus-inhibit-mime-unbuttonizing nil
827 "If non-nil, all MIME parts get buttons.
828 When nil (the default value), then some MIME parts do not get buttons,
829 as described by the variables `gnus-buttonized-mime-types' and
830 `gnus-unbuttonized-mime-types'."
832 :group 'gnus-article-mime
835 (defcustom gnus-body-boundary-delimiter "_"
836 "String used to delimit header and body.
837 This variable is used by `gnus-article-treat-body-boundary' which can
838 be controlled by `gnus-treat-body-boundary'."
840 :group 'gnus-article-various
841 :type '(choice (item :tag "None" :value nil)
844 (defcustom gnus-picon-databases '("/usr/lib/picon" "/usr/local/faces"
846 "Defines the location of the faces database.
847 For information on obtaining this database of pretty pictures, please
848 see http://www.cs.indiana.edu/picons/ftp/index.html"
850 :type '(repeat directory)
851 :link '(url-link :tag "download"
852 "http://www.cs.indiana.edu/picons/ftp/index.html")
853 :link '(custom-manual "(gnus)Picons")
856 (defun gnus-picons-installed-p ()
857 "Say whether picons are installed on your machine."
858 (let ((installed nil))
859 (dolist (database gnus-picon-databases)
860 (when (file-exists-p database)
864 (defcustom gnus-article-mime-part-function nil
865 "Function called with a MIME handle as the argument.
866 This is meant for people who want to do something automatic based
867 on parts -- for instance, adding Vcard info to a database."
868 :group 'gnus-article-mime
871 (defcustom gnus-mime-multipart-functions nil
872 "An alist of MIME types to functions to display them."
874 :group 'gnus-article-mime
875 :type '(repeat (cons :format "%v" (string :tag "MIME type") function)))
877 (defcustom gnus-article-date-lapsed-new-header nil
878 "Whether the X-Sent and Date headers can coexist.
879 When using `gnus-treat-date-lapsed', the \"X-Sent:\" header will
880 either replace the old \"Date:\" header (if this variable is nil), or
881 be added below it (otherwise)."
883 :group 'gnus-article-headers
886 (defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative
887 "Function called with a MIME handle as the argument.
888 This is meant for people who want to view first matched part.
889 For `undisplayed-alternative' (default), the first undisplayed
890 part or alternative part is used. For `undisplayed', the first
891 undisplayed part is used. For a function, the first part which
892 the function return t is used. For nil, the first part is
895 :group 'gnus-article-mime
897 (item :tag "first" :value nil)
898 (item :tag "undisplayed" :value undisplayed)
899 (item :tag "undisplayed or alternative"
900 :value undisplayed-alternative)
903 (defcustom gnus-mime-action-alist
904 '(("save to file" . gnus-mime-save-part)
905 ("save and strip" . gnus-mime-save-part-and-strip)
906 ("delete part" . gnus-mime-delete-part)
907 ("display as text" . gnus-mime-inline-part)
908 ("view the part" . gnus-mime-view-part)
909 ("pipe to command" . gnus-mime-pipe-part)
910 ("toggle display" . gnus-article-press-button)
911 ("toggle display" . gnus-article-view-part-as-charset)
912 ("view as type" . gnus-mime-view-part-as-type)
913 ("view internally" . gnus-mime-view-part-internally)
914 ("view externally" . gnus-mime-view-part-externally))
915 "An alist of actions that run on the MIME attachment."
916 :group 'gnus-article-mime
917 :type '(repeat (cons (string :tag "name")
921 ;;; The treatment variables
924 (defvar gnus-part-display-hook nil
925 "Hook called on parts that are to receive treatment.")
927 (defvar gnus-article-treat-custom
928 '(choice (const :tag "Off" nil)
930 (const :tag "Header" head)
931 (const :tag "Last" last)
932 (integer :tag "Less")
933 (repeat :tag "Groups" regexp)
934 (sexp :tag "Predicate")))
936 (defvar gnus-article-treat-head-custom
937 '(choice (const :tag "Off" nil)
938 (const :tag "Header" head)))
940 (defvar gnus-article-treat-types '("text/plain")
943 (defvar gnus-inhibit-treatment nil
944 "Whether to inhibit treatment.")
946 (defcustom gnus-treat-highlight-signature '(or t (typep "text/x-vcard"))
947 "Highlight the signature.
948 Valid values are nil, t, `head', `last', an integer or a predicate.
949 See Info node `(gnus)Customizing Articles'."
950 :group 'gnus-article-treat
951 :link '(custom-manual "(gnus)Customizing Articles")
952 :type gnus-article-treat-custom)
953 (put 'gnus-treat-highlight-signature 'highlight t)
955 (defcustom gnus-treat-buttonize 100000
957 Valid values are nil, t, `head', `last', an integer or a predicate.
958 See Info node `(gnus)Customizing Articles'."
959 :group 'gnus-article-treat
960 :link '(custom-manual "(gnus)Customizing Articles")
961 :type gnus-article-treat-custom)
962 (put 'gnus-treat-buttonize 'highlight t)
964 (defcustom gnus-treat-buttonize-head 'head
965 "Add buttons to the head.
966 Valid values are nil, t, `head', `last', an integer or a predicate.
967 See Info node `(gnus)Customizing Articles' for details."
968 :group 'gnus-article-treat
969 :link '(custom-manual "(gnus)Customizing Articles")
970 :type gnus-article-treat-head-custom)
971 (put 'gnus-treat-buttonize-head 'highlight t)
973 (defcustom gnus-treat-emphasize
974 (and (or window-system
978 Valid values are nil, t, `head', `last', an integer or a predicate.
979 See Info node `(gnus)Customizing Articles' for details."
980 :group 'gnus-article-treat
981 :link '(custom-manual "(gnus)Customizing Articles")
982 :type gnus-article-treat-custom)
983 (put 'gnus-treat-emphasize 'highlight t)
985 (defcustom gnus-treat-strip-cr nil
986 "Remove carriage returns.
987 Valid values are nil, t, `head', `last', an integer or a predicate.
988 See Info node `(gnus)Customizing Articles' for details."
990 :group 'gnus-article-treat
991 :link '(custom-manual "(gnus)Customizing Articles")
992 :type gnus-article-treat-custom)
994 (defcustom gnus-treat-unsplit-urls nil
995 "Remove newlines from within URLs.
996 Valid values are nil, t, `head', `last', an integer or a predicate.
997 See Info node `(gnus)Customizing Articles' for details."
999 :group 'gnus-article-treat
1000 :link '(custom-manual "(gnus)Customizing Articles")
1001 :type gnus-article-treat-custom)
1003 (defcustom gnus-treat-leading-whitespace nil
1004 "Remove leading whitespace in headers.
1005 Valid values are nil, t, `head', `last', an integer or a predicate.
1006 See Info node `(gnus)Customizing Articles' for details."
1008 :group 'gnus-article-treat
1009 :link '(custom-manual "(gnus)Customizing Articles")
1010 :type gnus-article-treat-custom)
1012 (defcustom gnus-treat-hide-headers 'head
1014 Valid values are nil, t, `head', `last', an integer or a predicate.
1015 See Info node `(gnus)Customizing Articles' for details."
1016 :group 'gnus-article-treat
1017 :link '(custom-manual "(gnus)Customizing Articles")
1018 :type gnus-article-treat-head-custom)
1020 (defcustom gnus-treat-hide-boring-headers nil
1021 "Hide boring headers.
1022 Valid values are nil, t, `head', `last', an integer or a predicate.
1023 See Info node `(gnus)Customizing Articles' for details."
1024 :group 'gnus-article-treat
1025 :link '(custom-manual "(gnus)Customizing Articles")
1026 :type gnus-article-treat-head-custom)
1028 (defcustom gnus-treat-hide-signature nil
1029 "Hide the signature.
1030 Valid values are nil, t, `head', `last', an integer or a predicate.
1031 See Info node `(gnus)Customizing Articles' for details."
1032 :group 'gnus-article-treat
1033 :link '(custom-manual "(gnus)Customizing Articles")
1034 :type gnus-article-treat-custom)
1036 (defcustom gnus-treat-fill-article nil
1038 Valid values are nil, t, `head', `last', an integer or a predicate.
1039 See Info node `(gnus)Customizing Articles' for details."
1040 :group 'gnus-article-treat
1041 :link '(custom-manual "(gnus)Customizing Articles")
1042 :type gnus-article-treat-custom)
1044 (defcustom gnus-treat-hide-citation nil
1046 Valid values are nil, t, `head', `last', an integer or a predicate.
1047 See Info node `(gnus)Customizing Articles' for details."
1048 :group 'gnus-article-treat
1049 :link '(custom-manual "(gnus)Customizing Articles")
1050 :type gnus-article-treat-custom)
1052 (defcustom gnus-treat-hide-citation-maybe nil
1054 Valid values are nil, t, `head', `last', an integer or a predicate.
1055 See Info node `(gnus)Customizing Articles' for details."
1056 :group 'gnus-article-treat
1057 :link '(custom-manual "(gnus)Customizing Articles")
1058 :type gnus-article-treat-custom)
1060 (defcustom gnus-treat-strip-list-identifiers 'head
1061 "Strip list identifiers from `gnus-list-identifiers`.
1062 Valid values are nil, t, `head', `last', an integer or a predicate.
1063 See Info node `(gnus)Customizing Articles' for details."
1065 :group 'gnus-article-treat
1066 :link '(custom-manual "(gnus)Customizing Articles")
1067 :type gnus-article-treat-custom)
1069 (make-obsolete-variable 'gnus-treat-strip-pgp
1070 "This option is obsolete in Gnus 5.10.")
1072 (defcustom gnus-treat-strip-pem nil
1073 "Strip PEM signatures.
1074 Valid values are nil, t, `head', `last', an integer or a predicate.
1075 See Info node `(gnus)Customizing Articles' for details."
1076 :group 'gnus-article-treat
1077 :link '(custom-manual "(gnus)Customizing Articles")
1078 :type gnus-article-treat-custom)
1080 (defcustom gnus-treat-strip-banner t
1081 "Strip banners from articles.
1082 The banner to be stripped is specified in the `banner' group parameter.
1083 Valid values are nil, t, `head', `last', an integer or a predicate.
1084 See Info node `(gnus)Customizing Articles' for details."
1085 :group 'gnus-article-treat
1086 :link '(custom-manual "(gnus)Customizing Articles")
1087 :type gnus-article-treat-custom)
1089 (defcustom gnus-treat-highlight-headers 'head
1090 "Highlight the headers.
1091 Valid values are nil, t, `head', `last', an integer or a predicate.
1092 See Info node `(gnus)Customizing Articles' for details."
1093 :group 'gnus-article-treat
1094 :link '(custom-manual "(gnus)Customizing Articles")
1095 :type gnus-article-treat-head-custom)
1096 (put 'gnus-treat-highlight-headers 'highlight t)
1098 (defcustom gnus-treat-highlight-citation t
1099 "Highlight cited text.
1100 Valid values are nil, t, `head', `last', an integer or a predicate.
1101 See Info node `(gnus)Customizing Articles' for details."
1102 :group 'gnus-article-treat
1103 :link '(custom-manual "(gnus)Customizing Articles")
1104 :type gnus-article-treat-custom)
1105 (put 'gnus-treat-highlight-citation 'highlight t)
1107 (defcustom gnus-treat-date-ut nil
1108 "Display the Date in UT (GMT).
1109 Valid values are nil, t, `head', `last', an integer or a predicate.
1110 See Info node `(gnus)Customizing Articles' for details."
1111 :group 'gnus-article-treat
1112 :link '(custom-manual "(gnus)Customizing Articles")
1113 :type gnus-article-treat-head-custom)
1115 (defcustom gnus-treat-date-local nil
1116 "Display the Date in the local timezone.
1117 Valid values are nil, t, `head', `last', an integer or a predicate.
1118 See Info node `(gnus)Customizing Articles' for details."
1119 :group 'gnus-article-treat
1120 :link '(custom-manual "(gnus)Customizing Articles")
1121 :type gnus-article-treat-head-custom)
1123 (defcustom gnus-treat-date-english nil
1124 "Display the Date in a format that can be read aloud in English.
1125 Valid values are nil, t, `head', `last', an integer or a predicate.
1126 See Info node `(gnus)Customizing Articles' for details."
1128 :group 'gnus-article-treat
1129 :link '(custom-manual "(gnus)Customizing Articles")
1130 :type gnus-article-treat-head-custom)
1132 (defcustom gnus-treat-date-lapsed nil
1133 "Display the Date header in a way that says how much time has elapsed.
1134 Valid values are nil, t, `head', `last', an integer or a predicate.
1135 See Info node `(gnus)Customizing Articles' for details."
1136 :group 'gnus-article-treat
1137 :link '(custom-manual "(gnus)Customizing Articles")
1138 :type gnus-article-treat-head-custom)
1140 (defcustom gnus-treat-date-original nil
1141 "Display the date in the original timezone.
1142 Valid values are nil, t, `head', `last', an integer or a predicate.
1143 See Info node `(gnus)Customizing Articles' for details."
1144 :group 'gnus-article-treat
1145 :link '(custom-manual "(gnus)Customizing Articles")
1146 :type gnus-article-treat-head-custom)
1148 (defcustom gnus-treat-date-iso8601 nil
1149 "Display the date in the ISO8601 format.
1150 Valid values are nil, t, `head', `last', an integer or a predicate.
1151 See Info node `(gnus)Customizing Articles' for details."
1153 :group 'gnus-article-treat
1154 :link '(custom-manual "(gnus)Customizing Articles")
1155 :type gnus-article-treat-head-custom)
1157 (defcustom gnus-treat-date-user-defined nil
1158 "Display the date in a user-defined format.
1159 The format is defined by the `gnus-article-time-format' variable.
1160 Valid values are nil, t, `head', `last', an integer or a predicate.
1161 See Info node `(gnus)Customizing Articles' for details."
1162 :group 'gnus-article-treat
1163 :link '(custom-manual "(gnus)Customizing Articles")
1164 :type gnus-article-treat-head-custom)
1166 (defcustom gnus-treat-strip-headers-in-body t
1167 "Strip the X-No-Archive header line from the beginning of the body.
1168 Valid values are nil, t, `head', `last', an integer or a predicate.
1169 See Info node `(gnus)Customizing Articles' for details."
1171 :group 'gnus-article-treat
1172 :link '(custom-manual "(gnus)Customizing Articles")
1173 :type gnus-article-treat-custom)
1175 (defcustom gnus-treat-strip-trailing-blank-lines nil
1176 "Strip trailing blank lines.
1177 Valid values are nil, t, `head', `last', an integer or a predicate.
1178 See Info node `(gnus)Customizing Articles' for details."
1179 :group 'gnus-article-treat
1180 :link '(custom-manual "(gnus)Customizing Articles")
1181 :type gnus-article-treat-custom)
1183 (defcustom gnus-treat-strip-leading-blank-lines nil
1184 "Strip leading blank lines.
1185 Valid values are nil, t, `head', `last', an integer or a predicate.
1186 See Info node `(gnus)Customizing Articles' for details."
1187 :group 'gnus-article-treat
1188 :link '(custom-manual "(gnus)Customizing Articles")
1189 :type gnus-article-treat-custom)
1191 (defcustom gnus-treat-strip-multiple-blank-lines nil
1192 "Strip multiple blank lines.
1193 Valid values are nil, t, `head', `last', an integer or a predicate.
1194 See Info node `(gnus)Customizing Articles' for details."
1195 :group 'gnus-article-treat
1196 :link '(custom-manual "(gnus)Customizing Articles")
1197 :type gnus-article-treat-custom)
1199 (defcustom gnus-treat-unfold-headers 'head
1200 "Unfold folded header lines.
1201 Valid values are nil, t, `head', `last', an integer or a predicate.
1202 See Info node `(gnus)Customizing Articles' for details."
1204 :group 'gnus-article-treat
1205 :link '(custom-manual "(gnus)Customizing Articles")
1206 :type gnus-article-treat-custom)
1208 (defcustom gnus-treat-fold-headers nil
1210 Valid values are nil, t, `head', `last', an integer or a predicate.
1211 See Info node `(gnus)Customizing Articles' for details."
1213 :group 'gnus-article-treat
1214 :link '(custom-manual "(gnus)Customizing Articles")
1215 :type gnus-article-treat-custom)
1217 (defcustom gnus-treat-fold-newsgroups 'head
1218 "Fold the Newsgroups and Followup-To headers.
1219 Valid values are nil, t, `head', `last', an integer or a predicate.
1220 See Info node `(gnus)Customizing Articles' for details."
1222 :group 'gnus-article-treat
1223 :link '(custom-manual "(gnus)Customizing Articles")
1224 :type gnus-article-treat-custom)
1226 (defcustom gnus-treat-overstrike t
1227 "Treat overstrike highlighting.
1228 Valid values are nil, t, `head', `last', an integer or a predicate.
1229 See Info node `(gnus)Customizing Articles' for details."
1230 :group 'gnus-article-treat
1231 :link '(custom-manual "(gnus)Customizing Articles")
1232 :type gnus-article-treat-custom)
1233 (put 'gnus-treat-overstrike 'highlight t)
1235 (defcustom gnus-treat-ansi-sequences (if (locate-library "ansi-color") t)
1236 "Treat ANSI SGR control sequences.
1237 Valid values are nil, t, `head', `last', an integer or a predicate.
1238 See Info node `(gnus)Customizing Articles' for details."
1239 :group 'gnus-article-treat
1240 :link '(custom-manual "(gnus)Customizing Articles")
1241 :type gnus-article-treat-custom)
1243 (make-obsolete-variable 'gnus-treat-display-xface
1244 'gnus-treat-display-x-face)
1246 (defcustom gnus-treat-display-x-face
1247 (and (not noninteractive)
1248 (or (and (fboundp 'image-type-available-p)
1249 (image-type-available-p 'xbm)
1250 (string-match "^0x" (shell-command-to-string "uncompface"))
1251 (executable-find "icontopbm"))
1252 (and (featurep 'xemacs)
1255 "Display X-Face headers.
1256 Valid values are nil, t, `head', `last', an integer or a predicate.
1257 See Info node `(gnus)Customizing Articles' and Info node
1258 `(gnus)X-Face' for details."
1259 :group 'gnus-article-treat
1261 :link '(custom-manual "(gnus)Customizing Articles")
1262 :link '(custom-manual "(gnus)X-Face")
1263 :type gnus-article-treat-head-custom
1264 :set (lambda (symbol value)
1267 (cond ((or (boundp symbol) (get symbol 'saved-value))
1269 ((boundp 'gnus-treat-display-xface)
1271 ** gnus-treat-display-xface is an obsolete variable;\
1272 use gnus-treat-display-x-face instead")
1273 (default-value 'gnus-treat-display-xface))
1274 ((get 'gnus-treat-display-xface 'saved-value)
1276 ** gnus-treat-display-xface is an obsolete variable;\
1277 use gnus-treat-display-x-face instead")
1278 (eval (car (get 'gnus-treat-display-xface 'saved-value))))
1281 (put 'gnus-treat-display-x-face 'highlight t)
1283 (defcustom gnus-treat-display-face
1284 (and (not noninteractive)
1285 (or (and (fboundp 'image-type-available-p)
1286 (image-type-available-p 'png))
1287 (and (featurep 'xemacs)
1290 "Display Face headers.
1291 Valid values are nil, t, `head', `last', an integer or a predicate.
1292 See Info node `(gnus)Customizing Articles' and Info node
1293 `(gnus)X-Face' for details."
1294 :group 'gnus-article-treat
1296 :link '(custom-manual "(gnus)Customizing Articles")
1297 :link '(custom-manual "(gnus)X-Face")
1298 :type gnus-article-treat-head-custom)
1299 (put 'gnus-treat-display-face 'highlight t)
1301 (defcustom gnus-treat-display-smileys
1302 (if (or (and (featurep 'xemacs)
1304 (and (fboundp 'image-type-available-p)
1305 (image-type-available-p 'pbm)))
1308 Valid values are nil, t, `head', `last', an integer or a predicate.
1309 See Info node `(gnus)Customizing Articles' and Info node
1310 `(gnus)Smileys' for details."
1311 :group 'gnus-article-treat
1313 :link '(custom-manual "(gnus)Customizing Articles")
1314 :link '(custom-manual "(gnus)Smileys")
1315 :type gnus-article-treat-custom)
1316 (put 'gnus-treat-display-smileys 'highlight t)
1318 (defcustom gnus-treat-from-picon
1319 (if (and (gnus-image-type-available-p 'xpm)
1320 (gnus-picons-installed-p))
1322 "Display picons in the From header.
1323 Valid values are nil, t, `head', `last', an integer or a predicate.
1324 See Info node `(gnus)Customizing Articles' and Info node
1325 `(gnus)Picons' for details."
1327 :group 'gnus-article-treat
1329 :link '(custom-manual "(gnus)Customizing Articles")
1330 :link '(custom-manual "(gnus)Picons")
1331 :type gnus-article-treat-head-custom)
1332 (put 'gnus-treat-from-picon 'highlight t)
1334 (defcustom gnus-treat-mail-picon
1335 (if (and (gnus-image-type-available-p 'xpm)
1336 (gnus-picons-installed-p))
1338 "Display picons in To and Cc headers.
1339 Valid values are nil, t, `head', `last', an integer or a predicate.
1340 See Info node `(gnus)Customizing Articles' and Info node
1341 `(gnus)Picons' for details."
1343 :group 'gnus-article-treat
1345 :link '(custom-manual "(gnus)Customizing Articles")
1346 :link '(custom-manual "(gnus)Picons")
1347 :type gnus-article-treat-head-custom)
1348 (put 'gnus-treat-mail-picon 'highlight t)
1350 (defcustom gnus-treat-newsgroups-picon
1351 (if (and (gnus-image-type-available-p 'xpm)
1352 (gnus-picons-installed-p))
1354 "Display picons in the Newsgroups and Followup-To headers.
1355 Valid values are nil, t, `head', `last', an integer or a predicate.
1356 See Info node `(gnus)Customizing Articles' and Info node
1357 `(gnus)Picons' for details."
1359 :group 'gnus-article-treat
1361 :link '(custom-manual "(gnus)Customizing Articles")
1362 :link '(custom-manual "(gnus)Picons")
1363 :type gnus-article-treat-head-custom)
1364 (put 'gnus-treat-newsgroups-picon 'highlight t)
1366 (defcustom gnus-treat-body-boundary
1367 (if (and (eq window-system 'x)
1368 (or gnus-treat-newsgroups-picon
1369 gnus-treat-mail-picon
1370 gnus-treat-from-picon))
1372 "Draw a boundary at the end of the headers.
1373 Valid values are nil and `head'.
1374 See Info node `(gnus)Customizing Articles' for details."
1376 :group 'gnus-article-treat
1377 :link '(custom-manual "(gnus)Customizing Articles")
1378 :type gnus-article-treat-head-custom)
1380 (defcustom gnus-treat-capitalize-sentences nil
1381 "Capitalize sentence-starting words.
1382 Valid values are nil, t, `head', `last', an integer or a predicate.
1383 See Info node `(gnus)Customizing Articles' for details."
1385 :group 'gnus-article-treat
1386 :link '(custom-manual "(gnus)Customizing Articles")
1387 :type gnus-article-treat-custom)
1389 (defcustom gnus-treat-wash-html nil
1391 Valid values are nil, t, `head', `last', an integer or a predicate.
1392 See Info node `(gnus)Customizing Articles' for details."
1394 :group 'gnus-article-treat
1395 :link '(custom-manual "(gnus)Customizing Articles")
1396 :type gnus-article-treat-custom)
1398 (defcustom gnus-treat-fill-long-lines nil
1400 Valid values are nil, t, `head', `last', an integer or a predicate.
1401 See Info node `(gnus)Customizing Articles' for details."
1402 :group 'gnus-article-treat
1403 :link '(custom-manual "(gnus)Customizing Articles")
1404 :type gnus-article-treat-custom)
1406 (defcustom gnus-treat-play-sounds nil
1408 Valid values are nil, t, `head', `last', an integer or a predicate.
1409 See Info node `(gnus)Customizing Articles' for details."
1411 :group 'gnus-article-treat
1412 :link '(custom-manual "(gnus)Customizing Articles")
1413 :type gnus-article-treat-custom)
1415 (defcustom gnus-treat-translate nil
1416 "Translate articles from one language to another.
1417 Valid values are nil, t, `head', `last', an integer or a predicate.
1418 See Info node `(gnus)Customizing Articles' for details."
1420 :group 'gnus-article-treat
1421 :link '(custom-manual "(gnus)Customizing Articles")
1422 :type gnus-article-treat-custom)
1424 (defcustom gnus-treat-x-pgp-sig nil
1426 To automatically treat X-PGP-Sig, set it to head.
1427 Valid values are nil, t, `head', `last', an integer or a predicate.
1428 See Info node `(gnus)Customizing Articles' for details."
1430 :group 'gnus-article-treat
1431 :group 'mime-security
1432 :link '(custom-manual "(gnus)Customizing Articles")
1433 :type gnus-article-treat-custom)
1435 (defvar gnus-article-encrypt-protocol-alist
1436 '(("PGP" . mml2015-self-encrypt)))
1438 ;; Set to nil if more than one protocol added to
1439 ;; gnus-article-encrypt-protocol-alist.
1440 (defcustom gnus-article-encrypt-protocol "PGP"
1441 "The protocol used for encrypt articles.
1442 It is a string, such as \"PGP\". If nil, ask user."
1445 :group 'mime-security)
1447 (defvar gnus-article-wash-function nil
1448 "Function used for converting HTML into text.")
1450 (defcustom gnus-use-idna (and (condition-case nil (require 'idna) (file-error))
1451 (mm-coding-system-p 'utf-8)
1452 (executable-find idna-program))
1453 "Whether IDNA decoding of headers is used when viewing messages.
1454 This requires GNU Libidn, and by default only enabled if it is found."
1456 :group 'gnus-article-headers
1459 (defcustom gnus-article-over-scroll nil
1460 "If non-nil, allow scrolling the article buffer even when there no more text."
1462 :group 'gnus-article
1465 ;;; Internal variables
1467 (defvar gnus-english-month-names
1468 '("January" "February" "March" "April" "May" "June" "July" "August"
1469 "September" "October" "November" "December"))
1471 (defvar gnus-button-regexp nil)
1472 (defvar gnus-button-marker-list nil)
1473 ;; Regexp matching any of the regexps from `gnus-button-alist'.
1475 (defvar gnus-button-last nil)
1476 ;; The value of `gnus-button-alist' when `gnus-button-regexp' was build.
1478 (defvar article-goto-body-goes-to-point-min-p nil)
1479 (defvar gnus-article-wash-types nil)
1480 (defvar gnus-article-emphasis-alist nil)
1481 (defvar gnus-article-image-alist nil)
1483 (defvar gnus-article-mime-handle-alist-1 nil)
1484 (defvar gnus-treatment-function-alist
1485 '((gnus-treat-x-pgp-sig gnus-article-verify-x-pgp-sig)
1486 (gnus-treat-strip-banner gnus-article-strip-banner)
1487 (gnus-treat-strip-headers-in-body gnus-article-strip-headers-in-body)
1488 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1489 (gnus-treat-buttonize gnus-article-add-buttons)
1490 (gnus-treat-fill-article gnus-article-fill-cited-article)
1491 (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
1492 (gnus-treat-strip-cr gnus-article-remove-cr)
1493 (gnus-treat-unsplit-urls gnus-article-unsplit-urls)
1494 (gnus-treat-date-ut gnus-article-date-ut)
1495 (gnus-treat-date-local gnus-article-date-local)
1496 (gnus-treat-date-english gnus-article-date-english)
1497 (gnus-treat-date-lapsed gnus-article-date-lapsed)
1498 (gnus-treat-date-original gnus-article-date-original)
1499 (gnus-treat-date-user-defined gnus-article-date-user)
1500 (gnus-treat-date-iso8601 gnus-article-date-iso8601)
1501 (gnus-treat-display-x-face gnus-article-display-x-face)
1502 (gnus-treat-display-face gnus-article-display-face)
1503 (gnus-treat-hide-headers gnus-article-maybe-hide-headers)
1504 (gnus-treat-hide-boring-headers gnus-article-hide-boring-headers)
1505 (gnus-treat-hide-signature gnus-article-hide-signature)
1506 (gnus-treat-strip-list-identifiers gnus-article-hide-list-identifiers)
1507 (gnus-treat-leading-whitespace gnus-article-remove-leading-whitespace)
1508 (gnus-treat-strip-pem gnus-article-hide-pem)
1509 (gnus-treat-from-picon gnus-treat-from-picon)
1510 (gnus-treat-mail-picon gnus-treat-mail-picon)
1511 (gnus-treat-newsgroups-picon gnus-treat-newsgroups-picon)
1512 (gnus-treat-highlight-headers gnus-article-highlight-headers)
1513 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1514 (gnus-treat-strip-trailing-blank-lines
1515 gnus-article-remove-trailing-blank-lines)
1516 (gnus-treat-strip-leading-blank-lines
1517 gnus-article-strip-leading-blank-lines)
1518 (gnus-treat-strip-multiple-blank-lines
1519 gnus-article-strip-multiple-blank-lines)
1520 (gnus-treat-overstrike gnus-article-treat-overstrike)
1521 (gnus-treat-ansi-sequences gnus-article-treat-ansi-sequences)
1522 (gnus-treat-unfold-headers gnus-article-treat-unfold-headers)
1523 (gnus-treat-fold-headers gnus-article-treat-fold-headers)
1524 (gnus-treat-fold-newsgroups gnus-article-treat-fold-newsgroups)
1525 (gnus-treat-buttonize-head gnus-article-add-buttons-to-head)
1526 (gnus-treat-display-smileys gnus-treat-smiley)
1527 (gnus-treat-capitalize-sentences gnus-article-capitalize-sentences)
1528 (gnus-treat-wash-html gnus-article-wash-html)
1529 (gnus-treat-emphasize gnus-article-emphasize)
1530 (gnus-treat-hide-citation gnus-article-hide-citation)
1531 (gnus-treat-hide-citation-maybe gnus-article-hide-citation-maybe)
1532 (gnus-treat-highlight-citation gnus-article-highlight-citation)
1533 (gnus-treat-body-boundary gnus-article-treat-body-boundary)
1534 (gnus-treat-play-sounds gnus-earcon-display)))
1536 (defvar gnus-article-mime-handle-alist nil)
1537 (defvar article-lapsed-timer nil)
1538 (defvar gnus-article-current-summary nil)
1540 (defvar gnus-article-mode-syntax-table
1541 (let ((table (copy-syntax-table text-mode-syntax-table)))
1542 ;; This causes the citation match run O(2^n).
1543 ;; (modify-syntax-entry ?- "w" table)
1544 (modify-syntax-entry ?> ")<" table)
1545 (modify-syntax-entry ?< "(>" table)
1546 ;; make M-. in article buffers work for `foo' strings
1547 (modify-syntax-entry ?' " " table)
1548 (modify-syntax-entry ?` " " table)
1550 "Syntax table used in article mode buffers.
1551 Initialized from `text-mode-syntax-table.")
1553 (defvar gnus-save-article-buffer nil)
1555 (defvar gnus-article-mode-line-format-alist
1556 (nconc '((?w (gnus-article-wash-status) ?s)
1557 (?m (gnus-article-mime-part-status) ?s))
1558 gnus-summary-mode-line-format-alist))
1560 (defvar gnus-number-of-articles-to-be-saved nil)
1562 (defvar gnus-inhibit-hiding nil)
1564 (defvar gnus-article-edit-mode nil)
1566 ;;; Macros for dealing with the article buffer.
1568 (defmacro gnus-with-article-headers (&rest forms)
1570 (set-buffer gnus-article-buffer)
1572 (let ((inhibit-read-only t)
1573 (inhibit-point-motion-hooks t)
1574 (case-fold-search t))
1575 (article-narrow-to-head)
1578 (put 'gnus-with-article-headers 'lisp-indent-function 0)
1579 (put 'gnus-with-article-headers 'edebug-form-spec '(body))
1581 (defmacro gnus-with-article-buffer (&rest forms)
1583 (set-buffer gnus-article-buffer)
1584 (let ((inhibit-read-only t))
1587 (put 'gnus-with-article-buffer 'lisp-indent-function 0)
1588 (put 'gnus-with-article-buffer 'edebug-form-spec '(body))
1590 (defun gnus-article-goto-header (header)
1591 "Go to HEADER, which is a regular expression."
1592 (re-search-forward (concat "^\\(" header "\\):") nil t))
1594 (defsubst gnus-article-hide-text (b e props)
1595 "Set text PROPS on the B to E region, extending `intangible' 1 past B."
1596 (gnus-add-text-properties-when 'article-type nil b e props)
1597 (when (memq 'intangible props)
1599 (max (1- b) (point-min))
1600 b 'intangible (cddr (memq 'intangible props)))))
1602 (defsubst gnus-article-unhide-text (b e)
1603 "Remove hidden text properties from region between B and E."
1604 (remove-text-properties b e gnus-hidden-properties)
1605 (when (memq 'intangible gnus-hidden-properties)
1606 (put-text-property (max (1- b) (point-min))
1607 b 'intangible nil)))
1609 (defun gnus-article-hide-text-type (b e type)
1610 "Hide text of TYPE between B and E."
1611 (gnus-add-wash-type type)
1612 (gnus-article-hide-text
1613 b e (cons 'article-type (cons type gnus-hidden-properties))))
1615 (defun gnus-article-unhide-text-type (b e type)
1616 "Unhide text of TYPE between B and E."
1617 (gnus-delete-wash-type type)
1618 (remove-text-properties
1619 b e (cons 'article-type (cons type gnus-hidden-properties)))
1620 (when (memq 'intangible gnus-hidden-properties)
1621 (put-text-property (max (1- b) (point-min))
1622 b 'intangible nil)))
1624 (defun gnus-article-hide-text-of-type (type)
1625 "Hide text of TYPE in the current buffer."
1627 (let ((b (point-min))
1629 (while (setq b (text-property-any b e 'article-type type))
1630 (add-text-properties b (incf b) gnus-hidden-properties)))))
1632 (defun gnus-article-delete-text-of-type (type)
1633 "Delete text of TYPE in the current buffer."
1635 (let ((b (point-min)))
1636 (while (setq b (text-property-any b (point-max) 'article-type type))
1638 b (or (text-property-not-all b (point-max) 'article-type type)
1641 (defun gnus-article-delete-invisible-text ()
1642 "Delete all invisible text in the current buffer."
1644 (let ((b (point-min)))
1645 (while (setq b (text-property-any b (point-max) 'invisible t))
1647 b (or (text-property-not-all b (point-max) 'invisible t)
1650 (defun gnus-article-text-type-exists-p (type)
1651 "Say whether any text of type TYPE exists in the buffer."
1652 (text-property-any (point-min) (point-max) 'article-type type))
1654 (defsubst gnus-article-header-rank ()
1655 "Give the rank of the string HEADER as given by `gnus-sorted-header-list'."
1656 (let ((list gnus-sorted-header-list)
1659 (if (looking-at (car list))
1661 (setq list (cdr list))
1665 (defun article-hide-headers (&optional arg delete)
1666 "Hide unwanted headers and possibly sort them as well."
1668 ;; This function might be inhibited.
1669 (unless gnus-inhibit-hiding
1670 (let ((inhibit-read-only nil)
1671 (case-fold-search t)
1672 (max (1+ (length gnus-sorted-header-list)))
1673 (inhibit-point-motion-hooks t)
1674 (cur (current-buffer))
1675 ignored visible beg)
1677 ;; `gnus-ignored-headers' and `gnus-visible-headers' may be
1678 ;; group parameters, so we should go to the summary buffer.
1681 (progn (set-buffer gnus-summary-buffer) t)
1683 (setq ignored (when (not gnus-visible-headers)
1684 (cond ((stringp gnus-ignored-headers)
1685 gnus-ignored-headers)
1686 ((listp gnus-ignored-headers)
1687 (mapconcat 'identity
1688 gnus-ignored-headers
1690 visible (cond ((stringp gnus-visible-headers)
1691 gnus-visible-headers)
1692 ((and gnus-visible-headers
1693 (listp gnus-visible-headers))
1694 (mapconcat 'identity
1695 gnus-visible-headers
1699 ;; First we narrow to just the headers.
1700 (article-narrow-to-head)
1701 ;; Hide any "From " lines at the beginning of (mail) articles.
1702 (while (looking-at "From ")
1705 (delete-region (point-min) (point)))
1706 ;; Then treat the rest of the header lines.
1707 ;; Then we use the two regular expressions
1708 ;; `gnus-ignored-headers' and `gnus-visible-headers' to
1709 ;; select which header lines is to remain visible in the
1711 (while (re-search-forward "^[^ \t:]*:" nil t)
1713 ;; Mark the rank of the header.
1715 (point) (1+ (point)) 'message-rank
1716 (if (or (and visible (looking-at visible))
1718 (not (looking-at ignored))))
1719 (gnus-article-header-rank)
1722 (message-sort-headers-1)
1723 (when (setq beg (text-property-any
1724 (point-min) (point-max) 'message-rank (+ 2 max)))
1725 ;; We delete the unwanted headers.
1726 (gnus-add-wash-type 'headers)
1727 (add-text-properties (point-min) (+ 5 (point-min))
1728 '(article-type headers dummy-invisible t))
1729 (delete-region beg (point-max))))))))
1731 (defun article-hide-boring-headers (&optional arg)
1732 "Toggle hiding of headers that aren't very interesting.
1733 If given a negative prefix, always show; if given a positive prefix,
1735 (interactive (gnus-article-hidden-arg))
1736 (when (and (not (gnus-article-check-hidden-text 'boring-headers arg))
1737 (not gnus-show-all-headers))
1740 (let ((inhibit-read-only t)
1741 (inhibit-point-motion-hooks t))
1742 (article-narrow-to-head)
1743 (dolist (elem gnus-boring-article-headers)
1744 (goto-char (point-min))
1746 ;; Hide empty headers.
1748 (while (re-search-forward "^[^: \t]+:[ \t]*\n[^ \t]" nil t)
1750 (gnus-article-hide-text-type
1754 (if (re-search-forward "^[^ \t]" nil t)
1758 ;; Hide boring Newsgroups header.
1759 ((eq elem 'newsgroups)
1760 (when (gnus-string-equal
1761 (gnus-fetch-field "newsgroups")
1762 (gnus-group-real-name
1763 (if (boundp 'gnus-newsgroup-name)
1766 (gnus-article-hide-header "newsgroups")))
1767 ((eq elem 'to-address)
1768 (let ((to (message-fetch-field "to"))
1770 (gnus-parameter-to-address
1771 (if (boundp 'gnus-newsgroup-name)
1772 gnus-newsgroup-name ""))))
1773 (when (and to to-address
1776 ;; only one address in To
1777 (nth 1 (mail-extract-address-components to))
1779 (gnus-article-hide-header "to"))))
1781 (let ((to (message-fetch-field "to"))
1783 (gnus-parameter-to-list
1784 (if (boundp 'gnus-newsgroup-name)
1785 gnus-newsgroup-name ""))))
1786 (when (and to to-list
1789 ;; only one address in To
1790 (nth 1 (mail-extract-address-components to))
1792 (gnus-article-hide-header "to"))))
1794 (let ((cc (message-fetch-field "cc"))
1796 (gnus-parameter-to-list
1797 (if (boundp 'gnus-newsgroup-name)
1798 gnus-newsgroup-name ""))))
1799 (when (and cc to-list
1802 ;; only one address in CC
1803 (nth 1 (mail-extract-address-components cc))
1805 (gnus-article-hide-header "cc"))))
1806 ((eq elem 'followup-to)
1807 (when (gnus-string-equal
1808 (message-fetch-field "followup-to")
1809 (message-fetch-field "newsgroups"))
1810 (gnus-article-hide-header "followup-to")))
1811 ((eq elem 'reply-to)
1812 (if (gnus-group-find-parameter
1813 gnus-newsgroup-name 'broken-reply-to)
1814 (gnus-article-hide-header "reply-to")
1815 (let ((from (message-fetch-field "from"))
1816 (reply-to (message-fetch-field "reply-to")))
1823 (lambda (x) (downcase (cadr x)))
1824 (mail-extract-address-components from t))
1827 (lambda (x) (downcase (cadr x)))
1828 (mail-extract-address-components reply-to t))
1830 (gnus-article-hide-header "reply-to")))))
1832 (let ((date (message-fetch-field "date")))
1834 (< (days-between (current-time-string) date)
1836 (gnus-article-hide-header "date"))))
1838 (let ((to (message-fetch-field "to"))
1839 (cc (message-fetch-field "cc")))
1840 (when (> (length to) 1024)
1841 (gnus-article-hide-header "to"))
1842 (when (> (length cc) 1024)
1843 (gnus-article-hide-header "cc"))))
1847 (goto-char (point-min))
1848 (while (re-search-forward "^to:" nil t)
1849 (setq to-count (1+ to-count)))
1850 (when (> to-count 1)
1851 (while (> to-count 0)
1852 (goto-char (point-min))
1854 (re-search-forward "^to:" nil nil to-count)
1856 (narrow-to-region (point) (point-max))
1857 (gnus-article-hide-header "to"))
1858 (setq to-count (1- to-count))))
1859 (goto-char (point-min))
1860 (while (re-search-forward "^cc:" nil t)
1861 (setq cc-count (1+ cc-count)))
1862 (when (> cc-count 1)
1863 (while (> cc-count 0)
1864 (goto-char (point-min))
1866 (re-search-forward "^cc:" nil nil cc-count)
1868 (narrow-to-region (point) (point-max))
1869 (gnus-article-hide-header "cc"))
1870 (setq cc-count (1- cc-count)))))))))))))
1872 (defun gnus-article-hide-header (header)
1874 (goto-char (point-min))
1875 (when (re-search-forward (concat "^" header ":") nil t)
1876 (gnus-article-hide-text-type
1880 (if (re-search-forward "^[^ \t]" nil t)
1885 (defvar gnus-article-normalized-header-length 40
1886 "Length of normalized headers.")
1888 (defun article-normalize-headers ()
1889 "Make all header lines 40 characters long."
1891 (let ((inhibit-read-only t)
1895 (article-narrow-to-head)
1898 ((< (setq column (- (point-at-eol) (point)))
1899 gnus-article-normalized-header-length)
1901 (insert (make-string
1902 (- gnus-article-normalized-header-length column)
1904 ((> column gnus-article-normalized-header-length)
1905 (gnus-put-text-property
1907 (forward-char gnus-article-normalized-header-length)
1914 (forward-line 1))))))
1916 (defun article-treat-dumbquotes ()
1917 "Translate M****s*** sm*rtq**t*s and other symbols into proper text.
1918 Note that this function guesses whether a character is a sm*rtq**t* or
1919 not, so it should only be used interactively.
1921 Sm*rtq**t*s are M****s***'s unilateral extension to the
1922 iso-8859-1 character map in an attempt to provide more quoting
1923 characters. If you see something like \\222 or \\264 where
1924 you're expecting some kind of apostrophe or quotation mark, then
1927 (article-translate-strings gnus-article-dumbquotes-map))
1929 (defun article-translate-characters (from to)
1930 "Translate all characters in the body of the article according to FROM and TO.
1931 FROM is a string of characters to translate from; to is a string of
1932 characters to translate to."
1934 (when (article-goto-body)
1935 (let ((inhibit-read-only t)
1936 (x (make-string 225 ?x))
1938 (while (< (incf i) (length x))
1941 (while (< i (length from))
1942 (aset x (aref from i) (aref to i))
1944 (translate-region (point) (point-max) x)))))
1946 (defun article-translate-strings (map)
1947 "Translate all string in the body of the article according to MAP.
1948 MAP is an alist where the elements are on the form (\"from\" \"to\")."
1950 (when (article-goto-body)
1951 (let ((inhibit-read-only t))
1954 (while (search-forward (car elem) nil t)
1955 (replace-match (cadr elem)))))))))
1957 (defun article-treat-overstrike ()
1958 "Translate overstrikes into bold text."
1961 (when (article-goto-body)
1962 (let ((inhibit-read-only t))
1963 (while (search-forward "\b" nil t)
1964 (let ((next (char-after))
1965 (previous (char-after (- (point) 2))))
1966 ;; We do the boldification/underlining by hiding the
1967 ;; overstrikes and putting the proper text property
1971 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
1972 (put-text-property (point) (1+ (point)) 'face 'bold))
1974 (gnus-article-hide-text-type
1975 (1- (point)) (1+ (point)) 'overstrike)
1977 (- (point) 2) (1- (point)) 'face 'underline))
1979 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
1981 (point) (1+ (point)) 'face 'underline)))))))))
1983 (defun article-treat-ansi-sequences ()
1984 "Translate ANSI SGR control sequences into overlays or extents."
1987 (when (article-goto-body)
1988 (let ((inhibit-read-only t))
1989 (ansi-color-apply-on-region (point) (point-max))))))
1991 (defun gnus-article-treat-unfold-headers ()
1992 "Unfold folded message headers.
1993 Only the headers that fit into the current window width will be
1996 (gnus-with-article-headers
2000 (mail-header-narrow-to-field)
2001 (let ((header (buffer-string)))
2004 (goto-char (point-min))
2005 (while (re-search-forward "\n[\t ]" nil t)
2006 (replace-match " " t t)))
2007 (setq length (- (point-max) (point-min) 1)))
2008 (when (< length (window-width))
2009 (while (re-search-forward "\n[\t ]" nil t)
2010 (replace-match " " t t)))
2011 (goto-char (point-max)))))))
2013 (defun gnus-article-treat-fold-headers ()
2014 "Fold message headers."
2016 (gnus-with-article-headers
2019 (mail-header-narrow-to-field)
2020 (mail-header-fold-field)
2021 (goto-char (point-max))))))
2023 (defun gnus-treat-smiley ()
2024 "Toggle display of textual emoticons (\"smileys\") as small graphical icons."
2026 (gnus-with-article-buffer
2027 (if (memq 'smiley gnus-article-wash-types)
2028 (gnus-delete-images 'smiley)
2030 (let ((images (smiley-region (point) (point-max))))
2032 (gnus-add-wash-type 'smiley)
2033 (dolist (image images)
2034 (gnus-add-image 'smiley image)))))))
2036 (defun gnus-article-remove-images ()
2037 "Remove all images from the article buffer."
2039 (gnus-with-article-buffer
2040 (dolist (elem gnus-article-image-alist)
2041 (gnus-delete-images (car elem)))))
2043 (defun gnus-article-treat-fold-newsgroups ()
2044 "Unfold folded message headers.
2045 Only the headers that fit into the current window width will be
2048 (gnus-with-article-headers
2049 (while (gnus-article-goto-header "newsgroups\\|followup-to")
2051 (mail-header-narrow-to-field)
2052 (while (re-search-forward ", *" nil t)
2053 (replace-match ", " t t))
2054 (mail-header-fold-field)
2055 (goto-char (point-max))))))
2057 (defun gnus-article-treat-body-boundary ()
2058 "Place a boundary line at the end of the headers."
2060 (when (and gnus-body-boundary-delimiter
2061 (> (length gnus-body-boundary-delimiter) 0))
2062 (gnus-with-article-headers
2063 (goto-char (point-max))
2064 (let ((start (point)))
2065 (insert "X-Boundary: ")
2066 (gnus-add-text-properties start (point) '(invisible t intangible t))
2068 (while (>= (1- (window-width)) (length str))
2069 (setq str (concat str gnus-body-boundary-delimiter)))
2070 (substring str 0 (1- (window-width))))
2072 (gnus-put-text-property start (point) 'gnus-decoration 'header)))))
2074 (defun article-fill-long-lines ()
2075 "Fill lines that are wider than the window width."
2078 (let ((inhibit-read-only t)
2079 (width (window-width (get-buffer-window (current-buffer)))))
2082 (let ((adaptive-fill-mode nil)) ;Why? -sm
2085 (when (>= (current-column) (min fill-column width))
2086 (narrow-to-region (min (1+ (point)) (point-max))
2088 (let ((goback (point-marker)))
2089 (fill-paragraph nil)
2090 (goto-char (marker-position goback)))
2092 (forward-line 1)))))))
2094 (defun article-capitalize-sentences ()
2095 "Capitalize the first word in each sentence."
2098 (let ((inhibit-read-only t)
2099 (paragraph-start "^[\n\^L]"))
2103 (forward-sentence)))))
2105 (defun article-remove-cr ()
2106 "Remove trailing CRs and then translate remaining CRs into LFs."
2109 (let ((inhibit-read-only t))
2110 (goto-char (point-min))
2111 (while (re-search-forward "\r+$" nil t)
2112 (replace-match "" t t))
2113 (goto-char (point-min))
2114 (while (search-forward "\r" nil t)
2115 (replace-match "\n" t t)))))
2117 (defun article-remove-trailing-blank-lines ()
2118 "Remove all trailing blank lines from the article."
2121 (let ((inhibit-read-only t))
2122 (goto-char (point-max))
2126 (while (and (not (bobp))
2127 (looking-at "^[ \t]*$")
2128 (not (gnus-annotation-in-region-p
2129 (point) (point-at-eol))))
2135 (defvar gnus-face-properties-alist))
2137 (defun article-display-face ()
2138 "Display any Face headers in the header."
2140 (let ((wash-face-p buffer-read-only))
2141 (gnus-with-article-headers
2142 ;; When displaying parts, this function can be called several times on
2143 ;; the same article, without any intended toggle semantic (as typing `W
2144 ;; D d' would have). So face deletion must occur only when we come from
2145 ;; an interactive command, that is when the *Article* buffer is
2147 (if (and wash-face-p (memq 'face gnus-article-wash-types))
2148 (gnus-delete-images 'face)
2151 (when (and wash-face-p
2153 (goto-char (point-min))
2154 (not (re-search-forward "^Face:[\t ]*" nil t)))
2155 (gnus-buffer-live-p gnus-original-article-buffer))
2156 (set-buffer gnus-original-article-buffer))
2158 (mail-narrow-to-head)
2159 (while (gnus-article-goto-header "Face")
2160 (setq faces (nconc faces (list (mail-header-field-value)))))))
2161 (dolist (face faces)
2162 (let ((png (gnus-convert-face-to-png face))
2166 (apply 'gnus-create-image png 'png t
2167 (cdr (assq 'png gnus-face-properties-alist))))
2168 (gnus-article-goto-header "from")
2170 (insert "From: [no `from' set]\n")
2172 (gnus-add-wash-type 'face)
2173 (gnus-add-image 'face image)
2174 (gnus-put-image image nil 'face))))))
2177 (defun article-display-x-face (&optional force)
2178 "Look for an X-Face header and display it if present."
2179 (interactive (list 'force))
2180 (let ((wash-face-p buffer-read-only)) ;; When type `W f'
2181 (gnus-with-article-headers
2182 ;; Delete the old process, if any.
2183 (when (process-status "article-x-face")
2184 (delete-process "article-x-face"))
2185 ;; See the comment in `article-display-face'.
2186 (if (and wash-face-p (memq 'xface gnus-article-wash-types))
2187 ;; We have already displayed X-Faces, so we remove them
2189 (gnus-delete-images 'xface)
2191 (let (x-faces from face)