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 'parse-time-string "parse-time" nil nil)
53 (autoload 'ansi-color-apply-on-region "ansi-color")
55 (defgroup gnus-article nil
57 :link '(custom-manual "(gnus)Article Buffer")
60 (defgroup gnus-article-treat nil
61 "Treating article parts."
62 :link '(custom-manual "(gnus)Article Hiding")
65 (defgroup gnus-article-hiding nil
66 "Hiding article parts."
67 :link '(custom-manual "(gnus)Article Hiding")
70 (defgroup gnus-article-highlight nil
71 "Article highlighting."
72 :link '(custom-manual "(gnus)Article Highlighting")
76 (defgroup gnus-article-signature nil
78 :link '(custom-manual "(gnus)Article Signature")
81 (defgroup gnus-article-headers nil
83 :link '(custom-manual "(gnus)Hiding Headers")
86 (defgroup gnus-article-washing nil
87 "Special commands on articles."
88 :link '(custom-manual "(gnus)Article Washing")
91 (defgroup gnus-article-emphasis nil
92 "Fontisizing articles."
93 :link '(custom-manual "(gnus)Article Fontisizing")
96 (defgroup gnus-article-saving nil
98 :link '(custom-manual "(gnus)Saving Articles")
101 (defgroup gnus-article-mime nil
102 "Worshiping the MIME wonder."
103 :link '(custom-manual "(gnus)Using MIME")
104 :group 'gnus-article)
106 (defgroup gnus-article-buttons nil
107 "Pushable buttons in the article buffer."
108 :link '(custom-manual "(gnus)Article Buttons")
109 :group 'gnus-article)
111 (defgroup gnus-article-various nil
112 "Other article options."
113 :link '(custom-manual "(gnus)Misc Article")
114 :group 'gnus-article)
116 (defcustom gnus-ignored-headers
119 (concat "^" header ":"))
120 '("Path" "Expires" "Date-Received" "References" "Xref" "Lines"
121 "Relay-Version" "Message-ID" "Approved" "Sender" "Received"
122 "X-UIDL" "MIME-Version" "Return-Path" "In-Reply-To"
123 "Content-Type" "Content-Transfer-Encoding" "X-WebTV-Signature"
124 "X-MimeOLE" "X-MSMail-Priority" "X-Priority" "X-Loop"
125 "X-Authentication-Warning" "X-MIME-Autoconverted" "X-Face"
126 "X-Attribution" "X-Originating-IP" "Delivered-To"
127 "NNTP-[-A-Za-z]+" "Distribution" "X-no-archive" "X-Trace"
128 "X-Complaints-To" "X-NNTP-Posting-Host" "X-Orig.*"
129 "Abuse-Reports-To" "Cache-Post-Path" "X-Article-Creation-Date"
130 "X-Poster" "X-Mail2News-Path" "X-Server-Date" "X-Cache"
131 "Originator" "X-Problems-To" "X-Auth-User" "X-Post-Time"
132 "X-Admin" "X-UID" "Resent-[-A-Za-z]+" "X-Mailing-List"
133 "Precedence" "Original-[-A-Za-z]+" "X-filename" "X-Orcpt"
134 "Old-Received" "X-Pgp" "X-Auth" "X-From-Line"
135 "X-Gnus-Article-Number" "X-Majordomo" "X-Url" "X-Sender"
136 "MBOX-Line" "Priority" "X400-[-A-Za-z]+"
137 "Status" "X-Gnus-Mail-Source" "Cancel-Lock"
138 "X-FTN" "X-EXP32-SerialNo" "Encoding" "Importance"
139 "Autoforwarded" "Original-Encoded-Information-Types" "X-Ya-Pop3"
140 "X-Face-Version" "X-Vms-To" "X-ML-NAME" "X-ML-COUNT"
141 "Mailing-List" "X-finfo" "X-md5sum" "X-md5sum-Origin"
142 "X-Sun-Charset" "X-Accept-Language" "X-Envelope-Sender"
143 "List-[A-Za-z]+" "X-Listprocessor-Version"
144 "X-Received" "X-Distribute" "X-Sequence" "X-Juno-Line-Breaks"
145 "X-Notes-Item" "X-MS-TNEF-Correlator" "x-uunet-gateway"
146 "X-Received" "Content-length" "X-precedence"
147 "X-Authenticated-User" "X-Comment" "X-Report" "X-Abuse-Info"
148 "X-HTTP-Proxy" "X-Mydeja-Info" "X-Copyright" "X-No-Markup"
149 "X-Abuse-Info" "X-From_" "X-Accept-Language" "Errors-To"
150 "X-BeenThere" "X-Mailman-Version" "List-Help" "List-Post"
151 "List-Subscribe" "List-Id" "List-Unsubscribe" "List-Archive"
152 "X-Content-length" "X-Posting-Agent" "Original-Received"
153 "X-Request-PGP" "X-Fingerprint" "X-WRIEnvto" "X-WRIEnvfrom"
154 "X-Virus-Scanned" "X-Delivery-Agent" "Posted-Date" "X-Gateway"
155 "X-Local-Origin" "X-Local-Destination" "X-UserInfo1"
156 "X-Received-Date" "X-Hashcash" "Face" "X-DMCA-Notifications"
157 "X-Abuse-and-DMCA-Info" "X-Postfilter" "X-Gpg-.*" "X-Disclaimer"))
158 "*All headers that start with this regexp will be hidden.
159 This variable can also be a list of regexps of headers to be ignored.
160 If `gnus-visible-headers' is non-nil, this variable will be ignored."
161 :type '(choice :custom-show nil
164 :group 'gnus-article-hiding)
166 (defcustom gnus-visible-headers
167 "^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:"
168 "*All headers that do not match this regexp will be hidden.
169 This variable can also be a list of regexp of headers to remain visible.
170 If this variable is non-nil, `gnus-ignored-headers' will be ignored."
171 :type '(repeat :value-to-internal (lambda (widget value)
172 (custom-split-regexp-maybe value))
173 :match (lambda (widget value)
175 (widget-editable-list-match widget value)))
177 :group 'gnus-article-hiding)
179 (defcustom gnus-sorted-header-list
180 '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:"
181 "^Followup-To:" "^To:" "^Cc:" "^Date:" "^Organization:")
182 "*This variable is a list of regular expressions.
183 If it is non-nil, headers that match the regular expressions will
184 be placed first in the article buffer in the sequence specified by
186 :type '(repeat regexp)
187 :group 'gnus-article-hiding)
189 (defcustom gnus-boring-article-headers '(empty followup-to reply-to)
190 "Headers that are only to be displayed if they have interesting data.
191 Possible values in this list are:
193 'empty Headers with no content.
194 'newsgroups Newsgroup identical to Gnus group.
195 'to-address To identical to To-address.
196 'to-list To identical to To-list.
197 'cc-list CC identical to To-list.
198 'followup-to Followup-to identical to Newsgroups.
199 'reply-to Reply-to identical to From.
200 'date Date less than four days old.
201 'long-to To and/or Cc longer than 1024 characters.
202 'many-to Multiple To and/or Cc."
203 :type '(set (const :tag "Headers with no content." empty)
204 (const :tag "Newsgroups identical to Gnus group." newsgroups)
205 (const :tag "To identical to To-address." to-address)
206 (const :tag "To identical to To-list." to-list)
207 (const :tag "CC identical to To-list." cc-list)
208 (const :tag "Followup-to identical to Newsgroups." followup-to)
209 (const :tag "Reply-to identical to From." reply-to)
210 (const :tag "Date less than four days old." date)
211 (const :tag "To and/or Cc longer than 1024 characters." long-to)
212 (const :tag "Multiple To and/or Cc headers." many-to))
213 :group 'gnus-article-hiding)
215 (defcustom gnus-article-skip-boring nil
216 "Skip over text that is not worth reading.
217 By default, if you set this t, then Gnus will display citations and
218 signatures, but will never scroll down to show you a page consisting
219 only of boring text. Boring text is controlled by
220 `gnus-article-boring-faces'."
223 :group 'gnus-article-hiding)
225 (defcustom gnus-signature-separator '("^-- $" "^-- *$")
226 "Regexp matching signature separator.
227 This can also be a list of regexps. In that case, it will be checked
228 from head to tail looking for a separator. Searches will be done from
229 the end of the buffer."
230 :type '(repeat string)
231 :group 'gnus-article-signature)
233 (defcustom gnus-signature-limit nil
234 "Provide a limit to what is considered a signature.
235 If it is a number, no signature may not be longer (in characters) than
236 that number. If it is a floating point number, no signature may be
237 longer (in lines) than that number. If it is a function, the function
238 will be called without any parameters, and if it returns nil, there is
239 no signature in the buffer. If it is a string, it will be used as a
240 regexp. If it matches, the text in question is not a signature.
242 This can also be a list of the above values."
243 :type '(choice (integer :value 200)
245 (function :value fun)
246 (regexp :value ".*"))
247 :group 'gnus-article-signature)
249 (defcustom gnus-hidden-properties '(invisible t intangible t)
250 "Property list to use for hiding text."
252 :group 'gnus-article-hiding)
254 ;; Fixme: This isn't the right thing for mixed graphical and non-graphical
255 ;; frames in a session.
256 (defcustom gnus-article-x-face-command
257 (if (featurep 'xemacs)
258 (if (or (gnus-image-type-available-p 'xface)
259 (gnus-image-type-available-p 'pbm))
260 'gnus-display-x-face-in-from
261 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | ee -")
262 (if (gnus-image-type-available-p 'pbm)
263 'gnus-display-x-face-in-from
264 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | \
266 "*String or function to be executed to display an X-Face header.
267 If it is a string, the command will be executed in a sub-shell
268 asynchronously. The compressed face will be piped to this command."
269 :type `(choice string
270 (function-item gnus-display-x-face-in-from)
274 :group 'gnus-article-washing)
276 (defcustom gnus-article-x-face-too-ugly nil
277 "Regexp matching posters whose face shouldn't be shown automatically."
278 :type '(choice regexp (const nil))
279 :group 'gnus-article-washing)
281 (defcustom gnus-article-banner-alist nil
282 "Banner alist for stripping.
284 ((egroups . \"^[ \\t\\n]*-------------------+\\\\( \\\\(e\\\\|Yahoo! \\\\)Groups Sponsor -+\\\\)?....\\n\\\\(.+\\n\\\\)+\"))"
286 :type '(repeat (cons symbol regexp))
287 :group 'gnus-article-washing)
289 (gnus-define-group-parameter
292 "Alist of regexps (to match group names) and banner."
293 :variable-group gnus-article-washing
295 '(choice :tag "Banner"
297 (const :tag "Remove signature" signature)
298 (symbol :tag "Item in `gnus-article-banner-alist'" none)
300 (const :tag "None" nil))
302 "If non-nil, specify how to remove `banners' from articles.
304 Symbol `signature' means to remove signatures delimited by
305 `gnus-signature-separator'. Any other symbol is used to look up a
306 regular expression to match the banner in `gnus-article-banner-alist'.
307 A string is used as a regular expression to match the banner
310 (defcustom gnus-article-address-banner-alist nil
311 "Alist of mail addresses and banners.
312 Each element has the form (ADDRESS . BANNER), where ADDRESS is a regexp
313 to match a mail address in the From: header, BANNER is one of a symbol
314 `signature', an item in `gnus-article-banner-alist', a regexp and nil.
315 If ADDRESS matches author's mail address, it will remove things like
316 advertisements. For example:
318 \((\"@yoo-hoo\\\\.co\\\\.jp\\\\'\" . \"\\n_+\\nDo You Yoo-hoo!\\\\?\\n.*\\n.*\\n\"))
322 (regexp :tag "Address")
323 (choice :tag "Banner" :value nil
324 (const :tag "Remove signature" signature)
325 (symbol :tag "Item in `gnus-article-banner-alist'" none)
327 (const :tag "None" nil))))
329 :group 'gnus-article-washing)
331 (defmacro gnus-emphasis-custom-with-format (&rest body)
333 \\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\
334 \\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)"))
337 (defun gnus-emphasis-custom-value-to-external (value)
338 (gnus-emphasis-custom-with-format
339 (if (consp (car value))
340 (list (format format (car (car value)) (cdr (car value)))
342 (if (nth 1 value) 2 3)
346 (defun gnus-emphasis-custom-value-to-internal (value)
347 (gnus-emphasis-custom-with-format
348 (let ((regexp (concat "\\`"
349 (format (regexp-quote format)
350 "\\([^()]+\\)" "\\([^()]+\\)")
353 (if (string-match regexp (setq pattern (car value)))
354 (list (cons (match-string 1 pattern) (match-string 2 pattern))
359 (defcustom gnus-emphasis-alist
361 '(("\\*" "\\*" bold nil 2)
364 ("_/" "/_" underline-italic)
365 ("_\\*" "\\*_" underline-bold)
366 ("\\*/" "/\\*" bold-italic)
367 ("_\\*/" "/\\*_" underline-bold-italic))))
369 (gnus-emphasis-custom-with-format
370 (mapcar (lambda (spec)
371 (list (format format (car spec) (cadr spec))
374 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
376 '(("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
377 2 3 gnus-emphasis-underline))))
378 "*Alist that says how to fontify certain phrases.
379 Each item looks like this:
381 (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
383 The first element is a regular expression to be matched. The second
384 is a number that says what regular expression grouping used to find
385 the entire emphasized word. The third is a number that says what
386 regexp grouping should be displayed and highlighted. The fourth
387 is the face used for highlighting."
391 :format "%[Customizing Style%]\n%v"
393 (group :tag "Default"
394 :value ("" 0 0 default)
397 (let ((value (widget-get
398 (cadr (widget-get (widget-get widget :parent)
401 (if (not (eq (nth 2 value) 'default))
405 (gnus-emphasis-custom-value-to-external value))))
406 (widget-group-value-create widget))
408 (integer :format "Match group: %v")
409 (integer :format "Emphasize group: %v")
412 :value (("_" . "_") nil default)
414 (regexp :format "Start regexp: %v")
415 (regexp :format "End regexp: %v"))
416 (boolean :format "Show start and end patterns: %[%v%]\n"
417 :on " On " :off " Off ")
419 :get (lambda (symbol)
420 (mapcar 'gnus-emphasis-custom-value-to-internal
421 (default-value symbol)))
422 :set (lambda (symbol value)
423 (set-default symbol (mapcar 'gnus-emphasis-custom-value-to-external
425 :group 'gnus-article-emphasis)
427 (defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
428 "A regexp to describe whitespace which should not be emphasized.
429 Typical values are \"^[ \\t]+\\\\|[ \\t]*\\n\" and \"[ \\t]+\\\\|[ \\t]*\\n\".
430 The former avoids underlining of leading and trailing whitespace,
431 and the latter avoids underlining any whitespace at all."
433 :group 'gnus-article-emphasis
436 (defface gnus-emphasis-bold '((t (:bold t)))
437 "Face used for displaying strong emphasized text (*word*)."
438 :group 'gnus-article-emphasis)
440 (defface gnus-emphasis-italic '((t (:italic t)))
441 "Face used for displaying italic emphasized text (/word/)."
442 :group 'gnus-article-emphasis)
444 (defface gnus-emphasis-underline '((t (:underline t)))
445 "Face used for displaying underlined emphasized text (_word_)."
446 :group 'gnus-article-emphasis)
448 (defface gnus-emphasis-underline-bold '((t (:bold t :underline t)))
449 "Face used for displaying underlined bold emphasized text (_*word*_)."
450 :group 'gnus-article-emphasis)
452 (defface gnus-emphasis-underline-italic '((t (:italic t :underline t)))
453 "Face used for displaying underlined italic emphasized text (_/word/_)."
454 :group 'gnus-article-emphasis)
456 (defface gnus-emphasis-bold-italic '((t (:bold t :italic t)))
457 "Face used for displaying bold italic emphasized text (/*word*/)."
458 :group 'gnus-article-emphasis)
460 (defface gnus-emphasis-underline-bold-italic
461 '((t (:bold t :italic t :underline t)))
462 "Face used for displaying underlined bold italic emphasized text.
463 Example: (_/*word*/_)."
464 :group 'gnus-article-emphasis)
466 (defface gnus-emphasis-strikethru (if (featurep 'xemacs)
467 '((t (:strikethru t)))
468 '((t (:strike-through t))))
469 "Face used for displaying strike-through text (-word-)."
470 :group 'gnus-article-emphasis)
472 (defface gnus-emphasis-highlight-words
473 '((t (:background "black" :foreground "yellow")))
474 "Face used for displaying highlighted words."
475 :group 'gnus-article-emphasis)
477 (defcustom gnus-article-time-format "%a, %d %b %Y %T %Z"
478 "Format for display of Date headers in article bodies.
479 See `format-time-string' for the possible values.
481 The variable can also be function, which should return a complete Date
482 header. The function is called with one argument, the time, which can
483 be fed to `format-time-string'."
484 :type '(choice string function)
485 :link '(custom-manual "(gnus)Article Date")
486 :group 'gnus-article-washing)
489 (autoload 'mail-extract-address-components "mail-extr"))
491 (defcustom gnus-save-all-headers t
492 "*If non-nil, don't remove any headers before saving."
493 :group 'gnus-article-saving
496 (defcustom gnus-prompt-before-saving 'always
497 "*This variable says how much prompting is to be done when saving articles.
498 If it is nil, no prompting will be done, and the articles will be
499 saved to the default files. If this variable is `always', each and
500 every article that is saved will be preceded by a prompt, even when
501 saving large batches of articles. If this variable is neither nil not
502 `always', there the user will be prompted once for a file name for
503 each invocation of the saving commands."
504 :group 'gnus-article-saving
505 :type '(choice (item always)
506 (item :tag "never" nil)
507 (sexp :tag "once" :format "%t\n" :value t)))
509 (defcustom gnus-saved-headers gnus-visible-headers
510 "Headers to keep if `gnus-save-all-headers' is nil.
511 If `gnus-save-all-headers' is non-nil, this variable will be ignored.
512 If that variable is nil, however, all headers that match this regexp
513 will be kept while the rest will be deleted before saving."
514 :group 'gnus-article-saving
517 (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail
518 "A function to save articles in your favourite format.
519 The function must be interactively callable (in other words, it must
520 be an Emacs command).
522 Gnus provides the following functions:
524 * gnus-summary-save-in-rmail (Rmail format)
525 * gnus-summary-save-in-mail (Unix mail format)
526 * gnus-summary-save-in-folder (MH folder)
527 * gnus-summary-save-in-file (article format)
528 * gnus-summary-save-body-in-file (article body)
529 * gnus-summary-save-in-vm (use VM's folder format)
530 * gnus-summary-write-to-file (article format -- overwrite)."
531 :group 'gnus-article-saving
532 :type '(radio (function-item gnus-summary-save-in-rmail)
533 (function-item gnus-summary-save-in-mail)
534 (function-item gnus-summary-save-in-folder)
535 (function-item gnus-summary-save-in-file)
536 (function-item gnus-summary-save-body-in-file)
537 (function-item gnus-summary-save-in-vm)
538 (function-item gnus-summary-write-to-file)))
540 (defcustom gnus-rmail-save-name 'gnus-plain-save-name
541 "A function generating a file name to save articles in Rmail format.
542 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
543 :group 'gnus-article-saving
546 (defcustom gnus-mail-save-name 'gnus-plain-save-name
547 "A function generating a file name to save articles in Unix mail format.
548 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
549 :group 'gnus-article-saving
552 (defcustom gnus-folder-save-name 'gnus-folder-save-name
553 "A function generating a file name to save articles in MH folder.
554 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER."
555 :group 'gnus-article-saving
558 (defcustom gnus-file-save-name 'gnus-numeric-save-name
559 "A function generating a file name to save articles in article format.
560 The function is called with NEWSGROUP, HEADERS, and optional
562 :group 'gnus-article-saving
565 (defcustom gnus-split-methods
566 '((gnus-article-archive-name)
567 (gnus-article-nndoc-name))
568 "*Variable used to suggest where articles are to be saved.
569 For instance, if you would like to save articles related to Gnus in
570 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
571 you could set this variable to something like:
573 '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
574 (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))
576 This variable is an alist where the key is the match and the
577 value is a list of possible files to save in if the match is
580 If the match is a string, it is used as a regexp match on the
581 article. If the match is a symbol, that symbol will be funcalled
582 from the buffer of the article to be saved with the newsgroup as
583 the parameter. If it is a list, it will be evaled in the same
586 If this form or function returns a string, this string will be
587 used as a possible file name; and if it returns a non-nil list,
588 that list will be used as possible file names."
589 :group 'gnus-article-saving
590 :type '(repeat (choice (list :value (fun) function)
591 (cons :value ("" "") regexp (repeat string))
594 (defcustom gnus-page-delimiter "^\^L"
595 "*Regexp describing what to use as article page delimiters.
596 The default value is \"^\^L\", which is a form linefeed at the
597 beginning of a line."
599 :group 'gnus-article-various)
601 (defcustom gnus-article-mode-line-format "Gnus: %g [%w] %S%m"
602 "*The format specification for the article mode line.
603 See `gnus-summary-mode-line-format' for a closer description.
605 The following additional specs are available:
607 %w The article washing status.
608 %m The number of MIME parts in the article."
610 :group 'gnus-article-various)
612 (defcustom gnus-article-mode-hook nil
613 "*A hook for Gnus article mode."
615 :group 'gnus-article-various)
617 (when (featurep 'xemacs)
618 ;; Extracted from gnus-xmas-define in order to preserve user settings
619 (when (fboundp 'turn-off-scroll-in-place)
620 (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
621 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
622 (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add))
624 (defcustom gnus-article-menu-hook nil
625 "*Hook run after the creation of the article mode menu."
627 :group 'gnus-article-various)
629 (defcustom gnus-article-prepare-hook nil
630 "*A hook called after an article has been prepared in the article buffer."
632 :group 'gnus-article-various)
634 (defcustom gnus-copy-article-ignored-headers nil
635 "List of headers to be removed when copying an article.
636 Each element is a regular expression."
637 :version "23.0" ;; No Gnus
638 :type '(repeat regexp)
639 :group 'gnus-article-various)
641 (make-obsolete-variable 'gnus-article-hide-pgp-hook
642 "This variable is obsolete in Gnus 5.10.")
644 (defcustom gnus-article-button-face 'bold
645 "Face used for highlighting buttons in the article buffer.
647 An article button is a piece of text that you can activate by pressing
648 `RET' or `mouse-2' above it."
650 :group 'gnus-article-buttons)
652 (defcustom gnus-article-mouse-face 'highlight
653 "Face used for mouse highlighting in the article buffer.
655 Article buttons will be displayed in this face when the cursor is
658 :group 'gnus-article-buttons)
660 (defcustom gnus-signature-face 'gnus-signature-face
661 "Face used for highlighting a signature in the article buffer.
662 Obsolete; use the face `gnus-signature-face' for customizations instead."
664 :group 'gnus-article-highlight
665 :group 'gnus-article-signature)
667 (defface gnus-signature-face
670 "Face used for highlighting a signature in the article buffer."
671 :group 'gnus-article-highlight
672 :group 'gnus-article-signature)
674 (defface gnus-header-from-face
677 (:foreground "spring green"))
680 (:foreground "red3"))
683 "Face used for displaying from headers."
684 :group 'gnus-article-headers
685 :group 'gnus-article-highlight)
687 (defface gnus-header-subject-face
690 (:foreground "SeaGreen3"))
693 (:foreground "red4"))
695 (:bold t :italic t)))
696 "Face used for displaying subject headers."
697 :group 'gnus-article-headers
698 :group 'gnus-article-highlight)
700 (defface gnus-header-newsgroups-face
703 (:foreground "yellow" :italic t))
706 (:foreground "MidnightBlue" :italic t))
709 "Face used for displaying newsgroups headers.
710 In the default setup this face is only used for crossposted
712 :group 'gnus-article-headers
713 :group 'gnus-article-highlight)
715 (defface gnus-header-name-face
718 (:foreground "SeaGreen"))
721 (:foreground "maroon"))
724 "Face used for displaying header names."
725 :group 'gnus-article-headers
726 :group 'gnus-article-highlight)
728 (defface gnus-header-content-face
731 (:foreground "forest green" :italic t))
734 (:foreground "indianred4" :italic t))
736 (:italic t))) "Face used for displaying header content."
737 :group 'gnus-article-headers
738 :group 'gnus-article-highlight)
740 (defcustom gnus-header-face-alist
741 '(("From" nil gnus-header-from-face)
742 ("Subject" nil gnus-header-subject-face)
743 ("Newsgroups:.*," nil gnus-header-newsgroups-face)
744 ("" gnus-header-name-face gnus-header-content-face))
745 "*Controls highlighting of article headers.
747 An alist of the form (HEADER NAME CONTENT).
749 HEADER is a regular expression which should match the name of a
750 header and NAME and CONTENT are either face names or nil.
752 The name of each header field will be displayed using the face
753 specified by the first element in the list where HEADER matches
754 the header name and NAME is non-nil. Similarly, the content will
755 be displayed by the first non-nil matching CONTENT face."
756 :group 'gnus-article-headers
757 :group 'gnus-article-highlight
758 :type '(repeat (list (regexp :tag "Header")
760 (item :tag "skip" nil)
761 (face :value default))
762 (choice :tag "Content"
763 (item :tag "skip" nil)
764 (face :value default)))))
766 (defcustom gnus-article-decode-hook
767 '(article-decode-charset article-decode-encoded-words
768 article-decode-group-name article-decode-idna-rhs)
769 "*Hook run to decode charsets in articles."
770 :group 'gnus-article-headers
773 (defcustom gnus-display-mime-function 'gnus-display-mime
774 "Function to display MIME articles."
775 :group 'gnus-article-mime
778 (defvar gnus-decode-header-function 'mail-decode-encoded-word-region
779 "Function used to decode headers.")
781 (defvar gnus-article-dumbquotes-map
801 "Table for MS-to-Latin1 translation.")
803 (defcustom gnus-ignored-mime-types nil
804 "List of MIME types that should be ignored by Gnus."
806 :group 'gnus-article-mime
807 :type '(repeat regexp))
809 (defcustom gnus-unbuttonized-mime-types '(".*/.*")
810 "List of MIME types that should not be given buttons when rendered inline.
811 See also `gnus-buttonized-mime-types' which may override this variable.
812 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
814 :group 'gnus-article-mime
815 :type '(repeat regexp))
817 (defcustom gnus-buttonized-mime-types nil
818 "List of MIME types that should be given buttons when rendered inline.
819 If set, this variable overrides `gnus-unbuttonized-mime-types'.
820 To see e.g. security buttons you could set this to
821 `(\"multipart/signed\")'.
822 This variable is only used when `gnus-inhibit-mime-unbuttonizing' is nil."
824 :group 'gnus-article-mime
825 :type '(repeat regexp))
827 (defcustom gnus-inhibit-mime-unbuttonizing nil
828 "If non-nil, all MIME parts get buttons.
829 When nil (the default value), then some MIME parts do not get buttons,
830 as described by the variables `gnus-buttonized-mime-types' and
831 `gnus-unbuttonized-mime-types'."
833 :group 'gnus-article-mime
836 (defcustom gnus-body-boundary-delimiter "_"
837 "String used to delimit header and body.
838 This variable is used by `gnus-article-treat-body-boundary' which can
839 be controlled by `gnus-treat-body-boundary'."
841 :group 'gnus-article-various
842 :type '(choice (item :tag "None" :value nil)
845 (defcustom gnus-picon-databases '("/usr/lib/picon" "/usr/local/faces"
847 "Defines the location of the faces database.
848 For information on obtaining this database of pretty pictures, please
849 see http://www.cs.indiana.edu/picons/ftp/index.html"
851 :type '(repeat directory)
852 :link '(url-link :tag "download"
853 "http://www.cs.indiana.edu/picons/ftp/index.html")
854 :link '(custom-manual "(gnus)Picons")
857 (defun gnus-picons-installed-p ()
858 "Say whether picons are installed on your machine."
859 (let ((installed nil))
860 (dolist (database gnus-picon-databases)
861 (when (file-exists-p database)
865 (defcustom gnus-article-mime-part-function nil
866 "Function called with a MIME handle as the argument.
867 This is meant for people who want to do something automatic based
868 on parts -- for instance, adding Vcard info to a database."
869 :group 'gnus-article-mime
872 (defcustom gnus-mime-multipart-functions nil
873 "An alist of MIME types to functions to display them."
875 :group 'gnus-article-mime
876 :type '(repeat (cons :format "%v" (string :tag "MIME type") function)))
878 (defcustom gnus-article-date-lapsed-new-header nil
879 "Whether the X-Sent and Date headers can coexist.
880 When using `gnus-treat-date-lapsed', the \"X-Sent:\" header will
881 either replace the old \"Date:\" header (if this variable is nil), or
882 be added below it (otherwise)."
884 :group 'gnus-article-headers
887 (defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative
888 "Function called with a MIME handle as the argument.
889 This is meant for people who want to view first matched part.
890 For `undisplayed-alternative' (default), the first undisplayed
891 part or alternative part is used. For `undisplayed', the first
892 undisplayed part is used. For a function, the first part which
893 the function return t is used. For nil, the first part is
896 :group 'gnus-article-mime
898 (item :tag "first" :value nil)
899 (item :tag "undisplayed" :value undisplayed)
900 (item :tag "undisplayed or alternative"
901 :value undisplayed-alternative)
904 (defcustom gnus-mime-action-alist
905 '(("save to file" . gnus-mime-save-part)
906 ("save and strip" . gnus-mime-save-part-and-strip)
907 ("delete part" . gnus-mime-delete-part)
908 ("display as text" . gnus-mime-inline-part)
909 ("view the part" . gnus-mime-view-part)
910 ("pipe to command" . gnus-mime-pipe-part)
911 ("toggle display" . gnus-article-press-button)
912 ("toggle display" . gnus-article-view-part-as-charset)
913 ("view as type" . gnus-mime-view-part-as-type)
914 ("view internally" . gnus-mime-view-part-internally)
915 ("view externally" . gnus-mime-view-part-externally))
916 "An alist of actions that run on the MIME attachment."
917 :group 'gnus-article-mime
918 :type '(repeat (cons (string :tag "name")
922 ;;; The treatment variables
925 (defvar gnus-part-display-hook nil
926 "Hook called on parts that are to receive treatment.")
928 (defvar gnus-article-treat-custom
929 '(choice (const :tag "Off" nil)
931 (const :tag "Header" head)
932 (const :tag "Last" last)
933 (integer :tag "Less")
934 (repeat :tag "Groups" regexp)
935 (sexp :tag "Predicate")))
937 (defvar gnus-article-treat-head-custom
938 '(choice (const :tag "Off" nil)
939 (const :tag "Header" head)))
941 (defvar gnus-article-treat-types '("text/plain")
944 (defvar gnus-inhibit-treatment nil
945 "Whether to inhibit treatment.")
947 (defcustom gnus-treat-highlight-signature '(or t (typep "text/x-vcard"))
948 "Highlight the signature.
949 Valid values are nil, t, `head', `last', an integer or a predicate.
950 See Info node `(gnus)Customizing Articles'."
951 :group 'gnus-article-treat
952 :link '(custom-manual "(gnus)Customizing Articles")
953 :type gnus-article-treat-custom)
954 (put 'gnus-treat-highlight-signature 'highlight t)
956 (defcustom gnus-treat-buttonize 100000
958 Valid values are nil, t, `head', `last', an integer or a predicate.
959 See Info node `(gnus)Customizing Articles'."
960 :group 'gnus-article-treat
961 :link '(custom-manual "(gnus)Customizing Articles")
962 :type gnus-article-treat-custom)
963 (put 'gnus-treat-buttonize 'highlight t)
965 (defcustom gnus-treat-buttonize-head 'head
966 "Add buttons to the head.
967 Valid values are nil, t, `head', `last', an integer or a predicate.
968 See Info node `(gnus)Customizing Articles' for details."
969 :group 'gnus-article-treat
970 :link '(custom-manual "(gnus)Customizing Articles")
971 :type gnus-article-treat-head-custom)
972 (put 'gnus-treat-buttonize-head 'highlight t)
974 (defcustom gnus-treat-emphasize
975 (and (or window-system
979 Valid values are nil, t, `head', `last', an integer or a predicate.
980 See Info node `(gnus)Customizing Articles' for details."
981 :group 'gnus-article-treat
982 :link '(custom-manual "(gnus)Customizing Articles")
983 :type gnus-article-treat-custom)
984 (put 'gnus-treat-emphasize 'highlight t)
986 (defcustom gnus-treat-strip-cr nil
987 "Remove carriage returns.
988 Valid values are nil, t, `head', `last', an integer or a predicate.
989 See Info node `(gnus)Customizing Articles' for details."
991 :group 'gnus-article-treat
992 :link '(custom-manual "(gnus)Customizing Articles")
993 :type gnus-article-treat-custom)
995 (defcustom gnus-treat-unsplit-urls nil
996 "Remove newlines from within URLs.
997 Valid values are nil, t, `head', `last', an integer or a predicate.
998 See Info node `(gnus)Customizing Articles' for details."
1000 :group 'gnus-article-treat
1001 :link '(custom-manual "(gnus)Customizing Articles")
1002 :type gnus-article-treat-custom)
1004 (defcustom gnus-treat-leading-whitespace nil
1005 "Remove leading whitespace in headers.
1006 Valid values are nil, t, `head', `last', an integer or a predicate.
1007 See Info node `(gnus)Customizing Articles' for details."
1009 :group 'gnus-article-treat
1010 :link '(custom-manual "(gnus)Customizing Articles")
1011 :type gnus-article-treat-custom)
1013 (defcustom gnus-treat-hide-headers 'head
1015 Valid values are nil, t, `head', `last', an integer or a predicate.
1016 See Info node `(gnus)Customizing Articles' for details."
1017 :group 'gnus-article-treat
1018 :link '(custom-manual "(gnus)Customizing Articles")
1019 :type gnus-article-treat-head-custom)
1021 (defcustom gnus-treat-hide-boring-headers nil
1022 "Hide boring headers.
1023 Valid values are nil, t, `head', `last', an integer or a predicate.
1024 See Info node `(gnus)Customizing Articles' for details."
1025 :group 'gnus-article-treat
1026 :link '(custom-manual "(gnus)Customizing Articles")
1027 :type gnus-article-treat-head-custom)
1029 (defcustom gnus-treat-hide-signature nil
1030 "Hide the signature.
1031 Valid values are nil, t, `head', `last', an integer or a predicate.
1032 See Info node `(gnus)Customizing Articles' for details."
1033 :group 'gnus-article-treat
1034 :link '(custom-manual "(gnus)Customizing Articles")
1035 :type gnus-article-treat-custom)
1037 (defcustom gnus-treat-fill-article nil
1039 Valid values are nil, t, `head', `last', an integer or a predicate.
1040 See Info node `(gnus)Customizing Articles' for details."
1041 :group 'gnus-article-treat
1042 :link '(custom-manual "(gnus)Customizing Articles")
1043 :type gnus-article-treat-custom)
1045 (defcustom gnus-treat-hide-citation nil
1047 Valid values are nil, t, `head', `last', an integer or a predicate.
1048 See Info node `(gnus)Customizing Articles' for details."
1049 :group 'gnus-article-treat
1050 :link '(custom-manual "(gnus)Customizing Articles")
1051 :type gnus-article-treat-custom)
1053 (defcustom gnus-treat-hide-citation-maybe nil
1055 Valid values are nil, t, `head', `last', an integer or a predicate.
1056 See Info node `(gnus)Customizing Articles' for details."
1057 :group 'gnus-article-treat
1058 :link '(custom-manual "(gnus)Customizing Articles")
1059 :type gnus-article-treat-custom)
1061 (defcustom gnus-treat-strip-list-identifiers 'head
1062 "Strip list identifiers from `gnus-list-identifiers`.
1063 Valid values are nil, t, `head', `last', an integer or a predicate.
1064 See Info node `(gnus)Customizing Articles' for details."
1066 :group 'gnus-article-treat
1067 :link '(custom-manual "(gnus)Customizing Articles")
1068 :type gnus-article-treat-custom)
1070 (make-obsolete-variable 'gnus-treat-strip-pgp
1071 "This option is obsolete in Gnus 5.10.")
1073 (defcustom gnus-treat-strip-pem nil
1074 "Strip PEM signatures.
1075 Valid values are nil, t, `head', `last', an integer or a predicate.
1076 See Info node `(gnus)Customizing Articles' for details."
1077 :group 'gnus-article-treat
1078 :link '(custom-manual "(gnus)Customizing Articles")
1079 :type gnus-article-treat-custom)
1081 (defcustom gnus-treat-strip-banner t
1082 "Strip banners from articles.
1083 The banner to be stripped is specified in the `banner' group parameter.
1084 Valid values are nil, t, `head', `last', an integer or a predicate.
1085 See Info node `(gnus)Customizing Articles' for details."
1086 :group 'gnus-article-treat
1087 :link '(custom-manual "(gnus)Customizing Articles")
1088 :type gnus-article-treat-custom)
1090 (defcustom gnus-treat-highlight-headers 'head
1091 "Highlight the headers.
1092 Valid values are nil, t, `head', `last', an integer or a predicate.
1093 See Info node `(gnus)Customizing Articles' for details."
1094 :group 'gnus-article-treat
1095 :link '(custom-manual "(gnus)Customizing Articles")
1096 :type gnus-article-treat-head-custom)
1097 (put 'gnus-treat-highlight-headers 'highlight t)
1099 (defcustom gnus-treat-highlight-citation t
1100 "Highlight cited text.
1101 Valid values are nil, t, `head', `last', an integer or a predicate.
1102 See Info node `(gnus)Customizing Articles' for details."
1103 :group 'gnus-article-treat
1104 :link '(custom-manual "(gnus)Customizing Articles")
1105 :type gnus-article-treat-custom)
1106 (put 'gnus-treat-highlight-citation 'highlight t)
1108 (defcustom gnus-treat-date-ut nil
1109 "Display the Date in UT (GMT).
1110 Valid values are nil, t, `head', `last', an integer or a predicate.
1111 See Info node `(gnus)Customizing Articles' for details."
1112 :group 'gnus-article-treat
1113 :link '(custom-manual "(gnus)Customizing Articles")
1114 :type gnus-article-treat-head-custom)
1116 (defcustom gnus-treat-date-local nil
1117 "Display the Date in the local timezone.
1118 Valid values are nil, t, `head', `last', an integer or a predicate.
1119 See Info node `(gnus)Customizing Articles' for details."
1120 :group 'gnus-article-treat
1121 :link '(custom-manual "(gnus)Customizing Articles")
1122 :type gnus-article-treat-head-custom)
1124 (defcustom gnus-treat-date-english nil
1125 "Display the Date in a format that can be read aloud in English.
1126 Valid values are nil, t, `head', `last', an integer or a predicate.
1127 See Info node `(gnus)Customizing Articles' for details."
1129 :group 'gnus-article-treat
1130 :link '(custom-manual "(gnus)Customizing Articles")
1131 :type gnus-article-treat-head-custom)
1133 (defcustom gnus-treat-date-lapsed nil
1134 "Display the Date header in a way that says how much time has elapsed.
1135 Valid values are nil, t, `head', `last', an integer or a predicate.
1136 See Info node `(gnus)Customizing Articles' for details."
1137 :group 'gnus-article-treat
1138 :link '(custom-manual "(gnus)Customizing Articles")
1139 :type gnus-article-treat-head-custom)
1141 (defcustom gnus-treat-date-original nil
1142 "Display the date in the original timezone.
1143 Valid values are nil, t, `head', `last', an integer or a predicate.
1144 See Info node `(gnus)Customizing Articles' for details."
1145 :group 'gnus-article-treat
1146 :link '(custom-manual "(gnus)Customizing Articles")
1147 :type gnus-article-treat-head-custom)
1149 (defcustom gnus-treat-date-iso8601 nil
1150 "Display the date in the ISO8601 format.
1151 Valid values are nil, t, `head', `last', an integer or a predicate.
1152 See Info node `(gnus)Customizing Articles' for details."
1154 :group 'gnus-article-treat
1155 :link '(custom-manual "(gnus)Customizing Articles")
1156 :type gnus-article-treat-head-custom)
1158 (defcustom gnus-treat-date-user-defined nil
1159 "Display the date in a user-defined format.
1160 The format is defined by the `gnus-article-time-format' variable.
1161 Valid values are nil, t, `head', `last', an integer or a predicate.
1162 See Info node `(gnus)Customizing Articles' for details."
1163 :group 'gnus-article-treat
1164 :link '(custom-manual "(gnus)Customizing Articles")
1165 :type gnus-article-treat-head-custom)
1167 (defcustom gnus-treat-strip-headers-in-body t
1168 "Strip the X-No-Archive header line from the beginning of the body.
1169 Valid values are nil, t, `head', `last', an integer or a predicate.
1170 See Info node `(gnus)Customizing Articles' for details."
1172 :group 'gnus-article-treat
1173 :link '(custom-manual "(gnus)Customizing Articles")
1174 :type gnus-article-treat-custom)
1176 (defcustom gnus-treat-strip-trailing-blank-lines nil
1177 "Strip trailing blank lines.
1178 Valid values are nil, t, `head', `last', an integer or a predicate.
1179 See Info node `(gnus)Customizing Articles' for details."
1180 :group 'gnus-article-treat
1181 :link '(custom-manual "(gnus)Customizing Articles")
1182 :type gnus-article-treat-custom)
1184 (defcustom gnus-treat-strip-leading-blank-lines nil
1185 "Strip leading blank lines.
1186 Valid values are nil, t, `head', `last', an integer or a predicate.
1187 See Info node `(gnus)Customizing Articles' for details."
1188 :group 'gnus-article-treat
1189 :link '(custom-manual "(gnus)Customizing Articles")
1190 :type gnus-article-treat-custom)
1192 (defcustom gnus-treat-strip-multiple-blank-lines nil
1193 "Strip multiple blank lines.
1194 Valid values are nil, t, `head', `last', an integer or a predicate.
1195 See Info node `(gnus)Customizing Articles' for details."
1196 :group 'gnus-article-treat
1197 :link '(custom-manual "(gnus)Customizing Articles")
1198 :type gnus-article-treat-custom)
1200 (defcustom gnus-treat-unfold-headers 'head
1201 "Unfold folded header lines.
1202 Valid values are nil, t, `head', `last', an integer or a predicate.
1203 See Info node `(gnus)Customizing Articles' for details."
1205 :group 'gnus-article-treat
1206 :link '(custom-manual "(gnus)Customizing Articles")
1207 :type gnus-article-treat-custom)
1209 (defcustom gnus-treat-fold-headers nil
1211 Valid values are nil, t, `head', `last', an integer or a predicate.
1212 See Info node `(gnus)Customizing Articles' for details."
1214 :group 'gnus-article-treat
1215 :link '(custom-manual "(gnus)Customizing Articles")
1216 :type gnus-article-treat-custom)
1218 (defcustom gnus-treat-fold-newsgroups 'head
1219 "Fold the Newsgroups and Followup-To headers.
1220 Valid values are nil, t, `head', `last', an integer or a predicate.
1221 See Info node `(gnus)Customizing Articles' for details."
1223 :group 'gnus-article-treat
1224 :link '(custom-manual "(gnus)Customizing Articles")
1225 :type gnus-article-treat-custom)
1227 (defcustom gnus-treat-overstrike t
1228 "Treat overstrike highlighting.
1229 Valid values are nil, t, `head', `last', an integer or a predicate.
1230 See Info node `(gnus)Customizing Articles' for details."
1231 :group 'gnus-article-treat
1232 :link '(custom-manual "(gnus)Customizing Articles")
1233 :type gnus-article-treat-custom)
1234 (put 'gnus-treat-overstrike 'highlight t)
1236 (defcustom gnus-treat-ansi-sequences (if (locate-library "ansi-color") t)
1237 "Treat ANSI SGR control sequences.
1238 Valid values are nil, t, `head', `last', an integer or a predicate.
1239 See Info node `(gnus)Customizing Articles' for details."
1240 :group 'gnus-article-treat
1241 :link '(custom-manual "(gnus)Customizing Articles")
1242 :type gnus-article-treat-custom)
1244 (make-obsolete-variable 'gnus-treat-display-xface
1245 'gnus-treat-display-x-face)
1247 (defcustom gnus-treat-display-x-face
1248 (and (not noninteractive)
1249 (or (and (fboundp 'image-type-available-p)
1250 (image-type-available-p 'xbm)
1251 (string-match "^0x" (shell-command-to-string "uncompface"))
1252 (executable-find "icontopbm"))
1253 (and (featurep 'xemacs)
1256 "Display X-Face headers.
1257 Valid values are nil, t, `head', `last', an integer or a predicate.
1258 See Info node `(gnus)Customizing Articles' and Info node
1259 `(gnus)X-Face' for details."
1260 :group 'gnus-article-treat
1262 :link '(custom-manual "(gnus)Customizing Articles")
1263 :link '(custom-manual "(gnus)X-Face")
1264 :type gnus-article-treat-head-custom
1265 :set (lambda (symbol value)
1268 (cond ((or (boundp symbol) (get symbol 'saved-value))
1270 ((boundp 'gnus-treat-display-xface)
1272 ** gnus-treat-display-xface is an obsolete variable;\
1273 use gnus-treat-display-x-face instead")
1274 (default-value 'gnus-treat-display-xface))
1275 ((get 'gnus-treat-display-xface 'saved-value)
1277 ** gnus-treat-display-xface is an obsolete variable;\
1278 use gnus-treat-display-x-face instead")
1279 (eval (car (get 'gnus-treat-display-xface 'saved-value))))
1282 (put 'gnus-treat-display-x-face 'highlight t)
1284 (defcustom gnus-treat-display-face
1285 (and (not noninteractive)
1286 (or (and (fboundp 'image-type-available-p)
1287 (image-type-available-p 'png))
1288 (and (featurep 'xemacs)
1291 "Display Face headers.
1292 Valid values are nil, t, `head', `last', an integer or a predicate.
1293 See Info node `(gnus)Customizing Articles' and Info node
1294 `(gnus)X-Face' for details."
1295 :group 'gnus-article-treat
1297 :link '(custom-manual "(gnus)Customizing Articles")
1298 :link '(custom-manual "(gnus)X-Face")
1299 :type gnus-article-treat-head-custom)
1300 (put 'gnus-treat-display-face 'highlight t)
1302 (defcustom gnus-treat-display-smileys
1303 (if (or (and (featurep 'xemacs)
1305 (and (fboundp 'image-type-available-p)
1306 (image-type-available-p 'pbm)))
1309 Valid values are nil, t, `head', `last', an integer or a predicate.
1310 See Info node `(gnus)Customizing Articles' and Info node
1311 `(gnus)Smileys' for details."
1312 :group 'gnus-article-treat
1314 :link '(custom-manual "(gnus)Customizing Articles")
1315 :link '(custom-manual "(gnus)Smileys")
1316 :type gnus-article-treat-custom)
1317 (put 'gnus-treat-display-smileys 'highlight t)
1319 (defcustom gnus-treat-from-picon
1320 (if (and (gnus-image-type-available-p 'xpm)
1321 (gnus-picons-installed-p))
1323 "Display picons in the From header.
1324 Valid values are nil, t, `head', `last', an integer or a predicate.
1325 See Info node `(gnus)Customizing Articles' and Info node
1326 `(gnus)Picons' for details."
1328 :group 'gnus-article-treat
1330 :link '(custom-manual "(gnus)Customizing Articles")
1331 :link '(custom-manual "(gnus)Picons")
1332 :type gnus-article-treat-head-custom)
1333 (put 'gnus-treat-from-picon 'highlight t)
1335 (defcustom gnus-treat-mail-picon
1336 (if (and (gnus-image-type-available-p 'xpm)
1337 (gnus-picons-installed-p))
1339 "Display picons in To and Cc headers.
1340 Valid values are nil, t, `head', `last', an integer or a predicate.
1341 See Info node `(gnus)Customizing Articles' and Info node
1342 `(gnus)Picons' for details."
1344 :group 'gnus-article-treat
1346 :link '(custom-manual "(gnus)Customizing Articles")
1347 :link '(custom-manual "(gnus)Picons")
1348 :type gnus-article-treat-head-custom)
1349 (put 'gnus-treat-mail-picon 'highlight t)
1351 (defcustom gnus-treat-newsgroups-picon
1352 (if (and (gnus-image-type-available-p 'xpm)
1353 (gnus-picons-installed-p))
1355 "Display picons in the Newsgroups and Followup-To headers.
1356 Valid values are nil, t, `head', `last', an integer or a predicate.
1357 See Info node `(gnus)Customizing Articles' and Info node
1358 `(gnus)Picons' for details."
1360 :group 'gnus-article-treat
1362 :link '(custom-manual "(gnus)Customizing Articles")
1363 :link '(custom-manual "(gnus)Picons")
1364 :type gnus-article-treat-head-custom)
1365 (put 'gnus-treat-newsgroups-picon 'highlight t)
1367 (defcustom gnus-treat-body-boundary
1368 (if (and (eq window-system 'x)
1369 (or gnus-treat-newsgroups-picon
1370 gnus-treat-mail-picon
1371 gnus-treat-from-picon))
1373 "Draw a boundary at the end of the headers.
1374 Valid values are nil and `head'.
1375 See Info node `(gnus)Customizing Articles' for details."
1377 :group 'gnus-article-treat
1378 :link '(custom-manual "(gnus)Customizing Articles")
1379 :type gnus-article-treat-head-custom)
1381 (defcustom gnus-treat-capitalize-sentences nil
1382 "Capitalize sentence-starting words.
1383 Valid values are nil, t, `head', `last', an integer or a predicate.
1384 See Info node `(gnus)Customizing Articles' for details."
1386 :group 'gnus-article-treat
1387 :link '(custom-manual "(gnus)Customizing Articles")
1388 :type gnus-article-treat-custom)
1390 (defcustom gnus-treat-wash-html nil
1392 Valid values are nil, t, `head', `last', an integer or a predicate.
1393 See Info node `(gnus)Customizing Articles' for details."
1395 :group 'gnus-article-treat
1396 :link '(custom-manual "(gnus)Customizing Articles")
1397 :type gnus-article-treat-custom)
1399 (defcustom gnus-treat-fill-long-lines nil
1401 Valid values are nil, t, `head', `last', an integer or a predicate.
1402 See Info node `(gnus)Customizing Articles' for details."
1403 :group 'gnus-article-treat
1404 :link '(custom-manual "(gnus)Customizing Articles")
1405 :type gnus-article-treat-custom)
1407 (defcustom gnus-treat-play-sounds nil
1409 Valid values are nil, t, `head', `last', an integer or a predicate.
1410 See Info node `(gnus)Customizing Articles' for details."
1412 :group 'gnus-article-treat
1413 :link '(custom-manual "(gnus)Customizing Articles")
1414 :type gnus-article-treat-custom)
1416 (defcustom gnus-treat-translate nil
1417 "Translate articles from one language to another.
1418 Valid values are nil, t, `head', `last', an integer or a predicate.
1419 See Info node `(gnus)Customizing Articles' for details."
1421 :group 'gnus-article-treat
1422 :link '(custom-manual "(gnus)Customizing Articles")
1423 :type gnus-article-treat-custom)
1425 (defcustom gnus-treat-x-pgp-sig nil
1427 To automatically treat X-PGP-Sig, set it to head.
1428 Valid values are nil, t, `head', `last', an integer or a predicate.
1429 See Info node `(gnus)Customizing Articles' for details."
1431 :group 'gnus-article-treat
1432 :group 'mime-security
1433 :link '(custom-manual "(gnus)Customizing Articles")
1434 :type gnus-article-treat-custom)
1436 (defvar gnus-article-encrypt-protocol-alist
1437 '(("PGP" . mml2015-self-encrypt)))
1439 ;; Set to nil if more than one protocol added to
1440 ;; gnus-article-encrypt-protocol-alist.
1441 (defcustom gnus-article-encrypt-protocol "PGP"
1442 "The protocol used for encrypt articles.
1443 It is a string, such as \"PGP\". If nil, ask user."
1446 :group 'mime-security)
1448 (defvar gnus-article-wash-function nil
1449 "Function used for converting HTML into text.")
1451 (defcustom gnus-use-idna (and (condition-case nil (require 'idna) (file-error))
1452 (mm-coding-system-p 'utf-8)
1453 (executable-find idna-program))
1454 "Whether IDNA decoding of headers is used when viewing messages.
1455 This requires GNU Libidn, and by default only enabled if it is found."
1457 :group 'gnus-article-headers
1460 (defcustom gnus-article-over-scroll nil
1461 "If non-nil, allow scrolling the article buffer even when there no more text."
1463 :group 'gnus-article
1466 ;;; Internal variables
1468 (defvar gnus-english-month-names
1469 '("January" "February" "March" "April" "May" "June" "July" "August"
1470 "September" "October" "November" "December"))
1472 (defvar gnus-button-regexp nil)
1473 (defvar gnus-button-marker-list nil)
1474 ;; Regexp matching any of the regexps from `gnus-button-alist'.
1476 (defvar gnus-button-last nil)
1477 ;; The value of `gnus-button-alist' when `gnus-button-regexp' was build.
1479 (defvar article-goto-body-goes-to-point-min-p nil)
1480 (defvar gnus-article-wash-types nil)
1481 (defvar gnus-article-emphasis-alist nil)
1482 (defvar gnus-article-image-alist nil)
1484 (defvar gnus-article-mime-handle-alist-1 nil)
1485 (defvar gnus-treatment-function-alist
1486 '((gnus-treat-x-pgp-sig gnus-article-verify-x-pgp-sig)
1487 (gnus-treat-strip-banner gnus-article-strip-banner)
1488 (gnus-treat-strip-headers-in-body gnus-article-strip-headers-in-body)
1489 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1490 (gnus-treat-buttonize gnus-article-add-buttons)
1491 (gnus-treat-fill-article gnus-article-fill-cited-article)
1492 (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
1493 (gnus-treat-strip-cr gnus-article-remove-cr)
1494 (gnus-treat-unsplit-urls gnus-article-unsplit-urls)
1495 (gnus-treat-date-ut gnus-article-date-ut)
1496 (gnus-treat-date-local gnus-article-date-local)
1497 (gnus-treat-date-english gnus-article-date-english)
1498 (gnus-treat-date-lapsed gnus-article-date-lapsed)
1499 (gnus-treat-date-original gnus-article-date-original)
1500 (gnus-treat-date-user-defined gnus-article-date-user)
1501 (gnus-treat-date-iso8601 gnus-article-date-iso8601)
1502 (gnus-treat-display-x-face gnus-article-display-x-face)
1503 (gnus-treat-display-face gnus-article-display-face)
1504 (gnus-treat-hide-headers gnus-article-maybe-hide-headers)
1505 (gnus-treat-hide-boring-headers gnus-article-hide-boring-headers)
1506 (gnus-treat-hide-signature gnus-article-hide-signature)
1507 (gnus-treat-strip-list-identifiers gnus-article-hide-list-identifiers)
1508 (gnus-treat-leading-whitespace gnus-article-remove-leading-whitespace)
1509 (gnus-treat-strip-pem gnus-article-hide-pem)
1510 (gnus-treat-from-picon gnus-treat-from-picon)
1511 (gnus-treat-mail-picon gnus-treat-mail-picon)
1512 (gnus-treat-newsgroups-picon gnus-treat-newsgroups-picon)
1513 (gnus-treat-highlight-headers gnus-article-highlight-headers)
1514 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1515 (gnus-treat-strip-trailing-blank-lines
1516 gnus-article-remove-trailing-blank-lines)
1517 (gnus-treat-strip-leading-blank-lines
1518 gnus-article-strip-leading-blank-lines)
1519 (gnus-treat-strip-multiple-blank-lines
1520 gnus-article-strip-multiple-blank-lines)
1521 (gnus-treat-overstrike gnus-article-treat-overstrike)
1522 (gnus-treat-ansi-sequences gnus-article-treat-ansi-sequences)
1523 (gnus-treat-unfold-headers gnus-article-treat-unfold-headers)
1524 (gnus-treat-fold-headers gnus-article-treat-fold-headers)
1525 (gnus-treat-fold-newsgroups gnus-article-treat-fold-newsgroups)
1526 (gnus-treat-buttonize-head gnus-article-add-buttons-to-head)
1527 (gnus-treat-display-smileys gnus-treat-smiley)
1528 (gnus-treat-capitalize-sentences gnus-article-capitalize-sentences)
1529 (gnus-treat-wash-html gnus-article-wash-html)
1530 (gnus-treat-emphasize gnus-article-emphasize)
1531 (gnus-treat-hide-citation gnus-article-hide-citation)
1532 (gnus-treat-hide-citation-maybe gnus-article-hide-citation-maybe)
1533 (gnus-treat-highlight-citation gnus-article-highlight-citation)
1534 (gnus-treat-body-boundary gnus-article-treat-body-boundary)
1535 (gnus-treat-play-sounds gnus-earcon-display)))
1537 (defvar gnus-article-mime-handle-alist nil)
1538 (defvar article-lapsed-timer nil)
1539 (defvar gnus-article-current-summary nil)
1541 (defvar gnus-article-mode-syntax-table
1542 (let ((table (copy-syntax-table text-mode-syntax-table)))
1543 ;; This causes the citation match run O(2^n).
1544 ;; (modify-syntax-entry ?- "w" table)
1545 (modify-syntax-entry ?> ")<" table)
1546 (modify-syntax-entry ?< "(>" table)
1547 ;; make M-. in article buffers work for `foo' strings
1548 (modify-syntax-entry ?' " " table)
1549 (modify-syntax-entry ?` " " table)
1551 "Syntax table used in article mode buffers.
1552 Initialized from `text-mode-syntax-table.")
1554 (defvar gnus-save-article-buffer nil)
1556 (defvar gnus-article-mode-line-format-alist
1557 (nconc '((?w (gnus-article-wash-status) ?s)
1558 (?m (gnus-article-mime-part-status) ?s))
1559 gnus-summary-mode-line-format-alist))
1561 (defvar gnus-number-of-articles-to-be-saved nil)
1563 (defvar gnus-inhibit-hiding nil)
1565 (defvar gnus-article-edit-mode nil)
1567 ;;; Macros for dealing with the article buffer.
1569 (defmacro gnus-with-article-headers (&rest forms)
1571 (set-buffer gnus-article-buffer)
1573 (let ((inhibit-read-only t)
1574 (inhibit-point-motion-hooks t)
1575 (case-fold-search t))
1576 (article-narrow-to-head)
1579 (put 'gnus-with-article-headers 'lisp-indent-function 0)
1580 (put 'gnus-with-article-headers 'edebug-form-spec '(body))
1582 (defmacro gnus-with-article-buffer (&rest forms)
1584 (set-buffer gnus-article-buffer)
1585 (let ((inhibit-read-only t))
1588 (put 'gnus-with-article-buffer 'lisp-indent-function 0)
1589 (put 'gnus-with-article-buffer 'edebug-form-spec '(body))
1591 (defun gnus-article-goto-header (header)
1592 "Go to HEADER, which is a regular expression."
1593 (re-search-forward (concat "^\\(" header "\\):") nil t))
1595 (defsubst gnus-article-hide-text (b e props)
1596 "Set text PROPS on the B to E region, extending `intangible' 1 past B."
1597 (gnus-add-text-properties-when 'article-type nil b e props)
1598 (when (memq 'intangible props)
1600 (max (1- b) (point-min))
1601 b 'intangible (cddr (memq 'intangible props)))))
1603 (defsubst gnus-article-unhide-text (b e)
1604 "Remove hidden text properties from region between B and E."
1605 (remove-text-properties b e gnus-hidden-properties)
1606 (when (memq 'intangible gnus-hidden-properties)
1607 (put-text-property (max (1- b) (point-min))
1608 b 'intangible nil)))
1610 (defun gnus-article-hide-text-type (b e type)
1611 "Hide text of TYPE between B and E."
1612 (gnus-add-wash-type type)
1613 (gnus-article-hide-text
1614 b e (cons 'article-type (cons type gnus-hidden-properties))))
1616 (defun gnus-article-unhide-text-type (b e type)
1617 "Unhide text of TYPE between B and E."
1618 (gnus-delete-wash-type type)
1619 (remove-text-properties
1620 b e (cons 'article-type (cons type gnus-hidden-properties)))
1621 (when (memq 'intangible gnus-hidden-properties)
1622 (put-text-property (max (1- b) (point-min))
1623 b 'intangible nil)))
1625 (defun gnus-article-hide-text-of-type (type)
1626 "Hide text of TYPE in the current buffer."
1628 (let ((b (point-min))
1630 (while (setq b (text-property-any b e 'article-type type))
1631 (add-text-properties b (incf b) gnus-hidden-properties)))))
1633 (defun gnus-article-delete-text-of-type (type)
1634 "Delete text of TYPE in the current buffer."
1636 (let ((b (point-min)))
1637 (while (setq b (text-property-any b (point-max) 'article-type type))
1639 b (or (text-property-not-all b (point-max) 'article-type type)
1642 (defun gnus-article-delete-invisible-text ()
1643 "Delete all invisible text in the current buffer."
1645 (let ((b (point-min)))
1646 (while (setq b (text-property-any b (point-max) 'invisible t))
1648 b (or (text-property-not-all b (point-max) 'invisible t)
1651 (defun gnus-article-text-type-exists-p (type)
1652 "Say whether any text of type TYPE exists in the buffer."
1653 (text-property-any (point-min) (point-max) 'article-type type))
1655 (defsubst gnus-article-header-rank ()
1656 "Give the rank of the string HEADER as given by `gnus-sorted-header-list'."
1657 (let ((list gnus-sorted-header-list)
1660 (if (looking-at (car list))
1662 (setq list (cdr list))
1666 (defun article-hide-headers (&optional arg delete)
1667 "Hide unwanted headers and possibly sort them as well."
1669 ;; This function might be inhibited.
1670 (unless gnus-inhibit-hiding
1671 (let ((inhibit-read-only nil)
1672 (case-fold-search t)
1673 (max (1+ (length gnus-sorted-header-list)))
1674 (inhibit-point-motion-hooks t)
1675 (cur (current-buffer))
1676 ignored visible beg)
1678 ;; `gnus-ignored-headers' and `gnus-visible-headers' may be
1679 ;; group parameters, so we should go to the summary buffer.
1682 (progn (set-buffer gnus-summary-buffer) t)
1684 (setq ignored (when (not gnus-visible-headers)
1685 (cond ((stringp gnus-ignored-headers)
1686 gnus-ignored-headers)
1687 ((listp gnus-ignored-headers)
1688 (mapconcat 'identity
1689 gnus-ignored-headers
1691 visible (cond ((stringp gnus-visible-headers)
1692 gnus-visible-headers)
1693 ((and gnus-visible-headers
1694 (listp gnus-visible-headers))
1695 (mapconcat 'identity
1696 gnus-visible-headers
1700 ;; First we narrow to just the headers.
1701 (article-narrow-to-head)
1702 ;; Hide any "From " lines at the beginning of (mail) articles.
1703 (while (looking-at "From ")
1706 (delete-region (point-min) (point)))
1707 ;; Then treat the rest of the header lines.
1708 ;; Then we use the two regular expressions
1709 ;; `gnus-ignored-headers' and `gnus-visible-headers' to
1710 ;; select which header lines is to remain visible in the
1712 (while (re-search-forward "^[^ \t:]*:" nil t)
1714 ;; Mark the rank of the header.
1716 (point) (1+ (point)) 'message-rank
1717 (if (or (and visible (looking-at visible))
1719 (not (looking-at ignored))))
1720 (gnus-article-header-rank)
1723 (message-sort-headers-1)
1724 (when (setq beg (text-property-any
1725 (point-min) (point-max) 'message-rank (+ 2 max)))
1726 ;; We delete the unwanted headers.
1727 (gnus-add-wash-type 'headers)
1728 (add-text-properties (point-min) (+ 5 (point-min))
1729 '(article-type headers dummy-invisible t))
1730 (delete-region beg (point-max))))))))
1732 (defun article-hide-boring-headers (&optional arg)
1733 "Toggle hiding of headers that aren't very interesting.
1734 If given a negative prefix, always show; if given a positive prefix,
1736 (interactive (gnus-article-hidden-arg))
1737 (when (and (not (gnus-article-check-hidden-text 'boring-headers arg))
1738 (not gnus-show-all-headers))
1741 (let ((inhibit-read-only t)
1742 (inhibit-point-motion-hooks t))
1743 (article-narrow-to-head)
1744 (dolist (elem gnus-boring-article-headers)
1745 (goto-char (point-min))
1747 ;; Hide empty headers.
1749 (while (re-search-forward "^[^: \t]+:[ \t]*\n[^ \t]" nil t)
1751 (gnus-article-hide-text-type
1755 (if (re-search-forward "^[^ \t]" nil t)
1759 ;; Hide boring Newsgroups header.
1760 ((eq elem 'newsgroups)
1761 (when (gnus-string-equal
1762 (gnus-fetch-field "newsgroups")
1763 (gnus-group-real-name
1764 (if (boundp 'gnus-newsgroup-name)
1767 (gnus-article-hide-header "newsgroups")))
1768 ((eq elem 'to-address)
1769 (let ((to (message-fetch-field "to"))
1771 (gnus-parameter-to-address
1772 (if (boundp 'gnus-newsgroup-name)
1773 gnus-newsgroup-name ""))))
1774 (when (and to to-address
1777 ;; only one address in To
1778 (nth 1 (mail-extract-address-components to))
1780 (gnus-article-hide-header "to"))))
1782 (let ((to (message-fetch-field "to"))
1784 (gnus-parameter-to-list
1785 (if (boundp 'gnus-newsgroup-name)
1786 gnus-newsgroup-name ""))))
1787 (when (and to to-list
1790 ;; only one address in To
1791 (nth 1 (mail-extract-address-components to))
1793 (gnus-article-hide-header "to"))))
1795 (let ((cc (message-fetch-field "cc"))
1797 (gnus-parameter-to-list
1798 (if (boundp 'gnus-newsgroup-name)
1799 gnus-newsgroup-name ""))))
1800 (when (and cc to-list
1803 ;; only one address in CC
1804 (nth 1 (mail-extract-address-components cc))
1806 (gnus-article-hide-header "cc"))))
1807 ((eq elem 'followup-to)
1808 (when (gnus-string-equal
1809 (message-fetch-field "followup-to")
1810 (message-fetch-field "newsgroups"))
1811 (gnus-article-hide-header "followup-to")))
1812 ((eq elem 'reply-to)
1813 (if (gnus-group-find-parameter
1814 gnus-newsgroup-name 'broken-reply-to)
1815 (gnus-article-hide-header "reply-to")
1816 (let ((from (message-fetch-field "from"))
1817 (reply-to (message-fetch-field "reply-to")))
1824 (lambda (x) (downcase (cadr x)))
1825 (mail-extract-address-components from t))
1828 (lambda (x) (downcase (cadr x)))
1829 (mail-extract-address-components reply-to t))
1831 (gnus-article-hide-header "reply-to")))))
1833 (let ((date (message-fetch-field "date")))
1835 (< (days-between (current-time-string) date)
1837 (gnus-article-hide-header "date"))))
1839 (let ((to (message-fetch-field "to"))
1840 (cc (message-fetch-field "cc")))
1841 (when (> (length to) 1024)
1842 (gnus-article-hide-header "to"))
1843 (when (> (length cc) 1024)
1844 (gnus-article-hide-header "cc"))))
1848 (goto-char (point-min))
1849 (while (re-search-forward "^to:" nil t)
1850 (setq to-count (1+ to-count)))
1851 (when (> to-count 1)
1852 (while (> to-count 0)
1853 (goto-char (point-min))
1855 (re-search-forward "^to:" nil nil to-count)
1857 (narrow-to-region (point) (point-max))
1858 (gnus-article-hide-header "to"))
1859 (setq to-count (1- to-count))))
1860 (goto-char (point-min))
1861 (while (re-search-forward "^cc:" nil t)
1862 (setq cc-count (1+ cc-count)))
1863 (when (> cc-count 1)
1864 (while (> cc-count 0)
1865 (goto-char (point-min))
1867 (re-search-forward "^cc:" nil nil cc-count)
1869 (narrow-to-region (point) (point-max))
1870 (gnus-article-hide-header "cc"))
1871 (setq cc-count (1- cc-count)))))))))))))
1873 (defun gnus-article-hide-header (header)
1875 (goto-char (point-min))
1876 (when (re-search-forward (concat "^" header ":") nil t)
1877 (gnus-article-hide-text-type
1881 (if (re-search-forward "^[^ \t]" nil t)
1886 (defvar gnus-article-normalized-header-length 40
1887 "Length of normalized headers.")
1889 (defun article-normalize-headers ()
1890 "Make all header lines 40 characters long."
1892 (let ((inhibit-read-only t)
1896 (article-narrow-to-head)
1899 ((< (setq column (- (point-at-eol) (point)))
1900 gnus-article-normalized-header-length)
1902 (insert (make-string
1903 (- gnus-article-normalized-header-length column)
1905 ((> column gnus-article-normalized-header-length)
1906 (gnus-put-text-property
1908 (forward-char gnus-article-normalized-header-length)
1915 (forward-line 1))))))
1917 (defun article-treat-dumbquotes ()
1918 "Translate M****s*** sm*rtq**t*s and other symbols into proper text.
1919 Note that this function guesses whether a character is a sm*rtq**t* or
1920 not, so it should only be used interactively.
1922 Sm*rtq**t*s are M****s***'s unilateral extension to the
1923 iso-8859-1 character map in an attempt to provide more quoting
1924 characters. If you see something like \\222 or \\264 where
1925 you're expecting some kind of apostrophe or quotation mark, then
1928 (article-translate-strings gnus-article-dumbquotes-map))
1930 (defun article-translate-characters (from to)
1931 "Translate all characters in the body of the article according to FROM and TO.
1932 FROM is a string of characters to translate from; to is a string of
1933 characters to translate to."
1935 (when (article-goto-body)
1936 (let ((inhibit-read-only t)
1937 (x (make-string 225 ?x))
1939 (while (< (incf i) (length x))
1942 (while (< i (length from))
1943 (aset x (aref from i) (aref to i))
1945 (translate-region (point) (point-max) x)))))
1947 (defun article-translate-strings (map)
1948 "Translate all string in the body of the article according to MAP.
1949 MAP is an alist where the elements are on the form (\"from\" \"to\")."
1951 (when (article-goto-body)
1952 (let ((inhibit-read-only t))
1955 (while (search-forward (car elem) nil t)
1956 (replace-match (cadr elem)))))))))
1958 (defun article-treat-overstrike ()
1959 "Translate overstrikes into bold text."
1962 (when (article-goto-body)
1963 (let ((inhibit-read-only t))
1964 (while (search-forward "\b" nil t)
1965 (let ((next (char-after))
1966 (previous (char-after (- (point) 2))))
1967 ;; We do the boldification/underlining by hiding the
1968 ;; overstrikes and putting the proper text property
1972 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
1973 (put-text-property (point) (1+ (point)) 'face 'bold))
1975 (gnus-article-hide-text-type
1976 (1- (point)) (1+ (point)) 'overstrike)
1978 (- (point) 2) (1- (point)) 'face 'underline))
1980 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
1982 (point) (1+ (point)) 'face 'underline)))))))))
1984 (defun article-treat-ansi-sequences ()
1985 "Translate ANSI SGR control sequences into overlays or extents."
1988 (when (article-goto-body)
1989 (let ((inhibit-read-only t))
1990 (ansi-color-apply-on-region (point) (point-max))))))
1992 (defun gnus-article-treat-unfold-headers ()
1993 "Unfold folded message headers.
1994 Only the headers that fit into the current window width will be
1997 (gnus-with-article-headers
2001 (mail-header-narrow-to-field)
2002 (let ((header (buffer-string)))
2005 (goto-char (point-min))
2006 (while (re-search-forward "\n[\t ]" nil t)
2007 (replace-match " " t t)))
2008 (setq length (- (point-max) (point-min) 1)))
2009 (when (< length (window-width))
2010 (while (re-search-forward "\n[\t ]" nil t)
2011 (replace-match " " t t)))
2012 (goto-char (point-max)))))))
2014 (defun gnus-article-treat-fold-headers ()
2015 "Fold message headers."
2017 (gnus-with-article-headers
2020 (mail-header-narrow-to-field)
2021 (mail-header-fold-field)
2022 (goto-char (point-max))))))
2024 (defun gnus-treat-smiley ()
2025 "Toggle display of textual emoticons (\"smileys\") as small graphical icons."
2027 (gnus-with-article-buffer
2028 (if (memq 'smiley gnus-article-wash-types)
2029 (gnus-delete-images 'smiley)
2031 (let ((images (smiley-region (point) (point-max))))
2033 (gnus-add-wash-type 'smiley)
2034 (dolist (image images)
2035 (gnus-add-image 'smiley image)))))))
2037 (defun gnus-article-remove-images ()
2038 "Remove all images from the article buffer."
2040 (gnus-with-article-buffer
2041 (dolist (elem gnus-article-image-alist)
2042 (gnus-delete-images (car elem)))))
2044 (defun gnus-article-treat-fold-newsgroups ()
2045 "Unfold folded message headers.
2046 Only the headers that fit into the current window width will be
2049 (gnus-with-article-headers
2050 (while (gnus-article-goto-header "newsgroups\\|followup-to")
2052 (mail-header-narrow-to-field)
2053 (while (re-search-forward ", *" nil t)
2054 (replace-match ", " t t))
2055 (mail-header-fold-field)
2056 (goto-char (point-max))))))
2058 (defun gnus-article-treat-body-boundary ()
2059 "Place a boundary line at the end of the headers."
2061 (when (and gnus-body-boundary-delimiter
2062 (> (length gnus-body-boundary-delimiter) 0))
2063 (gnus-with-article-headers
2064 (goto-char (point-max))
2065 (let ((start (point)))
2066 (insert "X-Boundary: ")
2067 (gnus-add-text-properties start (point) '(invisible t intangible t))
2069 (while (>= (1- (window-width)) (length str))
2070 (setq str (concat str gnus-body-boundary-delimiter)))
2071 (substring str 0 (1- (window-width))))
2073 (gnus-put-text-property start (point) 'gnus-decoration 'header)))))
2075 (defun article-fill-long-lines ()
2076 "Fill lines that are wider than the window width."
2079 (let ((inhibit-read-only t)
2080 (width (window-width (get-buffer-window (current-buffer)))))
2083 (let ((adaptive-fill-mode nil)) ;Why? -sm
2086 (when (>= (current-column) (min fill-column width))
2087 (narrow-to-region (min (1+ (point)) (point-max))
2089 (let ((goback (point-marker)))
2090 (fill-paragraph nil)
2091 (goto-char (marker-position goback)))
2093 (forward-line 1)))))))
2095 (defun article-capitalize-sentences ()
2096 "Capitalize the first word in each sentence."
2099 (let ((inhibit-read-only t)
2100 (paragraph-start "^[\n\^L]"))
2104 (forward-sentence)))))
2106 (defun article-remove-cr ()
2107 "Remove trailing CRs and then translate remaining CRs into LFs."
2110 (let ((inhibit-read-only t))
2111 (goto-char (point-min))
2112 (while (re-search-forward "\r+$" nil t)
2113 (replace-match "" t t))
2114 (goto-char (point-min))
2115 (while (search-forward "\r" nil t)
2116 (replace-match "\n" t t)))))
2118 (defun article-remove-trailing-blank-lines ()
2119 "Remove all trailing blank lines from the article."
2122 (let ((inhibit-read-only t))
2123 (goto-char (point-max))
2127 (while (and (not (bobp))
2128 (looking-at "^[ \t]*$")
2129 (not (gnus-annotation-in-region-p
2130 (point) (point-at-eol))))
2136 (defvar gnus-face-properties-alist))
2138 (defun article-display-face ()
2139 "Display any Face headers in the header."
2141 (let ((wash-face-p buffer-read-only))
2142 (gnus-with-article-headers
2143 ;; When displaying parts, this function can be called several times on
2144 ;; the same article, without any intended toggle semantic (as typing `W
2145 ;; D d' would have). So face deletion must occur only when we come from
2146 ;; an interactive command, that is when the *Article* buffer is
2148 (if (and wash-face-p (memq 'face gnus-article-wash-types))
2149 (gnus-delete-images 'face)
2152 (when (and wash-face-p
2154 (goto-char (point-min))
2155 (not (re-search-forward "^Face:[\t ]*" nil t)))
2156 (gnus-buffer-live-p gnus-original-article-buffer))
2157 (set-buffer gnus-original-article-buffer))
2159 (mail-narrow-to-head)
2160 (while (gnus-article-goto-header "Face")
2161 (setq faces (nconc faces (list (mail-header-field-value)))))))
2162 (dolist (face faces)
2163 (let ((png (gnus-convert-face-to-png face))
2167 (apply 'gnus-create-image png 'png t
2168 (cdr (assq 'png gnus-face-properties-alist))))
2169 (gnus-article-goto-header "from")
2171 (insert "From: [no `from' set]\n")
2173 (gnus-add-wash-type 'face)
2174 (gnus-add-image 'face image)
2175 (gnus-put-image image nil 'face))))))
2178 (defun article-display-x-face (&optional force)
2179 "Look for an X-Face header and display it if present."
2180 (interactive (list 'force))
2181 (let ((wash-face-p buffer-read-only)) ;; When type `W f'
2182 (gnus-with-article-headers
2183 ;; Delete the old process, if any.
2184 (when (process-status "article-x-face")
2185 (delete-process "article-x-face"))
2186 ;; See the comment in `article-display-face'.
2187 (if (and wash-face-p (memq 'xface gnus-article-wash-types))
2188 ;; We have already displayed X-Faces, so we remove them
2190 (gnus-delete-images 'xface)
2192 (let (x-faces from face)
2194 (when (and wash-face-p
2196 (goto-char (point-min))
2197 (not (re-search-forward
2198 "^X-Face\\(-[0-9]+\\)?:[\t ]*" nil t)))
2199 (gnus-buffer-live-p gnus-original-article-buffer))
2200 ;; If type `W f', use gnus-original-article-buffer,
2201 ;; otherwise use the current buffer because displaying
2202 ;; RFC822 parts calls this function too.
2203 (set-buffer gnus-original-article-buffer))
2205 (mail-narrow-to-head)
2206 (while (gnus-article-goto-header "X-Face")
2207 (push (mail-header-field-value) x-faces))
2208 (setq from (message-fetch-field "from"))))
2209 ;; Sending multiple EOFs to xv doesn't work, so we only do a
2210 ;; single external face.
2211 (when (stringp gnus-article-x-face-command)
2212 (setq x-faces (list (car x-faces))))
2213 (while (and (setq face (pop x-faces))
2214 gnus-article-x-face-command
2216 ;; Check whether this face is censored.
2217 (not gnus-article-x-face-too-ugly)
2218 (and gnus-article-x-face-too-ugly from
2219 (not (string-match gnus-article-x-face-too-ugly
2221 ;; We display the face.
2222 (cond ((stringp gnus-article-x-face-command)
2223 ;; The command is a string, so we interpret the command
2224 ;; as a, well, command, and fork it off.
2225 (let ((process-connection-type nil))
2226 (process-kill-without-query
2228 "article-x-face" nil shell-file-name
2229 shell-command-switch gnus-article-x-face-command))
2232 (process-send-region "article-x-face"
2233 (point-min) (point-max)))
2234 (process-send-eof "article-x-face")))
2235 ((functionp gnus-article-x-face-command)
2236 ;; The command is a lisp function, so we call it.
2237 (funcall gnus-article-x-face-command face))
2239 (error "%s is not a function"
2240 gnus-article-x-face-command)))))))))
2242 (defun article-decode-mime-words ()
2243 "Decode all MIME-encoded words in the article."
2245 (gnus-with-article-buffer
2246 (let ((inhibit-point-motion-hooks t)
2247 (mail-parse-charset gnus-newsgroup-charset)
2248 (mail-parse-ignored-charsets
2249 (with-current-buffer gnus-summary-buffer
2250 gnus-newsgroup-ignored-charsets)))
2251 (mail-decode-encoded-word-region (point-min) (point-max)))))
2253 (defun article-decode-charset (&optional prompt)
2254 "Decode charset-encoded text in the article.
2255 If PROMPT (the prefix), prompt for a coding system to use."
2257 (let ((inhibit-point-motion-hooks t) (case-fold-search t)
2258 (inhibit-read-only t)
2259 (mail-parse-charset gnus-newsgroup-charset)
2260 (mail-parse-ignored-charsets
2261 (save-excursion (condition-case nil
2262 (set-buffer gnus-summary-buffer)
2264 gnus-newsgroup-ignored-charsets))
2265 ct cte ctl charset format)
2268 (article-narrow-to-head)
2269 (setq ct (message-fetch-field "Content-Type" t)
2270 cte (message-fetch-field "Content-Transfer-Encoding" t)
2271 ctl (and ct (ignore-errors
2272 (mail-header-parse-content-type ct)))
2275 (mm-read-coding-system "Charset to decode: "))
2277 (mail-content-type-get ctl 'charset)))
2278 format (and ctl (mail-content-type-get ctl 'format)))
2280 (setq cte (mail-header-strip cte)))
2281 (if (and ctl (not (string-match "/" (car ctl))))
2283 (goto-char (point-max)))
2286 (narrow-to-region (point) (point-max))
2287 (when (and (eq mail-parse-charset 'gnus-decoded)
2288 (eq (mm-body-7-or-8) '8bit))
2289 ;; The text code could have been decoded.
2290 (setq charset mail-parse-charset))
2291 (when (and (or (not ctl)
2292 (equal (car ctl) "text/plain"))
2293 (not format)) ;; article with format will decode later.
2295 charset (and cte (intern (downcase
2296 (gnus-strip-whitespace cte))))
2299 (defun article-decode-encoded-words ()
2300 "Remove encoded-word encoding from headers."
2301 (let ((inhibit-point-motion-hooks t)
2302 (mail-parse-charset gnus-newsgroup-charset)
2303 (mail-parse-ignored-charsets
2304 (save-excursion (condition-case nil
2305 (set-buffer gnus-summary-buffer)
2307 gnus-newsgroup-ignored-charsets))
2308 (inhibit-read-only t))
2310 (article-narrow-to-head)
2311 (funcall gnus-decode-header-function (point-min) (point-max)))))
2313 (defun article-decode-group-name ()
2314 "Decode group names in `Newsgroups:'."
2315 (let ((inhibit-point-motion-hooks t)
2316 (inhibit-read-only t)
2317 (method (gnus-find-method-for-group gnus-newsgroup-name)))
2318 (when (and (or gnus-group-name-charset-method-alist
2319 gnus-group-name-charset-group-alist)
2320 (gnus-buffer-live-p gnus-original-article-buffer))
2322 (article-narrow-to-head)
2323 (with-current-buffer gnus-original-article-buffer
2324 (goto-char (point-min)))
2325 (while (re-search-forward
2326 "^Newsgroups:\\(\\(.\\|\n[\t ]\\)*\\)\n[^\t ]" nil t)
2327 (replace-match (save-match-data
2328 (gnus-decode-newsgroups
2329 ;; XXX how to use data in article buffer?
2330 (with-current-buffer gnus-original-article-buffer
2332 "^Newsgroups:\\(\\(.\\|\n[\t ]\\)*\\)\n[^\t ]"
2335 gnus-newsgroup-name method))
2337 (goto-char (point-min))
2338 (with-current-buffer gnus-original-article-buffer
2339 (goto-char (point-min)))
2340 (while (re-search-forward
2341 "^Followup-To:\\(\\(.\\|\n[\t ]\\)*\\)\n[^\t ]" nil t)
2342 (replace-match (save-match-data
2343 (gnus-decode-newsgroups
2344 ;; XXX how to use data in article buffer?
2345 (with-current-buffer gnus-original-article-buffer
2347 "^Followup-To:\\(\\(.\\|\n[\t ]\\)*\\)\n[^\t ]"
2350 gnus-newsgroup-name method))
2353 (autoload 'idna-to-unicode "idna")
2355 (defun article-decode-idna-rhs ()
2356 "Decode IDNA strings in RHS in From:, To: and Cc: headers in current buffer."
2359 (let ((inhibit-point-motion-hooks t)
2360 (inhibit-read-only t))
2361 (article-narrow-to-head)
2362 (goto-char (point-min))
2363 (while (re-search-forward "@.*\\(xn--[-A-Za-z0-9.]*\\)[ \t\n\r,>]" nil t)
2365 (when (save-match-data
2366 (and (setq ace (match-string 1))
2368 (and (re-search-backward "^[^ \t]" nil t)
2369 (looking-at "From\\|To\\|Cc")))
2370 (setq unicode (idna-to-unicode ace))))
2371 (unless (string= ace unicode)
2372 (replace-match unicode nil nil nil 1)))))))))
2374 (defun article-de-quoted-unreadable (&optional force read-charset)
2375 "Translate a quoted-printable-encoded article.
2376 If FORCE, decode the article whether it is marked as quoted-printable
2378 If READ-CHARSET, ask for a coding system."
2379 (interactive (list 'force current-prefix-arg))
2381 (let ((inhibit-read-only t) type charset)
2382 (if (gnus-buffer-live-p gnus-original-article-buffer)
2383 (with-current-buffer gnus-original-article-buffer
2385 (gnus-fetch-field "content-transfer-encoding"))
2386 (let* ((ct (gnus-fetch-field "content-type"))
2389 (mail-header-parse-content-type ct)))))
2390 (setq charset (and ctl
2391 (mail-content-type-get ctl 'charset)))
2392 (if (stringp charset)
2393 (setq charset (intern (downcase charset)))))))
2395 (setq charset (mm-read-coding-system "Charset: " charset)))
2397 (setq charset gnus-newsgroup-charset))
2399 (and type (let ((case-fold-search t))
2400 (string-match "quoted-printable" type))))
2402 (quoted-printable-decode-region
2403 (point) (point-max) (mm-charset-to-coding-system charset))))))
2405 (defun article-de-base64-unreadable (&optional force read-charset)
2406 "Translate a base64 article.
2407 If FORCE, decode the article whether it is marked as base64 not.
2408 If READ-CHARSET, ask for a coding system."
2409 (interactive (list 'force current-prefix-arg))
2411 (let ((inhibit-read-only t) type charset)
2412 (if (gnus-buffer-live-p gnus-original-article-buffer)
2413 (with-current-buffer gnus-original-article-buffer
2415 (gnus-fetch-field "content-transfer-encoding"))
2416 (let* ((ct (gnus-fetch-field "content-type"))
2419 (mail-header-parse-content-type ct)))))
2420 (setq charset (and ctl
2421 (mail-content-type-get ctl 'charset)))
2422 (if (stringp charset)
2423 (setq charset (intern (downcase charset)))))))
2425 (setq charset (mm-read-coding-system "Charset: " charset)))
2427 (setq charset gnus-newsgroup-charset))
2429 (and type (let ((case-fold-search t))
2430 (string-match "base64" type))))
2433 (narrow-to-region (point) (point-max))
2434 (base64-decode-region (point-min) (point-max))
2435 (mm-decode-coding-region
2436 (point-min) (point-max) (mm-charset-to-coding-system charset)))))))
2441 (defun article-decode-HZ ()
2442 "Translate a HZ-encoded article."
2446 (let ((inhibit-read-only t))
2447 (rfc1843-decode-region (point-min) (point-max)))))
2449 (defun article-unsplit-urls ()
2450 "Remove the newlines that some other mailers insert into URLs."
2453 (let ((inhibit-read-only t))
2454 (goto-char (point-min))
2455 (while (re-search-forward
2456 "\\(\\(https?\\|ftp\\)://\\S-+\\) *\n\\(\\S-+\\)" nil t)
2457 (replace-match "\\1\\3" t)))
2458 (when (interactive-p)
2459 (gnus-treat-article nil))))
2462 (defun article-wash-html (&optional read-charset)
2463 "Format an HTML article.
2464 If READ-CHARSET, ask for a coding system."
2467 (let ((inhibit-read-only t)
2469 (when (gnus-buffer-live-p gnus-original-article-buffer)
2470 (with-current-buffer gnus-original-article-buffer
2471 (let* ((ct (gnus-fetch-field "content-type"))
2474 (mail-header-parse-content-type ct)))))
2475 (setq charset (and ctl
2476 (mail-content-type-get ctl 'charset)))
2477 (when (stringp charset)
2478 (setq charset (intern (downcase charset)))))))
2480 (setq charset (mm-read-coding-system "Charset: " charset)))
2482 (setq charset gnus-newsgroup-charset))
2484 (save-window-excursion
2486 (narrow-to-region (point) (point-max))
2487 (let* ((func (or gnus-article-wash-function mm-text-html-renderer))
2488 (entry (assq func mm-text-html-washer-alist)))
2490 (setq func (cdr entry)))
2495 (apply (car func) (cdr func))))))))))
2497 (defun gnus-article-wash-html-with-w3 ()
2498 "Wash the current buffer with w3."
2500 (let ((w3-strict-width (window-width))
2501 (url-standalone-mode t)
2502 (url-gateway-unplugged t)
2503 (w3-honor-stylesheets nil))
2505 (w3-region (point-min) (point-max))
2508 (defun gnus-article-wash-html-with-w3m ()
2509 "Wash the current buffer with emacs-w3m."
2512 (narrow-to-region (point) (point-max))
2513 (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp)
2514 w3m-force-redisplay)
2515 (w3m-region (point-min) (point-max)))
2516 (when (and mm-inline-text-html-with-w3m-keymap
2517 (boundp 'w3m-minor-mode-map)
2519 (add-text-properties
2520 (point-min) (point-max)
2521 (list 'keymap w3m-minor-mode-map
2522 ;; Put the mark meaning this part was rendered by emacs-w3m.
2523 'mm-inline-text-html-with-w3m t)))))
2525 (defun article-hide-list-identifiers ()
2526 "Remove list identifies from the Subject header.
2527 The `gnus-list-identifiers' variable specifies what to do."
2529 (let ((inhibit-point-motion-hooks t)
2530 (regexp (if (consp gnus-list-identifiers)
2531 (mapconcat 'identity gnus-list-identifiers " *\\|")
2532 gnus-list-identifiers))
2533 (inhibit-read-only t))
2537 (article-narrow-to-head)
2538 (goto-char (point-min))
2539 (while (re-search-forward
2540 (concat "^Subject: +\\(R[Ee]: +\\)*\\(" regexp " *\\)")
2542 (delete-region (match-beginning 2) (match-end 0))
2543 (beginning-of-line))
2544 (when (re-search-forward
2545 "^Subject: +\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" nil t)
2546 (delete-region (match-beginning 1) (match-end 1))))))))
2548 (defun article-hide-pem (&optional arg)
2549 "Toggle hiding of any PEM headers and signatures in the current article.
2550 If given a negative prefix, always show; if given a positive prefix,
2552 (interactive (gnus-article-hidden-arg))
2553 (unless (gnus-article-check-hidden-text 'pem arg)
2555 (let ((inhibit-read-only t) end)
2556 (goto-char (point-min))
2557 ;; Hide the horrendously ugly "header".
2558 (when (and (search-forward
2559 "\n-----BEGIN PRIVACY-ENHANCED MESSAGE-----\n"
2561 (setq end (1+ (match-beginning 0))))
2562 (gnus-add-wash-type 'pem)
2563 (gnus-article-hide-text-type
2565 (if (search-forward "\n\n" nil t)
2569 ;; Hide the trailer as well
2570 (when (search-forward "\n-----END PRIVACY-ENHANCED MESSAGE-----\n"
2572 (gnus-article-hide-text-type
2573 (match-beginning 0) (match-end 0) 'pem)))))))
2575 (defun article-strip-banner ()
2576 "Strip the banners specified by the `banner' group parameter and by
2577 `gnus-article-address-banner-alist'."
2581 (let ((inhibit-point-motion-hooks t))
2582 (when (gnus-parameter-banner gnus-newsgroup-name)
2583 (article-really-strip-banner
2584 (gnus-parameter-banner gnus-newsgroup-name)))
2585 (when gnus-article-address-banner-alist
2586 ;; It is necessary to encode from fields before checking,
2587 ;; because `mail-header-parse-addresses' does not work
2588 ;; (reliably) on decoded headers. And more, it is
2589 ;; impossible to use `gnus-fetch-original-field' here,
2590 ;; because `article-strip-banner' may be called in draft
2591 ;; buffers to preview them.
2592 (let ((from (save-restriction
2594 (article-narrow-to-head)
2595 (mail-fetch-field "from"))))
2598 (caar (mail-header-parse-addresses
2599 (mail-encode-encoded-word-string from)))))
2601 (dolist (pair gnus-article-address-banner-alist)
2602 (when (string-match (car pair) from)
2604 (article-really-strip-banner (cdr pair)))))))))))))
2606 (defun article-really-strip-banner (banner)
2607 "Strip the banner specified by the argument."
2610 (let ((inhibit-point-motion-hooks t)
2611 (gnus-signature-limit nil)
2612 (inhibit-read-only t))
2615 ((eq banner 'signature)
2616 (when (gnus-article-narrow-to-signature)
2619 (delete-region (point) (point-max))))
2621 (if (setq banner (cdr (assq banner gnus-article-banner-alist)))
2622 (while (re-search-forward banner nil t)
2623 (delete-region (match-beginning 0) (match-end 0)))))
2625 (while (re-search-forward banner nil t)
2626 (delete-region (match-beginning 0) (match-end 0)))))))))
2628 (defun article-babel ()
2629 "Translate article using an online translation service."
2632 (gnus-with-article-buffer
2633 (when (article-goto-body)
2634 (let* ((start (point))
2636 (orig (buffer-substring start end))
2637 (trans (babel-as-string orig)))
2639 (narrow-to-region start end)
2640 (delete-region start end)
2643 (defun article-hide-signature (&optional arg)
2644 "Hide the signature in the current article.
2645 If given a negative prefix, always show; if given a positive prefix,
2647 (interactive (gnus-article-hidden-arg))
2648 (unless (gnus-article-check-hidden-text 'signature arg)
2651 (let ((inhibit-read-only t))
2652 (when (gnus-article-narrow-to-signature)
2653 (gnus-article-hide-text-type
2654 (point-min) (point-max) 'signature))))))
2655 (gnus-set-mode-line 'article))
2657 (defun article-strip-headers-in-body ()
2658 "Strip offensive headers from bodies."
2662 (let ((case-fold-search t))
2663 (when (looking-at "x-no-archive:")
2664 (gnus-delete-line)))))
2666 (defun article-strip-leading-blank-lines ()
2667 "Remove all blank lines from the beginning of the article."
2670 (let ((inhibit-point-motion-hooks t)
2671 (inhibit-read-only t))
2672 (when (article-goto-body)
2673 (while (and (not (eobp))
2674 (looking-at "[ \t]*$"))
2675 (gnus-delete-line))))))
2677 (defun article-narrow-to-head ()
2678 "Narrow the buffer to the head of the message.
2679 Point is left at the beginning of the narrowed-to region."
2681 (goto-char (point-min))
2682 (if (search-forward "\n\n" nil 1)
2685 (goto-char (point-min)))
2687 (defun article-goto-body ()
2688 "Place point at the start of the body."
2689 (goto-char (point-min))
2691 ;; This variable is only bound when dealing with separate
2693 (article-goto-body-goes-to-point-min-p
2695 ((search-forward "\n\n" nil t)
2698 (goto-char (point-max))
2701 (defun article-strip-multiple-blank-lines ()
2702 "Replace consecutive blank lines with one empty line."
2705 (let ((inhibit-point-motion-hooks t)
2706 (inhibit-read-only t))
2707 ;; First make all blank lines empty.
2709 (while (re-search-forward "^[ \t]+$" nil t)
2710 (unless (gnus-annotation-in-region-p
2711 (match-beginning 0) (match-end 0))
2712 (replace-match "" nil t)))
2713 ;; Then replace multiple empty lines with a single empty line.
2715 (while (re-search-forward "\n\n\\(\n+\\)" nil t)
2716 (unless (gnus-annotation-in-region-p
2717 (match-beginning 0) (match-end 0))
2718 (delete-region (match-beginning 1) (match-end 1)))))))
2720 (defun article-strip-leading-space ()
2721 "Remove all white space from the beginning of the lines in the article."
2724 (let ((inhibit-point-motion-hooks t)
2725 (inhibit-read-only t))
2727 (while (re-search-forward "^[ \t]+" nil t)
2728 (replace-match "" t t)))))
2730 (defun article-strip-trailing-space ()
2731 "Remove all white space from the end of the lines in the article."
2734 (let ((inhibit-point-motion-hooks t)
2735 (inhibit-read-only t))
2737 (while (re-search-forward "[ \t]+$" nil t)
2738 (replace-match "" t t)))))
2740 (defun article-strip-blank-lines ()
2741 "Strip leading, trailing and multiple blank lines."
2743 (article-strip-leading-blank-lines)
2744 (article-remove-trailing-blank-lines)
2745 (article-strip-multiple-blank-lines))
2747 (defun article-strip-all-blank-lines ()
2748 "Strip all blank lines."
2751 (let ((inhibit-point-motion-hooks t)
2752 (inhibit-read-only t))
2754 (while (re-search-forward "^[ \t]*\n" nil t)
2755 (replace-match "" t t)))))
2757 (defun gnus-article-narrow-to-signature ()
2758 "Narrow to the signature; return t if a signature is found, else nil."
2759 (let ((inhibit-point-motion-hooks t))
2760 (when (gnus-article-search-signature)
2762 ;; Check whether we have some limits to what we consider
2763 ;; to be a signature.
2764 (let ((limits (if (listp gnus-signature-limit) gnus-signature-limit
2765 (list gnus-signature-limit)))
2767 (while (setq limit (pop limits))
2768 (if (or (and (integerp limit)
2769 (< (- (point-max) (point)) limit))
2771 (< (count-lines (point) (point-max)) limit))
2772 (and (functionp limit)
2774 (and (stringp limit)
2775 (not (re-search-forward limit nil t))))
2776 () ; This limit did not succeed.
2780 (narrow-to-region (point) (point-max))
2783 (defun gnus-article-search-signature ()
2784 "Search the current buffer for the signature separator.
2785 Put point at the beginning of the signature separator."
2786 (let ((cur (point)))
2787 (goto-char (point-max))
2788 (if (if (stringp gnus-signature-separator)
2789 (re-search-backward gnus-signature-separator nil t)
2790 (let ((seps gnus-signature-separator))
2792 (not (re-search-backward (car seps) nil t)))
2799 (defun gnus-article-hidden-arg ()
2800 "Return the current prefix arg as a number, or 0 if no prefix."
2801 (list (if current-prefix-arg
2802 (prefix-numeric-value current-prefix-arg)
2805 (defun gnus-article-check-hidden-text (type arg)
2806 "Return nil if hiding is necessary.
2807 Arg can be nil or a number. nil and positive means hide, negative
2808 means show, 0 means toggle."
2811 (let ((hide (gnus-article-hidden-text-p type)))
2817 (gnus-article-show-hidden-text type)
2820 (if (eq hide 'hidden)
2822 (gnus-article-show-hidden-text type)
2826 (defun gnus-article-hidden-text-p (type)
2827 "Say whether the current buffer contains hidden text of type TYPE."
2828 (let ((pos (text-property-any (point-min) (point-max) 'article-type type)))
2830 (not (get-text-property pos 'invisible))
2831 (not (get-text-property pos 'dummy-invisible)))
2833 (text-property-any (1+ pos) (point-max) 'article-type type)))
2838 (defun gnus-article-show-hidden-text (type &optional dummy)
2839 "Show all hidden text of type TYPE.
2840 Originally it is hide instead of DUMMY."
2841 (let ((inhibit-read-only t)
2842 (inhibit-point-motion-hooks t))
2843 (gnus-remove-text-properties-when
2845 (point-min) (point-max)
2846 (cons 'article-type (cons type
2847 gnus-hidden-properties)))
2848 (gnus-delete-wash-type type)))
2850 (defconst article-time-units
2851 `((year . ,(* 365.25 24 60 60))
2852 (week . ,(* 7 24 60 60))
2853 (day . ,(* 24 60 60))
2857 "Mapping from time units to seconds.")
2859 (defun gnus-article-forward-header ()
2860 "Move point to the start of the next header.
2861 If the current header is a continuation header, this can be several
2866 (if (looking-at "[ \t]+[^ \t]")
2870 (defun article-date-ut (&optional type highlight)
2871 "Convert DATE date to universal time in the current article.
2872 If TYPE is `local', convert to local time; if it is `lapsed', output
2873 how much time has lapsed since DATE. For `lapsed', the value of
2874 `gnus-article-date-lapsed-new-header' says whether the \"X-Sent:\" header
2875 should replace the \"Date:\" one, or should be added below it."
2876 (interactive (list 'ut t))
2877 (let* ((tdate-regexp "^Date:[ \t]\\|^X-Sent:[ \t]")
2878 (date-regexp (if (and gnus-article-date-lapsed-new-header
2882 (case-fold-search t)
2883 (inhibit-read-only t)
2884 (inhibit-point-motion-hooks t)
2885 pos date bface eface)
2889 (goto-char (point-min))
2890 (while (and (or (setq date (get-text-property (setq pos (point))
2892 (and (setq pos (next-single-property-change
2893 (point) 'original-date))
2897 (setq date (get-text-property pos
2899 (not (string-equal date "")))
2902 (or (text-property-any pos (point-max) 'original-date nil)
2904 (goto-char (point-min))
2905 (when (re-search-forward tdate-regexp nil t)
2906 (setq bface (get-text-property (point-at-bol) 'face)
2907 eface (get-text-property (1- (point-at-eol)) 'face)))
2908 (goto-char (point-min))
2910 ;; Delete any old Date headers.
2911 (while (re-search-forward date-regexp nil t)
2913 (delete-region (point-at-bol) (progn
2914 (gnus-article-forward-header)
2916 (delete-region (point-at-bol) (progn
2917 (gnus-article-forward-header)
2920 (setq pos (point))))
2921 (when (and (not pos)
2922 (re-search-forward tdate-regexp nil t))
2924 (gnus-goto-char pos)
2925 (insert (article-make-date-line date (or type 'ut)))
2931 (when (looking-at "\\([^:]+\\): *\\(.*\\)$")
2932 (put-text-property (match-beginning 1) (1+ (match-end 1))
2934 (put-text-property (match-beginning 2) (match-end 2)
2936 (put-text-property (point-min) (1- (point-max)) 'original-date date)
2937 (goto-char (point-max))
2940 (defun article-make-date-line (date type)
2941 "Return a DATE line of TYPE."
2942 (unless (memq type '(local ut original user iso8601 lapsed english))
2943 (error "Unknown conversion type: %s" type))
2945 (let ((time (date-to-time date)))
2947 ;; Convert to the local timezone.
2949 (concat "Date: " (message-make-date time)))
2950 ;; Convert to Universal Time.
2955 (let* ((e (parse-time-string date))
2956 (tm (apply 'encode-time e))
2958 (ls (- (cadr tm) (car (current-time-zone time)))))
2959 (cond ((< ls 0) (list (1- ms) (+ ls 65536)))
2960 ((> ls 65535) (list (1+ ms) (- ls 65536)))
2964 ;; Get the original date from the article.
2965 ((eq type 'original)
2966 (concat "Date: " (if (string-match "\n+$" date)
2967 (substring date 0 (match-beginning 0))
2969 ;; Let the user define the format.
2971 (let ((format (or (condition-case nil
2972 (with-current-buffer gnus-summary-buffer
2973 gnus-article-time-format)
2975 gnus-article-time-format)))
2976 (if (functionp format)
2977 (funcall format time)
2978 (concat "Date: " (format-time-string format time)))))
2981 (let ((tz (car (current-time-zone time))))
2984 (format-time-string "%Y%m%dT%H%M%S" time)
2985 (format "%s%02d%02d"
2986 (if (> tz 0) "+" "-") (/ (abs tz) 3600)
2987 (/ (% (abs tz) 3600) 60)))))
2988 ;; Do an X-Sent lapsed format.
2990 ;; If the date is seriously mangled, the timezone functions are
2991 ;; liable to bug out, so we ignore all errors.
2992 (let* ((now (current-time))
2993 (real-time (subtract-time now time))
2994 (real-sec (and real-time
2995 (+ (* (float (car real-time)) 65536)
2997 (sec (and real-time (abs real-sec)))
3007 ;; This is a bit convoluted, but basically we go
3008 ;; through the time units for years, weeks, etc,
3009 ;; and divide things to see whether that results
3010 ;; in positive answers.
3013 (if (zerop (setq num (ffloor (/ sec (cdr unit)))))
3014 ;; The (remaining) seconds are too few to
3015 ;; be divided into this time unit.
3017 ;; It's big enough, so we output it.
3018 (setq sec (- sec (* num (cdr unit))))
3020 (concat (if prev ", " "") (int-to-string
3022 " " (symbol-name (car unit))
3023 (if (> num 1) "s" ""))
3025 article-time-units "")
3026 ;; If dates are odd, then it might appear like the
3027 ;; article was sent in the future.
3030 " in the future"))))))
3031 ;; Display the date in proper English
3033 (let ((dtime (decode-time time)))
3036 (number-to-string (nth 3 dtime))
3037 (let ((digit (% (nth 3 dtime) 10)))
3039 ((memq (nth 3 dtime) '(11 12 13)) "th")
3045 (nth (1- (nth 4 dtime)) gnus-english-month-names)
3047 (number-to-string (nth 5 dtime))
3049 (format "%02d" (nth 2 dtime))
3051 (format "%02d" (nth 1 dtime)))))))
3053 (format "Date: %s (from Gnus)" date))))
3055 (defun article-date-local (&optional highlight)
3056 "Convert the current article date to the local timezone."
3057 (interactive (list t))
3058 (article-date-ut 'local highlight))
3060 (defun article-date-english (&optional highlight)
3061 "Convert the current article date to something that is proper English."
3062 (interactive (list t))
3063 (article-date-ut 'english highlight))
3065 (defun article-date-original (&optional highlight)
3066 "Convert the current article date to what it was originally.
3067 This is only useful if you have used some other date conversion
3068 function and want to see what the date was before converting."
3069 (interactive (list t))
3070 (article-date-ut 'original highlight))
3072 (defun article-date-lapsed (&optional highlight)
3073 "Convert the current article date to time lapsed since it was sent."
3074 (interactive (list t))
3075 (article-date-ut 'lapsed highlight))
3077 (defun article-update-date-lapsed ()
3078 "Function to be run from a timer to update the lapsed time line."
3079 (let (deactivate-mark)
3084 (set-buffer (window-buffer w))
3085 (when (eq major-mode 'gnus-article-mode)
3086 (let ((mark (point-marker)))
3087 (goto-char (point-min))
3088 (when (re-search-forward "^X-Sent:" nil t)
3089 (article-date-lapsed t))
3090 (goto-char (marker-position mark))
3091 (move-marker mark nil))))
3094 (defun gnus-start-date-timer (&optional n)
3095 "Start a timer to update the X-Sent header in the article buffers.
3096 The numerical prefix says how frequently (in seconds) the function
3101 (gnus-stop-date-timer)
3102 (setq article-lapsed-timer
3103 (run-at-time 1 n 'article-update-date-lapsed)))
3105 (defun gnus-stop-date-timer ()
3106 "Stop the X-Sent timer."
3108 (when article-lapsed-timer
3109 (nnheader-cancel-timer article-lapsed-timer)
3110 (setq article-lapsed-timer nil)))
3112 (defun article-date-user (&optional highlight)
3113 "Convert the current article date to the user-defined format.
3114 This format is defined by the `gnus-article-time-format' variable."
3115 (interactive (list t))
3116 (article-date-ut 'user highlight))
3118 (defun article-date-iso8601 (&optional highlight)
3119 "Convert the current article date to ISO8601."
3120 (interactive (list t))
3121 (article-date-ut 'iso8601 highlight))
3123 (defun gnus-article-save-original-date ()
3124 "Save the original date as a text property."
3125 ;;(goto-char (point-max))
3126 (skip-chars-backward "\n")
3129 (case-fold-search t))
3130 (goto-char (point-min))
3131 (when (and (re-search-forward "^date:[\t\n ]+" nil t)
3133 (setq start (match-end 0))
3134 (re-search-forward "[\t ]*\n\\(?:[^\t ]\\|\\'\\)" nil t)))
3136 (point-min) end 'original-date
3137 (buffer-substring-no-properties start (match-beginning 0))))))
3139 ;; (defun article-show-all ()
3140 ;; "Show all hidden text in the article buffer."
3143 ;; (let ((inhibit-read-only t))
3144 ;; (gnus-article-unhide-text (point-min) (point-max)))))
3146 (defun article-remove-leading-whitespace ()
3147 "Remove excessive whitespace from all headers."
3151 (let ((inhibit-read-only t))
3152 (article-narrow-to-head)
3153 (goto-char (point-min))
3154 (while (re-search-forward "^[^ :]+: \\([ \t]+\\)" nil t)
3155 (delete-region (match-beginning 1) (match-end 1)))))))
3157 (defun article-emphasize (&optional arg)
3158 "Emphasize text according to `gnus-emphasis-alist'."
3159 (interactive (gnus-article-hidden-arg))
3160 (unless (gnus-article-check-hidden-text 'emphasis arg)
3164 (with-current-buffer gnus-summary-buffer
3165 gnus-article-emphasis-alist)
3167 gnus-emphasis-alist))
3168 (inhibit-read-only t)
3169 (props (append '(article-type emphasis)
3170 gnus-hidden-properties))
3171 regexp elem beg invisible visible face)
3174 (while (setq elem (pop alist))
3176 (setq regexp (car elem)
3177 invisible (nth 1 elem)
3178 visible (nth 2 elem)
3180 (while (re-search-forward regexp nil t)
3181 (when (and (match-beginning visible) (match-beginning invisible))
3182 (gnus-article-hide-text
3183 (match-beginning invisible) (match-end invisible) props)
3184 (gnus-article-unhide-text-type
3185 (match-beginning visible) (match-end visible) 'emphasis)
3186 (gnus-put-overlay-excluding-newlines
3187 (match-beginning visible) (match-end visible) 'face face)
3188 (gnus-add-wash-type 'emphasis)
3189 (goto-char (match-end invisible)))))))))
3191 (defun gnus-article-setup-highlight-words (&optional highlight-words)
3192 "Setup newsgroup emphasis alist."
3193 (unless gnus-article-emphasis-alist
3194 (let ((name (and gnus-newsgroup-name
3195 (gnus-group-real-name gnus-newsgroup-name))))
3196 (make-local-variable 'gnus-article-emphasis-alist)
3197 (setq gnus-article-emphasis-alist
3199 (let ((alist gnus-group-highlight-words-alist) elem highlight)
3200 (while (setq elem (pop alist))
3201 (when (and name (string-match (car elem) name))
3203 highlight (copy-sequence (cdr elem)))))
3205 (copy-sequence highlight-words)
3206 (if gnus-newsgroup-name
3207 (copy-sequence (gnus-group-find-parameter
3208 gnus-newsgroup-name 'highlight-words t)))
3209 gnus-emphasis-alist)))))
3212 (defvar gnus-summary-article-menu)
3213 (defvar gnus-summary-post-menu))
3215 ;;; Saving functions.
3217 (defun gnus-article-save (save-buffer file &optional num)
3218 "Save the currently selected article."
3219 (unless gnus-save-all-headers
3220 ;; Remove headers according to `gnus-saved-headers'.
3221 (let ((gnus-visible-headers
3222 (or gnus-saved-headers gnus-visible-headers))
3223 (gnus-article-buffer save-buffer))
3225 (set-buffer save-buffer)
3226 (article-hide-headers 1 t))))
3227 (save-window-excursion
3228 (if (not gnus-default-article-saver)
3229 (error "No default saver is defined")
3230 ;; !!! Magic! The saving functions all save
3231 ;; `gnus-save-article-buffer' (or so they think), but we
3232 ;; bind that variable to our save-buffer.
3233 (set-buffer gnus-article-buffer)
3234 (let* ((gnus-save-article-buffer save-buffer)
3237 ((not gnus-prompt-before-saving) 'default)
3238 ((eq gnus-prompt-before-saving 'always) nil)
3240 (gnus-number-of-articles-to-be-saved
3241 (when (eq gnus-prompt-before-saving t)
3243 (set-buffer gnus-article-current-summary)
3244 (funcall gnus-default-article-saver filename)))))
3246 (defun gnus-read-save-file-name (prompt &optional filename
3247 function group headers variable)
3249 (funcall function group headers (symbol-value variable)))
3254 ((eq filename 'default)
3260 (let* ((split-name (gnus-get-split-value gnus-split-methods))
3263 (if (and gnus-number-of-articles-to-be-saved
3264 (> gnus-number-of-articles-to-be-saved 1))
3265 (format "these %d articles"
3266 gnus-number-of-articles-to-be-saved)
3269 ;; Let the split methods have their say.
3271 ;; No split name was found.
3274 (concat prompt " (default "
3275 (file-name-nondirectory default-name) ") ")
3276 (file-name-directory default-name)
3278 ;; A single group name is returned.
3279 ((stringp split-name)
3281 (funcall function split-name headers
3282 (symbol-value variable)))
3284 (concat prompt " (default "
3285 (file-name-nondirectory default-name) ") ")
3286 (file-name-directory default-name)
3288 ;; A single split name was found
3289 ((= 1 (length split-name))
3290 (let* ((name (expand-file-name
3292 gnus-article-save-directory))
3293 (dir (cond ((file-directory-p name)
3294 (file-name-as-directory name))
3295 ((file-exists-p name) name)
3296 (t gnus-article-save-directory))))
3298 (concat prompt " (default " name ") ")
3300 ;; A list of splits was found.
3302 (setq split-name (nreverse split-name))
3304 (let ((file-name-history
3305 (nconc split-name file-name-history)))
3309 (concat prompt " (`M-p' for defaults) ")
3310 gnus-article-save-directory
3312 gnus-article-save-directory)))
3313 (car (push result file-name-history)))))))
3314 ;; Create the directory.
3315 (gnus-make-directory (file-name-directory file))
3316 ;; If we have read a directory, we append the default file name.
3317 (when (file-directory-p file)
3318 (setq file (expand-file-name (file-name-nondirectory
3320 (file-name-as-directory file))))
3321 ;; Possibly translate some characters.
3322 (nnheader-translate-file-chars file))))))
3323 (gnus-make-directory (file-name-directory result))
3324 (set variable result)))
3326 (defun gnus-article-archive-name (group)
3327 "Return the first instance of an \"Archive-name\" in the current buffer."
3328 (let ((case-fold-search t))
3329 (when (re-search-forward "archive-name: *\\([^ \n\t]+\\)[ \t]*$" nil t)
3330 (nnheader-concat gnus-article-save-directory
3331 (match-string 1)))))
3333 (defun gnus-article-nndoc-name (group)
3334 "If GROUP is an nndoc group, return the name of the parent group."
3335 (when (eq (car (gnus-find-method-for-group group)) 'nndoc)
3336 (gnus-group-get-parameter group 'save-article-group)))
3338 (defun gnus-summary-save-in-rmail (&optional filename)
3339 "Append this article to Rmail file.
3340 Optional argument FILENAME specifies file name.
3341 Directory to save to is default to `gnus-article-save-directory'."
3342 (setq filename (gnus-read-save-file-name
3343 "Save %s in rmail file:" filename
3344 gnus-rmail-save-name gnus-newsgroup-name
3345 gnus-current-headers 'gnus-newsgroup-last-rmail))
3346 (gnus-eval-in-buffer-window gnus-save-article-buffer
3350 (gnus-output-to-rmail filename))))
3353 (defun gnus-summary-save-in-mail (&optional filename)
3354 "Append this article to Unix mail file.
3355 Optional argument FILENAME specifies file name.
3356 Directory to save to is default to `gnus-article-save-directory'."
3357 (setq filename (gnus-read-save-file-name
3358 "Save %s in Unix mail file:" filename
3359 gnus-mail-save-name gnus-newsgroup-name
3360 gnus-current-headers 'gnus-newsgroup-last-mail))
3361 (gnus-eval-in-buffer-window gnus-save-article-buffer
3365 (if (and (file-readable-p filename)
3366 (file-regular-p filename)
3367 (mail-file-babyl-p filename))
3368 (rmail-output-to-rmail-file filename t)
3369 (gnus-output-to-mail filename)))))
3372 (defun gnus-summary-save-in-file (&optional filename overwrite)
3373 "Append this article to file.
3374 Optional argument FILENAME specifies file name.
3375 Directory to save to is default to `gnus-article-save-directory'."
3376 (setq filename (gnus-read-save-file-name
3377 "Save %s in file:" filename
3378 gnus-file-save-name gnus-newsgroup-name
3379 gnus-current-headers 'gnus-newsgroup-last-file))
3380 (gnus-eval-in-buffer-window gnus-save-article-buffer
3384 (when (and overwrite
3385 (file-exists-p filename))
3386 (delete-file filename))
3387 (gnus-output-to-file filename))))
3390 (defun gnus-summary-write-to-file (&optional filename)
3391 "Write this article to a file, overwriting it if the file exists.
3392 Optional argument FILENAME specifies file name.
3393 The directory to save in defaults to `gnus-article-save-directory'."
3394 (gnus-summary-save-in-file nil t))
3396 (defun gnus-summary-save-body-in-file (&optional filename)
3397 "Append this article body to a file.
3398 Optional argument FILENAME specifies file name.
3399 The directory to save in defaults to `gnus-article-save-directory'."
3400 (setq filename (gnus-read-save-file-name
3401 "Save %s body in file:" filename
3402 gnus-file-save-name gnus-newsgroup-name
3403 gnus-current-headers 'gnus-newsgroup-last-file))
3404 (gnus-eval-in-buffer-window gnus-save-article-buffer
3408 (when (article-goto-body)
3409 (narrow-to-region (point) (point-max)))
3410 (gnus-output-to-file filename))))
3413 (defun gnus-summary-save-in-pipe (&optional command)
3414 "Pipe this article to subprocess."
3416 (cond ((and (eq command 'default)
3417 gnus-last-shell-command)
3418 gnus-last-shell-command)
3423 "Shell command on %s: "
3424 (if (and gnus-number-of-articles-to-be-saved
3425 (> gnus-number-of-articles-to-be-saved 1))
3426 (format "these %d articles"
3427 gnus-number-of-articles-to-be-saved)
3429 gnus-last-shell-command))))
3430 (when (string-equal command "")
3431 (if gnus-last-shell-command
3432 (setq command gnus-last-shell-command)
3433 (error "A command is required")))
3434 (gnus-eval-in-buffer-window gnus-article-buffer
3437 (shell-command-on-region (point-min) (point-max) command nil)))
3438 (setq gnus-last-shell-command command))
3440 (defun gnus-summary-pipe-to-muttprint (&optional command)
3441 "Pipe this article to muttprint."
3442 (setq command (read-string
3443 "Print using command: " gnus-summary-muttprint-program
3444 nil gnus-summary-muttprint-program))
3445 (gnus-summary-save-in-pipe command))
3447 ;;; Article file names when saving.
3449 (defun gnus-capitalize-newsgroup (newsgroup)
3450 "Capitalize NEWSGROUP name."
3451 (when (not (zerop (length newsgroup)))
3452 (concat (char-to-string (upcase (aref newsgroup 0)))
3453 (substring newsgroup 1))))
3455 (defun gnus-Numeric-save-name (newsgroup headers &optional last-file)
3456 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
3457 If variable `gnus-use-long-file-name' is non-nil, it is ~/News/News.group/num.
3458 Otherwise, it is like ~/News/news/group/num."
3461 (concat (if (gnus-use-long-file-name 'not-save)
3462 (gnus-capitalize-newsgroup newsgroup)
3463 (gnus-newsgroup-directory-form newsgroup))
3464 "/" (int-to-string (mail-header-number headers)))
3465 gnus-article-save-directory)))
3467 (string-equal (file-name-directory default)
3468 (file-name-directory last-file))
3469 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
3471 (or last-file default))))
3473 (defun gnus-numeric-save-name (newsgroup headers &optional last-file)
3474 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
3475 If variable `gnus-use-long-file-name' is non-nil, it is
3476 ~/News/news.group/num. Otherwise, it is like ~/News/news/group/num."
3479 (concat (if (gnus-use-long-file-name 'not-save)
3481 (gnus-newsgroup-directory-form newsgroup))
3482 "/" (int-to-string (mail-header-number headers)))
3483 gnus-article-save-directory)))
3485 (string-equal (file-name-directory default)
3486 (file-name-directory last-file))
3487 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
3489 (or last-file default))))
3491 (defun gnus-plain-save-name (newsgroup headers &optional last-file)
3492 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
3493 If variable `gnus-use-long-file-name' is non-nil, it is
3494 ~/News/news.group. Otherwise, it is like ~/News/news/group/news."
3497 (if (gnus-use-long-file-name 'not-save)
3500 (expand-file-name "news" (gnus-newsgroup-directory-form newsgroup))
3502 gnus-article-save-directory)))
3504 (defun gnus-sender-save-name (newsgroup headers &optional last-file)
3505 "Generate file name from sender."
3506 (let ((from (mail-header-from headers)))
3508 (if (and from (string-match "\\([^ <]+\\)@" from))
3509 (match-string 1 from)
3511 gnus-article-save-directory)))
3513 (defun article-verify-x-pgp-sig ()
3516 (if (gnus-buffer-live-p gnus-original-article-buffer)
3517 (let ((sig (with-current-buffer gnus-original-article-buffer
3518 (gnus-fetch-field "X-PGP-Sig")))
3522 (mml2015-clear-verify-function))
3524 (insert-buffer-substring gnus-original-article-buffer)
3525 (setq items (split-string sig))
3526 (message-narrow-to-head)
3527 (let ((inhibit-point-motion-hooks t)
3528 (case-fold-search t))
3529 ;; Don't verify multiple headers.
3530 (setq headers (mapconcat (lambda (header)
3532 (mail-fetch-field header)
3534 (split-string (nth 1 items) ",") "")))
3535 (delete-region (point-min) (point-max))
3536 (insert "-----BEGIN PGP SIGNED MESSAGE-----\n\n")
3537 (insert "X-Signed-Headers: " (nth 1 items) "\n")
3542 (if (looking-at "^-")
3545 (insert "\n-----BEGIN PGP SIGNATURE-----\n")
3546 (insert "Version: " (car items) "\n\n")
3547 (insert (mapconcat 'identity (cddr items) "\n"))
3548 (insert "\n-----END PGP SIGNATURE-----\n")
3549 (let ((mm-security-handle (list (format "multipart/signed"))))
3550 (mml2015-clean-buffer)
3551 (let ((coding-system-for-write (or gnus-newsgroup-charset
3553 (funcall (mml2015-clear-verify-function)))
3555 (or (mm-handle-multipart-ctl-parameter
3556 mm-security-handle 'gnus-details)
3557 (mm-handle-multipart-ctl-parameter
3558 mm-security-handle 'gnus-info)))))
3560 (let ((inhibit-read-only t) bface eface)
3562 (message-narrow-to-head)
3563 (goto-char (point-max))
3565 (setq bface (get-text-property (point-at-bol) 'face)
3566 eface (get-text-property (1- (point-at-eol)) 'face))
3567 (message-remove-header "X-Gnus-PGP-Verify")
3568 (if (re-search-forward "^X-PGP-Sig:" nil t)
3570 (goto-char (point-max)))
3571 (narrow-to-region (point) (point))
3572 (insert "X-Gnus-PGP-Verify: " info "\n")
3573 (goto-char (point-min))
3576 (if (not (looking-at "^[ \t]"))
3580 (goto-char (point-min))
3581 (when (looking-at "\\([^:]+\\): *")
3582 (put-text-property (match-beginning 1) (1+ (match-end 1))
3584 (put-text-property (match-end 0) (point-max)
3585 'face eface)))))))))
3587 (defun article-verify-cancel-lock ()
3588 "Verify Cancel-Lock header."
3590 (if (gnus-buffer-live-p gnus-original-article-buffer)
3591 (canlock-verify gnus-original-article-buffer)))
3598 (setq afunc (car func)
3601 gfunc (intern (format "gnus-%s" func))))
3603 (when (fboundp afunc)
3604 `(lambda (&optional interactive &rest args)
3605 ,(documentation afunc t)
3606 (interactive (list t))
3608 (set-buffer gnus-article-buffer)
3610 (call-interactively ',afunc)
3611 (apply ',afunc args))))))))
3612 '(article-hide-headers
3613 article-verify-x-pgp-sig
3614 article-verify-cancel-lock
3615 article-hide-boring-headers
3616 article-treat-overstrike
3617 article-treat-ansi-sequences
3618 article-fill-long-lines
3619 article-capitalize-sentences
3621 article-remove-leading-whitespace
3622 article-display-x-face
3623 article-display-face
3624 article-de-quoted-unreadable
3625 article-de-base64-unreadable
3628 article-unsplit-urls
3629 article-hide-list-identifiers
3630 article-strip-banner
3633 article-hide-signature
3634 article-strip-headers-in-body
3635 article-remove-trailing-blank-lines
3636 article-strip-leading-blank-lines
3637 article-strip-multiple-blank-lines
3638 article-strip-leading-space
3639 article-strip-trailing-space
3640 article-strip-blank-lines
3641 article-strip-all-blank-lines
3643 article-date-english
3644 article-date-iso8601
3645 article-date-original
3647 article-decode-mime-words
3648 article-decode-charset
3649 article-decode-encoded-words
3653 article-treat-dumbquotes
3654 article-normalize-headers
3655 ;; (article-show-all . gnus-article-show-all-headers)
3659 ;;; Gnus article mode
3662 (put 'gnus-article-mode 'mode-class 'special)
3664 (set-keymap-parent gnus-article-mode-map widget-keymap)
3666 (gnus-define-keys gnus-article-mode-map
3667 " " gnus-article-goto-next-page
3668 "\177" gnus-article-goto-prev-page
3669 [delete] gnus-article-goto-prev-page
3670 [backspace] gnus-article-goto-prev-page
3671 "\C-c^" gnus-article-refer-article
3672 "h" gnus-article-show-summary
3673 "s" gnus-article-show-summary
3674 "\C-c\C-m" gnus-article-mail
3675 "?" gnus-article-describe-briefly
3676 "e" gnus-summary-edit-article
3677 "<" beginning-of-buffer
3679 "\C-c\C-i" gnus-info-find-node
3681 "R" gnus-article-reply-with-original
3682 "F" gnus-article-followup-with-original
3683 "\C-hk" gnus-article-describe-key
3684 "\C-hc" gnus-article-describe-key-briefly
3686 "\C-d" gnus-article-read-summary-keys
3687 "\M-*" gnus-article-read-summary-keys
3688 "\M-#" gnus-article-read-summary-keys
3689 "\M-^" gnus-article-read-summary-keys
3690 "\M-g" gnus-article-read-summary-keys)
3692 (substitute-key-definition
3693 'undefined 'gnus-article-read-summary-keys gnus-article-mode-map)
3695 (defun gnus-article-make-menu-bar ()
3696 (unless (boundp 'gnus-article-commands-menu)
3697 (gnus-summary-make-menu-bar))
3698 (gnus-turn-off-edit-menu 'article)
3699 (unless (boundp 'gnus-article-article-menu)
3701 gnus-article-article-menu gnus-article-mode-map ""
3703 ["Scroll forwards" gnus-article-goto-next-page t]
3704 ["Scroll backwards" gnus-article-goto-prev-page t]
3705 ["Show summary" gnus-article-show-summary t]
3706 ["Fetch Message-ID at point" gnus-article-refer-article t]
3707 ["Mail to address at point" gnus-article-mail t]
3708 ["Send a bug report" gnus-bug t]))
3711 gnus-article-treatment-menu gnus-article-mode-map ""
3712 ;; Fixme: this should use :active (and maybe :visible).
3714 ["Hide headers" gnus-article-hide-headers t]
3715 ["Hide signature" gnus-article-hide-signature t]
3716 ["Hide citation" gnus-article-hide-citation t]
3717 ["Treat overstrike" gnus-article-treat-overstrike t]
3718 ["Treat ANSI sequences" gnus-article-treat-ansi-sequences t]
3719 ["Remove carriage return" gnus-article-remove-cr t]
3720 ["Remove leading whitespace" gnus-article-remove-leading-whitespace t]
3721 ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]
3722 ["Remove base64" gnus-article-de-base64-unreadable t]
3723 ["Treat html" gnus-article-wash-html t]
3724 ["Remove newlines from within URLs" gnus-article-unsplit-urls t]
3725 ["Decode HZ" gnus-article-decode-HZ t]))
3727 ;; Note "Commands" menu is defined in gnus-sum.el for consistency
3729 ;; Note "Post" menu is defined in gnus-sum.el for consistency
3731 (gnus-run-hooks 'gnus-article-menu-hook)))
3733 (defun gnus-article-mode ()
3734 "Major mode for displaying an article.
3736 All normal editing commands are switched off.
3738 The following commands are available in addition to all summary mode
3740 \\<gnus-article-mode-map>
3741 \\[gnus-article-next-page]\t Scroll the article one page forwards
3742 \\[gnus-article-prev-page]\t Scroll the article one page backwards
3743 \\[gnus-article-refer-article]\t Go to the article referred to by an article id near point
3744 \\[gnus-article-show-summary]\t Display the summary buffer
3745 \\[gnus-article-mail]\t Send a reply to the address near point
3746 \\[gnus-article-describe-briefly]\t Describe the current mode briefly
3747 \\[gnus-info-find-node]\t Go to the Gnus info node"
3749 (gnus-simplify-mode-line)
3750 (setq mode-name "Article")
3751 (setq major-mode 'gnus-article-mode)
3752 (make-local-variable 'minor-mode-alist)
3753 (use-local-map gnus-article-mode-map)
3754 (when (gnus-visual-p 'article-menu 'menu)
3755 (gnus-article-make-menu-bar)
3756 (when gnus-summary-tool-bar-map
3757 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
3758 (gnus-update-format-specifications nil 'article-mode)
3759 (set (make-local-variable 'page-delimiter) gnus-page-delimiter)
3760 (set (make-local-variable 'gnus-page-broken) nil)
3761 (make-local-variable 'gnus-button-marker-list)
3762 (make-local-variable 'gnus-article-current-summary)
3763 (make-local-variable 'gnus-article-mime-handles)
3764 (make-local-variable 'gnus-article-decoded-p)
3765 (make-local-variable 'gnus-article-mime-handle-alist)
3766 (make-local-variable 'gnus-article-wash-types)
3767 (make-local-variable 'gnus-article-image-alist)
3768 (make-local-variable 'gnus-article-charset)
3769 (make-local-variable 'gnus-article-ignored-charsets)
3770 ;; Prevent recent Emacsen from displaying non-break space as "\ ".
3771 (set (make-local-variable 'show-nonbreak-escape) nil)
3772 (gnus-set-default-directory)
3773 (buffer-disable-undo)
3774 (setq buffer-read-only t
3775 show-trailing-whitespace nil)
3776 (set-syntax-table gnus-article-mode-syntax-table)
3777 (mm-enable-multibyte)
3778 (gnus-run-hooks 'gnus-article-mode-hook))
3780 (defun gnus-article-setup-buffer ()
3781 "Initialize the article buffer."
3782 (let* ((name (if gnus-single-article-buffer "*Article*"
3783 (concat "*Article " gnus-newsgroup-name "*")))
3785 (progn (string-match "\\*Article" name)
3786 (concat " *Original Article"
3787 (substring name (match-end 0))))))
3788 (setq gnus-article-buffer name)
3789 (setq gnus-original-article-buffer original)
3790 (setq gnus-article-mime-handle-alist nil)
3791 ;; This might be a variable local to the summary buffer.
3792 (unless gnus-single-article-buffer
3794 (set-buffer gnus-summary-buffer)
3795 (setq gnus-article-buffer name)
3796 (setq gnus-original-article-buffer original)
3797 (gnus-set-global-variables)))
3798 (gnus-article-setup-highlight-words)
3799 ;; Init original article buffer.
3801 (set-buffer (gnus-get-buffer-create gnus-original-article-buffer))
3802 (mm-enable-multibyte)
3803 (setq major-mode 'gnus-original-article-mode)
3804 (make-local-variable 'gnus-original-article))
3805 (if (and (get-buffer name)
3806 (with-current-buffer name
3807 (if gnus-article-edit-mode
3808 (if (y-or-n-p "Article mode edit in progress; discard? ")
3810 (set-buffer-modified-p nil)
3811 (gnus-kill-buffer name)
3814 (error "Action aborted"))
3818 (set (make-local-variable 'gnus-article-edit-mode) nil)
3819 (when gnus-article-mime-handles
3820 (mm-destroy-parts gnus-article-mime-handles)
3821 (setq gnus-article-mime-handles nil))
3822 ;; Set it to nil in article-buffer!
3823 (setq gnus-article-mime-handle-alist nil)
3824 (buffer-disable-undo)
3825 (setq buffer-read-only t)
3826 ;; This list just keeps growing if we don't reset it.
3827 (setq gnus-button-marker-list nil)
3828 (unless (eq major-mode 'gnus-article-mode)
3829 (gnus-article-mode))
3832 (set-buffer (gnus-get-buffer-create name))
3834 (make-local-variable 'gnus-summary-buffer)
3835 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3836 (current-buffer)))))
3838 ;; Set article window start at LINE, where LINE is the number of lines
3839 ;; from the head of the article.
3840 (defun gnus-article-set-window-start (&optional line)
3842 (gnus-get-buffer-window gnus-article-buffer t)
3844 (set-buffer gnus-article-buffer)
3845 (goto-char (point-min))
3848 (gnus-message 6 "Moved to bookmark")
3849 (search-forward "\n\n" nil t)
3853 (defun gnus-article-prepare (article &optional all-headers header)
3854 "Prepare ARTICLE in article mode buffer.
3855 ARTICLE should either be an article number or a Message-ID.
3856 If ARTICLE is an id, HEADER should be the article headers.
3857 If ALL-HEADERS is non-nil, no headers are hidden."
3859 ;; Make sure we start in a summary buffer.
3860 (unless (eq major-mode 'gnus-summary-mode)
3861 (set-buffer gnus-summary-buffer))
3862 (setq gnus-summary-buffer (current-buffer))
3863 (let* ((gnus-article (if header (mail-header-number header) article))
3864 (summary-buffer (current-buffer))
3865 (gnus-tmp-internal-hook gnus-article-internal-prepare-hook)
3866 (group gnus-newsgroup-name)
3869 (gnus-article-setup-buffer)
3870 (set-buffer gnus-article-buffer)
3871 ;; Deactivate active regions.
3872 (when (and (boundp 'transient-mark-mode)
3873 transient-mark-mode)
3874 (setq mark-active nil))
3875 (if (not (setq result (let ((inhibit-read-only t))
3876 (gnus-request-article-this-buffer
3878 ;; There is no such article.
3880 (when (and (numberp article)
3881 (not (memq article gnus-newsgroup-sparse)))
3882 (setq gnus-article-current
3883 (cons gnus-newsgroup-name article))
3884 (set-buffer gnus-summary-buffer)
3885 (setq gnus-current-article article)
3886 (if (and (memq article gnus-newsgroup-undownloaded)
3887 (not (gnus-online (gnus-find-method-for-group
3888 gnus-newsgroup-name))))
3890 (gnus-summary-set-agent-mark article)
3891 (message "Message marked for downloading"))
3892 (gnus-summary-mark-article article gnus-canceled-mark)
3893 (unless (memq article gnus-newsgroup-sparse)
3894 (gnus-error 1 "No such article (may have expired or been canceled)")))))
3895 (if (or (eq result 'pseudo)
3896 (eq result 'nneething))
3899 (set-buffer summary-buffer)
3900 (push article gnus-newsgroup-history)
3901 (setq gnus-last-article gnus-current-article
3902 gnus-current-article 0
3903 gnus-current-headers nil
3904 gnus-article-current nil)
3905 (if (eq result 'nneething)
3906 (gnus-configure-windows 'summary)
3907 (gnus-configure-windows 'article))
3908 (gnus-set-global-variables))
3909 (let ((gnus-article-mime-handle-alist-1
3910 gnus-article-mime-handle-alist))
3911 (gnus-set-mode-line 'article)))
3912 ;; The result from the `request' was an actual article -
3913 ;; or at least some text that is now displayed in the
3915 (when (and (numberp article)
3916 (not (eq article gnus-current-article)))
3917 ;; Seems like a new article has been selected.
3918 ;; `gnus-current-article' must be an article number.
3920 (set-buffer summary-buffer)
3921 (push article gnus-newsgroup-history)
3922 (setq gnus-last-article gnus-current-article
3923 gnus-current-article article
3924 gnus-current-headers
3925 (gnus-summary-article-header gnus-current-article)
3926 gnus-article-current
3927 (cons gnus-newsgroup-name gnus-current-article))
3928 (unless (vectorp gnus-current-headers)
3929 (setq gnus-current-headers nil))
3930 (gnus-summary-goto-subject gnus-current-article)
3931 (when (gnus-summary-show-thread)
3932 ;; If the summary buffer really was folded, the
3933 ;; previous goto may not actually have gone to
3934 ;; the right article, but the thread root instead.
3936 (gnus-summary-goto-subject gnus-current-article))
3937 (gnus-run-hooks 'gnus-mark-article-hook)
3938 (gnus-set-mode-line 'summary)
3939 (when (gnus-visual-p 'article-highlight 'highlight)
3940 (gnus-run-hooks 'gnus-visual-mark-article-hook))
3941 ;; Set the global newsgroup variables here.
3942 (gnus-set-global-variables)
3943 (setq gnus-have-all-headers
3944 (or all-headers gnus-show-all-headers))))
3946 (gnus-configure-windows 'article))
3947 (when (or (numberp article)
3949 (gnus-article-prepare-display)
3951 (goto-char (point-min))
3952 (when gnus-break-pages
3953 (gnus-narrow-to-page)))
3954 (let ((gnus-article-mime-handle-alist-1
3955 gnus-article-mime-handle-alist))
3956 (gnus-set-mode-line 'article))
3960 (set-window-point (get-buffer-window (current-buffer)) (point))
3961 (gnus-configure-windows 'article)
3965 (defun gnus-article-prepare-display ()
3966 "Make the current buffer look like a nice article."
3967 ;; Hooks for getting information from the article.
3968 ;; This hook must be called before being narrowed.
3969 (let ((gnus-article-buffer (current-buffer))
3971 (inhibit-read-only t))
3972 (unless (eq major-mode 'gnus-article-mode)
3973 (gnus-article-mode))
3974 (setq buffer-read-only nil
3975 gnus-article-wash-types nil
3976 gnus-article-image-alist nil)
3977 (gnus-run-hooks 'gnus-tmp-internal-hook)
3978 (when gnus-display-mime-function
3979 (funcall gnus-display-mime-function))
3980 (gnus-run-hooks 'gnus-article-prepare-hook)))
3983 ;;; Gnus MIME viewing functions
3986 (defvar gnus-mime-button-line-format "%{%([%p. %d%T]%)%}%e\n"
3987 "Format of the MIME buttons.
3989 Valid specifiers include:
3991 %T MIME type, along with additional info
3992 %n The `name' parameter
3993 %d The description, if any
3994 %l The length of the encoded part
3995 %p The part identifier number
3996 %e Dots if the part isn't displayed
3998 General format specifiers can also be used. See Info node
3999 `(gnus)Formatting Variables'.")
4001 (defvar gnus-mime-button-line-format-alist
4002 '((?t gnus-tmp-type ?s)
4003 (?T gnus-tmp-type-long ?s)
4004 (?n gnus-tmp-name ?s)
4005 (?d gnus-tmp-description ?s)
4007 (?l gnus-tmp-length ?d)
4008 (?e gnus-tmp-dots ?s)))
4010 (defvar gnus-mime-button-commands
4011 '((gnus-article-press-button "\r" "Toggle Display")
4012 (gnus-mime-view-part "v" "View Interactively...")
4013 (gnus-mime-view-part-as-type "t" "View As Type...")
4014 (gnus-mime-view-part-as-charset "C" "View As charset...")
4015 (gnus-mime-save-part "o" "Save...")
4016 (gnus-mime-save-part-and-strip "\C-o" "Save and Strip")
4017 (gnus-mime-delete-part "d" "Delete part")
4018 (gnus-mime-copy-part "c" "View As Text, In Other Buffer")
4019 (gnus-mime-inline-part "i" "View As Text, In This Buffer")
4020 (gnus-mime-view-part-internally "E" "View Internally")
4021 (gnus-mime-view-part-externally "e" "View Externally")
4022 (gnus-mime-print-part "p" "Print")
4023 (gnus-mime-pipe-part "|" "Pipe To Command...")
4024 (gnus-mime-action-on-part "." "Take action on the part...")))
4026 (defun gnus-article-mime-part-status ()
4027 (if gnus-article-mime-handle-alist-1
4028 (if (eq 1 (length gnus-article-mime-handle-alist-1))
4030 (format " (%d parts)" (length gnus-article-mime-handle-alist-1)))
4033 (defvar gnus-mime-button-map
4034 (let ((map (make-sparse-keymap)))
4035 (define-key map gnus-mouse-2 'gnus-article-push-button)
4036 (define-key map gnus-down-mouse-3 'gnus-mime-button-menu)
4037 (dolist (c gnus-mime-button-commands)
4038 (define-key map (cadr c) (car c)))
4042 gnus-mime-button-menu gnus-mime-button-map "MIME button menu."
4044 ,@(mapcar (lambda (c)
4045 (vector (caddr c) (car c) :enable t))
4046 gnus-mime-button-commands)))
4048 (defun gnus-mime-button-menu (event prefix)
4049 "Construct a context-sensitive menu of MIME commands."
4050 (interactive "e\nP")
4051 (save-window-excursion
4052 (let ((pos (event-start event)))
4053 (select-window (posn-window pos))
4054 (goto-char (posn-point pos))
4055 (gnus-article-check-buffer)
4056 (popup-menu gnus-mime-button-menu nil prefix))))
4058 (defun gnus-mime-view-all-parts (&optional handles)
4059 "View all the MIME parts."
4061 (with-current-buffer gnus-article-buffer
4062 (let ((handles (or handles gnus-article-mime-handles))
4063 (mail-parse-charset gnus-newsgroup-charset)
4064 (mail-parse-ignored-charsets
4065 (with-current-buffer gnus-summary-buffer
4066 gnus-newsgroup-ignored-charsets)))
4068 (mm-remove-parts handles)
4069 (goto-char (point-min))
4070 (or (search-forward "\n\n") (goto-char (point-max)))
4071 (let ((inhibit-read-only t))
4072 (delete-region (point) (point-max))
4073 (mm-display-parts handles))))))
4076 (defsubst gnus-article-edit-part (handles)
4077 "Edit an article in order to delete a mime part.
4078 This function is exclusively used by `gnus-mime-save-part-and-strip'
4079 and `gnus-mime-delete-part', and not provided at run-time normally."
4080 (gnus-article-edit-article
4083 (let ((mail-parse-charset (or gnus-article-charset
4084 ',gnus-newsgroup-charset))
4085 (mail-parse-ignored-charsets
4086 (or gnus-article-ignored-charsets
4087 ',gnus-newsgroup-ignored-charsets))
4088 (mbl mml-buffer-list))
4089 (setq mml-buffer-list nil)
4090 (insert-buffer gnus-original-article-buffer)
4091 (mime-to-mml ',handles)
4092 (setq gnus-article-mime-handles nil)
4093 (let ((mbl1 mml-buffer-list))
4094 (setq mml-buffer-list mbl)
4095 (set (make-local-variable 'mml-buffer-list) mbl1))
4096 (gnus-make-local-hook 'kill-buffer-hook)
4097 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t)))
4098 `(lambda (no-highlight)
4099 (let ((mail-parse-charset (or gnus-article-charset
4100 ',gnus-newsgroup-charset))
4101 (message-options message-options)
4102 (message-options-set-recipient)
4103 (mail-parse-ignored-charsets
4104 (or gnus-article-ignored-charsets
4105 ',gnus-newsgroup-ignored-charsets)))
4107 (mml-destroy-buffers)
4108 (remove-hook 'kill-buffer-hook
4109 'mml-destroy-buffers t)
4110 (kill-local-variable 'mml-buffer-list))
4111 (gnus-summary-edit-article-done
4112 ,(or (mail-header-references gnus-current-headers) "")
4113 ,(gnus-group-read-only-p)
4114 ,gnus-summary-buffer no-highlight)))
4115 (gnus-article-edit-done)
4116 (gnus-summary-expand-window)
4117 (gnus-summary-show-article)))
4119 (defun gnus-mime-save-part-and-strip ()
4120 "Save the MIME part under point then replace it with an external body."
4122 (gnus-article-check-buffer)
4123 (when (gnus-group-read-only-p)
4124 (error "The current group does not support deleting of parts"))
4125 (when (mm-complicated-handles gnus-article-mime-handles)
4127 The current article has a complicated MIME structure, giving up..."))
4128 (when (gnus-yes-or-no-p "\
4129 Deleting parts may malfunction or destroy the article; continue? ")
4130 (let* ((data (get-text-property (point) 'gnus-data))
4132 (handles gnus-article-mime-handles))
4133 (setq file (and data (mm-save-part data)))
4135 (with-current-buffer (mm-handle-buffer data)
4137 (insert "Content-Type: " (mm-handle-media-type data))
4138 (mml-insert-parameter-string (cdr (mm-handle-type data))
4141 (insert "Content-ID: " (message-make-message-id) "\n")
4142 (insert "Content-Transfer-Encoding: binary\n")
4145 (cdr (mm-make-handle nil
4146 `("message/external-body"
4147 (access-type . "LOCAL-FILE")
4149 (set-buffer gnus-summary-buffer)
4150 (gnus-article-edit-part handles)))))
4152 (defun gnus-mime-delete-part ()
4153 "Delete the MIME part under point.
4154 Replace it with some information about the removed part."
4156 (gnus-article-check-buffer)
4157 (when (gnus-group-read-only-p)
4158 (error "The current group does not support deleting of parts"))
4159 (when (mm-complicated-handles gnus-article-mime-handles)
4161 The current article has a complicated MIME structure, giving up..."))
4162 (when (gnus-yes-or-no-p "\
4163 Deleting parts may malfunction or destroy the article; continue? ")
4164 (let* ((data (get-text-property (point) 'gnus-data))
4165 (handles gnus-article-mime-handles)
4169 (mail-decode-encoded-word-string (or (mm-handle-description data)
4172 (or (mail-content-type-get (mm-handle-disposition data) 'filename)
4174 (type (mm-handle-media-type data)))
4176 (error "No MIME part under point"))
4177 (with-current-buffer (mm-handle-buffer data)
4178 (let ((bsize (format "%s" (buffer-size))))
4183 "| The following attachment has been deleted:\n"
4185 "| Type: " type "\n"
4186 "| Filename: " filename "\n"
4187 "| Size (encoded): " bsize " Byte\n"
4188 "| Description: " description "\n"
4191 (cdr (mm-make-handle
4192 nil `("text/plain") nil nil
4194 (format "Deleted attachment (%s bytes)" bsize))))))
4195 (set-buffer gnus-summary-buffer)
4196 (gnus-article-edit-part handles))))
4198 (defun gnus-mime-save-part ()
4199 "Save the MIME part under point."
4201 (gnus-article-check-buffer)
4202 (let ((data (get-text-property (point) 'gnus-data)))
4204 (mm-save-part data))))
4206 (defun gnus-mime-pipe-part ()
4207 "Pipe the MIME part under point to a process."
4209 (gnus-article-check-buffer)
4210 (let ((data (get-text-property (point) 'gnus-data)))
4212 (mm-pipe-part data))))
4214 (defun gnus-mime-view-part ()
4215 "Interactively choose a viewing method for the MIME part under point."
4217 (gnus-article-check-buffer)
4218 (let ((data (get-text-property (point) 'gnus-data)))
4220 (setq gnus-article-mime-handles
4222 gnus-article-mime-handles (setq data (copy-sequence data))))
4223 (mm-interactively-view-part data))))
4225 (defun gnus-mime-view-part-as-type-internal ()
4226 (gnus-article-check-buffer)
4227 (let* ((name (mail-content-type-get
4228 (mm-handle-type (get-text-property (point) 'gnus-data))
4230 (def-type (and name (mm-default-file-encoding name))))
4231 (and def-type (cons def-type 0))))
4233 (defun gnus-mime-view-part-as-type (&optional mime-type)
4234 "Choose a MIME media type, and view the part as such."
4237 (setq mime-type (completing-read
4238 "View as MIME type: "
4239 (mapcar #'list (mailcap-mime-types))
4241 (gnus-mime-view-part-as-type-internal))))
4242 (gnus-article-check-buffer)
4243 (let ((handle (get-text-property (point) 'gnus-data)))
4246 (mm-make-handle (mm-handle-buffer handle)
4247 (cons mime-type (cdr (mm-handle-type handle)))
4248 (mm-handle-encoding handle)
4249 (mm-handle-undisplayer handle)
4250 (mm-handle-disposition handle)
4251 (mm-handle-description handle)
4253 (mm-handle-id handle)))
4254 (setq gnus-article-mime-handles
4255 (mm-merge-handles gnus-article-mime-handles handle))
4256 (gnus-mm-display-part handle))))
4258 (defun gnus-mime-copy-part (&optional handle arg)
4259 "Put the MIME part under point into a new buffer.
4260 If `auto-compression-mode' is enabled, compressed files like .gz and .bz2
4262 (interactive (list nil current-prefix-arg))
4263 (gnus-article-check-buffer)
4265 (setq handle (get-text-property (point) 'gnus-data)))
4267 (let ((filename (or (mail-content-type-get (mm-handle-disposition handle)
4269 (mail-content-type-get (mm-handle-disposition handle)
4271 contents dont-decode charset coding-system)
4272 (mm-with-unibyte-buffer
4273 (mm-insert-part handle)
4274 (setq contents (or (condition-case nil
4275 (mm-decompress-buffer filename nil 'sig)
4277 (setq dont-decode t)
4280 (setq filename (cond (filename (file-name-nondirectory filename))
4281 (dont-decode "*raw data*")
4286 (unless (setq charset (mail-content-type-get
4287 (mm-handle-type handle) 'charset))
4288 (unless (setq coding-system (mm-with-unibyte-buffer
4290 (mm-find-buffer-file-coding-system)))
4291 (setq charset gnus-newsgroup-charset))))
4293 (setq charset (or (cdr (assq arg
4294 gnus-summary-show-article-charset-alist))
4295 (mm-read-coding-system "Charset: ")))))
4296 (switch-to-buffer (generate-new-buffer filename))
4297 (if (or coding-system
4299 (setq coding-system (mm-charset-to-coding-system charset))
4300 (not (eq charset 'ascii))))
4302 (mm-enable-multibyte)
4303 (insert (mm-decode-coding-string contents coding-system))
4304 (setq buffer-file-coding-system
4305 (if (boundp 'last-coding-system-used)
4306 (symbol-value 'last-coding-system-used)
4308 (mm-disable-multibyte)
4310 (setq buffer-file-coding-system mm-binary-coding-system))
4311 ;; We do it this way to make `normal-mode' set the appropriate mode.
4314 (setq buffer-file-name (expand-file-name filename))
4316 (setq buffer-file-name nil))
4317 (goto-char (point-min)))))
4319 (defun gnus-mime-print-part (&optional handle filename)
4320 "Print the MIME part under point."
4321 (interactive (list nil (ps-print-preprint current-prefix-arg)))
4322 (gnus-article-check-buffer)
4323 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
4324 (contents (and handle (mm-get-part handle)))
4325 (file (mm-make-temp-file (expand-file-name "mm." mm-tmp-directory)))
4326 (printer (mailcap-mime-info (mm-handle-media-type handle) "print")))
4331 (mm-save-part-to-file handle file)
4332 (call-process shell-file-name nil
4333 (generate-new-buffer " *mm*")
4335 shell-command-switch
4337 printer file (mm-handle-type handle))))
4341 (gnus-print-buffer))
4342 (ps-despool filename)))))
4344 (defun gnus-mime-inline-part (&optional handle arg)
4345 "Insert the MIME part under point into the current buffer.
4346 Compressed files like .gz and .bz2 are decompressed."
4347 (interactive (list nil current-prefix-arg))
4348 (gnus-article-check-buffer)
4350 (setq handle (get-text-property (point) 'gnus-data)))
4353 (inhibit-read-only t)
4354 contents charset coding-system)
4355 (if (and (not arg) (mm-handle-undisplayer handle))
4356 (mm-remove-part handle)
4357 (mm-with-unibyte-buffer
4358 (mm-insert-part handle)
4360 (or (mm-decompress-buffer
4361 (or (mail-content-type-get (mm-handle-disposition handle)
4363 (mail-content-type-get (mm-handle-disposition handle)
4369 (unless (setq charset (mail-content-type-get
4370 (mm-handle-type handle) 'charset))
4371 (unless (setq coding-system
4372 (mm-with-unibyte-buffer
4374 (mm-find-buffer-file-coding-system)))
4375 (setq charset gnus-newsgroup-charset))))
4377 (if (mm-handle-undisplayer handle)
4378 (mm-remove-part handle))
4381 gnus-summary-show-article-charset-alist))
4382 (mm-read-coding-system "Charset: "))))
4384 (if (mm-handle-undisplayer handle)
4385 (mm-remove-part handle))))
4389 (if (or coding-system
4392 (mm-charset-to-coding-system charset))
4393 (not (eq charset 'ascii))))
4394 (mm-decode-coding-string contents coding-system)
4395 (mm-string-to-multibyte contents)))
4398 (defun gnus-mime-view-part-as-charset (&optional handle arg)
4399 "Insert the MIME part under point into the current buffer using the
4401 (interactive (list nil current-prefix-arg))
4402 (gnus-article-check-buffer)
4403 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
4406 (inhibit-read-only t))
4408 (if (mm-handle-undisplayer handle)
4409 (mm-remove-part handle))
4410 (let ((gnus-newsgroup-charset
4412 gnus-summary-show-article-charset-alist))
4413 (mm-read-coding-system "Charset: ")))
4414 (gnus-newsgroup-ignored-charsets 'gnus-all))
4415 (gnus-article-press-button)))))
4417 (defun gnus-mime-view-part-externally (&optional handle)
4418 "View the MIME part under point with an external viewer."
4420 (gnus-article-check-buffer)
4421 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
4422 (mm-user-display-methods nil)
4423 (mm-inlined-types nil)
4424 (mail-parse-charset gnus-newsgroup-charset)
4425 (mail-parse-ignored-charsets
4426 (with-current-buffer gnus-summary-buffer
4427 gnus-newsgroup-ignored-charsets)))
4429 (if (mm-handle-undisplayer handle)
4430 (mm-remove-part handle)
4431 (mm-display-part handle)))))
4433 (defun gnus-mime-view-part-internally (&optional handle)
4434 "View the MIME part under point with an internal viewer.
4435 If no internal viewer is available, use an external viewer."
4437 (gnus-article-check-buffer)
4438 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
4439 (mm-inlined-types '(".*"))
4440 (mm-inline-large-images t)
4441 (mail-parse-charset gnus-newsgroup-charset)
4442 (mail-parse-ignored-charsets
4443 (with-current-buffer gnus-summary-buffer
4444 gnus-newsgroup-ignored-charsets))
4445 (inhibit-read-only t))
4447 (if (mm-handle-undisplayer handle)
4448 (mm-remove-part handle)
4449 (mm-display-part handle)))))
4451 (defun gnus-mime-action-on-part (&optional action)
4452 "Do something with the MIME attachment at \(point\)."
4454 (list (completing-read "Action: " gnus-mime-action-alist nil t)))
4455 (gnus-article-check-buffer)
4456 (let ((action-pair (assoc action gnus-mime-action-alist)))
4458 (funcall (cdr action-pair)))))
4460 (defun gnus-article-part-wrapper (n function)
4461 (with-current-buffer gnus-article-buffer
4462 (when (> n (length gnus-article-mime-handle-alist))
4463 (error "No such part"))
4464 (gnus-article-goto-part n)
4465 (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
4466 (funcall function handle))))
4468 (defun gnus-article-pipe-part (n)
4469 "Pipe MIME part N, which is the numerical prefix."
4471 (gnus-article-part-wrapper n 'mm-pipe-part))
4473 (defun gnus-article-save-part (n)
4474 "Save MIME part N, which is the numerical prefix."
4476 (gnus-article-part-wrapper n 'mm-save-part))
4478 (defun gnus-article-interactively-view-part (n)
4479 "View MIME part N interactively, which is the numerical prefix."
4481 (gnus-article-part-wrapper n 'mm-interactively-view-part))
4483 (defun gnus-article-copy-part (n)
4484 "Copy MIME part N, which is the numerical prefix."
4486 (gnus-article-part-wrapper n 'gnus-mime-copy-part))
4488 (defun gnus-article-view-part-as-charset (n)
4489 "View MIME part N using a specified charset.
4490 N is the numerical prefix."
4492 (gnus-article-part-wrapper n 'gnus-mime-view-part-as-charset))
4494 (defun gnus-article-view-part-externally (n)
4495 "View MIME part N externally, which is the numerical prefix."
4497 (gnus-article-part-wrapper n 'gnus-mime-view-part-externally))
4499 (defun gnus-article-inline-part (n)
4500 "Inline MIME part N, which is the numerical prefix."
4502 (gnus-article-part-wrapper n 'gnus-mime-inline-part))
4504 (defun gnus-article-mime-match-handle-first (condition)
4507 (dolist (ihandle gnus-article-mime-handle-alist)
4509 ((functionp condition)
4510 (funcall condition (cdr ihandle)))
4511 ((eq condition 'undisplayed)
4512 (not (or (mm-handle-undisplayer (cdr ihandle))
4513 (equal (mm-handle-media-type (cdr ihandle))
4514 "multipart/alternative"))))
4515 ((eq condition 'undisplayed-alternative)
4516 (not (mm-handle-undisplayer (cdr ihandle))))
4518 (gnus-article-goto-part (car ihandle))
4519 (or (not n) (< (car ihandle) n)))
4520 (setq n (car ihandle))))
4524 (defun gnus-article-view-part (&optional n)
4525 "View MIME part N, which is the numerical prefix."
4527 (with-current-buffer gnus-article-buffer
4528 (or (numberp n) (setq n (gnus-article-mime-match-handle-first
4529 gnus-article-mime-match-handle-function)))
4530 (when (> n (length gnus-article-mime-handle-alist))
4531 (error "No such part"))
4532 (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
4533 (when (gnus-article-goto-part n)
4534 (if (equal (car handle) "multipart/alternative")
4535 (gnus-article-press-button)
4536 (when (eq (gnus-mm-display-part handle) 'internal)
4537 (gnus-set-window-start)))))))
4539 (defsubst gnus-article-mime-total-parts ()
4540 (if (bufferp (car gnus-article-mime-handles))
4542 (1- (length gnus-article-mime-handles))))
4544 (defun gnus-mm-display-part (handle)
4545 "Display HANDLE and fix MIME button."
4546 (let ((id (get-text-property (point) 'gnus-part))
4548 (inhibit-read-only t))
4551 (let ((window (selected-window))
4552 (mail-parse-charset gnus-newsgroup-charset)
4553 (mail-parse-ignored-charsets
4554 (if (gnus-buffer-live-p gnus-summary-buffer)
4555 (with-current-buffer gnus-summary-buffer
4556 gnus-newsgroup-ignored-charsets)
4560 (let ((win (gnus-get-buffer-window (current-buffer) t))
4563 (select-window win))
4566 (if (mm-handle-displayed-p handle)
4567 ;; This will remove the part.
4568 (mm-display-part handle)
4570 (narrow-to-region (point)
4571 (if (eobp) (point) (1+ (point))))
4572 (mm-display-part handle)
4573 ;; We narrow to the part itself and
4574 ;; then call the treatment functions.
4575 (goto-char (point-min))
4577 (narrow-to-region (point) (point-max))
4580 (gnus-article-mime-total-parts)
4581 (mm-handle-media-type handle)))))
4582 (if (window-live-p window)
4583 (select-window window)))))
4586 (gnus-insert-mime-button
4587 handle id (list (mm-handle-displayed-p handle)))
4588 (goto-char point))))
4590 (defun gnus-article-goto-part (n)
4591 "Go to MIME part N."
4592 (gnus-goto-char (text-property-any (point-min) (point-max) 'gnus-part n)))
4594 (defun gnus-insert-mime-button (handle gnus-tmp-id &optional displayed)
4595 (let ((gnus-tmp-name
4596 (or (mail-content-type-get (mm-handle-type handle) 'name)
4597 (mail-content-type-get (mm-handle-disposition handle) 'filename)
4598 (mail-content-type-get (mm-handle-type handle) 'url)
4600 (gnus-tmp-type (mm-handle-media-type handle))
4601 (gnus-tmp-description
4602 (mail-decode-encoded-word-string (or (mm-handle-description handle)
4605 (if (if displayed (car displayed)
4606 (mm-handle-displayed-p handle))
4608 (gnus-tmp-length (with-current-buffer (mm-handle-buffer handle)
4610 gnus-tmp-type-long b e)
4611 (when (string-match ".*/" gnus-tmp-name)
4612 (setq gnus-tmp-name (replace-match "" t t gnus-tmp-name)))
4613 (setq gnus-tmp-type-long (concat gnus-tmp-type
4614 (and (not (equal gnus-tmp-name ""))
4615 (concat "; " gnus-tmp-name))))
4616 (unless (equal gnus-tmp-description "")
4617 (setq gnus-tmp-type-long (concat " --- " gnus-tmp-type-long)))
4622 gnus-mime-button-line-format gnus-mime-button-line-format-alist
4623 `(keymap ,gnus-mime-button-map
4624 gnus-callback gnus-mm-display-part
4625 gnus-part ,gnus-tmp-id
4626 article-type annotation
4629 ;; Exclude a newline.
4632 (widget-convert-button
4635 :action 'gnus-widget-press-button
4636 :button-keymap gnus-mime-button-map
4638 (lambda (widget/window &optional overlay pos)
4639 ;; Needed to properly clear the message due to a bug in
4640 ;; wid-edit (XEmacs only).
4641 (if (boundp 'help-echo-owns-message)
4642 (setq help-echo-owns-message t))
4644 "%S: %s the MIME part; %S: more options"
4645 (aref gnus-mouse-2 0)
4646 ;; XEmacs will get a single widget arg; Emacs 21 will get
4647 ;; window, overlay, position.
4648 (if (mm-handle-displayed-p
4650 (with-current-buffer (gnus-overlay-buffer overlay)
4651 (widget-get (widget-at (gnus-overlay-start overlay))
4653 (widget-get widget/window :mime-handle)))
4655 (aref gnus-down-mouse-3 0))))))
4657 (defun gnus-widget-press-button (elems el)
4658 (goto-char (widget-get elems :from))
4659 (gnus-article-press-button))
4661 (defvar gnus-displaying-mime nil)
4663 (defun gnus-display-mime (&optional ihandles)
4664 "Display the MIME parts."
4666 (save-selected-window
4667 (let ((window (get-buffer-window gnus-article-buffer))
4670 (select-window window)
4671 ;; We have to do this since selecting the window
4672 ;; may change the point. So we set the window point.
4673 (set-window-point window point)))
4674 (let ((handles ihandles)
4675 (inhibit-read-only t)
4676 handle name type b e display)
4678 ((setq handles (mm-dissect-buffer nil gnus-article-loose-mime))
4679 (when gnus-article-emulate-mime
4680 (mm-uu-dissect-text-parts handles)))
4681 (gnus-article-emulate-mime
4682 (setq handles (mm-uu-dissect))))
4683 (when (and (not ihandles)
4684 (not gnus-displaying-mime))
4685 ;; Top-level call; we clean up.
4686 (when gnus-article-mime-handles
4687 (mm-destroy-parts gnus-article-mime-handles)
4688 (setq gnus-article-mime-handle-alist nil));; A trick.
4689 (setq gnus-article-mime-handles handles)
4690 ;; We allow users to glean info from the handles.
4691 (when gnus-article-mime-part-function
4692 (gnus-mime-part-function handles)))
4694 (or (not (stringp (car handles)))
4697 (when (and (not ihandles)
4698 (not gnus-displaying-mime))
4699 ;; Clean up for mime parts.
4701 (delete-region (point) (point-max)))
4702 (let ((gnus-displaying-mime t))
4703 (gnus-mime-display-part handles)))
4706 (narrow-to-region (point) (point-max))
4707 (gnus-treat-article nil 1 1)
4710 ;; Highlight the headers.
4714 (narrow-to-region (point-min) (point))
4715 (gnus-article-save-original-date)
4716 (gnus-treat-article 'head))))))))
4718 (defcustom gnus-mime-display-multipart-as-mixed nil
4719 "Display \"multipart\" parts as \"multipart/mixed\".
4721 If t, it overrides nil values of
4722 `gnus-mime-display-multipart-alternative-as-mixed' and
4723 `gnus-mime-display-multipart-related-as-mixed'."
4724 :group 'gnus-article-mime
4727 (defcustom gnus-mime-display-multipart-alternative-as-mixed nil
4728 "Display \"multipart/alternative\" parts as \"multipart/mixed\"."
4730 :group 'gnus-article-mime
4733 (defcustom gnus-mime-display-multipart-related-as-mixed nil
4734 "Display \"multipart/related\" parts as \"multipart/mixed\".
4736 If displaying \"text/html\" is discouraged \(see
4737 `mm-discouraged-alternatives'\) images or other material inside a
4738 \"multipart/related\" part might be overlooked when this variable is nil."
4740 :group 'gnus-article-mime
4743 (defun gnus-mime-display-part (handle)
4746 ((not (stringp (car handle)))
4747 (gnus-mime-display-single handle))
4748 ;; User-defined multipart
4749 ((cdr (assoc (car handle) gnus-mime-multipart-functions))
4750 (funcall (cdr (assoc (car handle) gnus-mime-multipart-functions))
4752 ;; multipart/alternative
4753 ((and (equal (car handle) "multipart/alternative")
4754 (not (or gnus-mime-display-multipart-as-mixed
4755 gnus-mime-display-multipart-alternative-as-mixed)))
4756 (let ((id (1+ (length gnus-article-mime-handle-alist))))
4757 (push (cons id handle) gnus-article-mime-handle-alist)
4758 (gnus-mime-display-alternative (cdr handle) nil nil id)))
4759 ;; multipart/related
4760 ((and (equal (car handle) "multipart/related")
4761 (not (or gnus-mime-display-multipart-as-mixed
4762 gnus-mime-display-multipart-related-as-mixed)))
4763 ;;;!!!We should find the start part, but we just default
4764 ;;;!!!to the first part.
4765 ;;(gnus-mime-display-part (cadr handle))
4766 ;;;!!! Most multipart/related is an HTML message plus images.
4767 ;;;!!! Unfortunately we are unable to let W3 display those
4768 ;;;!!! included images, so we just display it as a mixed multipart.
4769 ;;(gnus-mime-display-mixed (cdr handle))
4770 ;;;!!! No, w3 can display everything just fine.
4771 (gnus-mime-display-part (cadr handle)))
4772 ((equal (car handle) "multipart/signed")
4773 (gnus-add-wash-type 'signed)
4774 (gnus-mime-display-security handle))
4775 ((equal (car handle) "multipart/encrypted")
4776 (gnus-add-wash-type 'encrypted)
4777 (gnus-mime-display-security handle))
4778 ;; Other multiparts are handled like multipart/mixed.
4780 (gnus-mime-display-mixed (cdr handle)))))
4782 (defun gnus-mime-part-function (handles)
4783 (if (stringp (car handles))
4784 (mapcar 'gnus-mime-part-function (cdr handles))
4785 (funcall gnus-article-mime-part-function handles)))
4787 (defun gnus-mime-display-mixed (handles)
4788 (mapcar 'gnus-mime-display-part handles))
4790 (defun gnus-mime-display-single (handle)
4791 (let ((type (mm-handle-media-type handle))
4792 (ignored gnus-ignored-mime-types)
4799 (when (string-match (pop ignored) type)
4800 (throw 'ignored nil)))
4801 (if (and (setq not-attachment
4802 (and (not (mm-inline-override-p handle))
4803 (or (not (mm-handle-disposition handle))
4804 (equal (car (mm-handle-disposition handle))
4806 (mm-attachment-override-p handle))))
4807 (mm-automatic-display-p handle)
4809 (mm-inlinable-p handle)
4810 (mm-inlined-p handle))
4811 (mm-automatic-external-display-p type)))
4813 (when (equal (mm-handle-media-supertype handle) "text")
4815 (let ((id (1+ (length gnus-article-mime-handle-alist)))
4817 (push (cons id handle) gnus-article-mime-handle-alist)
4818 (when (or (not display)
4819 (not (gnus-unbuttonized-mime-type-p type)))
4820 (gnus-insert-mime-button
4821 handle id (list (or display (and not-attachment text))))
4822 (gnus-article-insert-newline)
4823 ;; Remember modify the number of forward lines.
4831 (let ((mail-parse-charset gnus-newsgroup-charset)
4832 (mail-parse-ignored-charsets
4833 (save-excursion (condition-case ()
4834 (set-buffer gnus-summary-buffer)
4836 gnus-newsgroup-ignored-charsets)))
4837 (mm-display-part handle t))
4838 (goto-char (point-max)))
4839 ((and text not-attachment)
4843 (gnus-article-insert-newline)
4844 (mm-display-inline handle)
4845 (goto-char (point-max))))
4849 (narrow-to-region beg (point))
4852 (gnus-article-mime-total-parts)
4853 (mm-handle-media-type handle)))))))))
4855 (defun gnus-unbuttonized-mime-type-p (type)
4856 "Say whether TYPE is to be unbuttonized."
4857 (unless gnus-inhibit-mime-unbuttonizing
4859 (let ((types gnus-unbuttonized-mime-types))
4861 (when (string-match (pop types) type)
4862 (throw 'found t)))))
4864 (let ((types gnus-buttonized-mime-types))
4866 (when (string-match (pop types) type)
4867 (throw 'found t)))))))))
4869 (defun gnus-article-insert-newline ()
4870 "Insert a newline, but mark it as undeletable."
4871 (gnus-put-text-property
4872 (point) (progn (insert "\n") (point)) 'gnus-undeletable t))
4874 (defun gnus-mime-display-alternative (handles &optional preferred ibegend id)
4875 (let* ((preferred (or preferred (mm-preferred-alternative handles)))
4878 handle (inhibit-read-only t) from props begend not-pref)
4879 (save-window-excursion
4882 (narrow-to-region (car ibegend)
4885 (goto-char (car ibegend))
4888 (delete-region (point-min) (point-max))
4889 (mm-remove-parts handles))
4890 (setq begend (list (point-marker)))
4892 (unless (setq not-pref (cadr (member preferred ihandles)))
4893 (setq not-pref (car ihandles)))
4896 (not (gnus-unbuttonized-mime-type-p
4897 "multipart/alternative")))
4898 (gnus-add-text-properties
4901 (insert (format "%d. " id))
4905 (unless ,(not ibegend)
4906 (setq gnus-article-mime-handle-alist
4907 ',gnus-article-mime-handle-alist))
4908 (gnus-mime-display-alternative
4909 ',ihandles ',not-pref ',begend ,id))
4910 keymap ,gnus-mime-button-map
4911 ,gnus-mouse-face-prop ,gnus-article-mouse-face
4912 face ,gnus-article-button-face
4915 (widget-convert-button 'link from (point)
4916 :action 'gnus-widget-press-button
4917 :button-keymap gnus-widget-button-keymap)
4919 (while (setq handle (pop handles))
4920 (gnus-add-text-properties
4923 (insert (format "(%c) %-18s"
4924 (if (equal handle preferred) ?* ? )
4925 (mm-handle-media-type handle)))
4929 (unless ,(not ibegend)
4930 (setq gnus-article-mime-handle-alist
4931 ',gnus-article-mime-handle-alist))
4932 (gnus-mime-display-alternative
4933 ',ihandles ',handle ',begend ,id))
4934 keymap ,gnus-mime-button-map
4935 ,gnus-mouse-face-prop ,gnus-article-mouse-face
4936 face ,gnus-article-button-face
4939 (widget-convert-button 'link from (point)
4940 :action 'gnus-widget-press-button
4941 :button-keymap gnus-widget-button-keymap)
4945 (if (stringp (car preferred))
4946 (gnus-display-mime preferred)
4947 (let ((mail-parse-charset gnus-newsgroup-charset)
4948 (mail-parse-ignored-charsets
4949 (with-current-buffer gnus-summary-buffer
4950 gnus-newsgroup-ignored-charsets)))
4951 (mm-display-part preferred)
4955 (narrow-to-region (car begend) (point-max))
4957 nil (length gnus-article-mime-handle-alist)
4958 (gnus-article-mime-total-parts)
4959 (mm-handle-media-type handle))))))
4960 (goto-char (point-max))
4961 (setcdr begend (point-marker)))))
4963 (goto-char point))))
4965 (defconst gnus-article-wash-status-strings
4966 (let ((alist '((cite "c" "Possible hidden citation text"
4967 " " "All citation text visible")
4968 (headers "h" "Hidden headers"
4969 " " "All headers visible.")
4970 (pgp "p" "Encrypted or signed message status hidden"
4971 " " "No hidden encryption nor digital signature status")
4972 (signature "s" "Signature has been hidden"
4973 " " "Signature is visible")
4974 (overstrike "o" "Overstrike (^H) characters applied"
4975 " " "No overstrike characters applied")
4976 (emphasis "e" "/*_Emphasis_*/ characters applied"
4977 " " "No /*_emphasis_*/ characters applied")))
4979 (dolist (entry alist result)
4980 (let ((key (nth 0 entry))
4981 (on (copy-sequence (nth 1 entry)))
4982 (on-help (nth 2 entry))
4983 (off (copy-sequence (nth 3 entry)))
4984 (off-help (nth 4 entry)))
4985 (put-text-property 0 1 'help-echo on-help on)
4986 (put-text-property 0 1 'help-echo off-help off)
4987 (push (list key on off) result))))
4988 "Alist of strings describing wash status in the mode line.
4989 Each entry has the form (KEY ON OF), where the KEY is a symbol
4990 representing the particular washing function, ON is the string to use
4991 in the article mode line when the washing function is active, and OFF
4992 is the string to use when it is inactive.")
4994 (defun gnus-article-wash-status-entry (key value)
4995 (let ((entry (assoc key gnus-article-wash-status-strings)))
4996 (if value (nth 1 entry) (nth 2 entry))))
4998 (defun gnus-article-wash-status ()
4999 "Return a string which display status of article washing."
5000 (with-current-buffer gnus-article-buffer
5001 (let ((cite (memq 'cite gnus-article-wash-types))
5002 (headers (memq 'headers gnus-article-wash-types))
5003 (boring (memq 'boring-headers gnus-article-wash-types))
5004 (pgp (memq 'pgp gnus-article-wash-types))
5005 (pem (memq 'pem gnus-article-wash-types))
5006 (signed (memq 'signed gnus-article-wash-types))
5007 (encrypted (memq 'encrypted gnus-article-wash-types))
5008 (signature (memq 'signature gnus-article-wash-types))
5009 (overstrike (memq 'overstrike gnus-article-wash-types))
5010 (emphasis (memq 'emphasis gnus-article-wash-types)))
5012 (gnus-article-wash-status-entry 'cite cite)
5013 (gnus-article-wash-status-entry 'headers (or headers boring))
5014 (gnus-article-wash-status-entry 'pgp (or pgp pem signed encrypted))
5015 (gnus-article-wash-status-entry 'signature signature)
5016 (gnus-article-wash-status-entry 'overstrike overstrike)
5017 (gnus-article-wash-status-entry 'emphasis emphasis)))))
5019 (defun gnus-add-wash-type (type)
5020 "Add a washing of TYPE to the current status."
5021 (add-to-list 'gnus-article-wash-types type))
5023 (defun gnus-delete-wash-type (type)
5024 "Add a washing of TYPE to the current status."
5025 (setq gnus-article-wash-types (delq type gnus-article-wash-types)))
5027 (defun gnus-add-image (category image)
5028 "Add IMAGE of CATEGORY to the list of displayed images."
5029 (let ((entry (assq category gnus-article-image-alist)))
5031 (setq entry (list category))
5032 (push entry gnus-article-image-alist))
5033 (nconc entry (list image))))
5035 (defun gnus-delete-images (category)
5036 "Delete all images in CATEGORY."
5037 (let ((entry (assq category gnus-article-image-alist)))
5038 (dolist (image (cdr entry))
5039 (gnus-remove-image image category))
5040 (setq gnus-article-image-alist (delq entry gnus-article-image-alist))
5041 (gnus-delete-wash-type category)))
5043 (defalias 'gnus-article-hide-headers-if-wanted 'gnus-article-maybe-hide-headers)
5045 (defun gnus-article-maybe-hide-headers ()
5046 "Hide unwanted headers if `gnus-have-all-headers' is nil.
5047 Provided for backwards compatibility."
5048 (when (and (or (not (gnus-buffer-live-p gnus-summary-buffer))
5049 (not (with-current-buffer gnus-summary-buffer
5050 gnus-have-all-headers)))
5051 (not gnus-inhibit-hiding))
5052 (gnus-article-hide-headers)))
5056 (defun gnus-output-to-file (file-name)
5057 "Append the current article to a file named FILE-NAME."
5058 (let ((artbuf (current-buffer)))
5060 (insert-buffer-substring artbuf)
5061 ;; Append newline at end of the buffer as separator, and then
5063 (goto-char (point-max))
5065 (let ((file-name-coding-system nnmail-pathname-coding-system))
5066 (mm-append-to-file (point-min) (point-max) file-name))
5069 (defun gnus-narrow-to-page (&optional arg)
5070 "Narrow the article buffer to a page.
5071 If given a numerical ARG, move forward ARG pages."
5073 (setq arg (if arg (prefix-numeric-value arg) 0))
5075 (set-buffer gnus-article-buffer)
5076 (goto-char (point-min))
5078 ;; Remove any old next/prev buttons.
5079 (when (gnus-visual-p 'page-marker)
5080 (let ((inhibit-read-only t))
5081 (gnus-remove-text-with-property 'gnus-prev)
5082 (gnus-remove-text-with-property 'gnus-next)))
5085 (re-search-backward page-delimiter nil 'move (1+ (abs arg))))
5087 (re-search-forward page-delimiter nil 'move arg)))
5088 (goto-char (match-end 0))
5090 (goto-char (point-min))
5091 (setq gnus-page-broken
5092 (and (re-search-forward page-delimiter nil t) t))))
5093 (when gnus-page-broken
5096 (if (re-search-forward page-delimiter nil 'move)
5099 (when (and (gnus-visual-p 'page-marker)
5100 (> (point-min) (save-restriction (widen) (point-min))))
5102 (goto-char (point-min))
5103 (gnus-insert-prev-page-button)))
5104 (when (and (gnus-visual-p 'page-marker)
5105 (< (point-max) (save-restriction (widen) (point-max))))
5107 (goto-char (point-max))
5108 (gnus-insert-next-page-button))))))
5110 ;; Article mode commands
5112 (defun gnus-article-goto-next-page ()
5113 "Show the next page of the article."
5115 (when (gnus-article-next-page)
5116 (goto-char (point-min))
5117 (gnus-article-read-summary-keys nil (gnus-character-to-event ?n))))
5120 (defun gnus-article-goto-prev-page ()
5121 "Show the previous page of the article."
5124 (gnus-article-read-summary-keys nil (gnus-character-to-event ?p))
5125 (gnus-article-prev-page nil)))
5127 ;; This is cleaner but currently breaks `gnus-pick-mode':
5129 ;; (defun gnus-article-goto-next-page ()
5130 ;; "Show the next page of the article."
5132 ;; (gnus-eval-in-buffer-window gnus-summary-buffer
5133 ;; (gnus-summary-next-page)))
5135 ;; (defun gnus-article-goto-prev-page ()
5136 ;; "Show the next page of the article."
5138 ;; (gnus-eval-in-buffer-window gnus-summary-buffer
5139 ;; (gnus-summary-prev-page)))
5141 (defun gnus-article-next-page (&optional lines)
5142 "Show the next page of the current article.
5143 If end of article, return non-nil. Otherwise return nil.
5144 Argument LINES specifies lines to be scrolled up."
5146 (move-to-window-line -1)
5149 (and (pos-visible-in-window-p) ;Not continuation line.
5150 (>= (1+ (point)) (point-max)))) ;Allow for trailing newline.
5151 ;; Nothing in this page.
5152 (if (or (not gnus-page-broken)
5157 (eobp)))) ;Real end-of-buffer?
5159 (when gnus-article-over-scroll
5160 (gnus-article-next-page-1 lines))
5162 (gnus-narrow-to-page 1) ;Go to next page.
5164 ;; More in this page.
5165 (gnus-article-next-page-1 lines)
5168 (defun gnus-article-next-page-1 (lines)
5169 (let ((scroll-in-place nil))
5173 ;; Long lines may cause an end-of-buffer error.
5174 (goto-char (point-max)))))
5175 (move-to-window-line 0))
5177 (defun gnus-article-prev-page (&optional lines)
5178 "Show previous page of current article.
5179 Argument LINES specifies lines to be scrolled down."
5181 (move-to-window-line 0)
5182 (if (and gnus-page-broken
5184 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
5186 (gnus-narrow-to-page -1) ;Go to previous page.
5187 (goto-char (point-max))
5189 (let ((scroll-in-place nil))
5193 (beginning-of-buffer
5194 (goto-char (point-min))))
5195 (move-to-window-line 0)))))
5197 (defun gnus-article-only-boring-p ()
5198 "Decide whether there is only boring text remaining in the article.
5199 Something \"interesting\" is a word of at least two letters that does
5200 not have a face in `gnus-article-boring-faces'."
5201 (when (and gnus-article-skip-boring
5202 (boundp 'gnus-article-boring-faces)
5203 (symbol-value 'gnus-article-boring-faces))
5206 (while (re-search-forward "\\b\\w\\w" nil t)
5208 (when (not (gnus-intersection
5209 (gnus-faces-at (point))
5210 (symbol-value 'gnus-article-boring-faces)))
5211 (throw 'only-boring nil)))
5212 (throw 'only-boring t)))))
5214 (defun gnus-article-refer-article ()
5215 "Read article specified by message-id around point."
5218 (re-search-backward "[ \t]\\|^" (point-at-bol) t)
5219 (re-search-forward "<?news:<?\\|<" (point-at-eol) t)
5220 (if (re-search-forward "[^@ ]+@[^ \t>]+" (point-at-eol) t)
5221 (let ((msg-id (concat "<" (match-string 0) ">")))
5222 (set-buffer gnus-summary-buffer)
5223 (gnus-summary-refer-article msg-id))
5224 (error "No references around point"))))
5226 (defun gnus-article-show-summary ()
5227 "Reconfigure windows to show summary buffer."
5229 (if (not (gnus-buffer-live-p gnus-summary-buffer))
5230 (error "There is no summary buffer for this article buffer")
5231 (gnus-article-set-globals)
5232 (gnus-configure-windows 'article)
5233 (gnus-summary-goto-subject gnus-current-article)
5234 (gnus-summary-position-point)))
5236 (defun gnus-article-describe-briefly ()
5237 "Describe article mode commands briefly."
5239 (gnus-message 6 (substitute-command-keys "\\<gnus-article-mode-map>\\[gnus-article-goto-next-page]:Next page \\[gnus-article-goto-prev-page]:Prev page \\[gnus-article-show-summary]:Show summary \\[gnus-info-find-node]:Run Info \\[gnus-article-describe-briefly]:This help")))
5241 (defun gnus-article-summary-command ()
5242 "Execute the last keystroke in the summary buffer."
5244 (let ((obuf (current-buffer))
5245 (owin (current-window-configuration))
5247 (switch-to-buffer gnus-article-current-summary 'norecord)
5248 (setq func (lookup-key (current-local-map) (this-command-keys)))
5249 (call-interactively func)
5251 (set-window-configuration owin)
5252 (set-window-point (get-buffer-window (current-buffer)) (point))))
5254 (defun gnus-article-summary-command-nosave ()
5255 "Execute the last keystroke in the summary buffer."
5258 (pop-to-buffer gnus-article-current-summary 'norecord)
5259 (setq func (lookup-key (current-local-map) (this-command-keys)))
5260 (call-interactively func)))
5262 (defun gnus-article-check-buffer ()
5263 "Beep if not in an article buffer."
5264 (unless (equal major-mode 'gnus-article-mode)
5265 (error "Command invoked outside of a Gnus article buffer")))
5267 (defun gnus-article-read-summary-keys (&optional arg key not-restore-window)
5268 "Read a summary buffer key sequence and execute it from the article buffer."
5270 (gnus-article-check-buffer)
5272 '("q" "Q" "c" "r" "\C-c\C-f" "m" "a" "f"
5273 "Zc" "ZC" "ZE" "ZQ" "ZZ" "Zn" "ZR" "ZG" "ZN" "ZP"
5274 "=" "^" "\M-^" "|"))
5280 '("n" "Gn" "p" "Gp"))
5283 (set-buffer gnus-article-current-summary)
5284 (let (gnus-pick-mode)
5285 (push (or key last-command-event) unread-command-events)
5286 (setq keys (if (featurep 'xemacs)
5287 (events-to-keys (read-key-sequence nil))
5288 (read-key-sequence nil)))))
5292 (if (or (member keys nosaves)
5293 (member keys nosave-but-article)
5294 (member keys nosave-in-article))
5296 (save-window-excursion
5297 (pop-to-buffer gnus-article-current-summary 'norecord)
5298 ;; We disable the pick minor mode commands.
5299 (let (gnus-pick-mode)
5300 (setq func (lookup-key (current-local-map) keys))))
5304 (unless (member keys nosave-in-article)
5305 (set-buffer gnus-article-current-summary))
5306 (call-interactively func)
5307 (setq new-sum-point (point)))
5308 (when (member keys nosave-but-article)
5309 (pop-to-buffer gnus-article-buffer 'norecord)))
5310 ;; These commands should restore window configuration.
5311 (let ((obuf (current-buffer))
5312 (owin (current-window-configuration))
5314 win func in-buffer selected new-sum-start new-sum-hscroll)
5315 (cond (not-restore-window
5316 (pop-to-buffer gnus-article-current-summary 'norecord))
5317 ((setq win (get-buffer-window gnus-article-current-summary))
5318 (select-window win))
5320 (switch-to-buffer gnus-article-current-summary 'norecord)))
5321 (setq in-buffer (current-buffer))
5322 ;; We disable the pick minor mode commands.
5323 (if (and (setq func (let (gnus-pick-mode)
5324 (lookup-key (current-local-map) keys)))
5327 (call-interactively func)
5328 (when (eq win (selected-window))
5329 (setq new-sum-point (point)
5330 new-sum-start (window-start win)
5331 new-sum-hscroll (window-hscroll win)))
5332 (when (eq in-buffer (current-buffer))
5333 (setq selected (gnus-summary-select-article))
5335 (unless not-restore-window
5336 (set-window-configuration owin))
5337 (when (eq selected 'old)
5339 (set-window-start (get-buffer-window (current-buffer))
5341 (set-window-point (get-buffer-window (current-buffer))
5343 (when (and (not not-restore-window)
5345 (set-window-point win new-sum-point)
5346 (set-window-start win new-sum-start)
5347 (set-window-hscroll win new-sum-hscroll))))
5348 (set-window-configuration owin)
5351 (defun gnus-article-describe-key (key)
5352 "Display documentation of the function invoked by KEY. KEY is a string."
5353 (interactive "kDescribe key: ")
5354 (gnus-article-check-buffer)
5355 (if (eq (key-binding key) 'gnus-article-read-summary-keys)
5357 (set-buffer gnus-article-current-summary)
5358 (let (gnus-pick-mode)
5359 (if (featurep 'xemacs)
5361 (push (elt key 0) unread-command-events)
5362 (setq key (events-to-keys
5363 (read-key-sequence "Describe key: "))))
5364 (setq unread-command-events
5366 (lambda (x) (if (>= x 128) (list 'meta (- x 128)) x))
5367 (string-to-list key)))
5368 (setq key (read-key-sequence "Describe key: "))))
5370 (describe-key key)))
5372 (defun gnus-article-describe-key-briefly (key &optional insert)
5373 "Display documentation of the function invoked by KEY. KEY is a string."
5374 (interactive "kDescribe key: \nP")
5375 (gnus-article-check-buffer)
5376 (if (eq (key-binding key) 'gnus-article-read-summary-keys)
5378 (set-buffer gnus-article-current-summary)
5379 (let (gnus-pick-mode)
5380 (if (featurep 'xemacs)
5382 (push (elt key 0) unread-command-events)
5383 (setq key (events-to-keys
5384 (read-key-sequence "Describe key: "))))
5385 (setq unread-command-events
5387 (lambda (x) (if (>= x 128) (list 'meta (- x 128)) x))
5388 (string-to-list key)))
5389 (setq key (read-key-sequence "Describe key: "))))
5390 (describe-key-briefly key insert))
5391 (describe-key-briefly key insert)))
5393 (defun gnus-article-reply-with-original (&optional wide)
5394 "Start composing a reply mail to the current message.
5395 The text in the region will be yanked. If the region isn't active,
5396 the entire article will be yanked."
5398 (let ((article (cdr gnus-article-current))
5400 (if (not (gnus-region-active-p))
5401 (with-current-buffer gnus-summary-buffer
5402 (gnus-summary-reply (list (list article)) wide))
5403 (setq contents (buffer-substring (point) (mark t)))
5404 ;; Deactivate active regions.
5405 (when (and (boundp 'transient-mark-mode)
5406 transient-mark-mode)
5407 (setq mark-active nil))
5408 (with-current-buffer gnus-summary-buffer
5410 (list (list article contents)) wide)))))
5412 (defun gnus-article-followup-with-original ()
5413 "Compose a followup to the current article.
5414 The text in the region will be yanked. If the region isn't active,
5415 the entire article will be yanked."
5417 (let ((article (cdr gnus-article-current))
5419 (if (not (gnus-region-active-p))
5420 (with-current-buffer gnus-summary-buffer
5421 (gnus-summary-followup (list (list article))))
5422 (setq contents (buffer-substring (point) (mark t)))
5423 ;; Deactivate active regions.
5424 (when (and (boundp 'transient-mark-mode)
5425 transient-mark-mode)
5426 (setq mark-active nil))
5427 (with-current-buffer gnus-summary-buffer
5428 (gnus-summary-followup
5429 (list (list article contents)))))))
5431 (defun gnus-article-hide (&optional arg force)
5432 "Hide all the gruft in the current article.
5433 This means that signatures, cited text and (some) headers will be
5435 If given a prefix, show the hidden text instead."
5436 (interactive (append (gnus-article-hidden-arg) (list 'force)))
5437 (gnus-article-hide-headers arg)
5438 (gnus-article-hide-list-identifiers arg)
5439 (gnus-article-hide-citation-maybe arg force)
5440 (gnus-article-hide-signature arg))
5442 (defun gnus-article-maybe-highlight ()
5443 "Do some article highlighting if article highlighting is requested."
5444 (when (gnus-visual-p 'article-highlight 'highlight)
5445 (gnus-article-highlight-some)))
5447 (defun gnus-check-group-server ()
5448 ;; Make sure the connection to the server is alive.
5449 (unless (gnus-server-opened
5450 (gnus-find-method-for-group gnus-newsgroup-name))
5451 (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
5452 (gnus-request-group gnus-newsgroup-name t)))
5455 (autoload 'nneething-get-file-name "nneething"))
5457 (defun gnus-request-article-this-buffer (article group)
5458 "Get an article and insert it into this buffer."
5459 (let (do-update-line sparse-header)
5463 (gnus-kill-all-overlays)
5464 (setq group (or group gnus-newsgroup-name))
5466 ;; Using `gnus-request-article' directly will insert the article into
5467 ;; `nntp-server-buffer' - so we'll save some time by not having to
5468 ;; copy it from the server buffer into the article buffer.
5470 ;; We only request an article by message-id when we do not have the
5471 ;; headers for it, so we'll have to get those.
5472 (when (stringp article)
5473 (gnus-read-header article))
5475 ;; If the article number is negative, that means that this article
5476 ;; doesn't belong in this newsgroup (possibly), so we find its
5477 ;; message-id and request it by id instead of number.
5478 (when (and (numberp article)
5480 (get-buffer gnus-summary-buffer)
5481 (gnus-buffer-exists-p gnus-summary-buffer))
5483 (set-buffer gnus-summary-buffer)
5484 (let ((header (gnus-summary-article-header article)))
5487 ((memq article gnus-newsgroup-sparse)
5488 ;; This is a sparse gap article.
5489 (setq do-update-line article)
5490 (setq article (mail-header-id header))
5491 (setq sparse-header (gnus-read-header article))
5492 (setq gnus-newsgroup-sparse
5493 (delq article gnus-newsgroup-sparse)))
5495 ;; It's a real article.
5496 (setq article (mail-header-id header)))
5498 ;; It is an extracted pseudo-article.
5499 (setq article 'pseudo)
5500 (gnus-request-pseudo-article header))))
5502 (let ((method (gnus-find-method-for-group
5503 gnus-newsgroup-name)))
5504 (when (and (eq (car method) 'nneething)
5506 (let ((dir (nneething-get-file-name
5507 (mail-header-id header))))
5508 (when (and (stringp dir)
5509 (file-directory-p dir))
5510 (setq article 'nneething)
5511 (gnus-group-enter-directory dir))))))))
5514 ;; Refuse to select canceled articles.
5515 ((and (numberp article)
5517 (get-buffer gnus-summary-buffer)
5518 (gnus-buffer-exists-p gnus-summary-buffer)
5519 (eq (cdr (with-current-buffer gnus-summary-buffer
5520 (assq article gnus-newsgroup-reads)))
5521 gnus-canceled-mark))
5523 ;; We first check `gnus-original-article-buffer'.
5524 ((and (get-buffer gnus-original-article-buffer)
5526 (with-current-buffer gnus-original-article-buffer
5527 (and (equal (car gnus-original-article) group)
5528 (eq (cdr gnus-original-article) article))))
5529 (insert-buffer-substring gnus-original-article-buffer)
5531 ;; Check the backlog.
5532 ((and gnus-keep-backlog
5533 (gnus-backlog-request-article group article (current-buffer)))
5535 ;; Check asynchronous pre-fetch.
5536 ((gnus-async-request-fetched-article group article (current-buffer))
5537 (gnus-async-prefetch-next group article gnus-summary-buffer)
5538 (when (and (numberp article) gnus-keep-backlog)
5539 (gnus-backlog-enter-article group article (current-buffer)))
5542 ((and gnus-use-cache
5544 (gnus-cache-request-article article group))
5546 ;; Check the agent cache.
5547 ((gnus-agent-request-article article group)
5549 ;; Get the article and put into the article buffer.
5550 ((or (stringp article)
5552 (let ((gnus-override-method gnus-override-method)
5553 (methods (and (stringp article)
5554 gnus-refer-article-method))
5555 (backend (car (gnus-find-method-for-group
5556 gnus-newsgroup-name)))
5558 (inhibit-read-only t))
5559 (if (or (not (listp methods))
5560 (and (symbolp (car methods))
5561 (assq (car methods) nnoo-definition-alist)))
5562 (setq methods (list methods)))
5563 (when (and (null gnus-override-method)
5565 (setq gnus-override-method (pop methods)))
5567 (when (eq gnus-override-method 'current)
5568 (setq gnus-override-method
5569 (with-current-buffer gnus-summary-buffer
5570 gnus-current-select-method)))
5572 (gnus-kill-all-overlays)
5573 (let ((gnus-newsgroup-name group))
5574 (gnus-check-group-server))
5576 ((gnus-request-article article group (current-buffer))
5577 (when (numberp article)
5578 (gnus-async-prefetch-next group article
5579 gnus-summary-buffer)
5580 (when gnus-keep-backlog
5581 (gnus-backlog-enter-article
5582 group article (current-buffer))))
5583 (setq result 'article))
5585 (setq gnus-override-method (pop methods)))
5586 ((not (string-match "^400 "
5587 (nnheader-get-report backend)))
5588 ;; If we get 400 server disconnect, reconnect and
5589 ;; retry; otherwise, assume the article has expired.
5590 (setq result 'done))))
5591 (and (eq result 'article) 'article)))
5595 ;; Associate this article with the current summary buffer.
5596 (setq gnus-article-current-summary gnus-summary-buffer)
5598 ;; Take the article from the original article buffer
5599 ;; and place it in the buffer it's supposed to be in.
5600 (when (and (get-buffer gnus-article-buffer)
5601 (equal (buffer-name (current-buffer))
5602 (buffer-name (get-buffer gnus-article-buffer))))
5604 (if (get-buffer gnus-original-article-buffer)
5605 (set-buffer gnus-original-article-buffer)
5606 (set-buffer (gnus-get-buffer-create gnus-original-article-buffer))
5607 (buffer-disable-undo)
5608 (setq major-mode 'gnus-original-article-mode)
5609 (setq buffer-read-only t))
5610 (let ((inhibit-read-only t))
5612 (insert-buffer-substring gnus-article-buffer))
5613 (setq gnus-original-article (cons group article)))
5616 (run-hooks 'gnus-article-decode-hook)
5617 ;; Mark article as decoded or not.
5618 (setq gnus-article-decoded-p gnus-article-decode-hook))
5620 ;; Update sparse articles.
5621 (when (and do-update-line
5622 (or (numberp article)
5624 (let ((buf (current-buffer)))
5625 (set-buffer gnus-summary-buffer)
5626 (gnus-summary-update-article do-update-line sparse-header)
5627 (gnus-summary-goto-subject do-update-line nil t)
5628 (set-window-point (gnus-get-buffer-window (current-buffer) t)
5630 (set-buffer buf))))))
5636 (defcustom gnus-article-edit-mode-hook nil
5637 "Hook run in article edit mode buffers."
5638 :group 'gnus-article-various
5641 (defvar gnus-article-edit-done-function nil)
5643 (defvar gnus-article-edit-mode-map nil)
5645 ;; Should we be using derived.el for this?
5646 (unless gnus-article-edit-mode-map
5647 (setq gnus-article-edit-mode-map (make-keymap))
5648 (set-keymap-parent gnus-article-edit-mode-map text-mode-map)
5650 (gnus-define-keys gnus-article-edit-mode-map
5651 "\C-c?" describe-mode
5652 "\C-c\C-c" gnus-article-edit-done
5653 "\C-c\C-k" gnus-article-edit-exit
5654 "\C-c\C-f\C-t" message-goto-to
5655 "\C-c\C-f\C-o" message-goto-from
5656 "\C-c\C-f\C-b" message-goto-bcc
5657 ;;"\C-c\C-f\C-w" message-goto-fcc
5658 "\C-c\C-f\C-c" message-goto-cc
5659 "\C-c\C-f\C-s" message-goto-subject
5660 "\C-c\C-f\C-r" message-goto-reply-to
5661 "\C-c\C-f\C-n" message-goto-newsgroups
5662 "\C-c\C-f\C-d" message-goto-distribution
5663 "\C-c\C-f\C-f" message-goto-followup-to
5664 "\C-c\C-f\C-m" message-goto-mail-followup-to
5665 "\C-c\C-f\C-k" message-goto-keywords
5666 "\C-c\C-f\C-u" message-goto-summary
5667 "\C-c\C-f\C-i" message-insert-or-toggle-importance
5668 "\C-c\C-f\C-a" message-generate-unsubscribed-mail-followup-to
5669 "\C-c\C-b" message-goto-body
5670 "\C-c\C-i" message-goto-signature
5672 "\C-c\C-t" message-insert-to
5673 "\C-c\C-n" message-insert-newsgroups
5674 "\C-c\C-o" message-sort-headers
5675 "\C-c\C-e" message-elide-region
5676 "\C-c\C-v" message-delete-not-region
5677 "\C-c\C-z" message-kill-to-signature
5678 "\M-\r" message-newline-and-reformat
5679 "\C-c\C-a" mml-attach-file
5680 "\C-a" message-beginning-of-line
5682 "\M-;" comment-region)
5684 (gnus-define-keys (gnus-article-edit-wash-map
5685 "\C-c\C-w" gnus-article-edit-mode-map)
5686 "f" gnus-article-edit-full-stops))
5689 gnus-article-edit-mode-field-menu gnus-article-edit-mode-map ""
5691 ["Fetch To" message-insert-to t]
5692 ["Fetch Newsgroups" message-insert-newsgroups t]
5694 ["To" message-goto-to t]
5695 ["From" message-goto-from t]
5696 ["Subject" message-goto-subject t]
5697 ["Cc" message-goto-cc t]
5698 ["Reply-To" message-goto-reply-to t]
5699 ["Summary" message-goto-summary t]
5700 ["Keywords" message-goto-keywords t]
5701 ["Newsgroups" message-goto-newsgroups t]
5702 ["Followup-To" message-goto-followup-to t]
5703 ["Mail-Followup-To" message-goto-mail-followup-to t]
5704 ["Distribution" message-goto-distribution t]
5705 ["Body" message-goto-body t]
5706 ["Signature" message-goto-signature t]))
5708 (define-derived-mode gnus-article-edit-mode message-mode "Article Edit"
5709 "Major mode for editing articles.
5710 This is an extended text-mode.
5712 \\{gnus-article-edit-mode-map}"
5713 (make-local-variable 'gnus-article-edit-done-function)
5714 (make-local-variable 'gnus-prev-winconf)
5715 (set (make-local-variable 'font-lock-defaults)
5716 '(message-font-lock-keywords t))
5717 (set (make-local-variable 'mail-header-separator) "")
5718 (set (make-local-variable 'gnus-article-edit-mode) t)
5719 (easy-menu-add message-mode-field-menu message-mode-map)
5721 (setq buffer-read-only nil)
5722 (buffer-enable-undo)
5725 (defun gnus-article-edit (&optional force)
5726 "Edit the current article.
5727 This will have permanent effect only in mail groups.
5728 If FORCE is non-nil, allow editing of articles even in read-only
5731 (when (and (not force)
5732 (gnus-group-read-only-p))
5733 (error "The current newsgroup does not support article editing"))
5734 (gnus-article-date-original)
5735 (gnus-article-edit-article
5737 `(lambda (no-highlight)
5739 (gnus-summary-edit-article-done
5740 ,(or (mail-header-references gnus-current-headers) "")
5741 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight))))
5743 (defun gnus-article-edit-article (start-func exit-func)
5744 "Start editing the contents of the current article buffer."
5745 (let ((winconf (current-window-configuration)))
5746 (set-buffer gnus-article-buffer)
5747 (let ((message-auto-save-directory
5748 ;; Don't associate the article buffer with a draft file.
5750 (gnus-article-edit-mode))
5751 (funcall start-func)
5752 (set-buffer-modified-p nil)
5753 (gnus-configure-windows 'edit-article)
5754 (setq gnus-article-edit-done-function exit-func)
5755 (setq gnus-prev-winconf winconf)
5756 (gnus-message 6 "C-c C-c to end edits")))
5758 (defun gnus-article-edit-done (&optional arg)
5759 "Update the article edits and exit."
5761 (let ((func gnus-article-edit-done-function)
5762 (buf (current-buffer))
5763 (start (window-start))
5765 (winconf gnus-prev-winconf))
5766 (widen) ;; Widen it in case that users narrowed the buffer.
5769 ;; The cache and backlog have to be flushed somewhat.
5770 (when gnus-keep-backlog
5771 (gnus-backlog-remove-article
5772 (car gnus-article-current) (cdr gnus-article-current)))
5773 ;; Flush original article as well.
5775 (when (get-buffer gnus-original-article-buffer)
5776 (set-buffer gnus-original-article-buffer)
5777 (setq gnus-original-article nil)))
5778 (when gnus-use-cache
5779 (gnus-cache-update-article
5780 (car gnus-article-current) (cdr gnus-article-current)))
5781 ;; We remove all text props from the article buffer.
5782 (kill-all-local-variables)
5783 (set-text-properties (point-min) (point-max) nil)
5785 (set-window-configuration winconf)
5787 (set-window-start (get-buffer-window buf) start)
5788 (set-window-point (get-buffer-window buf) (point)))
5789 (gnus-summary-show-article))
5791 (defun gnus-article-edit-exit ()
5792 "Exit the article editing without updating."
5794 (when (or (not (buffer-modified-p))
5795 (yes-or-no-p "Article modified; kill anyway? "))
5796 (let ((curbuf (current-buffer))
5798 (window-start (window-start)))
5800 (if (gnus-buffer-live-p gnus-original-article-buffer)
5801 (insert-buffer gnus-original-article-buffer))
5802 (let ((winconf gnus-prev-winconf))
5803 (kill-all-local-variables)
5805 (set-window-configuration winconf)
5806 ;; Tippy-toe some to make sure that point remains where it was.
5807 (save-current-buffer
5809 (set-window-start (get-buffer-window (current-buffer)) window-start)
5811 (gnus-summary-show-article)))
5813 (defun gnus-article-edit-full-stops ()
5814 "Interactively repair spacing at end of sentences."
5817 (goto-char (point-min))
5818 (search-forward-regexp "^$" nil t)
5819 (let ((case-fold-search nil))
5820 (query-replace-regexp "\\([.!?][])}]* \\)\\([[({A-Z]\\)" "\\1 \\2"))))
5823 ;;; Article highlights
5826 ;; Written by Per Abrahamsen <abraham@iesd.auc.dk>.
5828 ;;; Internal Variables:
5830 (defcustom gnus-button-url-regexp
5831 (if (string-match "[[:digit:]]" "1") ;; support POSIX?
5832 "\\b\\(\\(www\\.\\|\\(s?https?\\|ftp\\|file\\|gopher\\|nntp\\|news\\|telnet\\|wais\\|mailto\\|info\\):\\)\\(//[-a-z0-9_.]+:[0-9]*\\)?[-a-z0-9_=!?#$@~%&*+\\/:;.,[:word:]]+[-a-z0-9_=#$@~%&*+\\/[:word:]]\\)"
5833 "\\b\\(\\(www\\.\\|\\(s?https?\\|ftp\\|file\\|gopher\\|nntp\\|news\\|telnet\\|wais\\|mailto\\|info\\):\\)\\(//[-a-z0-9_.]+:[0-9]*\\)?\\([-a-z0-9_=!?#$@~%&*+\\/:;.,]\\|\\w\\)+\\([-a-z0-9_=#$@~%&*+\\/]\\|\\w\\)\\)")
5834 "Regular expression that matches URLs."
5835 :group 'gnus-article-buttons
5838 (defcustom gnus-button-valid-fqdn-regexp
5839 message-valid-fqdn-regexp
5840 "Regular expression that matches a valid FQDN."
5842 :group 'gnus-article-buttons
5845 (defcustom gnus-button-man-handler 'manual-entry
5846 "Function to use for displaying man pages.
5847 The function must take at least one argument with a string naming the
5850 :type '(choice (function-item :tag "Man" manual-entry)
5851 (function-item :tag "Woman" woman)
5852 (function :tag "Other"))
5853 :group 'gnus-article-buttons)
5855 (defcustom gnus-ctan-url "http://tug.ctan.org/tex-archive/"
5856 "Top directory of a CTAN \(Comprehensive TeX Archive Network\) archive.
5857 If the default site is too slow, try to find a CTAN mirror, see
5858 <URL:http://tug.ctan.org/tex-archive/CTAN.sites?action=/index.html>. See also
5859 the variable `gnus-button-handle-ctan'."
5861 :group 'gnus-article-buttons
5862 :link '(custom-manual "(gnus)Group Parameters")
5863 :type '(choice (const "http://www.tex.ac.uk/tex-archive/")
5864 (const "http://tug.ctan.org/tex-archive/")
5865 (const "http://www.dante.de/CTAN/")
5866 (string :tag "Other")))
5868 (defcustom gnus-button-ctan-handler 'browse-url
5869 "Function to use for displaying CTAN links.
5870 The function must take one argument, the string naming the URL."
5872 :type '(choice (function-item :tag "Browse Url" browse-url)
5873 (function :tag "Other"))
5874 :group 'gnus-article-buttons)
5876 (defcustom gnus-button-handle-ctan-bogus-regexp "^/?tex-archive/\\|^/"
5877 "Bogus strings removed from CTAN URLs."
5879 :group 'gnus-article-buttons
5880 :type '(choice (const "^/?tex-archive/\\|/")
5881 (regexp :tag "Other")))
5883 (defcustom gnus-button-ctan-directory-regexp
5886 "biblio\\|digests\\|dviware\\|fonts\\|graphics\\|help\\|"
5887 "indexing\\|info\\|language\\|macros\\|support\\|systems\\|"
5888 "tds\\|tools\\|usergrps\\|web\\|nonfree\\|obsolete"
5890 "Regular expression for ctan directories.
5891 It should match all directories in the top level of `gnus-ctan-url'."
5893 :group 'gnus-article-buttons
5896 (defcustom gnus-button-mid-or-mail-regexp
5897 (concat "\\b\\(<?[a-z0-9$%(*-=?[_][^<>\")!;:,{}\n\t ]*@"
5898 ;; Felix Wiemann in <87oeuomcz9.fsf@news2.ososo.de>
5899 gnus-button-valid-fqdn-regexp
5901 "Regular expression that matches a message ID or a mail address."
5903 :group 'gnus-article-buttons
5906 (defcustom gnus-button-prefer-mid-or-mail 'gnus-button-mid-or-mail-heuristic
5907 "What to do when the button on a string as \"foo123@bar.invalid\" is pushed.
5908 Strings like this can be either a message ID or a mail address. If it is one
5909 of the symbols `mid' or `mail', Gnus will always assume that the string is a
5910 message ID or a mail address, respectively. If this variable is set to the
5911 symbol `ask', always query the user what do do. If it is a function, this
5912 function will be called with the string as it's only argument. The function
5913 must return `mid', `mail', `invalid' or `ask'."
5915 :group 'gnus-article-buttons
5916 :type '(choice (function-item :tag "Heuristic function"
5917 gnus-button-mid-or-mail-heuristic)
5922 (defcustom gnus-button-mid-or-mail-heuristic-alist
5923 '((-10.0 . ".+\\$.+@")
5926 (-5.0 . "\\+[^+]*\\+.*@") ;; # two plus signs
5927 (-5.0 . "@[Nn][Ee][Ww][Ss]") ;; /\@news/i
5928 (-5.0 . "@.*[Dd][Ii][Aa][Ll][Uu][Pp]") ;; /\@.*dialup/i;
5929 (-1.0 . "^[^a-z]+@")
5931 (-5.0 . "\\.[0-9][0-9]+.*@") ;; "\.[0-9]{2,}.*\@"
5932 (-5.0 . "[a-z].*[A-Z].*[a-z].*[A-Z].*@") ;; "([a-z].*[A-Z].*){2,}\@"
5933 (-3.0 . "[A-Z][A-Z][a-z][a-z].*@")
5934 (-5.0 . "\\...?.?@") ;; (-5.0 . "\..{1,3}\@")
5937 (-1.0 . "^[0-9][0-9]")
5939 ;; -3.0 /^[0-9][0-9a-fA-F]{2,2}/;
5940 (-3.0 . "^[0-9][0-9a-fA-F][0-9a-fA-F][^0-9a-fA-F]")
5941 ;; -5.0 /^[0-9][0-9a-fA-F]{3,3}/;
5942 (-5.0 . "^[0-9][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][^0-9a-fA-F]")
5944 (-3.0 . "[0-9][0-9][0-9][0-9][0-9][^0-9].*@") ;; "[0-9]{5,}.*\@"
5945 (-3.0 . "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][^0-9].*@")
5948 . "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].*@")
5950 ;; compensation for TDMA dated mail addresses:
5951 (25.0 . "-dated-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]+.*@")
5953 (-20.0 . "\\.fsf@") ;; Gnus
5956 (-20.0 . "_-_") ;; Subject change in thread
5958 (-20.0 . "\\.ln@") ;; leafnode
5959 (-30.0 . "@ID-[0-9]+\\.[a-zA-Z]+\\.dfncis\\.de")
5960 (-30.0 . "@4[Aa][Xx]\\.com") ;; Forte Agent
5962 ;; (5.0 . "") ;; $local_part_len <= 7
5963 (10.0 . "^[^0-9]+@")
5964 (3.0 . "^[^0-9]+[0-9][0-9]?[0-9]?@")
5965 ;; ^[^0-9]+[0-9]{1,3}\@ digits only at end of local part
5968 (2.0 . "[a-z][a-z][._-][A-Z][a-z].*@")
5970 (0.5 . "^[A-Z][a-z]")
5971 (0.5 . "^[A-Z][a-z][a-z]")
5972 (1.5 . "^[A-Z][a-z][A-Z][a-z][^a-z]") ;; ^[A-Z][a-z]{3,3}
5973 (2.0 . "^[A-Z][a-z][A-Z][a-z][a-z][^a-z]")) ;; ^[A-Z][a-z]{4,4}
5974 "An alist of \(RATE . REGEXP\) pairs for `gnus-button-mid-or-mail-heuristic'.
5976 A negative RATE indicates a message IDs, whereas a positive indicates a mail
5977 address. The REGEXP is processed with `case-fold-search' set to nil."
5979 :group 'gnus-article-buttons
5980 :type '(repeat (cons (number :tag "Rate")
5981 (regexp :tag "Regexp"))))
5983 (defun gnus-button-mid-or-mail-heuristic (mid-or-mail)
5984 "Guess whether MID-OR-MAIL is a message ID or a mail address.
5985 Returns `mid' if MID-OR-MAIL is a message IDs, `mail' if it's a mail
5986 address, `ask' if unsure and `invalid' if the string is invalid."
5987 (let ((case-fold-search nil)
5988 (list gnus-button-mid-or-mail-heuristic-alist)
5989 (result 0) rate regexp lpartlen elem)
5991 (length (gnus-replace-in-string mid-or-mail "^\\(.*\\)@.*$" "\\1")))
5992 (gnus-message 8 "`%s', length of local part=`%s'." mid-or-mail lpartlen)
5993 ;; Certain special cases...
5996 "^0[0-9]+-[0-9][0-9][0-9][0-9]@t-online\\.de$\\|"
5997 "^[0-9]+\\.[0-9]+@compuserve\\|"
5998 "@public\\.gmane\\.org")
6000 (gnus-message 8 "`%s' is a known mail address." mid-or-mail)
6001 (setq result 'mail))
6002 (when (string-match "@.*@\\| " mid-or-mail)
6003 (gnus-message 8 "`%s' is invalid." mid-or-mail)
6004 (setq result 'invalid))
6005 ;; Nothing more to do, if result is not a number here...
6006 (when (numberp result)
6008 (setq elem (car list)
6012 (when (string-match regexp mid-or-mail)
6013 (setq result (+ result rate))
6015 9 "`%s' matched `%s', rate `%s', result `%s'."
6016 mid-or-mail regexp rate result)))
6017 (when (<= lpartlen 7)
6018 (setq result (+ result 5.0))
6019 (gnus-message 9 "`%s' matched (<= lpartlen 7), result `%s'."
6020 mid-or-mail result))
6021 (when (>= lpartlen 12)
6022 (gnus-message 9 "`%s' matched (>= lpartlen 12)" mid-or-mail)
6024 ((string-match "[0-9][^0-9]+[0-9].*@" mid-or-mail)
6025 ;; Long local part should contain realname if e-mail address,
6026 ;; too many digits: message-id.
6027 ;; $score -= 5.0 + 0.1 * $local_part_len;
6028 (setq rate (* -1.0 (+ 5.0 (* 0.1 lpartlen))))
6029 (setq result (+ result rate))
6031 9 "Many digits in `%s', rate `%s', result `%s'."
6032 mid-or-mail rate result))
6033 ((string-match "[^aeiouy][^aeiouy][^aeiouy][^aeiouy]+.*\@"
6035 ;; Too few vowels [^aeiouy]{4,}.*\@
6036 (setq result (+ result -5.0))
6038 9 "Few vowels in `%s', rate `%s', result `%s'."
6039 mid-or-mail -5.0 result))
6041 (setq result (+ result 5.0))
6043 9 "`%s', rate `%s', result `%s'." mid-or-mail 5.0 result)))))
6044 (gnus-message 8 "`%s': Final rate is `%s'." mid-or-mail result)
6045 ;; Maybe we should make this a customizable alist: (condition . 'result)
6047 ((symbolp result) result)
6048 ;; Now convert number into proper results:
6049 ((< result -10.0) 'mid)
6050 ((> result 10.0) 'mail)
6053 (defun gnus-button-handle-mid-or-mail (mid-or-mail)
6054 (let* ((pref gnus-button-prefer-mid-or-mail) guessed
6055 (url-mid (concat "news" ":" mid-or-mail))
6056 (url-mailto (concat "mailto" ":" mid-or-mail)))
6057 (gnus-message 9 "mid-or-mail=%s" mid-or-mail)
6058 (when (fboundp pref)
6060 ;; get rid of surrounding angles...
6062 (gnus-replace-in-string mid-or-mail "^<\\|>$" "")))
6063 (if (or (eq 'mid guessed) (eq 'mail guessed))
6067 (save-window-excursion
6068 (if (y-or-n-p (concat "Is <" mid-or-mail "> a mail address? "))
6071 (cond ((eq pref 'mid)
6072 (gnus-message 8 "calling `gnus-button-handle-news' %s" url-mid)
6073 (gnus-button-handle-news url-mid))
6075 (gnus-message 8 "calling `gnus-url-mailto' %s" url-mailto)
6076 (gnus-url-mailto url-mailto))
6077 (t (gnus-message 3 "Invalid string.")))))
6079 (defun gnus-button-handle-custom (url)
6080 "Follow a Custom URL."
6081 (customize-apropos (gnus-url-unhex-string url)))
6083 (defvar gnus-button-handle-describe-prefix "^\\(C-h\\|<?[Ff]1>?\\)")
6085 ;; FIXME: Maybe we should merge some of the functions that do quite similar
6088 (defun gnus-button-handle-describe-function (url)
6089 "Call `describe-function' when pushing the corresponding URL button."
6092 (gnus-replace-in-string url gnus-button-handle-describe-prefix ""))))
6094 (defun gnus-button-handle-describe-variable (url)
6095 "Call `describe-variable' when pushing the corresponding URL button."
6098 (gnus-replace-in-string url gnus-button-handle-describe-prefix ""))))
6100 (defun gnus-button-handle-symbol (url)
6101 "Display help on variable or function.
6102 Calls `describe-variable' or `describe-function'."
6103 (let ((sym (intern url)))
6105 ((fboundp sym) (describe-function sym))
6106 ((boundp sym) (describe-variable sym))
6107 (t (gnus-message 3 "`%s' is not a known function of variable." url)))))
6109 (defun gnus-button-handle-describe-key (url)
6110 "Call `describe-key' when pushing the corresponding URL button."
6112 (gnus-replace-in-string url gnus-button-handle-describe-prefix ""))
6113 (keys (ignore-errors (eval `(kbd ,key-string)))))
6116 (gnus-message 3 "Invalid key sequence in button: %s" key-string))))
6118 (defun gnus-button-handle-apropos (url)
6119 "Call `apropos' when pushing the corresponding URL button."
6120 (apropos (gnus-replace-in-string url gnus-button-handle-describe-prefix "")))
6122 (defun gnus-button-handle-apropos-command (url)
6123 "Call `apropos' when pushing the corresponding URL button."
6125 (gnus-replace-in-string url gnus-button-handle-describe-prefix "")))
6127 (defun gnus-button-handle-apropos-variable (url)
6128 "Call `apropos' when pushing the corresponding URL button."
6130 (if (fboundp 'apropos-variable) 'apropos-variable 'apropos)
6131 (gnus-replace-in-string url gnus-button-handle-describe-prefix "")))
6133 (defun gnus-button-handle-apropos-documentation (url)
6134 "Call `apropos' when pushing the corresponding URL button."
6136 (if (fboundp 'apropos-documentation) 'apropos-documentation 'apropos)
6137 (gnus-replace-in-string url gnus-button-handle-describe-prefix "")))
6139 (defun gnus-button-handle-library (url)
6140 "Call `locate-library' when pushing the corresponding URL button."
6141 (gnus-message 9 "url=`%s'" url)
6142 (let* ((lib (locate-library url))
6143 (file (gnus-replace-in-string (or lib "") "\.elc" ".el")))
6145 (gnus-message 1 "Cannot locale library `%s'." url)
6146 (find-file-read-only file))))
6148 (defun gnus-button-handle-ctan (url)
6149 "Call `browse-url' when pushing a CTAN URL button."
6151 gnus-button-ctan-handler
6154 (gnus-replace-in-string url gnus-button-handle-ctan-bogus-regexp ""))))
6156 (defcustom gnus-button-tex-level 5
6157 "*Integer that says how many TeX-related buttons Gnus will show.
6158 The higher the number, the more buttons will appear and the more false
6159 positives are possible. Note that you can set this variable local to
6160 specific groups. Setting it higher in TeX groups is probably a good idea.
6161 See Info node `(gnus)Group Parameters' and the variable `gnus-parameters' on
6162 how to set variables in specific groups."
6164 :group 'gnus-article-buttons
6165 :link '(custom-manual "(gnus)Group Parameters")
6168 (defcustom gnus-button-man-level 5
6169 "*Integer that says how many man-related buttons Gnus will show.
6170 The higher the number, the more buttons will appear and the more false
6171 positives are possible. Note that you can set this variable local to
6172 specific groups. Setting it higher in Unix groups is probably a good idea.
6173 See Info node `(gnus)Group Parameters' and the variable `gnus-parameters' on
6174 how to set variables in specific groups."
6176 :group 'gnus-article-buttons
6177 :link '(custom-manual "(gnus)Group Parameters")
6180 (defcustom gnus-button-emacs-level 5
6181 "*Integer that says how many emacs-related buttons Gnus will show.
6182 The higher the number, the more buttons will appear and the more false
6183 positives are possible. Note that you can set this variable local to
6184 specific groups. Setting it higher in Emacs or Gnus related groups is
6185 probably a good idea. See Info node `(gnus)Group Parameters' and the variable
6186 `gnus-parameters' on how to set variables in specific groups."
6188 :group 'gnus-article-buttons
6189 :link '(custom-manual "(gnus)Group Parameters")
6192 (defcustom gnus-button-message-level 5
6193 "*Integer that says how many buttons for news or mail messages will appear.
6194 The higher the number, the more buttons will appear and the more false
6195 positives are possible."
6196 ;; mail addresses, MIDs, URLs for news, ...
6198 :group 'gnus-article-buttons
6201 (defcustom gnus-button-browse-level 5
6202 "*Integer that says how many buttons for browsing will appear.
6203 The higher the number, the more buttons will appear and the more false
6204 positives are possible."
6205 ;; stuff handled by `browse-url' or `gnus-button-embedded-url'
6207 :group 'gnus-article-buttons
6210 (defcustom gnus-button-alist
6211 '(("<\\(url:[>\n\t ]*?\\)?\\(nntp\\|news\\):[>\n\t ]*\\([^>\n\t ]*@[^>\n\t ]*\\)>"
6212 0 (>= gnus-button-message-level 0) gnus-button-handle-news 3)
6213 ("\\b\\(nntp\\|news\\):\\([^>\n\t ]*@[^>)!;:,\n\t ]*\\)" 0 t
6214 gnus-button-handle-news 2)
6215 ("\\(\\b<\\(url:[>\n\t ]*\\)?\\(nntp\\|news\\):[>\n\t ]*\\(//\\)?\\([^>\n\t ]*\\)>\\)"
6216 1 (>= gnus-button-message-level 0) gnus-button-fetch-group 5)
6217 ("\\b\\(nntp\\|news\\):\\(//\\)?\\([^'\">\n\t ]+\\)"
6218 0 (>= gnus-button-message-level 0) gnus-button-fetch-group 3)
6219 ;; RFC 2392 (Don't allow `/' in domain part --> CID)
6220 ("\\bmid:\\(//\\)?\\([^'\">\n\t ]+@[^'\">\n\t /]+\\)"
6221 0 (>= gnus-button-message-level 0) gnus-button-message-id 2)
6222 ("\\bin\\( +article\\| +message\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)"
6223 2 (>= gnus-button-message-level 0) gnus-button-message-id 3)
6224 ("\\(<URL: *\\)mailto: *\\([^> \n\t]+\\)>"
6225 0 (>= gnus-button-message-level 0) gnus-url-mailto 2)
6226 ;; RFC 2368 (The mailto URL scheme)
6227 ("\\bmailto:\\([-a-z.@_+0-9%=?&/]+\\)"
6228 0 (>= gnus-button-message-level 0) gnus-url-mailto 1)
6229 ("\\bmailto:\\([^ \n\t]+\\)"
6230 0 (>= gnus-button-message-level 0) gnus-url-mailto 1)
6232 ((concat "\\bCTAN:[ \t\n]?[^>)!;:,'\n\t ]*\\("
6233 gnus-button-ctan-directory-regexp
6234 "[^][>)!;:,'\n\t ]+\\)")
6235 0 (>= gnus-button-tex-level 1) gnus-button-handle-ctan 1)
6236 ((concat "\\btex-archive/\\("
6237 gnus-button-ctan-directory-regexp
6238 "/[-_.a-z0-9/]+[-_./a-z0-9]+[/a-z0-9]\\)")
6239 1 (>= gnus-button-tex-level 6) gnus-button-handle-ctan 1)
6242 gnus-button-ctan-directory-regexp
6243 "/[-_.a-z0-9]+/[-_./a-z0-9]+[/a-z0-9]\\)")
6244 1 (>= gnus-button-tex-level 8) gnus-button-handle-ctan 1)
6245 ;; This is info (home-grown style) <info://foo/bar+baz>
6246 ("\\binfo://\\([^'\">\n\t ]+\\)"
6247 0 (>= gnus-button-emacs-level 1) gnus-button-handle-info-url 1)
6248 ;; Info GNOME style <info:foo#bar_baz>
6249 ("\\binfo:\\([^('\n\t\r \"><][^'\n\t\r \"><]*\\)"
6250 0 (>= gnus-button-emacs-level 1) gnus-button-handle-info-url-gnome 1)
6251 ;; Info KDE style <info:(foo)bar baz>
6252 ("<\\(info:\\(([^)]+)[^>\n\r]*\\)\\)>"
6253 1 (>= gnus-button-emacs-level 1) gnus-button-handle-info-url-kde 2)
6254 ("\\((Info-goto-node\\|(info\\)[ \t\n]*\\(\"[^\"]*\"\\))" 0
6255 (>= gnus-button-emacs-level 1) gnus-button-handle-info-url 2)
6256 ("\\b\\(C-h\\|<?[Ff]1>?\\)[ \t\n]+i[ \t\n]+d?[ \t\n]?m[ \t\n]+\\([^ ]+ ?[^ ]+\\)[ \t\n]+RET"
6257 ;; Info links like `C-h i d m CC Mode RET'
6258 0 (>= gnus-button-emacs-level 1) gnus-button-handle-info-keystrokes 2)
6260 ("\\bcustom:\\(//\\)?\\([^'\">\n\t ]+\\)"
6261 0 (>= gnus-button-emacs-level 5) gnus-button-handle-custom 2)
6262 ("M-x[ \t\n]customize-[^ ]+[ \t\n]RET[ \t\n]\\([^ ]+\\)[ \t\n]RET" 0
6263 (>= gnus-button-emacs-level 1) gnus-button-handle-custom 1)
6264 ;; Emacs help commands
6265 ("M-x[ \t\n]+apropos[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
6266 ;; regexp doesn't match arguments containing ` '.
6267 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos 1)
6268 ("M-x[ \t\n]+apropos-command[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
6269 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos-command 1)
6270 ("M-x[ \t\n]+apropos-variable[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
6271 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos-variable 1)
6272 ("M-x[ \t\n]+apropos-documentation[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
6273 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos-documentation 1)
6274 ;; The following entries may lead to many false positives so don't enable
6275 ;; them by default (use a high button level).
6276 ("/\\([a-z][-a-z0-9]+\\.el\\)\\>[^.?]"
6277 ;; Exclude [.?] for URLs in gmane.emacs.cvs
6278 1 (>= gnus-button-emacs-level 8) gnus-button-handle-library 1)
6279 ("`\\([a-z][-a-z0-9]+\\.el\\)'"
6280 1 (>= gnus-button-emacs-level 8) gnus-button-handle-library 1)
6281 ("`\\([a-z][a-z0-9]+-[a-z]+-[-a-z]+\\|\\(gnus\\|message\\)-[-a-z]+\\)'"
6282 0 (>= gnus-button-emacs-level 8) gnus-button-handle-symbol 1)
6283 ("`\\([a-z][a-z0-9]+-[a-z]+\\)'"
6284 0 (>= gnus-button-emacs-level 9) gnus-button-handle-symbol 1)
6285 ("(setq[ \t\n]+\\([a-z][a-z0-9]+-[-a-z0-9]+\\)[ \t\n]+.+)"
6286 1 (>= gnus-button-emacs-level 7) gnus-button-handle-describe-variable 1)
6287 ("\\bM-x[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
6288 1 (>= gnus-button-emacs-level 7) gnus-button-handle-describe-function 1)
6289 ("\\b\\(C-h\\|<?[Ff]1>?\\)[ \t\n]+f[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
6290 0 (>= gnus-button-emacs-level 1) gnus-button-handle-describe-function 2)
6291 ("\\b\\(C-h\\|<?[Ff]1>?\\)[ \t\n]+v[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
6292 0 (>= gnus-button-emacs-level 1) gnus-button-handle-describe-variable 2)
6293 ("`\\(\\b\\(C-h\\|<?[Ff]1>?\\)[ \t\n]+k[ \t\n]+\\([^']+\\)\\)'"
6294 ;; Unlike the other regexps we really have to require quoting
6295 ;; here to determine where it ends.
6296 1 (>= gnus-button-emacs-level 1) gnus-button-handle-describe-key 3)
6297 ;; This is how URLs _should_ be embedded in text (RFC 1738, RFC 2396)...
6298 ("<URL: *\\([^<>]*\\)>"
6299 1 (>= gnus-button-browse-level 0) gnus-button-embedded-url 1)
6300 ;; RFC 2396 (2.4.3., delims) ...
6301 ("\"URL: *\\([^\"]*\\)\""
6302 1 (>= gnus-button-browse-level 0) gnus-button-embedded-url 1)
6303 ;; RFC 2396 (2.4.3., delims) ...
6304 ("\"URL: *\\([^\"]*\\)\""
6305 1 (>= gnus-button-browse-level 0) gnus-button-embedded-url 1)
6307 (gnus-button-url-regexp
6308 0 (>= gnus-button-browse-level 0) browse-url 0)
6310 ("\\b\\([a-z][a-z]+([1-9])\\)\\W"
6311 0 (and (>= gnus-button-man-level 1) (< gnus-button-man-level 3))
6312 gnus-button-handle-man 1)
6313 ;; more man pages: resolv.conf(5), iso_8859-1(7), xterm(1x)
6314 ("\\b\\([a-z][-_.a-z0-9]+([1-9])\\)\\W"
6315 0 (and (>= gnus-button-man-level 3) (< gnus-button-man-level 5))
6316 gnus-button-handle-man 1)
6317 ;; even more: Apache::PerlRun(3pm), PDL::IO::FastRaw(3pm),
6318 ;; SoWWWAnchor(3iv), XSelectInput(3X11), X(1), X(7)
6319 ("\\b\\(\\(?:[a-z][-+_.:a-z0-9]+([1-9][X1a-z]*)\\)\\|\\b\\(?:X([1-9])\\)\\)\\W"
6320 0 (>= gnus-button-man-level 5) gnus-button-handle-man 1)
6321 ;; MID or mail: To avoid too many false positives we don't try to catch
6322 ;; all kind of allowed MIDs or mail addresses. Domain part must contain
6323 ;; at least one dot. TLD must contain two or three chars or be a know TLD
6324 ;; (info|name|...). Put this entry near the _end_ of `gnus-button-alist'
6325 ;; so that non-ambiguous entries (see above) match first.
6326 (gnus-button-mid-or-mail-regexp
6327 0 (>= gnus-button-message-level 5) gnus-button-handle-mid-or-mail 1))
6328 "*Alist of regexps matching buttons in article bodies.
6330 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
6331 REGEXP: is the string (case insensitive) matching text around the button (can
6332 also be Lisp expression evaluating to a string),
6333 BUTTON: is the number of the regexp grouping actually matching the button,
6334 FORM: is a Lisp expression which must eval to true for the button to
6336 CALLBACK: is the function to call when the user push this button, and each
6337 PAR: is a number of a regexp grouping whose text will be passed to CALLBACK.
6339 CALLBACK can also be a variable, in that case the value of that
6340 variable it the real callback function."
6341 :group 'gnus-article-buttons
6342 :type '(repeat (list (choice regexp variable sexp)
6343 (integer :tag "Button")
6345 (function :tag "Callback")
6348 (integer :tag "Regexp group")))))
6350 (defcustom gnus-header-button-alist
6351 '(("^\\(References\\|Message-I[Dd]\\|^In-Reply-To\\):" "<[^<>]+>"
6352 0 (>= gnus-button-message-level 0) gnus-button-message-id 0)
6353 ("^\\(From\\|Reply-To\\):" ": *\\(.+\\)$"
6354 1 (>= gnus-button-message-level 0) gnus-button-reply 1)
6355 ("^\\(Cc\\|To\\):" "[^ \t\n<>,()\"]+@[^ \t\n<>,()\"]+"
6356 0 (>= gnus-button-message-level 0) gnus-msg-mail 0)
6357 ("^X-[Uu][Rr][Ll]:" gnus-button-url-regexp
6358 0 (>= gnus-button-browse-level 0) browse-url 0)
6359 ("^Subject:" gnus-button-url-regexp
6360 0 (>= gnus-button-browse-level 0) browse-url 0)
6361 ("^[^:]+:" gnus-button-url-regexp
6362 0 (>= gnus-button-browse-level 0) browse-url 0)
6363 ("^OpenPGP:.*url=" gnus-button-url-regexp
6364 0 (>= gnus-button-browse-level 0) gnus-button-openpgp 0)
6365 ("^[^:]+:" "\\bmailto:\\([-a-z.@_+0-9%=?&/]+\\)"
6366 0 (>= gnus-button-message-level 0) gnus-url-mailto 1)
6367 ("^[^:]+:" "\\(<\\(url: \\)?\\(nntp\\|news\\):\\([^>\n ]*\\)>\\)"
6368 1 (>= gnus-button-message-level 0) gnus-button-message-id 4))
6369 "*Alist of headers and regexps to match buttons in article heads.
6371 This alist is very similar to `gnus-button-alist', except that each
6372 alist has an additional HEADER element first in each entry:
6374 \(HEADER REGEXP BUTTON FORM CALLBACK PAR)
6376 HEADER is a regexp to match a header. For a fuller explanation, see
6377 `gnus-button-alist'."
6378 :group 'gnus-article-buttons
6379 :group 'gnus-article-headers
6380 :type '(repeat (list (regexp :tag "Header")
6381 (choice regexp variable)
6382 (integer :tag "Button")
6384 (function :tag "Callback")
6387 (integer :tag "Regexp group")))))
6391 (defun gnus-article-push-button (event)
6392 "Check text under the mouse pointer for a callback function.
6393 If the text under the mouse pointer has a `gnus-callback' property,
6394 call it with the value of the `gnus-data' text property."
6396 (set-buffer (window-buffer (posn-window (event-start event))))
6397 (let* ((pos (posn-point (event-start event)))
6398 (data (get-text-property pos 'gnus-data))
6399 (fun (get-text-property pos 'gnus-callback)))
6402 (funcall fun data))))
6404 (defun gnus-article-press-button ()
6405 "Check text at point for a callback function.
6406 If the text at point has a `gnus-callback' property,
6407 call it with the value of the `gnus-data' text property."
6409 (let ((data (get-text-property (point) 'gnus-data))
6410 (fun (get-text-property (point) 'gnus-callback)))
6412 (funcall fun data))))
6414 (defun gnus-article-highlight (&optional force)
6415 "Highlight current article.
6416 This function calls `gnus-article-highlight-headers',
6417 `gnus-article-highlight-citation',
6418 `gnus-article-highlight-signature', and `gnus-article-add-buttons' to
6419 do the highlighting. See the documentation for those functions."
6420 (interactive (list 'force))
6421 (gnus-article-highlight-headers)
6422 (gnus-article-highlight-citation force)
6423 (gnus-article-highlight-signature)
6424 (gnus-article-add-buttons force)
6425 (gnus-article-add-buttons-to-head))
6427 (defun gnus-article-highlight-some (&optional force)
6428 "Highlight current article.
6429 This function calls `gnus-article-highlight-headers',
6430 `gnus-article-highlight-signature', and `gnus-article-add-buttons' to
6431 do the highlighting. See the documentation for those functions."
6432 (interactive (list 'force))
6433 (gnus-article-highlight-headers)
6434 (gnus-article-highlight-signature)
6435 (gnus-article-add-buttons))
6437 (defun gnus-article-highlight-headers ()
6438 "Highlight article headers as specified by `gnus-header-face-alist'."
6440 (gnus-with-article-headers
6441 (let (regexp header-face field-face from hpoints fpoints)
6442 (dolist (entry gnus-header-face-alist)
6443 (goto-char (point-min))
6444 (setq regexp (concat "^\\("
6445 (if (string-equal "" (nth 0 entry))
6449 header-face (nth 1 entry)
6450 field-face (nth 2 entry))
6451 (while (and (re-search-forward regexp nil t)
6455 (unless (search-forward ":" nil t)
6457 (when (and header-face
6458 (not (memq (point) hpoints)))
6459 (push (point) hpoints)
6460 (gnus-put-text-property from (point) 'face header-face))
6461 (when (and field-face
6462 (not (memq (setq from (point)) fpoints)))
6464 (if (re-search-forward "^[^ \t]" nil t)
6466 (goto-char (point-max)))
6467 (gnus-put-text-property from (point) 'face field-face)))))))
6469 (defun gnus-article-highlight-signature ()
6470 "Highlight the signature in an article.
6471 It does this by highlighting everything after
6472 `gnus-signature-separator' using `gnus-signature-face'."
6474 (gnus-with-article-buffer
6475 (let ((inhibit-point-motion-hooks t))
6477 (when (and gnus-signature-face
6478 (gnus-article-narrow-to-signature))
6479 (gnus-overlay-put (gnus-make-overlay (point-min) (point-max))
6480 'face gnus-signature-face)
6482 (gnus-article-search-signature)
6483 (let ((start (match-beginning 0))
6484 (end (set-marker (make-marker) (1+ (match-end 0)))))
6485 (gnus-article-add-button start (1- end) 'gnus-signature-toggle
6488 (defun gnus-button-in-region-p (b e prop)
6489 "Say whether PROP exists in the region."
6490 (text-property-not-all b e prop nil))
6492 (defun gnus-article-add-buttons (&optional force)
6493 "Find external references in the article and make buttons of them.
6494 \"External references\" are things like Message-IDs and URLs, as
6495 specified by `gnus-button-alist'."
6496 (interactive (list 'force))
6497 (gnus-with-article-buffer
6498 (let ((inhibit-point-motion-hooks t)
6499 (case-fold-search t)
6500 (alist gnus-button-alist)
6502 ;; Remove all old markers.
6503 (let (marker entry new-list)
6504 (while (setq marker (pop gnus-button-marker-list))
6505 (if (or (< marker (point-min)) (>= marker (point-max)))
6506 (push marker new-list)
6508 (when (setq entry (gnus-button-entry))
6509 (put-text-property (match-beginning (nth 1 entry))
6510 (match-end (nth 1 entry))
6511 'gnus-callback nil))
6512 (set-marker marker nil)))
6513 (setq gnus-button-marker-list new-list))
6514 ;; We skip the headers.
6517 (while (setq entry (pop alist))
6518 (setq regexp (eval (car entry)))
6520 (while (re-search-forward regexp nil t)
6521 (let* ((start (and entry (match-beginning (nth 1 entry))))
6522 (end (and entry (match-end (nth 1 entry))))
6523 (from (match-beginning 0)))
6524 (when (and (or (eq t (nth 2 entry))
6525 (eval (nth 2 entry)))
6526 (not (gnus-button-in-region-p
6527 start end 'gnus-callback)))
6528 ;; That optional form returned non-nil, so we add the
6530 (gnus-article-add-button
6531 start end 'gnus-button-push
6532 (car (push (set-marker (make-marker) from)
6533 gnus-button-marker-list))))))))))
6535 ;; Add buttons to the head of an article.
6536 (defun gnus-article-add-buttons-to-head ()
6537 "Add buttons to the head of the article."
6539 (gnus-with-article-headers
6541 (dolist (entry gnus-header-button-alist)
6542 ;; Each alist entry.
6543 (goto-char (point-min))
6544 (while (re-search-forward (car entry) nil t)
6545 ;; Each header matching the entry.
6546 (setq beg (match-beginning 0))
6547 (setq end (or (and (re-search-forward "^[^ \t]" nil t)
6548 (match-beginning 0))
6551 (while (re-search-forward (eval (nth 1 entry)) end t)
6552 ;; Each match within a header.
6553 (let* ((entry (cdr entry))
6554 (start (match-beginning (nth 1 entry)))
6555 (end (match-end (nth 1 entry)))
6556 (form (nth 2 entry)))
6557 (goto-char (match-end 0))
6559 (gnus-article-add-button
6560 start end (nth 3 entry)
6561 (buffer-substring (match-beginning (nth 4 entry))
6562 (match-end (nth 4 entry)))))))
6563 (goto-char end))))))
6565 ;;; External functions:
6567 (defun gnus-article-add-button (from to fun &optional data)
6568 "Create a button between FROM and TO with callback FUN and data DATA."
6569 (when gnus-article-button-face
6570 (gnus-overlay-put (gnus-make-overlay from to)
6571 'face gnus-article-button-face))
6572 (gnus-add-text-properties
6574 (nconc (and gnus-article-mouse-face
6575 (list gnus-mouse-face-prop gnus-article-mouse-face))
6576 (list 'gnus-callback fun)
6577 (and data (list 'gnus-data data))))
6578 (widget-convert-button 'link from to :action 'gnus-widget-press-button
6579 :button-keymap gnus-widget-button-keymap))
6581 ;;; Internal functions:
6583 (defun gnus-article-set-globals ()
6584 (with-current-buffer gnus-summary-buffer
6585 (gnus-set-global-variables)))
6587 (defun gnus-signature-toggle (end)
6588 (gnus-with-article-buffer
6589 (let ((inhibit-point-motion-hooks t))
6590 (if (text-property-any end (point-max) 'article-type 'signature)
6592 (gnus-delete-wash-type 'signature)
6593 (gnus-remove-text-properties-when
6594 'article-type 'signature end (point-max)
6595 (cons 'article-type (cons 'signature
6596 gnus-hidden-properties))))
6597 (gnus-add-wash-type 'signature)
6598 (gnus-add-text-properties-when
6599 'article-type nil end (point-max)
6600 (cons 'article-type (cons 'signature
6601 gnus-hidden-properties)))))
6602 (let ((gnus-article-mime-handle-alist-1 gnus-article-mime-handle-alist))
6603 (gnus-set-mode-line 'article))))
6605 (defun gnus-button-entry ()
6606 ;; Return the first entry in `gnus-button-alist' matching this place.
6607 (let ((alist gnus-button-alist)
6610 (setq entry (pop alist))
6611 (if (looking-at (eval (car entry)))
6616 (defun gnus-button-push (marker)
6617 ;; Push button starting at MARKER.
6620 (let* ((entry (gnus-button-entry))
6621 (inhibit-point-motion-hooks t)
6623 (args (mapcar (lambda (group)
6624 (let ((string (match-string group)))
6625 (set-text-properties
6626 0 (length string) nil string)
6633 (fboundp (symbol-value fun)))
6634 (apply (symbol-value fun) args))
6636 (gnus-message 1 "You must define `%S' to use this button"
6637 (cons fun args)))))))
6639 (defun gnus-parse-news-url (url)
6640 (let (scheme server port group message-id articles)
6643 (goto-char (point-min))
6644 (when (looking-at "\\([A-Za-z]+\\):")
6645 (setq scheme (match-string 1))
6646 (goto-char (match-end 0)))
6647 (when (looking-at "//\\([^:/]+\\)\\(:?\\)\\([0-9]+\\)?/")
6648 (setq server (match-string 1))
6649 (setq port (if (stringp (match-string 3))
6650 (string-to-number (match-string 3))
6652 (goto-char (match-end 0)))
6655 ((looking-at "\\(.*@.*\\)")
6656 (setq message-id (match-string 1)))
6657 ((looking-at "\\([^/]+\\)/\\([-0-9]+\\)")
6658 (setq group (match-string 1)
6659 articles (split-string (match-string 2) "-")))
6660 ((looking-at "\\([^/]+\\)/?")
6661 (setq group (match-string 1)))
6663 (error "Unknown news URL syntax"))))
6664 (list scheme server port group message-id articles)))
6666 (defun gnus-button-handle-news (url)
6668 (destructuring-bind (scheme server port group message-id articles)
6669 (gnus-parse-news-url url)
6673 (set-buffer gnus-summary-buffer)
6675 (let ((gnus-refer-article-method
6676 (nconc (list (list 'nntp server))
6677 gnus-refer-article-method))
6678 (nntp-port-number (or port "nntp")))
6679 (gnus-message 7 "Fetching %s with %s"
6680 message-id gnus-refer-article-method)
6681 (gnus-summary-refer-article message-id))
6682 (gnus-summary-refer-article message-id))))
6684 (gnus-button-fetch-group url)))))
6686 (defun gnus-button-handle-man (url)
6688 (gnus-message 9 "`%s' `%s'" gnus-button-man-handler url)
6689 (when (eq gnus-button-man-handler 'woman)
6690 (setq url (gnus-replace-in-string url "([1-9][X1a-z]*).*\\'" "")))
6691 (gnus-message 9 "`%s' `%s'" gnus-button-man-handler url)
6692 (funcall gnus-button-man-handler url))
6694 (defun gnus-button-handle-info-url (url)
6695 "Fetch an info URL."
6696 (setq url (mm-subst-char-in-string ?+ ?\ url))
6698 ((string-match "^\\([^:/]+\\)?/\\(.*\\)" url)
6699 (gnus-info-find-node
6700 (concat "(" (or (gnus-url-unhex-string (match-string 1 url))
6702 ")" (gnus-url-unhex-string (match-string 2 url)))))
6703 ((string-match "([^)\"]+)[^\"]+" url)
6705 (gnus-replace-in-string
6706 (gnus-replace-in-string url "[\n\t ]+" " ") "\"" ""))
6707 (gnus-info-find-node url))
6708 (t (error "Can't parse %s" url))))
6710 (defun gnus-button-handle-info-url-gnome (url)
6711 "Fetch GNOME style info URL."
6712 (setq url (mm-subst-char-in-string ?_ ?\ url))
6713 (if (string-match "\\([^#]+\\)#?\\(.*\\)" url)
6714 (gnus-info-find-node
6716 (gnus-url-unhex-string
6717 (match-string 1 url))
6719 (or (gnus-url-unhex-string
6720 (match-string 2 url))
6722 (error "Can't parse %s" url)))
6724 (defun gnus-button-handle-info-url-kde (url)
6725 "Fetch KDE style info URL."
6726 (gnus-info-find-node (gnus-url-unhex-string url)))
6728 (defun gnus-button-handle-info-keystrokes (url)
6729 "Call `info' when pushing the corresponding URL button."
6730 ;; For links like `C-h i d m gnus RET', `C-h i d m CC Mode RET'.
6735 (defun gnus-button-openpgp (url)
6736 "Retrieve and add an OpenPGP key given URL from an OpenPGP header."
6738 (mm-url-insert-file-contents-external url)
6739 (pgg-snarf-keys-region (point-min) (point-max))
6740 (pgg-display-output-buffer nil nil nil)))
6742 (defun gnus-button-message-id (message-id)
6744 (with-current-buffer gnus-summary-buffer
6745 (gnus-summary-refer-article message-id)))
6747 (defun gnus-button-fetch-group (address)
6748 "Fetch GROUP specified by ADDRESS."
6749 (if (not (string-match "[:/]" address))
6750 ;; This is just a simple group url.
6751 (gnus-group-read-ephemeral-group address gnus-select-method)
6754 "^\\([^:/]+\\)\\(:\\([^/]+\\)\\)?/\\([^/]+\\)\\(/\\([0-9]+\\)\\)?"
6756 (error "Can't parse %s" address)
6757 (gnus-group-read-ephemeral-group
6758 (match-string 4 address)
6759 `(nntp ,(match-string 1 address)
6760 (nntp-address ,(match-string 1 address))
6761 (nntp-port-number ,(if (match-end 3)
6762 (match-string 3 address)
6765 (and (match-end 6) (list (string-to-int (match-string 6 address))))))))
6767 (defun gnus-url-parse-query-string (query &optional downcase)
6768 (let (retval pairs cur key val)
6769 (setq pairs (split-string query "&"))
6771 (setq cur (car pairs)
6773 (if (not (string-match "=" cur))
6775 (setq key (gnus-url-unhex-string (substring cur 0 (match-beginning 0)))
6776 val (gnus-url-unhex-string (substring cur (match-end 0) nil) t))
6778 (setq key (downcase key)))
6779 (setq cur (assoc key retval))
6781 (setcdr cur (cons val (cdr cur)))
6782 (setq retval (cons (list key val) retval)))))
6785 (defun gnus-url-mailto (url)
6786 ;; Send mail to someone
6787 (when (string-match "mailto:/*\\(.*\\)" url)
6788 (setq url (substring url (match-beginning 1) nil)))
6789 (let (to args subject func)
6790 (setq args (gnus-url-parse-query-string
6791 (if (string-match "^\\?" url)
6793 (if (string-match "^\\([^?]+\\)\\?\\(.*\\)" url)
6794 (concat "to=" (match-string 1 url) "&"
6795 (match-string 2 url))
6796 (concat "to=" url)))
6798 subject (cdr-safe (assoc "subject" args)))
6801 (setq func (intern-soft (concat "message-goto-" (downcase (caar args)))))
6804 (message-position-on-field (caar args)))
6805 (insert (gnus-replace-in-string
6806 (mapconcat 'identity (reverse (cdar args)) ", ")
6808 (setq args (cdr args)))
6811 (message-goto-subject))))
6813 (defun gnus-button-embedded-url (address)
6814 "Activate ADDRESS with `browse-url'."
6815 (browse-url (gnus-strip-whitespace address)))
6817 ;;; Next/prev buttons in the article buffer.
6819 (defvar gnus-next-page-line-format "%{%(Next page...%)%}\n")
6820 (defvar gnus-prev-page-line-format "%{%(Previous page...%)%}\n")
6822 (defvar gnus-prev-page-map
6823 (let ((map (make-sparse-keymap)))
6824 (define-key map gnus-mouse-2 'gnus-button-prev-page)
6825 (define-key map "\r" 'gnus-button-prev-page)
6828 (defvar gnus-next-page-map
6829 (let ((map (make-sparse-keymap)))
6830 (unless (>= emacs-major-version 21)
6831 ;; XEmacs doesn't care.
6832 (set-keymap-parent map gnus-article-mode-map))
6833 (define-key map gnus-mouse-2 'gnus-button-next-page)
6834 (define-key map "\r" 'gnus-button-next-page)
6837 (defun gnus-insert-prev-page-button ()
6839 (inhibit-read-only t))
6841 gnus-prev-page-line-format nil
6842 `(keymap ,gnus-prev-page-map
6844 gnus-callback gnus-article-button-prev-page
6845 article-type annotation))
6846 (widget-convert-button
6848 ;; Exclude a newline.
6851 :action 'gnus-button-prev-page
6852 :button-keymap gnus-prev-page-map)))
6854 (defun gnus-button-next-page (&optional args more-args)
6855 "Go to the next page."
6857 (let ((win (selected-window)))
6858 (select-window (gnus-get-buffer-window gnus-article-buffer t))
6859 (gnus-article-next-page)
6860 (select-window win)))
6862 (defun gnus-button-prev-page (&optional args more-args)
6863 "Go to the prev page."
6865 (let ((win (selected-window)))
6866 (select-window (gnus-get-buffer-window gnus-article-buffer t))
6867 (gnus-article-prev-page)
6868 (select-window win)))
6870 (defun gnus-insert-next-page-button ()
6872 (inhibit-read-only t))
6873 (gnus-eval-format gnus-next-page-line-format nil
6874 `(keymap ,gnus-next-page-map
6876 gnus-callback gnus-article-button-next-page
6877 article-type annotation))
6878 (widget-convert-button
6880 ;; Exclude a newline.
6883 :action 'gnus-button-next-page
6884 :button-keymap gnus-next-page-map)))
6886 (defun gnus-article-button-next-page (arg)
6887 "Go to the next page."
6889 (let ((win (selected-window)))
6890 (select-window (gnus-get-buffer-window gnus-article-buffer t))
6891 (gnus-article-next-page)
6892 (select-window win)))
6894 (defun gnus-article-button-prev-page (arg)
6895 "Go to the prev page."
6897 (let ((win (selected-window)))
6898 (select-window (gnus-get-buffer-window gnus-article-buffer t))
6899 (gnus-article-prev-page)
6900 (select-window win)))
6902 (defvar gnus-decode-header-methods
6903 '(mail-decode-encoded-word-region)
6904 "List of methods used to decode headers.
6906 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
6907 is FUNCTION, FUNCTION will be applied to all newsgroups. If item is a
6908 \(REGEXP . FUNCTION), FUNCTION will be only apply to the newsgroups
6909 whose names match REGEXP.
6912 \((\"chinese\" . gnus-decode-encoded-word-region-by-guess)
6913 mail-decode-encoded-word-region
6914 (\"chinese\" . rfc1843-decode-region))
6917 (defvar gnus-decode-header-methods-cache nil)
6919 (defun gnus-multi-decode-header (start end)
6920 "Apply the functions from `gnus-encoded-word-methods' that match."
6921 (unless (and gnus-decode-header-methods-cache
6922 (eq gnus-newsgroup-name
6923 (car gnus-decode-header-methods-cache)))
6924 (setq gnus-decode-header-methods-cache (list gnus-newsgroup-name))
6927 (nconc gnus-decode-header-methods-cache (list x))
6928 (if (and gnus-newsgroup-name
6929 (string-match (car x) gnus-newsgroup-name))
6930 (nconc gnus-decode-header-methods-cache
6932 gnus-decode-header-methods))
6933 (let ((xlist gnus-decode-header-methods-cache))
6936 (narrow-to-region start end)
6938 (funcall (pop xlist) (point-min) (point-max))))))
6941 ;;; Treatment top-level handling.
6944 (defun gnus-treat-article (condition &optional part-number total-parts type)
6945 (let ((length (- (point-max) (point-min)))
6946 (alist gnus-treatment-function-alist)
6947 (article-goto-body-goes-to-point-min-p t)
6951 (let ((list gnus-article-treat-types))
6953 (when (string-match (pop list) type)
6954 (throw 'found t)))))))
6955 (highlightp (gnus-visual-p 'article-highlight 'highlight))
6957 (gnus-run-hooks 'gnus-part-display-hook)
6958 (dolist (elem alist)
6961 (when (gnus-buffer-live-p gnus-summary-buffer)
6962 (set-buffer gnus-summary-buffer))
6963 (symbol-value (car elem))))
6964 (when (and (or (consp val)
6966 (gnus-treat-predicate val)
6967 (or (not (get (car elem) 'highlight))
6970 (funcall (cadr elem)))))))
6972 ;; Dynamic variables.
6974 (defvar part-number)
6975 (defvar total-parts)
6980 (defun gnus-treat-predicate (val)
6987 (stringp (car val)))
6988 (apply 'gnus-or (mapcar `(lambda (s)
6989 (string-match s ,(or gnus-newsgroup-name "")))
6992 (let ((pred (pop val)))
6995 (apply 'gnus-or (mapcar 'gnus-treat-predicate val)))
6997 (apply 'gnus-and (mapcar 'gnus-treat-predicate val)))
6999 (not (gnus-treat-predicate (car val))))
7001 (equal (car val) type))
7003 (error "%S is not a valid predicate" pred)))))
7009 (eq part-number total-parts))
7013 (error "%S is not a valid value" val))))
7015 (defun gnus-article-encrypt-body (protocol &optional n)
7016 "Encrypt the article body."
7019 (or gnus-article-encrypt-protocol
7020 (completing-read "Encrypt protocol: "
7021 gnus-article-encrypt-protocol-alist
7023 current-prefix-arg))
7024 (let ((func (cdr (assoc protocol gnus-article-encrypt-protocol-alist))))
7026 (error (format "Can't find the encrypt protocol %s" protocol)))
7027 (if (member gnus-newsgroup-name '("nndraft:delayed"
7030 (error "Can't encrypt the article in group %s"
7031 gnus-newsgroup-name))
7032 (gnus-summary-iterate n
7034 (set-buffer gnus-summary-buffer)
7035 (let ((mail-parse-charset gnus-newsgroup-charset)
7036 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
7037 (summary-buffer gnus-summary-buffer)
7039 (gnus-set-global-variables)
7040 (when (gnus-group-read-only-p)
7041 (error "The current newsgroup does not support article encrypt"))
7042 (gnus-summary-show-article t)
7044 (or (mail-header-references gnus-current-headers) ""))
7045 (set-buffer gnus-article-buffer)
7046 (let* ((inhibit-read-only t)
7048 (mapcar (lambda (field)
7049 (and (save-restriction
7050 (message-narrow-to-head)
7051 (goto-char (point-min))
7052 (search-forward field nil t))
7054 (message-narrow-to-field)
7056 (delete-region (point-min) (point-max))
7058 '("Content-Type:" "Content-Transfer-Encoding:"
7059 "Content-Disposition:"))))
7060 (message-narrow-to-head)
7061 (message-remove-header "MIME-Version")
7062 (goto-char (point-max))
7063 (setq point (point))
7064 (insert (apply 'concat headers))
7066 (narrow-to-region point (point-max))
7067 (let ((message-options message-options))
7068 (message-options-set 'message-sender user-mail-address)
7069 (message-options-set 'message-recipients user-mail-address)
7070 (message-options-set 'message-sign-encrypt 'not)
7072 (goto-char (point-min))
7073 (insert "MIME-Version: 1.0\n")
7075 (gnus-summary-edit-article-done
7076 references nil summary-buffer t))
7077 (when gnus-keep-backlog
7078 (gnus-backlog-remove-article
7079 (car gnus-article-current) (cdr gnus-article-current)))
7081 (when (get-buffer gnus-original-article-buffer)
7082 (set-buffer gnus-original-article-buffer)
7083 (setq gnus-original-article nil)))
7084 (when gnus-use-cache
7085 (gnus-cache-update-article
7086 (car gnus-article-current) (cdr gnus-article-current))))))))
7088 (defvar gnus-mime-security-button-line-format "%{%([[%t:%i]%D]%)%}\n"
7089 "The following specs can be used:
7090 %t The security MIME type
7093 %D Details if button is pressed")
7095 (defvar gnus-mime-security-button-end-line-format "%{%([[End of %t]%D]%)%}\n"
7096 "The following specs can be used:
7097 %t The security MIME type
7100 %D Details if button is pressed")
7102 (defvar gnus-mime-security-button-line-format-alist
7103 '((?t gnus-tmp-type ?s)
7104 (?i gnus-tmp-info ?s)
7105 (?d gnus-tmp-details ?s)
7106 (?D gnus-tmp-pressed-details ?s)))
7108 (defvar gnus-mime-security-button-map
7109 (let ((map (make-sparse-keymap)))
7110 (define-key map gnus-mouse-2 'gnus-article-push-button)
7111 (define-key map "\r" 'gnus-article-press-button)
7114 (defvar gnus-mime-security-details-buffer nil)
7116 (defvar gnus-mime-security-button-pressed nil)
7118 (defvar gnus-mime-security-show-details-inline t
7119 "If non-nil, show details in the article buffer.")
7121 (defun gnus-mime-security-verify-or-decrypt (handle)
7122 (mm-remove-parts (cdr handle))
7123 (let ((region (mm-handle-multipart-ctl-parameter handle 'gnus-region))
7124 point (inhibit-read-only t))
7126 (goto-char (car region)))
7128 (narrow-to-region (point) (point))
7129 (with-current-buffer (mm-handle-multipart-original-buffer handle)
7130 (let* ((mm-verify-option 'known)
7131 (mm-decrypt-option 'known)
7132 (nparts (mm-possibly-verify-or-decrypt (cdr handle) handle)))
7133 (unless (eq nparts (cdr handle))
7134 (mm-destroy-parts (cdr handle))
7135 (setcdr handle nparts))))
7136 (setq point (point))
7137 (gnus-mime-display-security handle)
7138 (goto-char (point-max)))
7140 (delete-region (point) (cdr region))
7141 (set-marker (car region) nil)
7142 (set-marker (cdr region) nil))
7145 (defun gnus-mime-security-show-details (handle)
7146 (let ((details (mm-handle-multipart-ctl-parameter handle 'gnus-details)))
7148 (gnus-message 5 "No details.")
7149 (if gnus-mime-security-show-details-inline
7150 (let ((gnus-mime-security-button-pressed
7151 (not (get-text-property (point) 'gnus-mime-details)))
7152 (gnus-mime-security-button-line-format
7153 (get-text-property (point) 'gnus-line-format))
7154 (inhibit-read-only t))
7156 (while (eq (get-text-property (point) 'gnus-line-format)
7157 gnus-mime-security-button-line-format)
7161 (narrow-to-region (point) (point))
7162 (gnus-insert-mime-security-button handle))
7163 (delete-region (point)
7164 (or (text-property-not-all
7167 gnus-mime-security-button-line-format)
7170 (if (gnus-buffer-live-p gnus-mime-security-details-buffer)
7171 (with-current-buffer gnus-mime-security-details-buffer
7174 (setq gnus-mime-security-details-buffer
7175 (gnus-get-buffer-create "*MIME Security Details*")))
7176 (with-current-buffer gnus-mime-security-details-buffer
7178 (goto-char (point-min)))
7179 (pop-to-buffer gnus-mime-security-details-buffer)))))
7181 (defun gnus-mime-security-press-button (handle)
7183 (if (mm-handle-multipart-ctl-parameter handle 'gnus-info)
7184 (gnus-mime-security-show-details handle)
7185 (gnus-mime-security-verify-or-decrypt handle))))
7187 (defun gnus-insert-mime-security-button (handle &optional displayed)
7188 (let* ((protocol (mm-handle-multipart-ctl-parameter handle 'protocol))
7191 (or (nth 2 (assoc protocol mm-verify-function-alist))
7192 (nth 2 (assoc protocol mm-decrypt-function-alist))
7194 (if (equal (car handle) "multipart/signed")
7195 " Signed" " Encrypted")
7198 (or (mm-handle-multipart-ctl-parameter handle 'gnus-info)
7201 (mm-handle-multipart-ctl-parameter handle 'gnus-details))
7202 gnus-tmp-pressed-details
7204 (setq gnus-tmp-details
7205 (if gnus-tmp-details
7206 (concat "\n" gnus-tmp-details)
7208 (setq gnus-tmp-pressed-details
7209 (if gnus-mime-security-button-pressed gnus-tmp-details ""))
7214 gnus-mime-security-button-line-format
7215 gnus-mime-security-button-line-format-alist
7216 `(keymap ,gnus-mime-security-button-map
7217 gnus-callback gnus-mime-security-press-button
7218 gnus-line-format ,gnus-mime-security-button-line-format
7219 gnus-mime-details ,gnus-mime-security-button-pressed
7220 article-type annotation
7223 ;; Exclude a newline.
7226 (widget-convert-button
7229 :action 'gnus-widget-press-button
7230 :button-keymap gnus-mime-security-button-map
7232 (lambda (widget/window &optional overlay pos)
7233 ;; Needed to properly clear the message due to a bug in
7234 ;; wid-edit (XEmacs only).
7235 (when (boundp 'help-echo-owns-message)
7236 (setq help-echo-owns-message t))
7239 (aref gnus-mouse-2 0))))))
7241 (defun gnus-mime-display-security (handle)
7243 (narrow-to-region (point) (point))
7244 (unless (gnus-unbuttonized-mime-type-p (car handle))
7245 (gnus-insert-mime-security-button handle))
7246 (gnus-mime-display-mixed (cdr handle))
7249 (unless (gnus-unbuttonized-mime-type-p (car handle))
7250 (let ((gnus-mime-security-button-line-format
7251 gnus-mime-security-button-end-line-format))
7252 (gnus-insert-mime-security-button handle)))
7253 (mm-set-handle-multipart-parameter
7255 (cons (set-marker (make-marker) (point-min))
7256 (set-marker (make-marker) (point-max))))))
7262 (run-hooks 'gnus-art-load-hook)
7264 ;;; arch-tag: 2654516f-6279-48f9-a83b-05c1fa450c33
7265 ;;; gnus-art.el ends here