1 ;;; gnus-art.el --- article mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
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.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
36 (defvar w3m-minor-mode-map)
39 ;; Avoid the "Recursive load suspected" error in Emacs 21.1.
41 (let ((recursive-load-depth-limit 100))
54 (autoload 'gnus-msg-mail "gnus-msg" nil t)
55 (autoload 'gnus-button-mailto "gnus-msg")
56 (autoload 'gnus-button-reply "gnus-msg" nil t)
57 (autoload 'parse-time-string "parse-time" nil nil)
58 (autoload 'ansi-color-apply-on-region "ansi-color")
59 (autoload 'mm-url-insert-file-contents-external "mm-url")
60 (autoload 'mm-extern-cache-contents "mm-extern")
62 (defgroup gnus-article nil
64 :link '(custom-manual "(gnus)Article Buffer")
67 (defgroup gnus-article-treat nil
68 "Treating article parts."
69 :link '(custom-manual "(gnus)Article Hiding")
72 (defgroup gnus-article-hiding nil
73 "Hiding article parts."
74 :link '(custom-manual "(gnus)Article Hiding")
77 (defgroup gnus-article-highlight nil
78 "Article highlighting."
79 :link '(custom-manual "(gnus)Article Highlighting")
83 (defgroup gnus-article-signature nil
85 :link '(custom-manual "(gnus)Article Signature")
88 (defgroup gnus-article-headers nil
90 :link '(custom-manual "(gnus)Hiding Headers")
93 (defgroup gnus-article-washing nil
94 "Special commands on articles."
95 :link '(custom-manual "(gnus)Article Washing")
98 (defgroup gnus-article-emphasis nil
99 "Fontisizing articles."
100 :link '(custom-manual "(gnus)Article Fontisizing")
101 :group 'gnus-article)
103 (defgroup gnus-article-saving nil
105 :link '(custom-manual "(gnus)Saving Articles")
106 :group 'gnus-article)
108 (defgroup gnus-article-mime nil
109 "Worshiping the MIME wonder."
110 :link '(custom-manual "(gnus)Using MIME")
111 :group 'gnus-article)
113 (defgroup gnus-article-buttons nil
114 "Pushable buttons in the article buffer."
115 :link '(custom-manual "(gnus)Article Buttons")
116 :group 'gnus-article)
118 (defgroup gnus-article-various nil
119 "Other article options."
120 :link '(custom-manual "(gnus)Misc Article")
121 :group 'gnus-article)
123 (defcustom gnus-ignored-headers
126 (concat "^" header ":"))
127 '("Path" "Expires" "Date-Received" "References" "Xref" "Lines"
128 "Relay-Version" "Message-ID" "Approved" "Sender" "Received"
129 "X-UIDL" "MIME-Version" "Return-Path" "In-Reply-To"
130 "Content-Type" "Content-Transfer-Encoding" "X-WebTV-Signature"
131 "X-MimeOLE" "X-MSMail-Priority" "X-Priority" "X-Loop"
132 "X-Authentication-Warning" "X-MIME-Autoconverted" "X-Face"
133 "X-Attribution" "X-Originating-IP" "Delivered-To"
134 "NNTP-[-A-Za-z]+" "Distribution" "X-no-archive" "X-Trace"
135 "X-Complaints-To" "X-NNTP-Posting-Host" "X-Orig.*"
136 "Abuse-Reports-To" "Cache-Post-Path" "X-Article-Creation-Date"
137 "X-Poster" "X-Mail2News-Path" "X-Server-Date" "X-Cache"
138 "Originator" "X-Problems-To" "X-Auth-User" "X-Post-Time"
139 "X-Admin" "X-UID" "Resent-[-A-Za-z]+" "X-Mailing-List"
140 "Precedence" "Original-[-A-Za-z]+" "X-filename" "X-Orcpt"
141 "Old-Received" "X-Pgp" "X-Auth" "X-From-Line"
142 "X-Gnus-Article-Number" "X-Majordomo" "X-Url" "X-Sender"
143 "MBOX-Line" "Priority" "X400-[-A-Za-z]+"
144 "Status" "X-Gnus-Mail-Source" "Cancel-Lock"
145 "X-FTN" "X-EXP32-SerialNo" "Encoding" "Importance"
146 "Autoforwarded" "Original-Encoded-Information-Types" "X-Ya-Pop3"
147 "X-Face-Version" "X-Vms-To" "X-ML-NAME" "X-ML-COUNT"
148 "Mailing-List" "X-finfo" "X-md5sum" "X-md5sum-Origin"
149 "X-Sun-Charset" "X-Accept-Language" "X-Envelope-Sender"
150 "List-[A-Za-z]+" "X-Listprocessor-Version"
151 "X-Received" "X-Distribute" "X-Sequence" "X-Juno-Line-Breaks"
152 "X-Notes-Item" "X-MS-TNEF-Correlator" "x-uunet-gateway"
153 "X-Received" "Content-length" "X-precedence"
154 "X-Authenticated-User" "X-Comment" "X-Report" "X-Abuse-Info"
155 "X-HTTP-Proxy" "X-Mydeja-Info" "X-Copyright" "X-No-Markup"
156 "X-Abuse-Info" "X-From_" "X-Accept-Language" "Errors-To"
157 "X-BeenThere" "X-Mailman-Version" "List-Help" "List-Post"
158 "List-Subscribe" "List-Id" "List-Unsubscribe" "List-Archive"
159 "X-Content-length" "X-Posting-Agent" "Original-Received"
160 "X-Request-PGP" "X-Fingerprint" "X-WRIEnvto" "X-WRIEnvfrom"
161 "X-Virus-Scanned" "X-Delivery-Agent" "Posted-Date" "X-Gateway"
162 "X-Local-Origin" "X-Local-Destination" "X-UserInfo1"
163 "X-Received-Date" "X-Hashcash" "Face" "X-DMCA-Notifications"
164 "X-Abuse-and-DMCA-Info" "X-Postfilter" "X-Gpg-.*" "X-Disclaimer"
165 "Envelope-To" "X-Spam-Score" "System-Type" "X-Injected-Via-Gmane"
166 "X-Gmane-NNTP-Posting-Host" "Jabber-ID" "Archived-At"
167 "Envelope-Sender" "Envelope-Recipients"))
168 "*All headers that start with this regexp will be hidden.
169 This variable can also be a list of regexps of headers to be ignored.
170 If `gnus-visible-headers' is non-nil, this variable will be ignored."
171 :type '(choice :custom-show nil
174 :group 'gnus-article-hiding)
176 (defcustom gnus-visible-headers
177 "^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:"
178 "*All headers that do not match this regexp will be hidden.
179 This variable can also be a list of regexp of headers to remain visible.
180 If this variable is non-nil, `gnus-ignored-headers' will be ignored."
181 :type '(repeat :value-to-internal (lambda (widget value)
182 (custom-split-regexp-maybe value))
183 :match (lambda (widget value)
185 (widget-editable-list-match widget value)))
187 :group 'gnus-article-hiding)
189 (defcustom gnus-sorted-header-list
190 '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:"
191 "^Followup-To:" "^To:" "^Cc:" "^Date:" "^Organization:")
192 "*This variable is a list of regular expressions.
193 If it is non-nil, headers that match the regular expressions will
194 be placed first in the article buffer in the sequence specified by
196 :type '(repeat regexp)
197 :group 'gnus-article-hiding)
199 (defcustom gnus-boring-article-headers '(empty followup-to reply-to)
200 "Headers that are only to be displayed if they have interesting data.
201 Possible values in this list are:
203 'empty Headers with no content.
204 'newsgroups Newsgroup identical to Gnus group.
205 'to-address To identical to To-address.
206 'to-list To identical to To-list.
207 'cc-list CC identical to To-list.
208 'followup-to Followup-to identical to Newsgroups.
209 'reply-to Reply-to identical to From.
210 'date Date less than four days old.
211 'long-to To and/or Cc longer than 1024 characters.
212 'many-to Multiple To and/or Cc."
213 :type '(set (const :tag "Headers with no content." empty)
214 (const :tag "Newsgroups identical to Gnus group." newsgroups)
215 (const :tag "To identical to To-address." to-address)
216 (const :tag "To identical to To-list." to-list)
217 (const :tag "CC identical to To-list." cc-list)
218 (const :tag "Followup-to identical to Newsgroups." followup-to)
219 (const :tag "Reply-to identical to From." reply-to)
220 (const :tag "Date less than four days old." date)
221 (const :tag "To and/or Cc longer than 1024 characters." long-to)
222 (const :tag "Multiple To and/or Cc headers." many-to))
223 :group 'gnus-article-hiding)
225 (defcustom gnus-article-skip-boring nil
226 "Skip over text that is not worth reading.
227 By default, if you set this t, then Gnus will display citations and
228 signatures, but will never scroll down to show you a page consisting
229 only of boring text. Boring text is controlled by
230 `gnus-article-boring-faces'."
233 :group 'gnus-article-hiding)
235 (defcustom gnus-signature-separator '("^-- $" "^-- *$")
236 "Regexp matching signature separator.
237 This can also be a list of regexps. In that case, it will be checked
238 from head to tail looking for a separator. Searches will be done from
239 the end of the buffer."
240 :type '(choice :format "%{%t%}: %[Value Menu%]\n%v"
242 (repeat :tag "List of regexp" regexp))
243 :group 'gnus-article-signature)
245 (defcustom gnus-signature-limit nil
246 "Provide a limit to what is considered a signature.
247 If it is a number, no signature may not be longer (in characters) than
248 that number. If it is a floating point number, no signature may be
249 longer (in lines) than that number. If it is a function, the function
250 will be called without any parameters, and if it returns nil, there is
251 no signature in the buffer. If it is a string, it will be used as a
252 regexp. If it matches, the text in question is not a signature.
254 This can also be a list of the above values."
255 :type '(choice (const nil)
259 (regexp :value ".*"))
260 :group 'gnus-article-signature)
262 (defcustom gnus-hidden-properties '(invisible t intangible t)
263 "Property list to use for hiding text."
265 :group 'gnus-article-hiding)
267 ;; Fixme: This isn't the right thing for mixed graphical and non-graphical
268 ;; frames in a session.
269 (defcustom gnus-article-x-face-command
270 (if (featurep 'xemacs)
271 (if (or (gnus-image-type-available-p 'xface)
272 (gnus-image-type-available-p 'pbm))
273 'gnus-display-x-face-in-from
274 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | ee -")
275 (if (gnus-image-type-available-p 'pbm)
276 'gnus-display-x-face-in-from
277 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | \
279 "*String or function to be executed to display an X-Face header.
280 If it is a string, the command will be executed in a sub-shell
281 asynchronously. The compressed face will be piped to this command."
282 :type `(choice string
283 (function-item gnus-display-x-face-in-from)
287 :group 'gnus-article-washing)
289 (defcustom gnus-article-x-face-too-ugly nil
290 "Regexp matching posters whose face shouldn't be shown automatically."
291 :type '(choice regexp (const nil))
292 :group 'gnus-article-washing)
294 (defcustom gnus-article-banner-alist nil
295 "Banner alist for stripping.
297 ((egroups . \"^[ \\t\\n]*-------------------+\\\\( \\\\(e\\\\|Yahoo! \\\\)Groups Sponsor -+\\\\)?....\\n\\\\(.+\\n\\\\)+\"))"
299 :type '(repeat (cons symbol regexp))
300 :group 'gnus-article-washing)
302 (gnus-define-group-parameter
305 "Alist of regexps (to match group names) and banner."
306 :variable-group gnus-article-washing
308 '(choice :tag "Banner"
310 (const :tag "Remove signature" signature)
311 (symbol :tag "Item in `gnus-article-banner-alist'" none)
313 (const :tag "None" nil))
315 "If non-nil, specify how to remove `banners' from articles.
317 Symbol `signature' means to remove signatures delimited by
318 `gnus-signature-separator'. Any other symbol is used to look up a
319 regular expression to match the banner in `gnus-article-banner-alist'.
320 A string is used as a regular expression to match the banner
323 (defcustom gnus-article-address-banner-alist nil
324 "Alist of mail addresses and banners.
325 Each element has the form (ADDRESS . BANNER), where ADDRESS is a regexp
326 to match a mail address in the From: header, BANNER is one of a symbol
327 `signature', an item in `gnus-article-banner-alist', a regexp and nil.
328 If ADDRESS matches author's mail address, it will remove things like
329 advertisements. For example:
331 \((\"@yoo-hoo\\\\.co\\\\.jp\\\\'\" . \"\\n_+\\nDo You Yoo-hoo!\\\\?\\n.*\\n.*\\n\"))
335 (regexp :tag "Address")
336 (choice :tag "Banner" :value nil
337 (const :tag "Remove signature" signature)
338 (symbol :tag "Item in `gnus-article-banner-alist'" none)
340 (const :tag "None" nil))))
342 :group 'gnus-article-washing)
344 (defmacro gnus-emphasis-custom-with-format (&rest body)
346 \\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\
347 \\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)"))
350 (defun gnus-emphasis-custom-value-to-external (value)
351 (gnus-emphasis-custom-with-format
352 (if (consp (car value))
353 (list (format format (car (car value)) (cdr (car value)))
355 (if (nth 1 value) 2 3)
359 (defun gnus-emphasis-custom-value-to-internal (value)
360 (gnus-emphasis-custom-with-format
361 (let ((regexp (concat "\\`"
362 (format (regexp-quote format)
363 "\\([^()]+\\)" "\\([^()]+\\)")
366 (if (string-match regexp (setq pattern (car value)))
367 (list (cons (match-string 1 pattern) (match-string 2 pattern))
372 (defcustom gnus-emphasis-alist
374 '(("\\*" "\\*" bold nil 2)
377 ("_/" "/_" underline-italic)
378 ("_\\*" "\\*_" underline-bold)
379 ("\\*/" "/\\*" bold-italic)
380 ("_\\*/" "/\\*_" underline-bold-italic))))
382 (gnus-emphasis-custom-with-format
383 (mapcar (lambda (spec)
384 (list (format format (car spec) (cadr spec))
387 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
389 '(;; I've never seen anyone use this strikethru convention whereas I've
390 ;; several times seen it triggered by normal text. --Stef
391 ;; Miles suggests that this form is sometimes used but for italics,
392 ;; so maybe we should map it to `italic'.
393 ;; ("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)"
394 ;; 2 3 gnus-emphasis-strikethru)
395 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
396 2 3 gnus-emphasis-underline))))
397 "*Alist that says how to fontify certain phrases.
398 Each item looks like this:
400 (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
402 The first element is a regular expression to be matched. The second
403 is a number that says what regular expression grouping used to find
404 the entire emphasized word. The third is a number that says what
405 regexp grouping should be displayed and highlighted. The fourth
406 is the face used for highlighting."
410 :format "%[Customizing Style%]\n%v"
412 (group :tag "Default"
413 :value ("" 0 0 default)
416 (let ((value (widget-get
417 (cadr (widget-get (widget-get widget :parent)
420 (if (not (eq (nth 2 value) 'default))
424 (gnus-emphasis-custom-value-to-external value))))
425 (widget-group-value-create widget))
427 (integer :format "Match group: %v")
428 (integer :format "Emphasize group: %v")
431 :value (("_" . "_") nil default)
433 (regexp :format "Start regexp: %v")
434 (regexp :format "End regexp: %v"))
435 (boolean :format "Show start and end patterns: %[%v%]\n"
436 :on " On " :off " Off ")
438 :get (lambda (symbol)
439 (mapcar 'gnus-emphasis-custom-value-to-internal
440 (default-value symbol)))
441 :set (lambda (symbol value)
442 (set-default symbol (mapcar 'gnus-emphasis-custom-value-to-external
444 :group 'gnus-article-emphasis)
446 (defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
447 "A regexp to describe whitespace which should not be emphasized.
448 Typical values are \"^[ \\t]+\\\\|[ \\t]*\\n\" and \"[ \\t]+\\\\|[ \\t]*\\n\".
449 The former avoids underlining of leading and trailing whitespace,
450 and the latter avoids underlining any whitespace at all."
452 :group 'gnus-article-emphasis
455 (defface gnus-emphasis-bold '((t (:bold t)))
456 "Face used for displaying strong emphasized text (*word*)."
457 :group 'gnus-article-emphasis)
459 (defface gnus-emphasis-italic '((t (:italic t)))
460 "Face used for displaying italic emphasized text (/word/)."
461 :group 'gnus-article-emphasis)
463 (defface gnus-emphasis-underline '((t (:underline t)))
464 "Face used for displaying underlined emphasized text (_word_)."
465 :group 'gnus-article-emphasis)
467 (defface gnus-emphasis-underline-bold '((t (:bold t :underline t)))
468 "Face used for displaying underlined bold emphasized text (_*word*_)."
469 :group 'gnus-article-emphasis)
471 (defface gnus-emphasis-underline-italic '((t (:italic t :underline t)))
472 "Face used for displaying underlined italic emphasized text (_/word/_)."
473 :group 'gnus-article-emphasis)
475 (defface gnus-emphasis-bold-italic '((t (:bold t :italic t)))
476 "Face used for displaying bold italic emphasized text (/*word*/)."
477 :group 'gnus-article-emphasis)
479 (defface gnus-emphasis-underline-bold-italic
480 '((t (:bold t :italic t :underline t)))
481 "Face used for displaying underlined bold italic emphasized text.
482 Example: (_/*word*/_)."
483 :group 'gnus-article-emphasis)
485 (defface gnus-emphasis-strikethru (if (featurep 'xemacs)
486 '((t (:strikethru t)))
487 '((t (:strike-through t))))
488 "Face used for displaying strike-through text (-word-)."
489 :group 'gnus-article-emphasis)
491 (defface gnus-emphasis-highlight-words
492 '((t (:background "black" :foreground "yellow")))
493 "Face used for displaying highlighted words."
494 :group 'gnus-article-emphasis)
496 (defcustom gnus-article-time-format "%a, %d %b %Y %T %Z"
497 "Format for display of Date headers in article bodies.
498 See `format-time-string' for the possible values.
500 The variable can also be function, which should return a complete Date
501 header. The function is called with one argument, the time, which can
502 be fed to `format-time-string'."
503 :type '(choice string function)
504 :link '(custom-manual "(gnus)Article Date")
505 :group 'gnus-article-washing)
507 (defcustom gnus-save-all-headers t
508 "*If non-nil, don't remove any headers before saving.
509 This will be overridden by the `:headers' property that the symbol of
510 the saver function, which is specified by `gnus-default-article-saver',
512 :group 'gnus-article-saving
515 (defcustom gnus-prompt-before-saving 'always
516 "*This variable says how much prompting is to be done when saving articles.
517 If it is nil, no prompting will be done, and the articles will be
518 saved to the default files. If this variable is `always', each and
519 every article that is saved will be preceded by a prompt, even when
520 saving large batches of articles. If this variable is neither nil not
521 `always', there the user will be prompted once for a file name for
522 each invocation of the saving commands."
523 :group 'gnus-article-saving
524 :type '(choice (item always)
525 (item :tag "never" nil)
526 (sexp :tag "once" :format "%t\n" :value t)))
528 (defcustom gnus-saved-headers gnus-visible-headers
529 "Headers to keep if `gnus-save-all-headers' is nil.
530 If `gnus-save-all-headers' is non-nil, this variable will be ignored.
531 If that variable is nil, however, all headers that match this regexp
532 will be kept while the rest will be deleted before saving. This and
533 `gnus-save-all-headers' will be overridden by the `:headers' property
534 that the symbol of the saver function, which is specified by
535 `gnus-default-article-saver', might have."
536 :group 'gnus-article-saving
539 (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail
540 "A function to save articles in your favourite format.
541 The function will be called by way of the `gnus-summary-save-article'
542 command, and friends such as `gnus-summary-save-article-rmail'.
544 Gnus provides the following functions:
546 * gnus-summary-save-in-rmail (Rmail format)
547 * gnus-summary-save-in-mail (Unix mail format)
548 * gnus-summary-save-in-folder (MH folder)
549 * gnus-summary-save-in-file (article format)
550 * gnus-summary-save-body-in-file (article body)
551 * gnus-summary-save-in-vm (use VM's folder format)
552 * gnus-summary-write-to-file (article format -- overwrite)
553 * gnus-summary-write-body-to-file (article body -- overwrite)
555 The symbol of each function may have the following properties:
558 The value non-nil means save decoded articles. This is meaningful
559 only with `gnus-summary-save-in-file', `gnus-summary-save-body-in-file',
560 `gnus-summary-write-to-file', and `gnus-summary-write-body-to-file'.
563 The value specifies an alternative function which appends, not
564 overwrites, articles to a file. This implies that when saving many
565 articles at a time, `gnus-prompt-before-saving' is bound to t and all
566 articles are saved in a single file. This is meaningful only with
567 `gnus-summary-write-to-file' and `gnus-summary-write-body-to-file'.
570 The value specifies the symbol of a variable of which the value
571 specifies headers to be saved. If it is omitted,
572 `gnus-save-all-headers' and `gnus-saved-headers' control what
573 headers should be saved."
574 :group 'gnus-article-saving
575 :type '(radio (function-item gnus-summary-save-in-rmail)
576 (function-item gnus-summary-save-in-mail)
577 (function-item gnus-summary-save-in-folder)
578 (function-item gnus-summary-save-in-file)
579 (function-item gnus-summary-save-body-in-file)
580 (function-item gnus-summary-save-in-vm)
581 (function-item gnus-summary-write-to-file)
582 (function-item gnus-summary-write-body-to-file)
585 (defcustom gnus-article-save-coding-system
586 (or (and (mm-coding-system-p 'utf-8) 'utf-8)
587 (and (mm-coding-system-p 'iso-2022-7bit) 'iso-2022-7bit)
588 (and (mm-coding-system-p 'emacs-mule) 'emacs-mule)
589 (and (mm-coding-system-p 'escape-quoted) 'escape-quoted))
590 "Coding system used to save decoded articles to a file.
592 The recommended coding systems are `utf-8', `iso-2022-7bit' and so on,
593 which can safely encode any characters in text. This is used by the
596 * gnus-summary-save-article-file
597 * gnus-summary-save-article-body-file
598 * gnus-summary-write-article-file
599 * gnus-summary-write-article-body-file
601 and the functions to which you may set `gnus-default-article-saver':
603 * gnus-summary-save-in-file
604 * gnus-summary-save-body-in-file
605 * gnus-summary-write-to-file
606 * gnus-summary-write-body-to-file
608 Those commands and functions save just text displayed in the article
609 buffer to a file if the value of this variable is non-nil. Note that
610 buttonized MIME parts will be lost in a saved file in that case.
611 Otherwise, raw articles will be saved."
612 :group 'gnus-article-saving
614 :format "%{%t%}:\n %[Value Menu%] %v"
615 (const :tag "Save raw articles" nil)
618 (lambda (arg) (if (mm-coding-system-p (nth 3 arg)) arg))
619 '((const :tag "UTF-8" utf-8)
620 (const :tag "iso-2022-7bit" iso-2022-7bit)
621 (const :tag "Emacs internal" emacs-mule)
622 (const :tag "escape-quoted" escape-quoted))))
623 (symbol :tag "Coding system")))
625 (defcustom gnus-rmail-save-name 'gnus-plain-save-name
626 "A function generating a file name to save articles in Rmail format.
627 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
628 :group 'gnus-article-saving
631 (defcustom gnus-mail-save-name 'gnus-plain-save-name
632 "A function generating a file name to save articles in Unix mail format.
633 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
634 :group 'gnus-article-saving
637 (defcustom gnus-folder-save-name 'gnus-folder-save-name
638 "A function generating a file name to save articles in MH folder.
639 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER."
640 :group 'gnus-article-saving
643 (defcustom gnus-file-save-name 'gnus-numeric-save-name
644 "A function generating a file name to save articles in article format.
645 The function is called with NEWSGROUP, HEADERS, and optional
647 :group 'gnus-article-saving
650 (defcustom gnus-split-methods
651 '((gnus-article-archive-name)
652 (gnus-article-nndoc-name))
653 "*Variable used to suggest where articles are to be saved.
654 For instance, if you would like to save articles related to Gnus in
655 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
656 you could set this variable to something like:
658 '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
659 (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))
661 This variable is an alist where the key is the match and the
662 value is a list of possible files to save in if the match is
665 If the match is a string, it is used as a regexp match on the
666 article. If the match is a symbol, that symbol will be funcalled
667 from the buffer of the article to be saved with the newsgroup as the
668 parameter. If it is a list, it will be evaled in the same buffer.
670 If this form or function returns a string, this string will be used as a
671 possible file name; and if it returns a non-nil list, that list will be
672 used as possible file names."
673 :group 'gnus-article-saving
674 :type '(repeat (choice (list :value (fun) function)
675 (cons :value ("" "") regexp (repeat string))
678 (defcustom gnus-page-delimiter "^\^L"
679 "*Regexp describing what to use as article page delimiters.
680 The default value is \"^\^L\", which is a form linefeed at the
681 beginning of a line."
683 :group 'gnus-article-various)
685 (defcustom gnus-article-mode-line-format "Gnus: %g [%w] %S%m"
686 "*The format specification for the article mode line.
687 See `gnus-summary-mode-line-format' for a closer description.
689 The following additional specs are available:
691 %w The article washing status.
692 %m The number of MIME parts in the article."
694 :group 'gnus-article-various)
696 (defcustom gnus-article-mode-hook nil
697 "*A hook for Gnus article mode."
699 :group 'gnus-article-various)
701 (when (featurep 'xemacs)
702 ;; Extracted from gnus-xmas-define in order to preserve user settings
703 (when (fboundp 'turn-off-scroll-in-place)
704 (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
705 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
706 (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add))
708 (defcustom gnus-article-menu-hook nil
709 "*Hook run after the creation of the article mode menu."
711 :group 'gnus-article-various)
713 (defcustom gnus-article-prepare-hook nil
714 "*A hook called after an article has been prepared in the article buffer."
716 :group 'gnus-article-various)
718 (defcustom gnus-copy-article-ignored-headers nil
719 "List of headers to be removed when copying an article.
720 Each element is a regular expression."
721 :version "23.0" ;; No Gnus
722 :type '(repeat regexp)
723 :group 'gnus-article-various)
725 (make-obsolete-variable 'gnus-article-hide-pgp-hook
726 "This variable is obsolete in Gnus 5.10.")
729 '((t (:weight bold)))
730 "Face used for highlighting a button in the article buffer."
731 :group 'gnus-article-buttons)
733 (defcustom gnus-article-button-face 'gnus-button
734 "Face used for highlighting buttons in the article buffer.
736 An article button is a piece of text that you can activate by pressing
737 `RET' or `mouse-2' above it."
739 :group 'gnus-article-buttons)
741 (defcustom gnus-article-mouse-face 'highlight
742 "Face used for mouse highlighting in the article buffer.
744 Article buttons will be displayed in this face when the cursor is
747 :group 'gnus-article-buttons)
749 (defcustom gnus-signature-face 'gnus-signature
750 "Face used for highlighting a signature in the article buffer.
751 Obsolete; use the face `gnus-signature' for customizations instead."
753 :group 'gnus-article-highlight
754 :group 'gnus-article-signature)
756 (defface gnus-signature
759 "Face used for highlighting a signature in the article buffer."
760 :group 'gnus-article-highlight
761 :group 'gnus-article-signature)
762 ;; backward-compatibility alias
763 (put 'gnus-signature-face 'face-alias 'gnus-signature)
765 (defface gnus-header-from
768 (:foreground "PaleGreen1"))
771 (:foreground "red3"))
774 "Face used for displaying from headers."
775 :group 'gnus-article-headers
776 :group 'gnus-article-highlight)
777 ;; backward-compatibility alias
778 (put 'gnus-header-from-face 'face-alias 'gnus-header-from)
780 (defface gnus-header-subject
783 (:foreground "SeaGreen1"))
786 (:foreground "red4"))
788 (:bold t :italic t)))
789 "Face used for displaying subject headers."
790 :group 'gnus-article-headers
791 :group 'gnus-article-highlight)
792 ;; backward-compatibility alias
793 (put 'gnus-header-subject-face 'face-alias 'gnus-header-subject)
795 (defface gnus-header-newsgroups
798 (:foreground "yellow" :italic t))
801 (:foreground "MidnightBlue" :italic t))
804 "Face used for displaying newsgroups headers.
805 In the default setup this face is only used for crossposted
807 :group 'gnus-article-headers
808 :group 'gnus-article-highlight)
809 ;; backward-compatibility alias
810 (put 'gnus-header-newsgroups-face 'face-alias 'gnus-header-newsgroups)
812 (defface gnus-header-name
815 (:foreground "SpringGreen2"))
818 (:foreground "maroon"))
821 "Face used for displaying header names."
822 :group 'gnus-article-headers
823 :group 'gnus-article-highlight)
824 ;; backward-compatibility alias
825 (put 'gnus-header-name-face 'face-alias 'gnus-header-name)
827 (defface gnus-header-content
830 (:foreground "SpringGreen1" :italic t))
833 (:foreground "indianred4" :italic t))
835 (:italic t))) "Face used for displaying header content."
836 :group 'gnus-article-headers
837 :group 'gnus-article-highlight)
838 ;; backward-compatibility alias
839 (put 'gnus-header-content-face 'face-alias 'gnus-header-content)
841 (defcustom gnus-header-face-alist
842 '(("From" nil gnus-header-from)
843 ("Subject" nil gnus-header-subject)
844 ("Newsgroups:.*," nil gnus-header-newsgroups)
845 ("" gnus-header-name gnus-header-content))
846 "*Controls highlighting of article headers.
848 An alist of the form (HEADER NAME CONTENT).
850 HEADER is a regular expression which should match the name of a
851 header and NAME and CONTENT are either face names or nil.
853 The name of each header field will be displayed using the face
854 specified by the first element in the list where HEADER matches
855 the header name and NAME is non-nil. Similarly, the content will
856 be displayed by the first non-nil matching CONTENT face."
857 :group 'gnus-article-headers
858 :group 'gnus-article-highlight
859 :type '(repeat (list (regexp :tag "Header")
861 (item :tag "skip" nil)
862 (face :value default))
863 (choice :tag "Content"
864 (item :tag "skip" nil)
865 (face :value default)))))
867 (defcustom gnus-face-properties-alist (if (featurep 'xemacs)
868 '((xface . (:face gnus-x-face)))
869 '((pbm . (:face gnus-x-face))
871 "Alist of image types and properties applied to Face and X-Face images.
874 ;; Specify the altitude of Face images in the From header.
875 \(setq gnus-face-properties-alist
876 '((pbm . (:face gnus-x-face :ascent 80))
877 (png . (:ascent 80))))
879 ;; Show Face images as pressed buttons.
880 \(setq gnus-face-properties-alist
881 '((pbm . (:face gnus-x-face :relief -2))
882 (png . (:relief -2))))
884 See the manual for the valid properties for various image types.
885 Currently, `pbm' is used for X-Face images and `png' is used for Face
886 images in Emacs. Only the `:face' property is effective on the `xface'
887 image type in XEmacs if it is built with the libcompface library."
888 :version "23.0" ;; No Gnus
889 :group 'gnus-article-headers
890 :type '(repeat (cons :format "%v" (symbol :tag "Image type") plist)))
892 (defcustom gnus-article-decode-hook
893 '(article-decode-charset article-decode-encoded-words
894 article-decode-group-name article-decode-idna-rhs)
895 "*Hook run to decode charsets in articles."
896 :group 'gnus-article-headers
899 (defcustom gnus-display-mime-function 'gnus-display-mime
900 "Function to display MIME articles."
901 :group 'gnus-article-mime
904 (defvar gnus-decode-header-function 'mail-decode-encoded-word-region
905 "Function used to decode headers.")
907 (defvar gnus-decode-address-function 'mail-decode-encoded-address-region
908 "Function used to decode addresses.")
910 (defvar gnus-article-dumbquotes-map
930 "Table for MS-to-Latin1 translation.")
932 (defcustom gnus-ignored-mime-types nil
933 "List of MIME types that should be ignored by Gnus."
935 :group 'gnus-article-mime
936 :type '(repeat regexp))
938 (defcustom gnus-unbuttonized-mime-types '(".*/.*")
939 "List of MIME types that should not be given buttons when rendered inline.
940 See also `gnus-buttonized-mime-types' which may override this variable.
941 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
943 :group 'gnus-article-mime
944 :type '(repeat regexp))
946 (defcustom gnus-buttonized-mime-types nil
947 "List of MIME types that should be given buttons when rendered inline.
948 If set, this variable overrides `gnus-unbuttonized-mime-types'.
949 To see e.g. security buttons you could set this to
950 `(\"multipart/signed\")'. You could also add \"multipart/alternative\" to
951 this list to display radio buttons that allow you to choose one of two
952 media types those mails include. See also `mm-discouraged-alternatives'.
953 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
955 :group 'gnus-article-mime
956 :type '(repeat regexp))
958 (defcustom gnus-inhibit-mime-unbuttonizing nil
959 "If non-nil, all MIME parts get buttons.
960 When nil (the default value), then some MIME parts do not get buttons,
961 as described by the variables `gnus-buttonized-mime-types' and
962 `gnus-unbuttonized-mime-types'."
964 :group 'gnus-article-mime
967 (defcustom gnus-body-boundary-delimiter "_"
968 "String used to delimit header and body.
969 This variable is used by `gnus-article-treat-body-boundary' which can
970 be controlled by `gnus-treat-body-boundary'."
972 :group 'gnus-article-various
973 :type '(choice (item :tag "None" :value nil)
976 (defcustom gnus-picon-databases '("/usr/lib/picon" "/usr/local/faces"
978 "Defines the location of the faces database.
979 For information on obtaining this database of pretty pictures, please
980 see http://www.cs.indiana.edu/picons/ftp/index.html"
982 :type '(repeat directory)
983 :link '(url-link :tag "download"
984 "http://www.cs.indiana.edu/picons/ftp/index.html")
985 :link '(custom-manual "(gnus)Picons")
988 (defun gnus-picons-installed-p ()
989 "Say whether picons are installed on your machine."
990 (let ((installed nil))
991 (dolist (database gnus-picon-databases)
992 (when (file-exists-p database)
996 (defcustom gnus-article-mime-part-function nil
997 "Function called with a MIME handle as the argument.
998 This is meant for people who want to do something automatic based
999 on parts -- for instance, adding Vcard info to a database."
1000 :group 'gnus-article-mime
1001 :type '(choice (const nil)
1004 (defcustom gnus-mime-multipart-functions nil
1005 "An alist of MIME types to functions to display them."
1007 :group 'gnus-article-mime
1008 :type '(repeat (cons :format "%v" (string :tag "MIME type") function)))
1010 (defcustom gnus-article-date-lapsed-new-header nil
1011 "Whether the X-Sent and Date headers can coexist.
1012 When using `gnus-treat-date-lapsed', the \"X-Sent:\" header will
1013 either replace the old \"Date:\" header (if this variable is nil), or
1014 be added below it (otherwise)."
1016 :group 'gnus-article-headers
1019 (defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative
1020 "Function called with a MIME handle as the argument.
1021 This is meant for people who want to view first matched part.
1022 For `undisplayed-alternative' (default), the first undisplayed
1023 part or alternative part is used. For `undisplayed', the first
1024 undisplayed part is used. For a function, the first part which
1025 the function return t is used. For nil, the first part is
1028 :group 'gnus-article-mime
1030 (item :tag "first" :value nil)
1031 (item :tag "undisplayed" :value undisplayed)
1032 (item :tag "undisplayed or alternative"
1033 :value undisplayed-alternative)
1036 (defcustom gnus-mime-action-alist
1037 '(("save to file" . gnus-mime-save-part)
1038 ("save and strip" . gnus-mime-save-part-and-strip)
1039 ("replace with file" . gnus-mime-replace-part)
1040 ("delete part" . gnus-mime-delete-part)
1041 ("display as text" . gnus-mime-inline-part)
1042 ("view the part" . gnus-mime-view-part)
1043 ("pipe to command" . gnus-mime-pipe-part)
1044 ("toggle display" . gnus-article-press-button)
1045 ("toggle display" . gnus-article-view-part-as-charset)
1046 ("view as type" . gnus-mime-view-part-as-type)
1047 ("view internally" . gnus-mime-view-part-internally)
1048 ("view externally" . gnus-mime-view-part-externally))
1049 "An alist of actions that run on the MIME attachment."
1050 :group 'gnus-article-mime
1051 :type '(repeat (cons (string :tag "name")
1054 (defcustom gnus-auto-select-part 1
1055 "Advance to next MIME part when deleting or stripping parts.
1057 When 0, point will be placed on the same part as before. When
1058 positive (negative), move point forward (backwards) this many
1059 parts. When nil, redisplay article."
1060 :version "23.0" ;; No Gnus
1061 :group 'gnus-article-mime
1062 :type '(choice (const nil :tag "Redisplay article.")
1063 (const 1 :tag "Next part.")
1064 (const 0 :tag "Current part.")
1068 ;;; The treatment variables
1071 (defvar gnus-part-display-hook nil
1072 "Hook called on parts that are to receive treatment.")
1074 (defvar gnus-article-treat-custom
1075 '(choice (const :tag "Off" nil)
1077 (const :tag "Header" head)
1078 (const :tag "First" first)
1079 (const :tag "Last" last)
1080 (integer :tag "Less")
1081 (repeat :tag "Groups" regexp)
1082 (sexp :tag "Predicate")))
1084 (defvar gnus-article-treat-head-custom
1085 '(choice (const :tag "Off" nil)
1086 (const :tag "Header" head)))
1088 (defvar gnus-article-treat-types '("text/plain" "text/x-verbatim"
1092 (defvar gnus-inhibit-treatment nil
1093 "Whether to inhibit treatment.")
1095 (defcustom gnus-treat-highlight-signature '(or t (typep "text/x-vcard"))
1096 "Highlight the signature.
1097 Valid values are nil, t, `head', `first', `last', an integer or a
1098 predicate. See Info node `(gnus)Customizing Articles'."
1099 :group 'gnus-article-treat
1100 :link '(custom-manual "(gnus)Customizing Articles")
1101 :type gnus-article-treat-custom)
1102 (put 'gnus-treat-highlight-signature 'highlight t)
1104 (defcustom gnus-treat-buttonize 100000
1106 Valid values are nil, t, `head', `first', `last', an integer or a
1107 predicate. See Info node `(gnus)Customizing Articles'."
1108 :group 'gnus-article-treat
1109 :link '(custom-manual "(gnus)Customizing Articles")
1110 :type gnus-article-treat-custom)
1111 (put 'gnus-treat-buttonize 'highlight t)
1113 (defcustom gnus-treat-buttonize-head 'head
1114 "Add buttons to the head.
1115 Valid values are nil, t, `head', `first', `last', an integer or a
1116 predicate. See Info node `(gnus)Customizing Articles'."
1117 :group 'gnus-article-treat
1118 :link '(custom-manual "(gnus)Customizing Articles")
1119 :type gnus-article-treat-head-custom)
1120 (put 'gnus-treat-buttonize-head 'highlight t)
1122 (defcustom gnus-treat-emphasize 50000
1124 Valid values are nil, t, `head', `first', `last', an integer or a
1125 predicate. See Info node `(gnus)Customizing Articles'."
1126 :group 'gnus-article-treat
1127 :link '(custom-manual "(gnus)Customizing Articles")
1128 :type gnus-article-treat-custom)
1129 (put 'gnus-treat-emphasize 'highlight t)
1131 (defcustom gnus-treat-strip-cr nil
1132 "Remove carriage returns.
1133 Valid values are nil, t, `head', `first', `last', an integer or a
1134 predicate. See Info node `(gnus)Customizing Articles'."
1136 :group 'gnus-article-treat
1137 :link '(custom-manual "(gnus)Customizing Articles")
1138 :type gnus-article-treat-custom)
1140 (defcustom gnus-treat-unsplit-urls nil
1141 "Remove newlines from within URLs.
1142 Valid values are nil, t, `head', `first', `last', an integer or a
1143 predicate. See Info node `(gnus)Customizing Articles'."
1145 :group 'gnus-article-treat
1146 :link '(custom-manual "(gnus)Customizing Articles")
1147 :type gnus-article-treat-custom)
1149 (defcustom gnus-treat-leading-whitespace nil
1150 "Remove leading whitespace in headers.
1151 Valid values are nil, t, `head', `first', `last', an integer or a
1152 predicate. See Info node `(gnus)Customizing Articles'."
1154 :group 'gnus-article-treat
1155 :link '(custom-manual "(gnus)Customizing Articles")
1156 :type gnus-article-treat-custom)
1158 (defcustom gnus-treat-hide-headers 'head
1160 Valid values are nil, t, `head', `first', `last', an integer or a
1161 predicate. See Info node `(gnus)Customizing Articles'."
1162 :group 'gnus-article-treat
1163 :link '(custom-manual "(gnus)Customizing Articles")
1164 :type gnus-article-treat-head-custom)
1166 (defcustom gnus-treat-hide-boring-headers nil
1167 "Hide boring headers.
1168 Valid values are nil, t, `head', `first', `last', an integer or a
1169 predicate. See Info node `(gnus)Customizing Articles'."
1170 :group 'gnus-article-treat
1171 :link '(custom-manual "(gnus)Customizing Articles")
1172 :type gnus-article-treat-head-custom)
1174 (defcustom gnus-treat-hide-signature nil
1175 "Hide the signature.
1176 Valid values are nil, t, `head', `first', `last', an integer or a
1177 predicate. See Info node `(gnus)Customizing Articles'."
1178 :group 'gnus-article-treat
1179 :link '(custom-manual "(gnus)Customizing Articles")
1180 :type gnus-article-treat-custom)
1182 (defcustom gnus-treat-fill-article nil
1184 Valid values are nil, t, `head', `first', `last', an integer or a
1185 predicate. See Info node `(gnus)Customizing Articles'."
1186 :group 'gnus-article-treat
1187 :link '(custom-manual "(gnus)Customizing Articles")
1188 :type gnus-article-treat-custom)
1190 (defcustom gnus-treat-hide-citation nil
1192 Valid values are nil, t, `head', `first', `last', an integer or a
1193 predicate. See Info node `(gnus)Customizing Articles'."
1194 :group 'gnus-article-treat
1195 :link '(custom-manual "(gnus)Customizing Articles")
1196 :type gnus-article-treat-custom)
1198 (defcustom gnus-treat-hide-citation-maybe nil
1200 Valid values are nil, t, `head', `first', `last', an integer or a
1201 predicate. See Info node `(gnus)Customizing Articles'."
1202 :group 'gnus-article-treat
1203 :link '(custom-manual "(gnus)Customizing Articles")
1204 :type gnus-article-treat-custom)
1206 (defcustom gnus-treat-strip-list-identifiers 'head
1207 "Strip list identifiers from `gnus-list-identifiers`.
1208 Valid values are nil, t, `head', `first', `last', an integer or a
1209 predicate. See Info node `(gnus)Customizing Articles'."
1211 :group 'gnus-article-treat
1212 :link '(custom-manual "(gnus)Customizing Articles")
1213 :type gnus-article-treat-custom)
1215 (make-obsolete-variable 'gnus-treat-strip-pgp
1216 "This option is obsolete in Gnus 5.10.")
1218 (defcustom gnus-treat-strip-pem nil
1219 "Strip PEM signatures.
1220 Valid values are nil, t, `head', `first', `last', an integer or a
1221 predicate. See Info node `(gnus)Customizing Articles'."
1222 :group 'gnus-article-treat
1223 :link '(custom-manual "(gnus)Customizing Articles")
1224 :type gnus-article-treat-custom)
1226 (defcustom gnus-treat-strip-banner t
1227 "Strip banners from articles.
1228 The banner to be stripped is specified in the `banner' group parameter.
1229 Valid values are nil, t, `head', `first', `last', an integer or a
1230 predicate. See Info node `(gnus)Customizing Articles'."
1231 :group 'gnus-article-treat
1232 :link '(custom-manual "(gnus)Customizing Articles")
1233 :type gnus-article-treat-custom)
1235 (defcustom gnus-treat-highlight-headers 'head
1236 "Highlight the headers.
1237 Valid values are nil, t, `head', `first', `last', an integer or a
1238 predicate. See Info node `(gnus)Customizing Articles'."
1239 :group 'gnus-article-treat
1240 :link '(custom-manual "(gnus)Customizing Articles")
1241 :type gnus-article-treat-head-custom)
1242 (put 'gnus-treat-highlight-headers 'highlight t)
1244 (defcustom gnus-treat-highlight-citation t
1245 "Highlight cited text.
1246 Valid values are nil, t, `head', `first', `last', an integer or a
1247 predicate. See Info node `(gnus)Customizing Articles'."
1248 :group 'gnus-article-treat
1249 :link '(custom-manual "(gnus)Customizing Articles")
1250 :type gnus-article-treat-custom)
1251 (put 'gnus-treat-highlight-citation 'highlight t)
1253 (defcustom gnus-treat-date-ut nil
1254 "Display the Date in UT (GMT).
1255 Valid values are nil, t, `head', `first', `last', an integer or a
1256 predicate. See Info node `(gnus)Customizing Articles'."
1257 :group 'gnus-article-treat
1258 :link '(custom-manual "(gnus)Customizing Articles")
1259 :type gnus-article-treat-head-custom)
1261 (defcustom gnus-treat-date-local nil
1262 "Display the Date in the local timezone.
1263 Valid values are nil, t, `head', `first', `last', an integer or a
1264 predicate. See Info node `(gnus)Customizing Articles'."
1265 :group 'gnus-article-treat
1266 :link '(custom-manual "(gnus)Customizing Articles")
1267 :type gnus-article-treat-head-custom)
1269 (defcustom gnus-treat-date-english nil
1270 "Display the Date in a format that can be read aloud in English.
1271 Valid values are nil, t, `head', `first', `last', an integer or a
1272 predicate. See Info node `(gnus)Customizing Articles'."
1274 :group 'gnus-article-treat
1275 :link '(custom-manual "(gnus)Customizing Articles")
1276 :type gnus-article-treat-head-custom)
1278 (defcustom gnus-treat-date-lapsed nil
1279 "Display the Date header in a way that says how much time has elapsed.
1280 Valid values are nil, t, `head', `first', `last', an integer or a
1281 predicate. See Info node `(gnus)Customizing Articles'."
1282 :group 'gnus-article-treat
1283 :link '(custom-manual "(gnus)Customizing Articles")
1284 :type gnus-article-treat-head-custom)
1286 (defcustom gnus-treat-date-original nil
1287 "Display the date in the original timezone.
1288 Valid values are nil, t, `head', `first', `last', an integer or a
1289 predicate. See Info node `(gnus)Customizing Articles'."
1290 :group 'gnus-article-treat
1291 :link '(custom-manual "(gnus)Customizing Articles")
1292 :type gnus-article-treat-head-custom)
1294 (defcustom gnus-treat-date-iso8601 nil
1295 "Display the date in the ISO8601 format.
1296 Valid values are nil, t, `head', `first', `last', an integer or a
1297 predicate. See Info node `(gnus)Customizing Articles'."
1299 :group 'gnus-article-treat
1300 :link '(custom-manual "(gnus)Customizing Articles")
1301 :type gnus-article-treat-head-custom)
1303 (defcustom gnus-treat-date-user-defined nil
1304 "Display the date in a user-defined format.
1305 The format is defined by the `gnus-article-time-format' variable.
1306 Valid values are nil, t, `head', `first', `last', an integer or a
1307 predicate. See Info node `(gnus)Customizing Articles'."
1308 :group 'gnus-article-treat
1309 :link '(custom-manual "(gnus)Customizing Articles")
1310 :type gnus-article-treat-head-custom)
1312 (defcustom gnus-treat-strip-headers-in-body t
1313 "Strip the X-No-Archive header line from the beginning of the body.
1314 Valid values are nil, t, `head', `first', `last', an integer or a
1315 predicate. See Info node `(gnus)Customizing Articles'."
1317 :group 'gnus-article-treat
1318 :link '(custom-manual "(gnus)Customizing Articles")
1319 :type gnus-article-treat-custom)
1321 (defcustom gnus-treat-strip-trailing-blank-lines nil
1322 "Strip trailing blank lines.
1323 Valid values are nil, t, `head', `first', `last', an integer or a
1324 predicate. See Info node `(gnus)Customizing Articles'.
1326 When set to t, it also strips trailing blanks in all MIME parts.
1327 Consider to use `last' instead."
1328 :group 'gnus-article-treat
1329 :link '(custom-manual "(gnus)Customizing Articles")
1330 :type gnus-article-treat-custom)
1332 (defcustom gnus-treat-strip-leading-blank-lines nil
1333 "Strip leading blank lines.
1334 Valid values are nil, t, `head', `first', `last', an integer or a
1335 predicate. See Info node `(gnus)Customizing Articles'.
1337 When set to t, it also strips trailing blanks in all MIME parts."
1338 :group 'gnus-article-treat
1339 :link '(custom-manual "(gnus)Customizing Articles")
1340 :type gnus-article-treat-custom)
1342 (defcustom gnus-treat-strip-multiple-blank-lines nil
1343 "Strip multiple blank lines.
1344 Valid values are nil, t, `head', `first', `last', an integer or a
1345 predicate. See Info node `(gnus)Customizing Articles'."
1346 :group 'gnus-article-treat
1347 :link '(custom-manual "(gnus)Customizing Articles")
1348 :type gnus-article-treat-custom)
1350 (defcustom gnus-treat-unfold-headers 'head
1351 "Unfold folded header lines.
1352 Valid values are nil, t, `head', `first', `last', an integer or a
1353 predicate. See Info node `(gnus)Customizing Articles'."
1355 :group 'gnus-article-treat
1356 :link '(custom-manual "(gnus)Customizing Articles")
1357 :type gnus-article-treat-custom)
1359 (defcustom gnus-article-unfold-long-headers nil
1360 "If non-nil, allow unfolding headers even if the header is long.
1361 If it is a regexp, only long headers matching this regexp are unfolded.
1362 If it is t, all long headers are unfolded.
1364 This variable has no effect if `gnus-treat-unfold-headers' is nil."
1365 :version "23.0" ;; No Gnus
1366 :group 'gnus-article-treat
1367 :type '(choice (const nil)
1368 (const :tag "all" t)
1371 (defcustom gnus-treat-fold-headers nil
1373 Valid values are nil, t, `head', `first', `last', an integer or a
1374 predicate. See Info node `(gnus)Customizing Articles'."
1376 :group 'gnus-article-treat
1377 :link '(custom-manual "(gnus)Customizing Articles")
1378 :type gnus-article-treat-custom)
1380 (defcustom gnus-treat-fold-newsgroups 'head
1381 "Fold the Newsgroups and Followup-To headers.
1382 Valid values are nil, t, `head', `first', `last', an integer or a
1383 predicate. See Info node `(gnus)Customizing Articles'."
1385 :group 'gnus-article-treat
1386 :link '(custom-manual "(gnus)Customizing Articles")
1387 :type gnus-article-treat-custom)
1389 (defcustom gnus-treat-overstrike t
1390 "Treat overstrike highlighting.
1391 Valid values are nil, t, `head', `first', `last', an integer or a
1392 predicate. See Info node `(gnus)Customizing Articles'."
1393 :group 'gnus-article-treat
1394 :link '(custom-manual "(gnus)Customizing Articles")
1395 :type gnus-article-treat-custom)
1396 (put 'gnus-treat-overstrike 'highlight t)
1398 (defcustom gnus-treat-ansi-sequences (if (locate-library "ansi-color") t)
1399 "Treat ANSI SGR control sequences.
1400 Valid values are nil, t, `head', `first', `last', an integer or a
1401 predicate. See Info node `(gnus)Customizing Articles'."
1402 :group 'gnus-article-treat
1403 :link '(custom-manual "(gnus)Customizing Articles")
1404 :type gnus-article-treat-custom)
1406 (make-obsolete-variable 'gnus-treat-display-xface
1407 'gnus-treat-display-x-face)
1409 (defcustom gnus-treat-display-x-face
1410 (and (not noninteractive)
1411 (gnus-image-type-available-p 'xbm)
1412 (if (featurep 'xemacs)
1414 (and (string-match "^0x" (shell-command-to-string "uncompface"))
1415 (executable-find "icontopbm")))
1417 "Display X-Face headers.
1418 Valid values are nil and `head'.
1419 See Info node `(gnus)Customizing Articles' and Info node
1420 `(gnus)X-Face' for details."
1421 :group 'gnus-article-treat
1423 :link '(custom-manual "(gnus)Customizing Articles")
1424 :link '(custom-manual "(gnus)X-Face")
1425 :type gnus-article-treat-head-custom
1426 :set (lambda (symbol value)
1429 (cond ((or (boundp symbol) (get symbol 'saved-value))
1431 ((boundp 'gnus-treat-display-xface)
1433 ** gnus-treat-display-xface is an obsolete variable;\
1434 use gnus-treat-display-x-face instead")
1435 (default-value 'gnus-treat-display-xface))
1436 ((get 'gnus-treat-display-xface 'saved-value)
1438 ** gnus-treat-display-xface is an obsolete variable;\
1439 use gnus-treat-display-x-face instead")
1440 (eval (car (get 'gnus-treat-display-xface 'saved-value))))
1443 (put 'gnus-treat-display-x-face 'highlight t)
1445 (defcustom gnus-treat-display-face
1446 (and (not noninteractive)
1447 (gnus-image-type-available-p 'png)
1449 "Display Face headers.
1450 Valid values are nil, t, `head', `first', `last', an integer or a
1451 predicate. See Info node `(gnus)Customizing Articles' and Info
1452 node `(gnus)X-Face' for details."
1453 :group 'gnus-article-treat
1455 :link '(custom-manual "(gnus)Customizing Articles")
1456 :link '(custom-manual "(gnus)X-Face")
1457 :type gnus-article-treat-head-custom)
1458 (put 'gnus-treat-display-face 'highlight t)
1460 (defcustom gnus-treat-display-smileys (gnus-image-type-available-p 'xpm)
1462 Valid values are nil, t, `head', `first', `last', an integer or a
1463 predicate. See Info node `(gnus)Customizing Articles' and Info
1464 node `(gnus)Smileys' for details."
1465 :group 'gnus-article-treat
1467 :link '(custom-manual "(gnus)Customizing Articles")
1468 :link '(custom-manual "(gnus)Smileys")
1469 :type gnus-article-treat-custom)
1470 (put 'gnus-treat-display-smileys 'highlight t)
1472 (defcustom gnus-treat-from-picon
1473 (if (and (gnus-image-type-available-p 'xpm)
1474 (gnus-picons-installed-p))
1476 "Display picons in the From header.
1477 Valid values are nil, t, `head', `first', `last', an integer or a
1478 predicate. See Info node `(gnus)Customizing Articles' and Info
1479 node `(gnus)Picons' for details."
1481 :group 'gnus-article-treat
1483 :link '(custom-manual "(gnus)Customizing Articles")
1484 :link '(custom-manual "(gnus)Picons")
1485 :type gnus-article-treat-head-custom)
1486 (put 'gnus-treat-from-picon 'highlight t)
1488 (defcustom gnus-treat-mail-picon
1489 (if (and (gnus-image-type-available-p 'xpm)
1490 (gnus-picons-installed-p))
1492 "Display picons in To and Cc headers.
1493 Valid values are nil, t, `head', `first', `last', an integer or a
1494 predicate. See Info node `(gnus)Customizing Articles' and Info
1495 node `(gnus)Picons' for details."
1497 :group 'gnus-article-treat
1499 :link '(custom-manual "(gnus)Customizing Articles")
1500 :link '(custom-manual "(gnus)Picons")
1501 :type gnus-article-treat-head-custom)
1502 (put 'gnus-treat-mail-picon 'highlight t)
1504 (defcustom gnus-treat-newsgroups-picon
1505 (if (and (gnus-image-type-available-p 'xpm)
1506 (gnus-picons-installed-p))
1508 "Display picons in the Newsgroups and Followup-To headers.
1509 Valid values are nil, t, `head', `first', `last', an integer or a
1510 predicate. See Info node `(gnus)Customizing Articles' and Info
1511 node `(gnus)Picons' for details."
1513 :group 'gnus-article-treat
1515 :link '(custom-manual "(gnus)Customizing Articles")
1516 :link '(custom-manual "(gnus)Picons")
1517 :type gnus-article-treat-head-custom)
1518 (put 'gnus-treat-newsgroups-picon 'highlight t)
1520 (defcustom gnus-treat-body-boundary
1521 (if (or gnus-treat-newsgroups-picon
1522 gnus-treat-mail-picon
1523 gnus-treat-from-picon)
1524 ;; If there's much decoration, the user might prefer a boundery.
1527 "Draw a boundary at the end of the headers.
1528 Valid values are nil and `head'.
1529 See Info node `(gnus)Customizing Articles' for details."
1531 :group 'gnus-article-treat
1532 :link '(custom-manual "(gnus)Customizing Articles")
1533 :type gnus-article-treat-head-custom)
1535 (defcustom gnus-treat-capitalize-sentences nil
1536 "Capitalize sentence-starting words.
1537 Valid values are nil, t, `head', `first', `last', an integer or a
1538 predicate. See Info node `(gnus)Customizing Articles'."
1540 :group 'gnus-article-treat
1541 :link '(custom-manual "(gnus)Customizing Articles")
1542 :type gnus-article-treat-custom)
1544 (defcustom gnus-treat-wash-html nil
1546 Valid values are nil, t, `head', `first', `last', an integer or a
1547 predicate. See Info node `(gnus)Customizing Articles'."
1549 :group 'gnus-article-treat
1550 :link '(custom-manual "(gnus)Customizing Articles")
1551 :type gnus-article-treat-custom)
1553 (defcustom gnus-treat-fill-long-lines nil
1555 Valid values are nil, t, `head', `first', `last', an integer or a
1556 predicate. See Info node `(gnus)Customizing Articles'."
1557 :group 'gnus-article-treat
1558 :link '(custom-manual "(gnus)Customizing Articles")
1559 :type gnus-article-treat-custom)
1561 (defcustom gnus-treat-play-sounds nil
1563 Valid values are nil, t, `head', `first', `last', an integer or a
1564 predicate. See Info node `(gnus)Customizing Articles'."
1566 :group 'gnus-article-treat
1567 :link '(custom-manual "(gnus)Customizing Articles")
1568 :type gnus-article-treat-custom)
1570 (defcustom gnus-treat-translate nil
1571 "Translate articles from one language to another.
1572 Valid values are nil, t, `head', `first', `last', an integer or a
1573 predicate. See Info node `(gnus)Customizing Articles'."
1575 :group 'gnus-article-treat
1576 :link '(custom-manual "(gnus)Customizing Articles")
1577 :type gnus-article-treat-custom)
1579 (defcustom gnus-treat-x-pgp-sig nil
1581 To automatically treat X-PGP-Sig, set it to head.
1582 Valid values are nil, t, `head', `first', `last', an integer or a
1583 predicate. See Info node `(gnus)Customizing Articles'."
1585 :group 'gnus-article-treat
1586 :group 'mime-security
1587 :link '(custom-manual "(gnus)Customizing Articles")
1588 :type gnus-article-treat-custom)
1590 (defvar gnus-article-encrypt-protocol-alist
1591 '(("PGP" . mml2015-self-encrypt)))
1593 ;; Set to nil if more than one protocol added to
1594 ;; gnus-article-encrypt-protocol-alist.
1595 (defcustom gnus-article-encrypt-protocol "PGP"
1596 "The protocol used for encrypt articles.
1597 It is a string, such as \"PGP\". If nil, ask user."
1600 :group 'mime-security)
1602 (defvar gnus-article-wash-function nil
1603 "Function used for converting HTML into text.")
1605 (defcustom gnus-use-idna (and (condition-case nil (require 'idna) (file-error))
1606 (mm-coding-system-p 'utf-8)
1607 (executable-find idna-program))
1608 "Whether IDNA decoding of headers is used when viewing messages.
1609 This requires GNU Libidn, and by default only enabled if it is found."
1611 :group 'gnus-article-headers
1614 (defcustom gnus-article-over-scroll nil
1615 "If non-nil, allow scrolling the article buffer even when there no more text."
1617 :group 'gnus-article
1620 ;;; Internal variables
1622 (defvar gnus-english-month-names
1623 '("January" "February" "March" "April" "May" "June" "July" "August"
1624 "September" "October" "November" "December"))
1626 (defvar article-goto-body-goes-to-point-min-p nil)
1627 (defvar gnus-article-wash-types nil)
1628 (defvar gnus-article-emphasis-alist nil)
1629 (defvar gnus-article-image-alist nil)
1631 (defvar gnus-article-mime-handle-alist-1 nil)
1632 (defvar gnus-treatment-function-alist
1633 '((gnus-treat-x-pgp-sig gnus-article-verify-x-pgp-sig)
1634 (gnus-treat-strip-banner gnus-article-strip-banner)
1635 (gnus-treat-strip-headers-in-body gnus-article-strip-headers-in-body)
1636 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1637 (gnus-treat-buttonize gnus-article-add-buttons)
1638 (gnus-treat-fill-article gnus-article-fill-cited-article)
1639 (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
1640 (gnus-treat-strip-cr gnus-article-remove-cr)
1641 (gnus-treat-unsplit-urls gnus-article-unsplit-urls)
1642 (gnus-treat-date-ut gnus-article-date-ut)
1643 (gnus-treat-date-local gnus-article-date-local)
1644 (gnus-treat-date-english gnus-article-date-english)
1645 (gnus-treat-date-original gnus-article-date-original)
1646 (gnus-treat-date-user-defined gnus-article-date-user)
1647 (gnus-treat-date-iso8601 gnus-article-date-iso8601)
1648 (gnus-treat-date-lapsed gnus-article-date-lapsed)
1649 (gnus-treat-display-x-face gnus-article-display-x-face)
1650 (gnus-treat-display-face gnus-article-display-face)
1651 (gnus-treat-hide-headers gnus-article-maybe-hide-headers)
1652 (gnus-treat-hide-boring-headers gnus-article-hide-boring-headers)
1653 (gnus-treat-hide-signature gnus-article-hide-signature)
1654 (gnus-treat-strip-list-identifiers gnus-article-hide-list-identifiers)
1655 (gnus-treat-leading-whitespace gnus-article-remove-leading-whitespace)
1656 (gnus-treat-strip-pem gnus-article-hide-pem)
1657 (gnus-treat-from-picon gnus-treat-from-picon)
1658 (gnus-treat-mail-picon gnus-treat-mail-picon)
1659 (gnus-treat-newsgroups-picon gnus-treat-newsgroups-picon)
1660 (gnus-treat-highlight-headers gnus-article-highlight-headers)
1661 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1662 (gnus-treat-strip-trailing-blank-lines
1663 gnus-article-remove-trailing-blank-lines)
1664 (gnus-treat-strip-leading-blank-lines
1665 gnus-article-strip-leading-blank-lines)
1666 (gnus-treat-strip-multiple-blank-lines
1667 gnus-article-strip-multiple-blank-lines)
1668 (gnus-treat-overstrike gnus-article-treat-overstrike)
1669 (gnus-treat-ansi-sequences gnus-article-treat-ansi-sequences)
1670 (gnus-treat-unfold-headers gnus-article-treat-unfold-headers)
1671 (gnus-treat-fold-newsgroups gnus-article-treat-fold-newsgroups)
1672 (gnus-treat-fold-headers gnus-article-treat-fold-headers)
1673 (gnus-treat-buttonize-head gnus-article-add-buttons-to-head)
1674 (gnus-treat-display-smileys gnus-treat-smiley)
1675 (gnus-treat-capitalize-sentences gnus-article-capitalize-sentences)
1676 (gnus-treat-wash-html gnus-article-wash-html)
1677 (gnus-treat-emphasize gnus-article-emphasize)
1678 (gnus-treat-hide-citation gnus-article-hide-citation)
1679 (gnus-treat-hide-citation-maybe gnus-article-hide-citation-maybe)
1680 (gnus-treat-highlight-citation gnus-article-highlight-citation)
1681 (gnus-treat-body-boundary gnus-article-treat-body-boundary)
1682 (gnus-treat-play-sounds gnus-earcon-display)))
1684 (defvar gnus-article-mime-handle-alist nil)
1685 (defvar article-lapsed-timer nil)
1686 (defvar gnus-article-current-summary nil)
1688 (defvar gnus-article-mode-syntax-table
1689 (let ((table (copy-syntax-table text-mode-syntax-table)))
1690 ;; This causes the citation match run O(2^n).
1691 ;; (modify-syntax-entry ?- "w" table)
1692 (modify-syntax-entry ?> ")<" table)
1693 (modify-syntax-entry ?< "(>" table)
1694 ;; make M-. in article buffers work for `foo' strings
1695 (modify-syntax-entry ?' " " table)
1696 (modify-syntax-entry ?` " " table)
1698 "Syntax table used in article mode buffers.
1699 Initialized from `text-mode-syntax-table.")
1701 (defvar gnus-save-article-buffer nil)
1703 (defvar gnus-article-mode-line-format-alist
1704 (nconc '((?w (gnus-article-wash-status) ?s)
1705 (?m (gnus-article-mime-part-status) ?s))
1706 gnus-summary-mode-line-format-alist))
1708 (defvar gnus-number-of-articles-to-be-saved nil)
1710 (defvar gnus-inhibit-hiding nil)
1712 (defvar gnus-article-edit-mode nil)
1714 ;;; Macros for dealing with the article buffer.
1716 (defmacro gnus-with-article-headers (&rest forms)
1718 (set-buffer gnus-article-buffer)
1720 (let ((inhibit-read-only t)
1721 (inhibit-point-motion-hooks t)
1722 (case-fold-search t))
1723 (article-narrow-to-head)
1726 (put 'gnus-with-article-headers 'lisp-indent-function 0)
1727 (put 'gnus-with-article-headers 'edebug-form-spec '(body))
1729 (defmacro gnus-with-article-buffer (&rest forms)
1731 (set-buffer gnus-article-buffer)
1732 (let ((inhibit-read-only t))
1735 (put 'gnus-with-article-buffer 'lisp-indent-function 0)
1736 (put 'gnus-with-article-buffer 'edebug-form-spec '(body))
1738 (defun gnus-article-goto-header (header)
1739 "Go to HEADER, which is a regular expression."
1740 (re-search-forward (concat "^\\(" header "\\):") nil t))
1742 (defsubst gnus-article-hide-text (b e props)
1743 "Set text PROPS on the B to E region, extending `intangible' 1 past B."
1744 (gnus-add-text-properties-when 'article-type nil b e props)
1745 (when (memq 'intangible props)
1747 (max (1- b) (point-min))
1748 b 'intangible (cddr (memq 'intangible props)))))
1750 (defsubst gnus-article-unhide-text (b e)
1751 "Remove hidden text properties from region between B and E."
1752 (remove-text-properties b e gnus-hidden-properties)
1753 (when (memq 'intangible gnus-hidden-properties)
1754 (put-text-property (max (1- b) (point-min))
1755 b 'intangible nil)))
1757 (defun gnus-article-hide-text-type (b e type)
1758 "Hide text of TYPE between B and E."
1759 (gnus-add-wash-type type)
1760 (gnus-article-hide-text
1761 b e (cons 'article-type (cons type gnus-hidden-properties))))
1763 (defun gnus-article-unhide-text-type (b e type)
1764 "Unhide text of TYPE between B and E."
1765 (gnus-delete-wash-type type)
1766 (remove-text-properties
1767 b e (cons 'article-type (cons type gnus-hidden-properties)))
1768 (when (memq 'intangible gnus-hidden-properties)
1769 (put-text-property (max (1- b) (point-min))
1770 b 'intangible nil)))
1772 (defun gnus-article-hide-text-of-type (type)
1773 "Hide text of TYPE in the current buffer."
1775 (let ((b (point-min))
1777 (while (setq b (text-property-any b e 'article-type type))
1778 (add-text-properties b (incf b) gnus-hidden-properties)))))
1780 (defun gnus-article-delete-text-of-type (type)
1781 "Delete text of TYPE in the current buffer."
1783 (let ((b (point-min)))
1784 (if (eq type 'multipart)
1785 ;; Remove MIME buttons associated with multipart/alternative parts.
1788 (while (if (get-text-property (point) 'gnus-part)
1790 (when (setq b (next-single-property-change (point)
1795 (skip-chars-forward "\n")
1796 (when (eq (get-text-property b 'article-type) 'multipart)
1797 (delete-region b (point)))))
1798 (while (setq b (text-property-any b (point-max) 'article-type type))
1800 b (or (text-property-not-all b (point-max) 'article-type type)
1803 (defun gnus-article-delete-invisible-text ()
1804 "Delete all invisible text in the current buffer."
1806 (let ((b (point-min)))
1807 (while (setq b (text-property-any b (point-max) 'invisible t))
1809 b (or (text-property-not-all b (point-max) 'invisible t)
1812 (defun gnus-article-text-type-exists-p (type)
1813 "Say whether any text of type TYPE exists in the buffer."
1814 (text-property-any (point-min) (point-max) 'article-type type))
1816 (defsubst gnus-article-header-rank ()
1817 "Give the rank of the string HEADER as given by `gnus-sorted-header-list'."
1818 (let ((list gnus-sorted-header-list)
1821 (if (looking-at (car list))
1823 (setq list (cdr list))
1827 (defun article-hide-headers (&optional arg delete)
1828 "Hide unwanted headers and possibly sort them as well."
1830 ;; This function might be inhibited.
1831 (unless gnus-inhibit-hiding
1832 (let ((inhibit-read-only t)
1833 (case-fold-search t)
1834 (max (1+ (length gnus-sorted-header-list)))
1835 (inhibit-point-motion-hooks t)
1836 (cur (current-buffer))
1837 ignored visible beg)
1839 ;; `gnus-ignored-headers' and `gnus-visible-headers' may be
1840 ;; group parameters, so we should go to the summary buffer.
1843 (progn (set-buffer gnus-summary-buffer) t)
1845 (setq ignored (when (not gnus-visible-headers)
1846 (cond ((stringp gnus-ignored-headers)
1847 gnus-ignored-headers)
1848 ((listp gnus-ignored-headers)
1849 (mapconcat 'identity
1850 gnus-ignored-headers
1852 visible (cond ((stringp gnus-visible-headers)
1853 gnus-visible-headers)
1854 ((and gnus-visible-headers
1855 (listp gnus-visible-headers))
1856 (mapconcat 'identity
1857 gnus-visible-headers
1861 ;; First we narrow to just the headers.
1862 (article-narrow-to-head)
1863 ;; Hide any "From " lines at the beginning of (mail) articles.
1864 (while (looking-at "From ")
1867 (delete-region (point-min) (point)))
1868 ;; Then treat the rest of the header lines.
1869 ;; Then we use the two regular expressions
1870 ;; `gnus-ignored-headers' and `gnus-visible-headers' to
1871 ;; select which header lines is to remain visible in the
1873 (while (re-search-forward "^[^ \t:]*:" nil t)
1875 ;; Mark the rank of the header.
1877 (point) (1+ (point)) 'message-rank
1878 (if (or (and visible (looking-at visible))
1880 (not (looking-at ignored))))
1881 (gnus-article-header-rank)
1884 (message-sort-headers-1)
1885 (when (setq beg (text-property-any
1886 (point-min) (point-max) 'message-rank (+ 2 max)))
1887 ;; We delete the unwanted headers.
1888 (gnus-add-wash-type 'headers)
1889 (add-text-properties (point-min) (+ 5 (point-min))
1890 '(article-type headers dummy-invisible t))
1891 (delete-region beg (point-max))))))))
1893 (defun article-hide-boring-headers (&optional arg)
1894 "Toggle hiding of headers that aren't very interesting.
1895 If given a negative prefix, always show; if given a positive prefix,
1897 (interactive (gnus-article-hidden-arg))
1898 (when (and (not (gnus-article-check-hidden-text 'boring-headers arg))
1899 (not gnus-show-all-headers))
1902 (let ((inhibit-read-only t)
1903 (inhibit-point-motion-hooks t))
1904 (article-narrow-to-head)
1905 (dolist (elem gnus-boring-article-headers)
1906 (goto-char (point-min))
1908 ;; Hide empty headers.
1910 (while (re-search-forward "^[^: \t]+:[ \t]*\n[^ \t]" nil t)
1912 (gnus-article-hide-text-type
1916 (if (re-search-forward "^[^ \t]" nil t)
1920 ;; Hide boring Newsgroups header.
1921 ((eq elem 'newsgroups)
1922 (when (gnus-string-equal
1923 (gnus-fetch-field "newsgroups")
1924 (gnus-group-real-name
1925 (if (boundp 'gnus-newsgroup-name)
1928 (gnus-article-hide-header "newsgroups")))
1929 ((eq elem 'to-address)
1930 (let ((to (message-fetch-field "to"))
1932 (gnus-parameter-to-address
1933 (if (boundp 'gnus-newsgroup-name)
1934 gnus-newsgroup-name ""))))
1935 (when (and to to-address
1938 ;; only one address in To
1939 (nth 1 (mail-extract-address-components to))
1941 (gnus-article-hide-header "to"))))
1943 (let ((to (message-fetch-field "to"))
1945 (gnus-parameter-to-list
1946 (if (boundp 'gnus-newsgroup-name)
1947 gnus-newsgroup-name ""))))
1948 (when (and to to-list
1951 ;; only one address in To
1952 (nth 1 (mail-extract-address-components to))
1954 (gnus-article-hide-header "to"))))
1956 (let ((cc (message-fetch-field "cc"))
1958 (gnus-parameter-to-list
1959 (if (boundp 'gnus-newsgroup-name)
1960 gnus-newsgroup-name ""))))
1961 (when (and cc to-list
1964 ;; only one address in CC
1965 (nth 1 (mail-extract-address-components cc))
1967 (gnus-article-hide-header "cc"))))
1968 ((eq elem 'followup-to)
1969 (when (gnus-string-equal
1970 (message-fetch-field "followup-to")
1971 (message-fetch-field "newsgroups"))
1972 (gnus-article-hide-header "followup-to")))
1973 ((eq elem 'reply-to)
1974 (if (gnus-group-find-parameter
1975 gnus-newsgroup-name 'broken-reply-to)
1976 (gnus-article-hide-header "reply-to")
1977 (let ((from (message-fetch-field "from"))
1978 (reply-to (message-fetch-field "reply-to")))
1985 (lambda (x) (downcase (cadr x)))
1986 (mail-extract-address-components from t))
1989 (lambda (x) (downcase (cadr x)))
1990 (mail-extract-address-components reply-to t))
1992 (gnus-article-hide-header "reply-to")))))
1994 (let ((date (with-current-buffer gnus-original-article-buffer
1995 ;; If date in `gnus-article-buffer' is localized
1996 ;; (`gnus-treat-date-user-defined'),
1997 ;; `days-between' might fail.
1998 (message-fetch-field "date"))))
2000 (< (days-between (current-time-string) date)
2002 (gnus-article-hide-header "date"))))
2004 (let ((to (message-fetch-field "to"))
2005 (cc (message-fetch-field "cc")))
2006 (when (> (length to) 1024)
2007 (gnus-article-hide-header "to"))
2008 (when (> (length cc) 1024)
2009 (gnus-article-hide-header "cc"))))
2013 (goto-char (point-min))
2014 (while (re-search-forward "^to:" nil t)
2015 (setq to-count (1+ to-count)))
2016 (when (> to-count 1)
2017 (while (> to-count 0)
2018 (goto-char (point-min))
2020 (re-search-forward "^to:" nil nil to-count)
2022 (narrow-to-region (point) (point-max))
2023 (gnus-article-hide-header "to"))
2024 (setq to-count (1- to-count))))
2025 (goto-char (point-min))
2026 (while (re-search-forward "^cc:" nil t)
2027 (setq cc-count (1+ cc-count)))
2028 (when (> cc-count 1)
2029 (while (> cc-count 0)
2030 (goto-char (point-min))
2032 (re-search-forward "^cc:" nil nil cc-count)
2034 (narrow-to-region (point) (point-max))
2035 (gnus-article-hide-header "cc"))
2036 (setq cc-count (1- cc-count)))))))))))))
2038 (defun gnus-article-hide-header (header)
2040 (goto-char (point-min))
2041 (when (re-search-forward (concat "^" header ":") nil t)
2042 (gnus-article-hide-text-type
2046 (if (re-search-forward "^[^ \t]" nil t)
2051 (defvar gnus-article-normalized-header-length 40
2052 "Length of normalized headers.")
2054 (defun article-normalize-headers ()
2055 "Make all header lines 40 characters long."
2057 (let ((inhibit-read-only t)
2061 (article-narrow-to-head)
2064 ((< (setq column (- (point-at-eol) (point)))
2065 gnus-article-normalized-header-length)
2067 (insert (make-string
2068 (- gnus-article-normalized-header-length column)
2070 ((> column gnus-article-normalized-header-length)
2071 (gnus-put-text-property
2073 (forward-char gnus-article-normalized-header-length)
2080 (forward-line 1))))))
2082 (defun article-treat-dumbquotes ()
2083 "Translate M****s*** sm*rtq**t*s and other symbols into proper text.
2084 Note that this function guesses whether a character is a sm*rtq**t* or
2085 not, so it should only be used interactively.
2087 Sm*rtq**t*s are M****s***'s unilateral extension to the
2088 iso-8859-1 character map in an attempt to provide more quoting
2089 characters. If you see something like \\222 or \\264 where
2090 you're expecting some kind of apostrophe or quotation mark, then
2093 (article-translate-strings gnus-article-dumbquotes-map))
2095 (defun article-translate-characters (from to)
2096 "Translate all characters in the body of the article according to FROM and TO.
2097 FROM is a string of characters to translate from; to is a string of
2098 characters to translate to."
2100 (when (article-goto-body)
2101 (let ((inhibit-read-only t)
2102 (x (make-string 225 ?x))
2104 (while (< (incf i) (length x))
2107 (while (< i (length from))
2108 (aset x (aref from i) (aref to i))
2110 (translate-region (point) (point-max) x)))))
2112 (defun article-translate-strings (map)
2113 "Translate all string in the body of the article according to MAP.
2114 MAP is an alist where the elements are on the form (\"from\" \"to\")."
2116 (when (article-goto-body)
2117 (let ((inhibit-read-only t))
2120 (while (search-forward (car elem) nil t)
2121 (replace-match (cadr elem)))))))))
2123 (defun article-treat-overstrike ()
2124 "Translate overstrikes into bold text."
2127 (when (article-goto-body)
2128 (let ((inhibit-read-only t))
2129 (while (search-forward "\b" nil t)
2130 (let ((next (char-after))
2131 (previous (char-after (- (point) 2))))
2132 ;; We do the boldification/underlining by hiding the
2133 ;; overstrikes and putting the proper text property
2137 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
2138 (put-text-property (point) (1+ (point)) 'face 'bold))
2140 (gnus-article-hide-text-type
2141 (1- (point)) (1+ (point)) 'overstrike)
2143 (- (point) 2) (1- (point)) 'face 'underline))
2145 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
2147 (point) (1+ (point)) 'face 'underline)))))))))
2149 (defun article-treat-ansi-sequences ()
2150 "Translate ANSI SGR control sequences into overlays or extents."
2153 (when (article-goto-body)
2154 (let ((inhibit-read-only t))
2155 (ansi-color-apply-on-region (point) (point-max))))))
2157 (defun gnus-article-treat-unfold-headers ()
2158 "Unfold folded message headers.
2159 Only the headers that fit into the current window width will be
2162 (gnus-with-article-headers
2166 (mail-header-narrow-to-field)
2167 (let* ((header (buffer-string))
2169 (or (equal gnus-article-unfold-long-headers t)
2170 (and (stringp gnus-article-unfold-long-headers)
2171 (string-match gnus-article-unfold-long-headers header)))))
2174 (goto-char (point-min))
2175 (while (re-search-forward "\n[\t ]" nil t)
2176 (replace-match " " t t)))
2177 (setq length (- (point-max) (point-min) 1))
2178 (when (or unfoldable
2179 (< length (window-width)))
2180 (while (re-search-forward "\n[\t ]" nil t)
2181 (replace-match " " t t))))
2182 (goto-char (point-max)))))))
2184 (defun gnus-article-treat-fold-headers ()
2185 "Fold message headers."
2187 (gnus-with-article-headers
2190 (mail-header-narrow-to-field)
2191 (mail-header-fold-field)
2192 (goto-char (point-max))))))
2194 (defun gnus-treat-smiley ()
2195 "Toggle display of textual emoticons (\"smileys\") as small graphical icons."
2197 (gnus-with-article-buffer
2198 (if (memq 'smiley gnus-article-wash-types)
2199 (gnus-delete-images 'smiley)
2201 (let ((images (smiley-region (point) (point-max))))
2203 (gnus-add-wash-type 'smiley)
2204 (dolist (image images)
2205 (gnus-add-image 'smiley image)))))))
2207 (defun gnus-article-remove-images ()
2208 "Remove all images from the article buffer."
2210 (gnus-with-article-buffer
2211 (dolist (elem gnus-article-image-alist)
2212 (gnus-delete-images (car elem)))))
2214 (defun gnus-article-treat-fold-newsgroups ()
2215 "Unfold folded message headers.
2216 Only the headers that fit into the current window width will be
2219 (gnus-with-article-headers
2220 (while (gnus-article-goto-header "newsgroups\\|followup-to")
2222 (mail-header-narrow-to-field)
2223 (while (re-search-forward ", *" nil t)
2224 (replace-match ", " t t))
2225 (mail-header-fold-field)
2226 (goto-char (point-max))))))
2228 (defcustom gnus-article-truncate-lines (default-value 'truncate-lines)
2229 "Value of `truncate-lines' in Gnus Article buffer.
2230 Valid values are nil, t, `head', `first', `last', an integer or a
2231 predicate. See Info node `(gnus)Customizing Articles'."
2232 :version "23.0" ;; No Gnus
2233 :group 'gnus-article
2234 ;; :link '(custom-manual "(gnus)Customizing Articles")
2237 (defun gnus-article-toggle-truncate-lines (&optional arg)
2238 "Toggle whether to fold or truncate long lines in article the buffer.
2239 If ARG is non-nil and not a number, toggle
2240 `gnus-article-truncate-lines' too. If ARG is a number, truncate
2241 long lines iff arg is positive."
2244 ((and (numberp arg) (> arg 0))
2245 (setq gnus-article-truncate-lines t))
2247 (setq gnus-article-truncate-lines nil))
2249 (setq gnus-article-truncate-lines
2250 (not gnus-article-truncate-lines))))
2251 (gnus-with-article-buffer
2253 ((and (numberp arg) (> arg 0))
2254 (setq truncate-lines nil))
2256 (setq truncate-lines t)))
2257 ;; In versions of Emacs 22 (CVS) before 2006-05-26,
2258 ;; `toggle-truncate-lines' needs an argument.
2259 (toggle-truncate-lines)))
2261 (defun gnus-article-treat-body-boundary ()
2262 "Place a boundary line at the end of the headers."
2264 (when (and gnus-body-boundary-delimiter
2265 (> (length gnus-body-boundary-delimiter) 0))
2266 (gnus-with-article-headers
2267 (goto-char (point-max))
2268 (let ((start (point)))
2269 (insert "X-Boundary: ")
2270 (gnus-add-text-properties start (point) '(invisible t intangible t))
2272 (while (>= (1- (window-width)) (length str))
2273 (setq str (concat str gnus-body-boundary-delimiter)))
2274 (substring str 0 (1- (window-width))))
2276 (gnus-put-text-property start (point) 'gnus-decoration 'header)))))
2278 (defun article-fill-long-lines ()
2279 "Fill lines that are wider than the window width."
2282 (let ((inhibit-read-only t)
2283 (width (window-width (get-buffer-window (current-buffer)))))
2286 (let ((adaptive-fill-mode nil)) ;Why? -sm
2289 (when (>= (current-column) (min fill-column width))
2290 (narrow-to-region (min (1+ (point)) (point-max))
2292 (let ((goback (point-marker)))
2293 (fill-paragraph nil)
2294 (goto-char (marker-position goback)))
2296 (forward-line 1)))))))
2298 (defun article-capitalize-sentences ()
2299 "Capitalize the first word in each sentence."
2302 (let ((inhibit-read-only t)
2303 (paragraph-start "^[\n\^L]"))
2307 (forward-sentence)))))
2309 (defun article-remove-cr ()
2310 "Remove trailing CRs and then translate remaining CRs into LFs."
2313 (let ((inhibit-read-only t))
2314 (goto-char (point-min))
2315 (while (re-search-forward "\r+$" nil t)
2316 (replace-match "" t t))
2317 (goto-char (point-min))
2318 (while (search-forward "\r" nil t)
2319 (replace-match "\n" t t)))))
2321 (defun article-remove-trailing-blank-lines ()
2322 "Remove all trailing blank lines from the article."
2325 (let ((inhibit-read-only t))
2326 (goto-char (point-max))
2330 (while (and (not (bobp))
2331 (looking-at "^[ \t]*$")
2332 (not (gnus-annotation-in-region-p
2333 (point) (point-at-eol))))
2338 (defvar gnus-face-properties-alist)
2340 (defun article-display-face (&optional force)
2341 "Display any Face headers in the header."
2342 (interactive (list 'force))
2343 (let ((wash-face-p buffer-read-only))
2344 (gnus-with-article-headers
2345 ;; When displaying parts, this function can be called several times on
2346 ;; the same article, without any intended toggle semantic (as typing `W
2347 ;; D d' would have). So face deletion must occur only when we come from
2348 ;; an interactive command, that is when the *Article* buffer is
2350 (if (and wash-face-p (memq 'face gnus-article-wash-types))
2351 (gnus-delete-images 'face)
2352 (let ((from (message-fetch-field "from"))
2354 (save-current-buffer
2355 (when (and wash-face-p
2356 (gnus-buffer-live-p gnus-original-article-buffer)
2357 (not (re-search-forward "^Face:[\t ]*" nil t)))
2358 (set-buffer gnus-original-article-buffer))
2360 (mail-narrow-to-head)
2362 ;; Check whether this face is censored.
2363 (not (and gnus-article-x-face-too-ugly
2365 (setq from (message-fetch-field "from")))
2366 (string-match gnus-article-x-face-too-ugly
2368 (while (gnus-article-goto-header "Face")
2369 (push (mail-header-field-value) faces)))))
2371 (goto-char (point-min))
2373 (unless (setq from (gnus-article-goto-header "from"))
2376 (insert " [no `from' set]\n"))
2378 (when (setq png (gnus-convert-face-to-png (pop faces)))
2380 (apply 'gnus-create-image png 'png t
2381 (cdr (assq 'png gnus-face-properties-alist))))
2383 (gnus-add-wash-type 'face)
2384 (gnus-add-image 'face image)
2385 (gnus-put-image image nil 'face))))))))))
2387 (defun article-display-x-face (&optional force)
2388 "Look for an X-Face header and display it if present."
2389 (interactive (list 'force))
2390 (let ((wash-face-p buffer-read-only)) ;; When type `W f'
2391 (gnus-with-article-headers
2392 ;; Delete the old process, if any.
2393 (when (process-status "article-x-face")
2394 (delete-process "article-x-face"))
2395 ;; See the comment in `article-display-face'.
2396 (if (and wash-face-p (memq 'xface gnus-article-wash-types))
2397 ;; We have already displayed X-Faces, so we remove them
2399 (gnus-delete-images 'xface)
2401 (let ((from (message-fetch-field "from"))
2403 (save-current-buffer
2404 (when (and wash-face-p
2405 (gnus-buffer-live-p gnus-original-article-buffer)
2406 (not (re-search-forward "^X-Face:[\t ]*" nil t)))
2407 ;; If type `W f', use gnus-original-article-buffer,
2408 ;; otherwise use the current buffer because displaying
2409 ;; RFC822 parts calls this function too.
2410 (set-buffer gnus-original-article-buffer))
2412 (mail-narrow-to-head)
2413 (and gnus-article-x-face-command
2415 ;; Check whether this face is censored.
2416 (not (and gnus-article-x-face-too-ugly
2418 (setq from (message-fetch-field "from")))
2419 (string-match gnus-article-x-face-too-ugly
2421 (while (gnus-article-goto-header "X-Face")
2422 (push (mail-header-field-value) x-faces)))))
2424 ;; We display the face.
2425 (cond ((functionp gnus-article-x-face-command)
2426 ;; The command is a lisp function, so we call it.
2427 (mapc gnus-article-x-face-command x-faces))
2428 ((stringp gnus-article-x-face-command)
2429 ;; The command is a string, so we interpret the command
2430 ;; as a, well, command, and fork it off.
2431 (let ((process-connection-type nil))
2432 (gnus-set-process-query-on-exit-flag
2434 "article-x-face" nil shell-file-name
2435 shell-command-switch gnus-article-x-face-command)
2437 ;; Sending multiple EOFs to xv doesn't work,
2438 ;; so we only do a single external face.
2440 (insert (car x-faces))
2441 (process-send-region "article-x-face"
2442 (point-min) (point-max)))
2443 (process-send-eof "article-x-face")))
2445 (error "`%s' set to `%s' is not a function"
2446 gnus-article-x-face-command
2447 'gnus-article-x-face-command)))))))))
2449 (defun article-decode-mime-words ()
2450 "Decode all MIME-encoded words in the article."
2452 (gnus-with-article-buffer
2453 (let ((inhibit-point-motion-hooks t)
2454 (mail-parse-charset gnus-newsgroup-charset)
2455 (mail-parse-ignored-charsets
2456 (with-current-buffer gnus-summary-buffer
2457 gnus-newsgroup-ignored-charsets)))
2458 (mail-decode-encoded-word-region (point-min) (point-max)))))
2460 (defun article-decode-charset (&optional prompt)
2461 "Decode charset-encoded text in the article.
2462 If PROMPT (the prefix), prompt for a coding system to use."
2464 (let ((inhibit-point-motion-hooks t) (case-fold-search t)
2465 (inhibit-read-only t)
2466 (mail-parse-charset gnus-newsgroup-charset)
2467 (mail-parse-ignored-charsets
2468 (save-excursion (condition-case nil
2469 (set-buffer gnus-summary-buffer)
2471 gnus-newsgroup-ignored-charsets))
2472 ct cte ctl charset format)