1 ;;; gnus-art.el --- article mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
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.
29 (eval-when-compile (require 'cl))
43 (autoload 'gnus-msg-mail "gnus-msg" nil t)
44 (autoload 'gnus-button-mailto "gnus-msg")
45 (autoload 'gnus-button-reply "gnus-msg" nil t)
47 (defgroup gnus-article nil
49 :link '(custom-manual "(gnus)The Article Buffer")
52 (defgroup gnus-article-treat nil
53 "Treating article parts."
54 :link '(custom-manual "(gnus)Article Hiding")
57 (defgroup gnus-article-hiding nil
58 "Hiding article parts."
59 :link '(custom-manual "(gnus)Article Hiding")
62 (defgroup gnus-article-highlight nil
63 "Article highlighting."
64 :link '(custom-manual "(gnus)Article Highlighting")
68 (defgroup gnus-article-signature nil
70 :link '(custom-manual "(gnus)Article Signature")
73 (defgroup gnus-article-headers nil
75 :link '(custom-manual "(gnus)Hiding Headers")
78 (defgroup gnus-article-washing nil
79 "Special commands on articles."
80 :link '(custom-manual "(gnus)Article Washing")
83 (defgroup gnus-article-emphasis nil
84 "Fontisizing articles."
85 :link '(custom-manual "(gnus)Article Fontisizing")
88 (defgroup gnus-article-saving nil
90 :link '(custom-manual "(gnus)Saving Articles")
93 (defgroup gnus-article-mime nil
94 "Worshiping the MIME wonder."
95 :link '(custom-manual "(gnus)Using MIME")
98 (defgroup gnus-article-buttons nil
99 "Pushable buttons in the article buffer."
100 :link '(custom-manual "(gnus)Article Buttons")
101 :group 'gnus-article)
103 (defgroup gnus-article-various nil
104 "Other article options."
105 :link '(custom-manual "(gnus)Misc Article")
106 :group 'gnus-article)
108 (defcustom gnus-ignored-headers
109 '("^Path:" "^Expires:" "^Date-Received:" "^References:" "^Xref:" "^Lines:"
110 "^Relay-Version:" "^Message-ID:" "^Approved:" "^Sender:" "^Received:"
111 "^X-UIDL:" "^MIME-Version:" "^Return-Path:" "^In-Reply-To:"
112 "^Content-Type:" "^Content-Transfer-Encoding:" "^X-WebTV-Signature:"
113 "^X-MimeOLE:" "^X-MSMail-Priority:" "^X-Priority:" "^X-Loop:"
114 "^X-Authentication-Warning:" "^X-MIME-Autoconverted:" "^X-Face"
115 "^X-Attribution:" "^X-Originating-IP:" "^Delivered-To:"
116 "^NNTP-[-A-Za-z]+:" "^Distribution:" "^X-no-archive:" "^X-Trace:"
117 "^X-Complaints-To:" "^X-NNTP-Posting-Host:" "^X-Orig.*:"
118 "^Abuse-Reports-To:" "^Cache-Post-Path:" "^X-Article-Creation-Date:"
119 "^X-Poster:" "^X-Mail2News-Path:" "^X-Server-Date:" "^X-Cache:"
120 "^Originator:" "^X-Problems-To:" "^X-Auth-User:" "^X-Post-Time:"
121 "^X-Admin:" "^X-UID:" "^Resent-[-A-Za-z]+:" "^X-Mailing-List:"
122 "^Precedence:" "^Original-[-A-Za-z]+:" "^X-filename:" "^X-Orcpt:"
123 "^Old-Received:" "^X-Pgp" "^X-Auth:" "^X-From-Line:"
124 "^X-Gnus-Article-Number:" "^X-Majordomo:" "^X-Url:" "^X-Sender:"
125 "^MBOX-Line" "^Priority:" "^X400-[-A-Za-z]+:"
126 "^Status:" "^X-Gnus-Mail-Source:" "^Cancel-Lock:"
127 "^X-FTN" "^X-EXP32-SerialNo:" "^Encoding:" "^Importance:"
128 "^Autoforwarded:" "^Original-Encoded-Information-Types:" "^X-Ya-Pop3:"
129 "^X-Face-Version:" "^X-Vms-To:" "^X-ML-NAME:" "^X-ML-COUNT:"
130 "^Mailing-List:" "^X-finfo:" "^X-md5sum:" "^X-md5sum-Origin:"
131 "^X-Sun-Charset:" "^X-Accept-Language:" "^X-Envelope-Sender:"
132 "^List-[A-Za-z]+:" "^X-Listprocessor-Version:"
133 "^X-Received:" "^X-Distribute:" "^X-Sequence:" "^X-Juno-Line-Breaks:"
134 "^X-Notes-Item:" "^X-MS-TNEF-Correlator:" "^x-uunet-gateway:"
135 "^X-Received:" "^Content-length:" "X-precedence:"
136 "^X-Authenticated-User:" "^X-Comment" "^X-Report:" "^X-Abuse-Info:"
137 "^X-HTTP-Proxy:" "^X-Mydeja-Info:" "^X-Copyright" "^X-No-Markup:"
138 "^X-Abuse-Info:" "^X-From_:" "^X-Accept-Language:" "^Errors-To:"
139 "^X-BeenThere:" "^X-Mailman-Version:" "^List-Help:" "^List-Post:"
140 "^List-Subscribe:" "^List-Id:" "^List-Unsubscribe:" "^List-Archive:"
141 "^X-Content-length:" "^X-Posting-Agent:" "^Original-Received:"
142 "^X-Request-PGP:" "^X-Fingerprint:" "^X-WRIEnvto:" "^X-WRIEnvfrom:"
143 "^X-Virus-Scanned:" "^X-Delivery-Agent:" "^Posted-Date:" "^X-Gateway:"
144 "^X-Local-Origin:" "^X-Local-Destination:" "^X-UserInfo1:"
146 "*All headers that start with this regexp will be hidden.
147 This variable can also be a list of regexps of headers to be ignored.
148 If `gnus-visible-headers' is non-nil, this variable will be ignored."
149 :type '(choice :custom-show nil
152 :group 'gnus-article-hiding)
154 (defcustom gnus-visible-headers
155 "^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:"
156 "*All headers that do not match this regexp will be hidden.
157 This variable can also be a list of regexp of headers to remain visible.
158 If this variable is non-nil, `gnus-ignored-headers' will be ignored."
159 :type '(repeat :value-to-internal (lambda (widget value)
160 (custom-split-regexp-maybe value))
161 :match (lambda (widget value)
163 (widget-editable-list-match widget value)))
165 :group 'gnus-article-hiding)
167 (defcustom gnus-sorted-header-list
168 '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:"
169 "^Followup-To:" "^To:" "^Cc:" "^Date:" "^Organization:")
170 "*This variable is a list of regular expressions.
171 If it is non-nil, headers that match the regular expressions will
172 be placed first in the article buffer in the sequence specified by
174 :type '(repeat regexp)
175 :group 'gnus-article-hiding)
177 (defcustom gnus-boring-article-headers '(empty followup-to reply-to)
178 "Headers that are only to be displayed if they have interesting data.
179 Possible values in this list are:
181 'empty Headers with no content.
182 'newsgroups Newsgroup identical to Gnus group.
183 'to-address To identical to To-address.
184 'followup-to Followup-to identical to Newsgroups.
185 'reply-to Reply-to identical to From.
186 'date Date less than four days old.
187 'long-to To and/or Cc longer than 1024 characters.
188 'many-to Multiple To and/or Cc."
189 :type '(set (const :tag "Headers with no content." empty)
190 (const :tag "Newsgroups identical to Gnus group." newsgroups)
191 (const :tag "To identical to To-address." to-address)
192 (const :tag "Followup-to identical to Newsgroups." followup-to)
193 (const :tag "Reply-to identical to From." reply-to)
194 (const :tag "Date less than four days old." date)
195 (const :tag "To and/or Cc longer than 1024 characters." long-to)
196 (const :tag "Multiple To and/or Cc headers." many-to))
197 :group 'gnus-article-hiding)
199 (defcustom gnus-signature-separator '("^-- $" "^-- *$")
200 "Regexp matching signature separator.
201 This can also be a list of regexps. In that case, it will be checked
202 from head to tail looking for a separator. Searches will be done from
203 the end of the buffer."
204 :type '(repeat string)
205 :group 'gnus-article-signature)
207 (defcustom gnus-signature-limit nil
208 "Provide a limit to what is considered a signature.
209 If it is a number, no signature may not be longer (in characters) than
210 that number. If it is a floating point number, no signature may be
211 longer (in lines) than that number. If it is a function, the function
212 will be called without any parameters, and if it returns nil, there is
213 no signature in the buffer. If it is a string, it will be used as a
214 regexp. If it matches, the text in question is not a signature."
215 :type '(choice (integer :value 200)
217 (function :value fun)
218 (regexp :value ".*"))
219 :group 'gnus-article-signature)
221 (defcustom gnus-hidden-properties '(invisible t intangible t)
222 "Property list to use for hiding text."
224 :group 'gnus-article-hiding)
226 ;; Fixme: This isn't the right thing for mixed graphical and and
227 ;; non-graphical frames in a session.
228 (defcustom gnus-article-x-face-command
229 (if (featurep 'xemacs)
230 (if (or (gnus-image-type-available-p 'xface)
231 (gnus-image-type-available-p 'pbm))
232 'gnus-display-x-face-in-from
233 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | ee -")
234 (if (gnus-image-type-available-p 'pbm)
235 'gnus-display-x-face-in-from
236 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | \
238 "*String or function to be executed to display an X-Face header.
239 If it is a string, the command will be executed in a sub-shell
240 asynchronously. The compressed face will be piped to this command."
241 :type `(choice string
242 (function-item gnus-display-x-face-in-from)
246 :group 'gnus-article-washing)
248 (defcustom gnus-article-x-face-too-ugly nil
249 "Regexp matching posters whose face shouldn't be shown automatically."
250 :type '(choice regexp (const nil))
251 :group 'gnus-article-washing)
253 (defcustom gnus-article-banner-alist nil
254 "Banner alist for stripping.
256 ((egroups . \"^[ \\t\\n]*-------------------+\\\\( \\\\(e\\\\|Yahoo! \\\\)Groups Sponsor -+\\\\)?....\\n\\\\(.+\\n\\\\)+\"))"
258 :type '(repeat (cons symbol regexp))
259 :group 'gnus-article-washing)
261 (gnus-define-group-parameter
264 "Alist of regexps (to match group names) and banner."
265 :variable-group gnus-article-washing
267 '(choice :tag "Banner"
269 (const :tag "Remove signature" signature)
270 (symbol :tag "Item in `gnus-article-banner-alist'" none)
272 (const :tag "None" nil))
274 "If non-nil, specify how to remove `banners' from articles.
276 Symbol `signature' means to remove signatures delimited by
277 `gnus-signature-separator'. Any other symbol is used to look up a
278 regular expression to match the banner in `gnus-article-banner-alist'.
279 A string is used as a regular expression to match the banner
282 (defcustom gnus-emphasis-alist
284 "\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)")
290 ("_/" "/_" underline-italic)
291 ("_\\*" "\\*_" underline-bold)
292 ("\\*/" "/\\*" bold-italic)
293 ("_\\*/" "/\\*_" underline-bold-italic))))
297 (format format (car spec) (cadr spec))
298 2 3 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
300 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
301 2 3 gnus-emphasis-underline)))
302 "*Alist that says how to fontify certain phrases.
303 Each item looks like this:
305 (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
307 The first element is a regular expression to be matched. The second
308 is a number that says what regular expression grouping used to find
309 the entire emphasized word. The third is a number that says what
310 regexp grouping should be displayed and highlighted. The fourth
311 is the face used for highlighting."
312 :type '(repeat (list :value ("" 0 0 default)
314 (integer :tag "Match group")
315 (integer :tag "Emphasize group")
317 :group 'gnus-article-emphasis)
319 (defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
320 "A regexp to describe whitespace which should not be emphasized.
321 Typical values are \"^[ \\t]+\\\\|[ \\t]*\\n\" and \"[ \\t]+\\\\|[ \\t]*\\n\".
322 The former avoids underlining of leading and trailing whitespace,
323 and the latter avoids underlining any whitespace at all."
325 :group 'gnus-article-emphasis
328 (defface gnus-emphasis-bold '((t (:bold t)))
329 "Face used for displaying strong emphasized text (*word*)."
330 :group 'gnus-article-emphasis)
332 (defface gnus-emphasis-italic '((t (:italic t)))
333 "Face used for displaying italic emphasized text (/word/)."
334 :group 'gnus-article-emphasis)
336 (defface gnus-emphasis-underline '((t (:underline t)))
337 "Face used for displaying underlined emphasized text (_word_)."
338 :group 'gnus-article-emphasis)
340 (defface gnus-emphasis-underline-bold '((t (:bold t :underline t)))
341 "Face used for displaying underlined bold emphasized text (_*word*_)."
342 :group 'gnus-article-emphasis)
344 (defface gnus-emphasis-underline-italic '((t (:italic t :underline t)))
345 "Face used for displaying underlined italic emphasized text (_/word/_)."
346 :group 'gnus-article-emphasis)
348 (defface gnus-emphasis-bold-italic '((t (:bold t :italic t)))
349 "Face used for displaying bold italic emphasized text (/*word*/)."
350 :group 'gnus-article-emphasis)
352 (defface gnus-emphasis-underline-bold-italic
353 '((t (:bold t :italic t :underline t)))
354 "Face used for displaying underlined bold italic emphasized text.
355 Example: (_/*word*/_)."
356 :group 'gnus-article-emphasis)
358 (defface gnus-emphasis-strikethru '((t (:strikethru t)))
359 "Face used for displaying strike-through text (-word-)."
360 :group 'gnus-article-emphasis)
362 (defface gnus-emphasis-highlight-words
363 '((t (:background "black" :foreground "yellow")))
364 "Face used for displaying highlighted words."
365 :group 'gnus-article-emphasis)
367 (defcustom gnus-article-time-format "%a, %b %d %Y %T %Z"
368 "Format for display of Date headers in article bodies.
369 See `format-time-string' for the possible values.
371 The variable can also be function, which should return a complete Date
372 header. The function is called with one argument, the time, which can
373 be fed to `format-time-string'."
374 :type '(choice string symbol)
375 :link '(custom-manual "(gnus)Article Date")
376 :group 'gnus-article-washing)
379 (autoload 'mail-extract-address-components "mail-extr"))
381 (defcustom gnus-save-all-headers t
382 "*If non-nil, don't remove any headers before saving."
383 :group 'gnus-article-saving
386 (defcustom gnus-prompt-before-saving 'always
387 "*This variable says how much prompting is to be done when saving articles.
388 If it is nil, no prompting will be done, and the articles will be
389 saved to the default files. If this variable is `always', each and
390 every article that is saved will be preceded by a prompt, even when
391 saving large batches of articles. If this variable is neither nil not
392 `always', there the user will be prompted once for a file name for
393 each invocation of the saving commands."
394 :group 'gnus-article-saving
395 :type '(choice (item always)
396 (item :tag "never" nil)
397 (sexp :tag "once" :format "%t\n" :value t)))
399 (defcustom gnus-saved-headers gnus-visible-headers
400 "Headers to keep if `gnus-save-all-headers' is nil.
401 If `gnus-save-all-headers' is non-nil, this variable will be ignored.
402 If that variable is nil, however, all headers that match this regexp
403 will be kept while the rest will be deleted before saving."
404 :group 'gnus-article-saving
407 (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail
408 "A function to save articles in your favourite format.
409 The function must be interactively callable (in other words, it must
410 be an Emacs command).
412 Gnus provides the following functions:
414 * gnus-summary-save-in-rmail (Rmail format)
415 * gnus-summary-save-in-mail (Unix mail format)
416 * gnus-summary-save-in-folder (MH folder)
417 * gnus-summary-save-in-file (article format)
418 * gnus-summary-save-body-in-file (article body)
419 * gnus-summary-save-in-vm (use VM's folder format)
420 * gnus-summary-write-to-file (article format -- overwrite)."
421 :group 'gnus-article-saving
422 :type '(radio (function-item gnus-summary-save-in-rmail)
423 (function-item gnus-summary-save-in-mail)
424 (function-item gnus-summary-save-in-folder)
425 (function-item gnus-summary-save-in-file)
426 (function-item gnus-summary-save-body-in-file)
427 (function-item gnus-summary-save-in-vm)
428 (function-item gnus-summary-write-to-file)))
430 (defcustom gnus-rmail-save-name 'gnus-plain-save-name
431 "A function generating a file name to save articles in Rmail format.
432 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
433 :group 'gnus-article-saving
436 (defcustom gnus-mail-save-name 'gnus-plain-save-name
437 "A function generating a file name to save articles in Unix mail format.
438 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
439 :group 'gnus-article-saving
442 (defcustom gnus-folder-save-name 'gnus-folder-save-name
443 "A function generating a file name to save articles in MH folder.
444 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER."
445 :group 'gnus-article-saving
448 (defcustom gnus-file-save-name 'gnus-numeric-save-name
449 "A function generating a file name to save articles in article format.
450 The function is called with NEWSGROUP, HEADERS, and optional
452 :group 'gnus-article-saving
455 (defcustom gnus-split-methods
456 '((gnus-article-archive-name)
457 (gnus-article-nndoc-name))
458 "*Variable used to suggest where articles are to be saved.
459 For instance, if you would like to save articles related to Gnus in
460 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
461 you could set this variable to something like:
463 '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
464 (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))
466 This variable is an alist where the where the key is the match and the
467 value is a list of possible files to save in if the match is non-nil.
469 If the match is a string, it is used as a regexp match on the
470 article. If the match is a symbol, that symbol will be funcalled
471 from the buffer of the article to be saved with the newsgroup as the
472 parameter. If it is a list, it will be evaled in the same buffer.
474 If this form or function returns a string, this string will be used as
475 a possible file name; and if it returns a non-nil list, that list will
476 be used as possible file names."
477 :group 'gnus-article-saving
478 :type '(repeat (choice (list :value (fun) function)
479 (cons :value ("" "") regexp (repeat string))
482 (defcustom gnus-page-delimiter "^\^L"
483 "*Regexp describing what to use as article page delimiters.
484 The default value is \"^\^L\", which is a form linefeed at the
485 beginning of a line."
487 :group 'gnus-article-various)
489 (defcustom gnus-article-mode-line-format "Gnus: %g [%w] %S%m"
490 "*The format specification for the article mode line.
491 See `gnus-summary-mode-line-format' for a closer description.
493 The following additional specs are available:
495 %w The article washing status.
496 %m The number of MIME parts in the article."
498 :group 'gnus-article-various)
500 (defcustom gnus-article-mode-hook nil
501 "*A hook for Gnus article mode."
503 :group 'gnus-article-various)
505 (when (featurep 'xemacs)
506 ;; Extracted from gnus-xmas-define in order to preserve user settings
507 (when (fboundp 'turn-off-scroll-in-place)
508 (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
509 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
510 (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add))
512 (defcustom gnus-article-menu-hook nil
513 "*Hook run after the creation of the article mode menu."
515 :group 'gnus-article-various)
517 (defcustom gnus-article-prepare-hook nil
518 "*A hook called after an article has been prepared in the article buffer."
520 :group 'gnus-article-various)
522 (defcustom gnus-article-hide-pgp-hook nil
523 "*A hook called after successfully hiding a PGP signature."
525 :group 'gnus-article-various)
527 (defcustom gnus-article-button-face 'bold
528 "Face used for highlighting buttons in the article buffer.
530 An article button is a piece of text that you can activate by pressing
531 `RET' or `mouse-2' above it."
533 :group 'gnus-article-buttons)
535 (defcustom gnus-article-mouse-face 'highlight
536 "Face used for mouse highlighting in the article buffer.
538 Article buttons will be displayed in this face when the cursor is
541 :group 'gnus-article-buttons)
543 (defcustom gnus-signature-face 'gnus-signature-face
544 "Face used for highlighting a signature in the article buffer.
545 Obsolete; use the face `gnus-signature-face' for customizations instead."
547 :group 'gnus-article-highlight
548 :group 'gnus-article-signature)
550 (defface gnus-signature-face
553 "Face used for highlighting a signature in the article buffer."
554 :group 'gnus-article-highlight
555 :group 'gnus-article-signature)
557 (defface gnus-header-from-face
560 (:foreground "spring green"))
563 (:foreground "red3"))
566 "Face used for displaying from headers."
567 :group 'gnus-article-headers
568 :group 'gnus-article-highlight)
570 (defface gnus-header-subject-face
573 (:foreground "SeaGreen3"))
576 (:foreground "red4"))
578 (:bold t :italic t)))
579 "Face used for displaying subject headers."
580 :group 'gnus-article-headers
581 :group 'gnus-article-highlight)
583 (defface gnus-header-newsgroups-face
586 (:foreground "yellow" :italic t))
589 (:foreground "MidnightBlue" :italic t))
592 "Face used for displaying newsgroups headers."
593 :group 'gnus-article-headers
594 :group 'gnus-article-highlight)
596 (defface gnus-header-name-face
599 (:foreground "SeaGreen"))
602 (:foreground "maroon"))
605 "Face used for displaying header names."
606 :group 'gnus-article-headers
607 :group 'gnus-article-highlight)
609 (defface gnus-header-content-face
612 (:foreground "forest green" :italic t))
615 (:foreground "indianred4" :italic t))
617 (:italic t))) "Face used for displaying header content."
618 :group 'gnus-article-headers
619 :group 'gnus-article-highlight)
621 (defcustom gnus-header-face-alist
622 '(("From" nil gnus-header-from-face)
623 ("Subject" nil gnus-header-subject-face)
624 ("Newsgroups:.*," nil gnus-header-newsgroups-face)
625 ("" gnus-header-name-face gnus-header-content-face))
626 "*Controls highlighting of article header.
628 An alist of the form (HEADER NAME CONTENT).
630 HEADER is a regular expression which should match the name of an
631 header header and NAME and CONTENT are either face names or nil.
633 The name of each header field will be displayed using the face
634 specified by the first element in the list where HEADER match the
635 header name and NAME is non-nil. Similarly, the content will be
636 displayed by the first non-nil matching CONTENT face."
637 :group 'gnus-article-headers
638 :group 'gnus-article-highlight
639 :type '(repeat (list (regexp :tag "Header")
641 (item :tag "skip" nil)
642 (face :value default))
643 (choice :tag "Content"
644 (item :tag "skip" nil)
645 (face :value default)))))
647 (defcustom gnus-article-decode-hook
648 '(article-decode-charset article-decode-encoded-words
649 article-decode-group-name)
650 "*Hook run to decode charsets in articles."
651 :group 'gnus-article-headers
654 (defcustom gnus-display-mime-function 'gnus-display-mime
655 "Function to display MIME articles."
656 :group 'gnus-article-mime
659 (defvar gnus-decode-header-function 'mail-decode-encoded-word-region
660 "Function used to decode headers.")
662 (defvar gnus-article-dumbquotes-map
681 "Table for MS-to-Latin1 translation.")
683 (defcustom gnus-ignored-mime-types nil
684 "List of MIME types that should be ignored by Gnus."
686 :group 'gnus-article-mime
687 :type '(repeat regexp))
689 (defcustom gnus-unbuttonized-mime-types '(".*/.*")
690 "List of MIME types that should not be given buttons when rendered inline.
691 See also `gnus-buttonized-mime-types' which may override this variable."
693 :group 'gnus-article-mime
694 :type '(repeat regexp))
696 (defcustom gnus-buttonized-mime-types nil
697 "List of MIME types that should be given buttons when rendered inline.
698 If set, this variable overrides `gnus-unbuttonized-mime-types'.
699 To see e.g. security buttons you could set this to
700 `(\"multipart/signed\")'."
702 :group 'gnus-article-mime
703 :type '(repeat regexp))
705 (defcustom gnus-body-boundary-delimiter "_"
706 "String used to delimit header and body.
707 This variable is used by `gnus-article-treat-body-boundary' which can
708 be controlled by `gnus-treat-body-boundary'."
709 :group 'gnus-article-various
710 :type '(choice (item :tag "None" :value nil)
713 (defcustom gnus-picon-databases '("/usr/lib/picon" "/usr/local/faces")
714 "Defines the location of the faces database.
715 For information on obtaining this database of pretty pictures, please
716 see http://www.cs.indiana.edu/picons/ftp/index.html"
717 :type '(repeat directory)
718 :link '(url-link :tag "download"
719 "http://www.cs.indiana.edu/picons/ftp/index.html")
720 :link '(custom-manual "(gnus)Picons")
723 (defun gnus-picons-installed-p ()
724 "Say whether picons are installed on your machine."
725 (let ((installed nil))
726 (dolist (database gnus-picon-databases)
727 (when (file-exists-p database)
731 (defcustom gnus-article-mime-part-function nil
732 "Function called with a MIME handle as the argument.
733 This is meant for people who want to do something automatic based
734 on parts -- for instance, adding Vcard info to a database."
735 :group 'gnus-article-mime
738 (defcustom gnus-mime-multipart-functions nil
739 "An alist of MIME types to functions to display them."
741 :group 'gnus-article-mime
744 (defcustom gnus-article-date-lapsed-new-header nil
745 "Whether the X-Sent and Date headers can coexist.
746 When using `gnus-treat-date-lapsed', the \"X-Sent:\" header will
747 either replace the old \"Date:\" header (if this variable is nil), or
748 be added below it (otherwise)."
750 :group 'gnus-article-headers
753 (defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative
754 "Function called with a MIME handle as the argument.
755 This is meant for people who want to view first matched part.
756 For `undisplayed-alternative' (default), the first undisplayed
757 part or alternative part is used. For `undisplayed', the first
758 undisplayed part is used. For a function, the first part which
759 the function return `t' is used. For `nil', the first part is
762 :group 'gnus-article-mime
764 (item :tag "first" :value nil)
765 (item :tag "undisplayed" :value undisplayed)
766 (item :tag "undisplayed or alternative"
767 :value undisplayed-alternative)
770 (defcustom gnus-mime-action-alist
771 '(("save to file" . gnus-mime-save-part)
772 ("save and strip" . gnus-mime-save-part-and-strip)
773 ("display as text" . gnus-mime-inline-part)
774 ("view the part" . gnus-mime-view-part)
775 ("pipe to command" . gnus-mime-pipe-part)
776 ("toggle display" . gnus-article-press-button)
777 ("toggle display" . gnus-article-view-part-as-charset)
778 ("view as type" . gnus-mime-view-part-as-type)
779 ("view internally" . gnus-mime-view-part-internally)
780 ("view externally" . gnus-mime-view-part-externally))
781 "An alist of actions that run on the MIME attachment."
782 :group 'gnus-article-mime
783 :type '(repeat (cons (string :tag "name")
787 ;;; The treatment variables
790 (defvar gnus-part-display-hook nil
791 "Hook called on parts that are to receive treatment.")
793 (defvar gnus-article-treat-custom
794 '(choice (const :tag "Off" nil)
796 (const :tag "Header" head)
797 (const :tag "Last" last)
798 (integer :tag "Less")
799 (repeat :tag "Groups" regexp)
800 (sexp :tag "Predicate")))
802 (defvar gnus-article-treat-head-custom
803 '(choice (const :tag "Off" nil)
804 (const :tag "Header" head)))
806 (defvar gnus-article-treat-types '("text/plain")
809 (defvar gnus-inhibit-treatment nil
810 "Whether to inhibit treatment.")
812 (defcustom gnus-treat-highlight-signature '(or last (typep "text/x-vcard"))
813 "Highlight the signature.
814 Valid values are nil, t, `head', `last', an integer or a predicate.
815 See Info node `(gnus)Customizing Articles'."
816 :group 'gnus-article-treat
817 :type gnus-article-treat-custom)
818 (put 'gnus-treat-highlight-signature 'highlight t)
820 (defcustom gnus-treat-buttonize 100000
822 Valid values are nil, t, `head', `last', an integer or a predicate.
823 See Info node `(gnus)Customizing Articles'."
824 :group 'gnus-article-treat
825 :type gnus-article-treat-custom)
826 (put 'gnus-treat-buttonize 'highlight t)
828 (defcustom gnus-treat-buttonize-head 'head
829 "Add buttons to the head.
830 Valid values are nil, t, `head', `last', an integer or a predicate.
831 See Info node `(gnus)Customizing Articles' for details."
832 :group 'gnus-article-treat
833 :type gnus-article-treat-head-custom)
834 (put 'gnus-treat-buttonize-head 'highlight t)
836 (defcustom gnus-treat-emphasize
837 (and (or window-system
839 (>= (string-to-number emacs-version) 21))
842 Valid values are nil, t, `head', `last', an integer or a predicate.
843 See Info node `(gnus)Customizing Articles' for details."
844 :group 'gnus-article-treat
845 :type gnus-article-treat-custom)
846 (put 'gnus-treat-emphasize 'highlight t)
848 (defcustom gnus-treat-strip-cr nil
849 "Remove carriage returns.
850 Valid values are nil, t, `head', `last', an integer or a predicate.
851 See Info node `(gnus)Customizing Articles' for details."
852 :group 'gnus-article-treat
853 :type gnus-article-treat-custom)
855 (defcustom gnus-treat-unsplit-urls nil
856 "Remove newlines from within URLs.
857 Valid values are nil, t, `head', `last', an integer or a predicate.
858 See Info node `(gnus)Customizing Articles' for details."
859 :group 'gnus-article-treat
860 :type gnus-article-treat-custom)
862 (defcustom gnus-treat-leading-whitespace nil
863 "Remove leading whitespace in headers.
864 Valid values are nil, t, `head', `last', an integer or a predicate.
865 See Info node `(gnus)Customizing Articles' for details."
866 :group 'gnus-article-treat
867 :type gnus-article-treat-custom)
869 (defcustom gnus-treat-hide-headers 'head
871 Valid values are nil, t, `head', `last', an integer or a predicate.
872 See Info node `(gnus)Customizing Articles' for details."
873 :group 'gnus-article-treat
874 :type gnus-article-treat-head-custom)
876 (defcustom gnus-treat-hide-boring-headers nil
877 "Hide boring headers.
878 Valid values are nil, t, `head', `last', an integer or a predicate.
879 See Info node `(gnus)Customizing Articles' for details."
880 :group 'gnus-article-treat
881 :type gnus-article-treat-head-custom)
883 (defcustom gnus-treat-hide-signature nil
885 Valid values are nil, t, `head', `last', an integer or a predicate.
886 See Info node `(gnus)Customizing Articles' for details."
887 :group 'gnus-article-treat
888 :type gnus-article-treat-custom)
890 (defcustom gnus-treat-fill-article nil
892 Valid values are nil, t, `head', `last', an integer or a predicate.
893 See Info node `(gnus)Customizing Articles' for details."
894 :group 'gnus-article-treat
895 :type gnus-article-treat-custom)
897 (defcustom gnus-treat-hide-citation nil
899 Valid values are nil, t, `head', `last', an integer or a predicate.
900 See Info node `(gnus)Customizing Articles' for details."
901 :group 'gnus-article-treat
902 :type gnus-article-treat-custom)
904 (defcustom gnus-treat-hide-citation-maybe nil
906 Valid values are nil, t, `head', `last', an integer or a predicate.
907 See Info node `(gnus)Customizing Articles' for details."
908 :group 'gnus-article-treat
909 :type gnus-article-treat-custom)
911 (defcustom gnus-treat-strip-list-identifiers 'head
912 "Strip list identifiers from `gnus-list-identifiers`.
913 Valid values are nil, t, `head', `last', an integer or a predicate.
914 See Info node `(gnus)Customizing Articles' for details."
916 :group 'gnus-article-treat
917 :type gnus-article-treat-custom)
919 (defcustom gnus-treat-strip-pgp t
920 "Strip PGP signatures.
921 Valid values are nil, t, `head', `last', an integer or a predicate.
922 See Info node `(gnus)Customizing Articles' for details."
923 :group 'gnus-article-treat
924 :type gnus-article-treat-custom)
926 (defcustom gnus-treat-strip-pem nil
927 "Strip PEM signatures.
928 Valid values are nil, t, `head', `last', an integer or a predicate.
929 See Info node `(gnus)Customizing Articles' for details."
930 :group 'gnus-article-treat
931 :type gnus-article-treat-custom)
933 (defcustom gnus-treat-strip-banner t
934 "Strip banners from articles.
935 The banner to be stripped is specified in the `banner' group parameter.
936 Valid values are nil, t, `head', `last', an integer or a predicate.
937 See Info node `(gnus)Customizing Articles' for details."
938 :group 'gnus-article-treat
939 :type gnus-article-treat-custom)
941 (defcustom gnus-treat-highlight-headers 'head
942 "Highlight the headers.
943 Valid values are nil, t, `head', `last', an integer or a predicate.
944 See Info node `(gnus)Customizing Articles' for details."
945 :group 'gnus-article-treat
946 :type gnus-article-treat-head-custom)
947 (put 'gnus-treat-highlight-headers 'highlight t)
949 (defcustom gnus-treat-highlight-citation t
950 "Highlight cited text.
951 Valid values are nil, t, `head', `last', an integer or a predicate.
952 See Info node `(gnus)Customizing Articles' for details."
953 :group 'gnus-article-treat
954 :type gnus-article-treat-custom)
955 (put 'gnus-treat-highlight-citation 'highlight t)
957 (defcustom gnus-treat-date-ut nil
958 "Display the Date in UT (GMT).
959 Valid values are nil, t, `head', `last', an integer or a predicate.
960 See Info node `(gnus)Customizing Articles' for details."
961 :group 'gnus-article-treat
962 :type gnus-article-treat-head-custom)
964 (defcustom gnus-treat-date-local nil
965 "Display the Date in the local timezone.
966 Valid values are nil, t, `head', `last', an integer or a predicate.
967 See Info node `(gnus)Customizing Articles' for details."
968 :group 'gnus-article-treat
969 :type gnus-article-treat-head-custom)
971 (defcustom gnus-treat-date-english nil
972 "Display the Date in a format that can be read aloud in English.
973 Valid values are nil, t, `head', `last', an integer or a predicate.
974 See Info node `(gnus)Customizing Articles' for details."
975 :group 'gnus-article-treat
976 :type gnus-article-treat-head-custom)
978 (defcustom gnus-treat-date-lapsed nil
979 "Display the Date header in a way that says how much time has elapsed.
980 Valid values are nil, t, `head', `last', an integer or a predicate.
981 See Info node `(gnus)Customizing Articles' for details."
982 :group 'gnus-article-treat
983 :type gnus-article-treat-head-custom)
985 (defcustom gnus-treat-date-original nil
986 "Display the date in the original timezone.
987 Valid values are nil, t, `head', `last', an integer or a predicate.
988 See Info node `(gnus)Customizing Articles' for details."
989 :group 'gnus-article-treat
990 :type gnus-article-treat-head-custom)
992 (defcustom gnus-treat-date-iso8601 nil
993 "Display the date in the ISO8601 format.
994 Valid values are nil, t, `head', `last', an integer or a predicate.
995 See Info node `(gnus)Customizing Articles' for details."
997 :group 'gnus-article-treat
998 :type gnus-article-treat-head-custom)
1000 (defcustom gnus-treat-date-user-defined nil
1001 "Display the date in a user-defined format.
1002 The format is defined by the `gnus-article-time-format' variable.
1003 Valid values are nil, t, `head', `last', an integer or a predicate.
1004 See Info node `(gnus)Customizing Articles' for details."
1005 :group 'gnus-article-treat
1006 :type gnus-article-treat-head-custom)
1008 (defcustom gnus-treat-strip-headers-in-body t
1009 "Strip the X-No-Archive header line from the beginning of the body.
1010 Valid values are nil, t, `head', `last', an integer or a predicate.
1011 See Info node `(gnus)Customizing Articles' for details."
1013 :group 'gnus-article-treat
1014 :type gnus-article-treat-custom)
1016 (defcustom gnus-treat-strip-trailing-blank-lines nil
1017 "Strip trailing blank lines.
1018 Valid values are nil, t, `head', `last', an integer or a predicate.
1019 See Info node `(gnus)Customizing Articles' for details."
1020 :group 'gnus-article-treat
1021 :type gnus-article-treat-custom)
1023 (defcustom gnus-treat-strip-leading-blank-lines nil
1024 "Strip leading blank lines.
1025 Valid values are nil, t, `head', `last', an integer or a predicate.
1026 See Info node `(gnus)Customizing Articles' for details."
1027 :group 'gnus-article-treat
1028 :type gnus-article-treat-custom)
1030 (defcustom gnus-treat-strip-multiple-blank-lines nil
1031 "Strip multiple blank lines.
1032 Valid values are nil, t, `head', `last', an integer or a predicate.
1033 See Info node `(gnus)Customizing Articles' for details."
1034 :group 'gnus-article-treat
1035 :type gnus-article-treat-custom)
1037 (defcustom gnus-treat-unfold-headers 'head
1038 "Unfold folded header lines.
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 :type gnus-article-treat-custom)
1044 (defcustom gnus-treat-fold-headers nil
1046 Valid values are nil, t, `head', `last', an integer or a predicate.
1047 See Info node `(gnus)Customizing Articles' for details."
1048 :group 'gnus-article-treat
1049 :type gnus-article-treat-custom)
1051 (defcustom gnus-treat-fold-newsgroups 'head
1052 "Fold the Newsgroups and Followup-To headers.
1053 Valid values are nil, t, `head', `last', an integer or a predicate.
1054 See Info node `(gnus)Customizing Articles' for details."
1055 :group 'gnus-article-treat
1056 :type gnus-article-treat-custom)
1058 (defcustom gnus-treat-overstrike t
1059 "Treat overstrike highlighting.
1060 Valid values are nil, t, `head', `last', an integer or a predicate.
1061 See Info node `(gnus)Customizing Articles' for details."
1062 :group 'gnus-article-treat
1063 :type gnus-article-treat-custom)
1064 (put 'gnus-treat-overstrike 'highlight t)
1066 (defcustom gnus-treat-display-xface
1067 (and (not noninteractive)
1068 (or (and (fboundp 'image-type-available-p)
1069 (image-type-available-p 'xbm)
1070 (string-match "^0x" (shell-command-to-string "uncompface")))
1071 (and (featurep 'xemacs)
1074 "Display X-Face headers.
1075 Valid values are nil, t, `head', `last', an integer or a predicate.
1076 See Info node `(gnus)Customizing Articles' and Info node
1077 `(gnus)X-Face' for details."
1078 :group 'gnus-article-treat
1080 :type gnus-article-treat-head-custom)
1081 (put 'gnus-treat-display-xface 'highlight t)
1083 (defcustom gnus-treat-display-grey-xface
1084 (and (not noninteractive)
1085 (string-match "^0x" (shell-command-to-string "uncompface"))
1087 "Display grey X-Face headers.
1088 Valid values are nil, t."
1089 :group 'gnus-article-treat
1092 (put 'gnus-treat-display-grey-xface 'highlight t)
1094 (defcustom gnus-treat-display-smileys
1095 (if (or (and (featurep 'xemacs)
1097 (and (fboundp 'image-type-available-p)
1098 (image-type-available-p 'pbm)))
1101 Valid values are nil, t, `head', `last', an integer or a predicate.
1102 See Info node `(gnus)Customizing Articles' and Info node
1103 `(gnus)Smileys' for details."
1104 :group 'gnus-article-treat
1106 :type gnus-article-treat-custom)
1107 (put 'gnus-treat-display-smileys 'highlight t)
1109 (defcustom gnus-treat-from-picon
1110 (if (and (gnus-image-type-available-p 'xpm)
1111 (gnus-picons-installed-p))
1113 "Display picons in the From header.
1114 Valid values are nil, t, `head', `last', an integer or a predicate.
1115 See Info node `(gnus)Customizing Articles' and Info node
1116 `(gnus)Picons' for details."
1117 :group 'gnus-article-treat
1119 :link '(info-link "(gnus)Customizing Articles")
1120 :link '(info-link "(gnus)Picons")
1121 :type gnus-article-treat-head-custom)
1122 (put 'gnus-treat-from-picon 'highlight t)
1124 (defcustom gnus-treat-mail-picon
1125 (if (and (gnus-image-type-available-p 'xpm)
1126 (gnus-picons-installed-p))
1128 "Display picons in To and Cc headers.
1129 Valid values are nil, t, `head', `last', an integer or a predicate.
1130 See Info node `(gnus)Customizing Articles' and Info node
1131 `(gnus)Picons' for details."
1132 :group 'gnus-article-treat
1134 :link '(info-link "(gnus)Customizing Articles")
1135 :link '(info-link "(gnus)Picons")
1136 :type gnus-article-treat-head-custom)
1137 (put 'gnus-treat-mail-picon 'highlight t)
1139 (defcustom gnus-treat-newsgroups-picon
1140 (if (and (gnus-image-type-available-p 'xpm)
1141 (gnus-picons-installed-p))
1143 "Display picons in the Newsgroups and Followup-To headers.
1144 Valid values are nil, t, `head', `last', an integer or a predicate.
1145 See Info node `(gnus)Customizing Articles' and Info node
1146 `(gnus)Picons' for details."
1147 :group 'gnus-article-treat
1149 :link '(info-link "(gnus)Customizing Articles")
1150 :link '(info-link "(gnus)Picons")
1151 :type gnus-article-treat-head-custom)
1152 (put 'gnus-treat-newsgroups-picon 'highlight t)
1154 (defcustom gnus-treat-body-boundary
1155 (if (or gnus-treat-newsgroups-picon
1156 gnus-treat-mail-picon
1157 gnus-treat-from-picon)
1159 "Draw a boundary at the end of the headers.
1160 Valid values are nil, t, `head', `last', an integer or a predicate.
1161 See Info node `(gnus)Customizing Articles' for details."
1163 :group 'gnus-article-treat
1164 :type gnus-article-treat-custom)
1166 (defcustom gnus-treat-capitalize-sentences nil
1167 "Capitalize sentence-starting words.
1168 Valid values are nil, t, `head', `last', an integer or a predicate.
1169 See Info node `(gnus)Customizing Articles' for details."
1171 :group 'gnus-article-treat
1172 :type gnus-article-treat-custom)
1174 (defcustom gnus-treat-fill-long-lines nil
1176 Valid values are nil, t, `head', `last', an integer or a predicate.
1177 See Info node `(gnus)Customizing Articles' for details."
1178 :group 'gnus-article-treat
1179 :type gnus-article-treat-custom)
1181 (defcustom gnus-treat-play-sounds nil
1183 Valid values are nil, t, `head', `last', an integer or a predicate.
1184 See Info node `(gnus)Customizing Articles' for details."
1186 :group 'gnus-article-treat
1187 :type gnus-article-treat-custom)
1189 (defcustom gnus-treat-translate nil
1190 "Translate articles from one language to another.
1191 Valid values are nil, t, `head', `last', an integer or a predicate.
1192 See Info node `(gnus)Customizing Articles' for details."
1194 :group 'gnus-article-treat
1195 :type gnus-article-treat-custom)
1197 (defcustom gnus-treat-x-pgp-sig nil
1199 To automatically treat X-PGP-Sig, set it to head.
1200 Valid values are nil, t, `head', `last', an integer or a predicate.
1201 See Info node `(gnus)Customizing Articles' for details."
1202 :group 'gnus-article-treat
1203 :group 'mime-security
1204 :type gnus-article-treat-custom)
1206 (defvar gnus-article-encrypt-protocol-alist
1207 '(("PGP" . mml2015-self-encrypt)))
1209 ;; Set to nil if more than one protocol added to
1210 ;; gnus-article-encrypt-protocol-alist.
1211 (defcustom gnus-article-encrypt-protocol "PGP"
1212 "The protocol used for encrypt articles.
1213 It is a string, such as \"PGP\". If nil, ask user."
1215 :group 'mime-security)
1217 (defvar gnus-article-wash-function nil
1218 "Function used for converting HTML into text.")
1220 ;;; Internal variables
1222 (defvar gnus-english-month-names
1223 '("January" "February" "March" "April" "May" "June" "July" "August"
1224 "September" "October" "November" "December"))
1226 (defvar article-goto-body-goes-to-point-min-p nil)
1227 (defvar gnus-article-wash-types nil)
1228 (defvar gnus-article-emphasis-alist nil)
1229 (defvar gnus-article-image-alist nil)
1231 (defvar gnus-article-mime-handle-alist-1 nil)
1232 (defvar gnus-treatment-function-alist
1233 '((gnus-treat-x-pgp-sig gnus-article-verify-x-pgp-sig)
1234 (gnus-treat-strip-banner gnus-article-strip-banner)
1235 (gnus-treat-strip-headers-in-body gnus-article-strip-headers-in-body)
1236 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1237 (gnus-treat-buttonize gnus-article-add-buttons)
1238 (gnus-treat-fill-article gnus-article-fill-cited-article)
1239 (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
1240 (gnus-treat-strip-cr gnus-article-remove-cr)
1241 (gnus-treat-unsplit-urls gnus-article-unsplit-urls)
1242 (gnus-treat-date-ut gnus-article-date-ut)
1243 (gnus-treat-date-local gnus-article-date-local)
1244 (gnus-treat-date-english gnus-article-date-english)
1245 (gnus-treat-date-lapsed gnus-article-date-lapsed)
1246 (gnus-treat-date-original gnus-article-date-original)
1247 (gnus-treat-date-user-defined gnus-article-date-user)
1248 (gnus-treat-date-iso8601 gnus-article-date-iso8601)
1249 (gnus-treat-display-xface gnus-article-display-x-face)
1250 (gnus-treat-hide-headers gnus-article-maybe-hide-headers)
1251 (gnus-treat-hide-boring-headers gnus-article-hide-boring-headers)
1252 (gnus-treat-hide-signature gnus-article-hide-signature)
1253 (gnus-treat-strip-list-identifiers gnus-article-hide-list-identifiers)
1254 (gnus-treat-leading-whitespace gnus-article-remove-leading-whitespace)
1255 (gnus-treat-strip-pgp gnus-article-hide-pgp)
1256 (gnus-treat-strip-pem gnus-article-hide-pem)
1257 (gnus-treat-from-picon gnus-treat-from-picon)
1258 (gnus-treat-mail-picon gnus-treat-mail-picon)
1259 (gnus-treat-newsgroups-picon gnus-treat-newsgroups-picon)
1260 (gnus-treat-highlight-headers gnus-article-highlight-headers)
1261 (gnus-treat-highlight-signature gnus-article-highlight-signature)
1262 (gnus-treat-strip-trailing-blank-lines
1263 gnus-article-remove-trailing-blank-lines)
1264 (gnus-treat-strip-leading-blank-lines
1265 gnus-article-strip-leading-blank-lines)
1266 (gnus-treat-strip-multiple-blank-lines
1267 gnus-article-strip-multiple-blank-lines)
1268 (gnus-treat-overstrike gnus-article-treat-overstrike)
1269 (gnus-treat-unfold-headers gnus-article-treat-unfold-headers)
1270 (gnus-treat-fold-headers gnus-article-treat-fold-headers)
1271 (gnus-treat-fold-newsgroups gnus-article-treat-fold-newsgroups)
1272 (gnus-treat-buttonize-head gnus-article-add-buttons-to-head)
1273 (gnus-treat-display-smileys gnus-treat-smiley)
1274 (gnus-treat-capitalize-sentences gnus-article-capitalize-sentences)
1275 (gnus-treat-emphasize gnus-article-emphasize)
1276 (gnus-treat-hide-citation gnus-article-hide-citation)
1277 (gnus-treat-hide-citation-maybe gnus-article-hide-citation-maybe)
1278 (gnus-treat-highlight-citation gnus-article-highlight-citation)
1279 (gnus-treat-body-boundary gnus-article-treat-body-boundary)
1280 (gnus-treat-play-sounds gnus-earcon-display)))
1282 (defvar gnus-article-mime-handle-alist nil)
1283 (defvar article-lapsed-timer nil)
1284 (defvar gnus-article-current-summary nil)
1286 (defvar gnus-article-mode-syntax-table
1287 (let ((table (copy-syntax-table text-mode-syntax-table)))
1288 ;; This causes the citation match run O(2^n).
1289 ;; (modify-syntax-entry ?- "w" table)
1290 (modify-syntax-entry ?> ")<" table)
1291 (modify-syntax-entry ?< "(>" table)
1293 "Syntax table used in article mode buffers.
1294 Initialized from `text-mode-syntax-table.")
1296 (defvar gnus-save-article-buffer nil)
1298 (defvar gnus-article-mode-line-format-alist
1299 (nconc '((?w (gnus-article-wash-status) ?s)
1300 (?m (gnus-article-mime-part-status) ?s))
1301 gnus-summary-mode-line-format-alist))
1303 (defvar gnus-number-of-articles-to-be-saved nil)
1305 (defvar gnus-inhibit-hiding nil)
1307 ;;; Macros for dealing with the article buffer.
1309 (defmacro gnus-with-article-headers (&rest forms)
1311 (set-buffer gnus-article-buffer)
1313 (let ((buffer-read-only nil)
1314 (inhibit-point-motion-hooks t)
1315 (case-fold-search t))
1316 (article-narrow-to-head)
1319 (put 'gnus-with-article-headers 'lisp-indent-function 0)
1320 (put 'gnus-with-article-headers 'edebug-form-spec '(body))
1322 (defmacro gnus-with-article-buffer (&rest forms)
1324 (set-buffer gnus-article-buffer)
1325 (let ((buffer-read-only nil))
1328 (put 'gnus-with-article-buffer 'lisp-indent-function 0)
1329 (put 'gnus-with-article-buffer 'edebug-form-spec '(body))
1331 (defun gnus-article-goto-header (header)
1332 "Go to HEADER, which is a regular expression."
1333 (re-search-forward (concat "^\\(" header "\\):") nil t))
1335 (defsubst gnus-article-hide-text (b e props)
1336 "Set text PROPS on the B to E region, extending `intangible' 1 past B."
1337 (gnus-add-text-properties-when 'article-type nil b e props)
1338 (when (memq 'intangible props)
1340 (max (1- b) (point-min))
1341 b 'intangible (cddr (memq 'intangible props)))))
1343 (defsubst gnus-article-unhide-text (b e)
1344 "Remove hidden text properties from region between B and E."
1345 (remove-text-properties b e gnus-hidden-properties)
1346 (when (memq 'intangible gnus-hidden-properties)
1347 (put-text-property (max (1- b) (point-min))
1348 b 'intangible nil)))
1350 (defun gnus-article-hide-text-type (b e type)
1351 "Hide text of TYPE between B and E."
1352 (gnus-add-wash-type type)
1353 (gnus-article-hide-text
1354 b e (cons 'article-type (cons type gnus-hidden-properties))))
1356 (defun gnus-article-unhide-text-type (b e type)
1357 "Unhide text of TYPE between B and E."
1358 (gnus-delete-wash-type type)
1359 (remove-text-properties
1360 b e (cons 'article-type (cons type gnus-hidden-properties)))
1361 (when (memq 'intangible gnus-hidden-properties)
1362 (put-text-property (max (1- b) (point-min))
1363 b 'intangible nil)))
1365 (defun gnus-article-hide-text-of-type (type)
1366 "Hide text of TYPE in the current buffer."
1368 (let ((b (point-min))
1370 (while (setq b (text-property-any b e 'article-type type))
1371 (add-text-properties b (incf b) gnus-hidden-properties)))))
1373 (defun gnus-article-delete-text-of-type (type)
1374 "Delete text of TYPE in the current buffer."
1376 (let ((b (point-min)))
1377 (while (setq b (text-property-any b (point-max) 'article-type type))
1379 b (or (text-property-not-all b (point-max) 'article-type type)
1382 (defun gnus-article-delete-invisible-text ()
1383 "Delete all invisible text in the current buffer."
1385 (let ((b (point-min)))
1386 (while (setq b (text-property-any b (point-max) 'invisible t))
1388 b (or (text-property-not-all b (point-max) 'invisible t)
1391 (defun gnus-article-text-type-exists-p (type)
1392 "Say whether any text of type TYPE exists in the buffer."
1393 (text-property-any (point-min) (point-max) 'article-type type))
1395 (defsubst gnus-article-header-rank ()
1396 "Give the rank of the string HEADER as given by `gnus-sorted-header-list'."
1397 (let ((list gnus-sorted-header-list)
1400 (when (looking-at (car list))
1402 (setq list (cdr list))
1406 (defun article-hide-headers (&optional arg delete)
1407 "Hide unwanted headers and possibly sort them as well."
1409 ;; This function might be inhibited.
1410 (unless gnus-inhibit-hiding
1413 (let ((buffer-read-only nil)
1414 (case-fold-search t)
1415 (max (1+ (length gnus-sorted-header-list)))
1416 (ignored (when (not gnus-visible-headers)
1417 (cond ((stringp gnus-ignored-headers)
1418 gnus-ignored-headers)
1419 ((listp gnus-ignored-headers)
1420 (mapconcat 'identity gnus-ignored-headers
1423 (cond ((stringp gnus-visible-headers)
1424 gnus-visible-headers)
1425 ((and gnus-visible-headers
1426 (listp gnus-visible-headers))
1427 (mapconcat 'identity gnus-visible-headers "\\|"))))
1428 (inhibit-point-motion-hooks t)
1430 ;; First we narrow to just the headers.
1431 (article-narrow-to-head)
1432 ;; Hide any "From " lines at the beginning of (mail) articles.
1433 (while (looking-at "From ")
1436 (delete-region (point-min) (point)))
1437 ;; Then treat the rest of the header lines.
1438 ;; Then we use the two regular expressions
1439 ;; `gnus-ignored-headers' and `gnus-visible-headers' to
1440 ;; select which header lines is to remain visible in the
1442 (while (re-search-forward "^[^ \t:]*:" nil t)
1444 ;; Mark the rank of the header.
1446 (point) (1+ (point)) 'message-rank
1447 (if (or (and visible (looking-at visible))
1449 (not (looking-at ignored))))
1450 (gnus-article-header-rank)
1453 (message-sort-headers-1)
1454 (when (setq beg (text-property-any
1455 (point-min) (point-max) 'message-rank (+ 2 max)))
1456 ;; We delete the unwanted headers.
1457 (gnus-add-wash-type 'headers)
1458 (add-text-properties (point-min) (+ 5 (point-min))
1459 '(article-type headers dummy-invisible t))
1460 (delete-region beg (point-max))))))))
1462 (defun article-hide-boring-headers (&optional arg)
1463 "Toggle hiding of headers that aren't very interesting.
1464 If given a negative prefix, always show; if given a positive prefix,
1466 (interactive (gnus-article-hidden-arg))
1467 (when (and (not (gnus-article-check-hidden-text 'boring-headers arg))
1468 (not gnus-show-all-headers))
1471 (let ((buffer-read-only nil)
1472 (list gnus-boring-article-headers)
1473 (inhibit-point-motion-hooks t)
1475 (article-narrow-to-head)
1477 (setq elem (pop list))
1478 (goto-char (point-min))
1480 ;; Hide empty headers.
1482 (while (re-search-forward "^[^: \t]+:[ \t]*\n[^ \t]" nil t)
1484 (gnus-article-hide-text-type
1485 (progn (beginning-of-line) (point))
1488 (if (re-search-forward "^[^ \t]" nil t)
1492 ;; Hide boring Newsgroups header.
1493 ((eq elem 'newsgroups)
1494 (when (gnus-string-equal
1495 (gnus-fetch-field "newsgroups")
1496 (gnus-group-real-name
1497 (if (boundp 'gnus-newsgroup-name)
1500 (gnus-article-hide-header "newsgroups")))
1501 ((eq elem 'to-address)
1502 (let ((to (message-fetch-field "to"))
1504 (gnus-parameter-to-address
1505 (if (boundp 'gnus-newsgroup-name)
1506 gnus-newsgroup-name ""))))
1507 (when (and to to-address
1510 ;; only one address in To
1511 (nth 1 (mail-extract-address-components to))
1513 (gnus-article-hide-header "to"))))
1514 ((eq elem 'followup-to)
1515 (when (gnus-string-equal
1516 (message-fetch-field "followup-to")
1517 (message-fetch-field "newsgroups"))
1518 (gnus-article-hide-header "followup-to")))
1519 ((eq elem 'reply-to)
1520 (let ((from (message-fetch-field "from"))
1521 (reply-to (message-fetch-field "reply-to")))
1526 (nth 1 (mail-extract-address-components from))
1527 (nth 1 (mail-extract-address-components reply-to)))))
1528 (gnus-article-hide-header "reply-to"))))
1530 (let ((date (message-fetch-field "date")))
1532 (< (days-between (current-time-string) date)
1534 (gnus-article-hide-header "date"))))
1536 (let ((to (message-fetch-field "to"))
1537 (cc (message-fetch-field "cc")))
1538 (when (> (length to) 1024)
1539 (gnus-article-hide-header "to"))
1540 (when (> (length cc) 1024)
1541 (gnus-article-hide-header "cc"))))
1545 (goto-char (point-min))
1546 (while (re-search-forward "^to:" nil t)
1547 (setq to-count (1+ to-count)))
1548 (when (> to-count 1)
1549 (while (> to-count 0)
1550 (goto-char (point-min))
1552 (re-search-forward "^to:" nil nil to-count)
1554 (narrow-to-region (point) (point-max))
1555 (gnus-article-hide-header "to"))
1556 (setq to-count (1- to-count))))
1557 (goto-char (point-min))
1558 (while (re-search-forward "^cc:" nil t)
1559 (setq cc-count (1+ cc-count)))
1560 (when (> cc-count 1)
1561 (while (> cc-count 0)
1562 (goto-char (point-min))
1564 (re-search-forward "^cc:" nil nil cc-count)
1566 (narrow-to-region (point) (point-max))
1567 (gnus-article-hide-header "cc"))
1568 (setq cc-count (1- cc-count)))))))))))))
1570 (defun gnus-article-hide-header (header)
1572 (goto-char (point-min))
1573 (when (re-search-forward (concat "^" header ":") nil t)
1574 (gnus-article-hide-text-type
1575 (progn (beginning-of-line) (point))
1578 (if (re-search-forward "^[^ \t]" nil t)
1583 (defvar gnus-article-normalized-header-length 40
1584 "Length of normalized headers.")
1586 (defun article-normalize-headers ()
1587 "Make all header lines 40 characters long."
1589 (let ((buffer-read-only nil)
1593 (article-narrow-to-head)
1596 ((< (setq column (- (gnus-point-at-eol) (point)))
1597 gnus-article-normalized-header-length)
1599 (insert (make-string
1600 (- gnus-article-normalized-header-length column)
1602 ((> column gnus-article-normalized-header-length)
1603 (gnus-put-text-property
1605 (forward-char gnus-article-normalized-header-length)
1612 (forward-line 1))))))
1614 (defun article-treat-dumbquotes ()
1615 "Translate M****s*** sm*rtq**t*s into proper text.
1616 Note that this function guesses whether a character is a sm*rtq**t* or
1617 not, so it should only be used interactively.
1619 Sm*rtq**t*s are M****s***'s unilateral extension to the character map
1620 in an attempt to provide more quoting characters. If you see
1621 something like \\222 or \\264 where you're expecting some kind of
1622 apostrophe or quotation mark, then try this wash."
1624 (article-translate-strings gnus-article-dumbquotes-map))
1626 (defun article-translate-characters (from to)
1627 "Translate all characters in the body of the article according to FROM and TO.
1628 FROM is a string of characters to translate from; to is a string of
1629 characters to translate to."
1631 (when (article-goto-body)
1632 (let ((buffer-read-only nil)
1633 (x (make-string 225 ?x))
1635 (while (< (incf i) (length x))
1638 (while (< i (length from))
1639 (aset x (aref from i) (aref to i))
1641 (translate-region (point) (point-max) x)))))
1643 (defun article-translate-strings (map)
1644 "Translate all string in the body of the article according to MAP.
1645 MAP is an alist where the elements are on the form (\"from\" \"to\")."
1647 (when (article-goto-body)
1648 (let ((buffer-read-only nil)
1650 (while (setq elem (pop map))
1652 (while (search-forward (car elem) nil t)
1653 (replace-match (cadr elem)))))))))
1655 (defun article-treat-overstrike ()
1656 "Translate overstrikes into bold text."
1659 (when (article-goto-body)
1660 (let ((buffer-read-only nil))
1661 (while (search-forward "\b" nil t)
1662 (let ((next (char-after))
1663 (previous (char-after (- (point) 2))))
1664 ;; We do the boldification/underlining by hiding the
1665 ;; overstrikes and putting the proper text property
1669 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
1670 (put-text-property (point) (1+ (point)) 'face 'bold))
1672 (gnus-article-hide-text-type
1673 (1- (point)) (1+ (point)) 'overstrike)
1675 (- (point) 2) (1- (point)) 'face 'underline))
1677 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
1679 (point) (1+ (point)) 'face 'underline)))))))))
1681 (defun gnus-article-treat-unfold-headers ()
1682 "Unfold folded message headers.
1683 Only the headers that fit into the current window width will be
1686 (gnus-with-article-headers
1690 (mail-header-narrow-to-field)
1691 (let ((header (buffer-substring (point-min) (point-max))))
1694 (goto-char (point-min))
1695 (while (re-search-forward "\n[\t ]" nil t)
1696 (replace-match " " t t)))
1697 (setq length (- (point-max) (point-min) 1)))
1698 (when (< length (window-width))
1699 (while (re-search-forward "\n[\t ]" nil t)
1700 (replace-match " " t t)))
1701 (goto-char (point-max)))))))
1703 (defun gnus-article-treat-fold-headers ()
1704 "Fold message headers."
1706 (gnus-with-article-headers
1709 (mail-header-narrow-to-field)
1710 (mail-header-fold-field)
1711 (goto-char (point-max))))))
1713 (defun gnus-treat-smiley ()
1714 "Toggle display of textual emoticons (\"smileys\") as small graphical icons."
1716 (gnus-with-article-buffer
1717 (if (memq 'smiley gnus-article-wash-types)
1718 (gnus-delete-images 'smiley)
1720 (let ((images (smiley-region (point) (point-max))))
1722 (gnus-add-wash-type 'smiley)
1723 (dolist (image images)
1724 (gnus-add-image 'smiley image)))))))
1726 (defun gnus-article-remove-images ()
1727 "Remove all images from the article buffer."
1729 (gnus-with-article-buffer
1730 (dolist (elem gnus-article-image-alist)
1731 (gnus-delete-images (car elem)))))
1733 (defun gnus-article-treat-fold-newsgroups ()
1734 "Unfold folded message headers.
1735 Only the headers that fit into the current window width will be
1738 (gnus-with-article-headers
1739 (while (gnus-article-goto-header "newsgroups\\|followup-to")
1741 (mail-header-narrow-to-field)
1742 (while (re-search-forward ", *" nil t)
1743 (replace-match ", " t t))
1744 (mail-header-fold-field)
1745 (goto-char (point-max))))))
1747 (defun gnus-article-treat-body-boundary ()
1748 "Place a boundary line at the end of the headers."
1750 (when (and gnus-body-boundary-delimiter
1751 (> (length gnus-body-boundary-delimiter) 0))
1752 (gnus-with-article-headers
1753 (goto-char (point-max))
1754 (let ((start (point)))
1755 (insert "X-Boundary: ")
1756 (gnus-add-text-properties start (point) '(invisible t intangible t))
1758 (while (>= (1- (window-width)) (length str))
1759 (setq str (concat str gnus-body-boundary-delimiter)))
1760 (substring str 0 (1- (window-width))))
1762 (gnus-add-text-properties start (point) '(gnus-decoration 'header))))))
1764 (defun article-fill-long-lines ()
1765 "Fill lines that are wider than the window width."
1768 (let ((buffer-read-only nil)
1769 (width (window-width (get-buffer-window (current-buffer)))))
1772 (let ((adaptive-fill-mode nil)) ;Why? -sm
1775 (when (>= (current-column) (min fill-column width))
1776 (narrow-to-region (point) (gnus-point-at-bol))
1777 (fill-paragraph nil)
1778 (goto-char (point-max))
1780 (forward-line 1)))))))
1782 (defun article-capitalize-sentences ()
1783 "Capitalize the first word in each sentence."
1786 (let ((buffer-read-only nil)
1787 (paragraph-start "^[\n\^L]"))
1791 (forward-sentence)))))
1793 (defun article-remove-cr ()
1794 "Remove trailing CRs and then translate remaining CRs into LFs."
1797 (let ((buffer-read-only nil))
1798 (goto-char (point-min))
1799 (while (re-search-forward "\r+$" nil t)
1800 (replace-match "" t t))
1801 (goto-char (point-min))
1802 (while (search-forward "\r" nil t)
1803 (replace-match "\n" t t)))))
1805 (defun article-remove-trailing-blank-lines ()
1806 "Remove all trailing blank lines from the article."
1809 (let ((buffer-read-only nil))
1810 (goto-char (point-max))
1814 (while (and (not (bobp))
1815 (looking-at "^[ \t]*$")
1816 (not (gnus-annotation-in-region-p
1817 (point) (gnus-point-at-eol))))
1822 (defun article-display-x-face (&optional force)
1823 "Look for an X-Face header and display it if present."
1824 (interactive (list 'force))
1825 (let ((wash-face-p buffer-read-only)) ;; When type `W f'
1826 (gnus-with-article-headers
1827 ;; Delete the old process, if any.
1828 (when (process-status "article-x-face")
1829 (delete-process "article-x-face"))
1830 (if (memq 'xface gnus-article-wash-types)
1831 ;; We have already displayed X-Faces, so we remove them
1833 (gnus-delete-images 'xface)
1835 (let (x-faces from face grey)
1837 (when (and wash-face-p
1839 (goto-char (point-min))
1840 (not (re-search-forward
1841 "^X-Face\\(-[0-9]+\\)?:[\t ]*" nil t)))
1842 (gnus-buffer-live-p gnus-original-article-buffer))
1843 ;; If type `W f', use gnus-original-article-buffer,
1844 ;; otherwise use the current buffer because displaying
1845 ;; RFC822 parts calls this function too.
1846 (set-buffer gnus-original-article-buffer))
1848 (mail-narrow-to-head)
1849 (if gnus-treat-display-grey-xface
1851 (while (gnus-article-goto-header "X-Face\\(-[0-9]+\\)?")
1852 (if (match-beginning 2)
1855 (push (cons (- (string-to-number (match-string 2)))
1856 (mail-header-field-value))
1858 (push (cons 0 (mail-header-field-value)) x-faces)))
1859 (dolist (x-face (prog1
1861 (sort x-faces 'car-less-than-car)
1863 (setq x-faces nil)))
1864 (push (cdr x-face) x-faces)))
1865 (while (gnus-article-goto-header "X-Face")
1866 (push (mail-header-field-value) x-faces)))
1867 (setq from (message-fetch-field "from"))))
1869 (let ((xpm (gnus-convert-gray-x-face-to-xpm x-faces))
1872 (setq image (gnus-create-image xpm 'xpm t))
1873 (gnus-article-goto-header "from")
1875 (insert "From: [no `from' set]\n")
1877 (gnus-add-wash-type 'xface)
1878 (gnus-add-image 'xface image)
1879 (gnus-put-image image)))
1880 ;; Sending multiple EOFs to xv doesn't work, so we only do a
1881 ;; single external face.
1882 (when (stringp gnus-article-x-face-command)
1883 (setq x-faces (list (car x-faces))))
1884 (while (and (setq face (pop x-faces))
1885 gnus-article-x-face-command
1887 ;; Check whether this face is censored.
1888 (not gnus-article-x-face-too-ugly)
1889 (and gnus-article-x-face-too-ugly from
1890 (not (string-match gnus-article-x-face-too-ugly
1892 ;; We display the face.
1893 (if (symbolp gnus-article-x-face-command)
1894 ;; The command is a lisp function, so we call it.
1895 (if (gnus-functionp gnus-article-x-face-command)
1896 (funcall gnus-article-x-face-command face)
1897 (error "%s is not a function" gnus-article-x-face-command))
1898 ;; The command is a string, so we interpret the command
1899 ;; as a, well, command, and fork it off.
1900 (let ((process-connection-type nil))
1901 (process-kill-without-query
1903 "article-x-face" nil shell-file-name shell-command-switch
1904 gnus-article-x-face-command))
1907 (process-send-region "article-x-face"
1908 (point-min) (point-max)))
1909 (process-send-eof "article-x-face"))))))))))
1911 (defun article-decode-mime-words ()
1912 "Decode all MIME-encoded words in the article."
1915 (set-buffer gnus-article-buffer)
1916 (let ((inhibit-point-motion-hooks t)
1918 (mail-parse-charset gnus-newsgroup-charset)
1919 (mail-parse-ignored-charsets
1920 (save-excursion (set-buffer gnus-summary-buffer)
1921 gnus-newsgroup-ignored-charsets)))
1922 (mail-decode-encoded-word-region (point-min) (point-max)))))
1924 (defun article-decode-charset (&optional prompt)
1925 "Decode charset-encoded text in the article.
1926 If PROMPT (the prefix), prompt for a coding system to use."
1928 (let ((inhibit-point-motion-hooks t) (case-fold-search t)
1930 (mail-parse-charset gnus-newsgroup-charset)
1931 (mail-parse-ignored-charsets
1932 (save-excursion (condition-case nil
1933 (set-buffer gnus-summary-buffer)
1935 gnus-newsgroup-ignored-charsets))
1936 ct cte ctl charset format)
1939 (article-narrow-to-head)
1940 (setq ct (message-fetch-field "Content-Type" t)
1941 cte (message-fetch-field "Content-Transfer-Encoding" t)
1942 ctl (and ct (ignore-errors
1943 (mail-header-parse-content-type ct)))
1946 (mm-read-coding-system "Charset to decode: "))
1948 (mail-content-type-get ctl 'charset)))
1949 format (and ctl (mail-content-type-get ctl 'format)))
1951 (setq cte (mail-header-strip cte)))
1952 (if (and ctl (not (string-match "/" (car ctl))))
1954 (goto-char (point-max)))
1957 (narrow-to-region (point) (point-max))
1958 (when (and (eq mail-parse-charset 'gnus-decoded)
1959 (eq (mm-body-7-or-8) '8bit))
1960 ;; The text code could have been decoded.
1961 (setq charset mail-parse-charset))
1962 (when (and (or (not ctl)
1963 (equal (car ctl) "text/plain"))
1964 (not format)) ;; article with format will decode later.
1966 charset (and cte (intern (downcase
1967 (gnus-strip-whitespace cte))))
1970 (defun article-decode-encoded-words ()
1971 "Remove encoded-word encoding from headers."
1972 (let ((inhibit-point-motion-hooks t)
1973 (mail-parse-charset gnus-newsgroup-charset)
1974 (mail-parse-ignored-charsets
1975 (save-excursion (condition-case nil
1976 (set-buffer gnus-summary-buffer)
1978 gnus-newsgroup-ignored-charsets))
1981 (article-narrow-to-head)
1982 (funcall gnus-decode-header-function (point-min) (point-max)))))
1984 (defun article-decode-group-name ()
1985 "Decode group names in `Newsgroups:'."
1986 (let ((inhibit-point-motion-hooks t)
1988 (method (gnus-find-method-for-group gnus-newsgroup-name)))
1989 (when (and (or gnus-group-name-charset-method-alist
1990 gnus-group-name-charset-group-alist)
1991 (gnus-buffer-live-p gnus-original-article-buffer))
1992 (when (nnmail-fetch-field "Newsgroups")
1993 (nnheader-replace-header "Newsgroups"
1994 (gnus-decode-newsgroups
1995 (with-current-buffer
1996 gnus-original-article-buffer
1997 (nnmail-fetch-field "Newsgroups"))
1998 gnus-newsgroup-name method)))
1999 (when (nnmail-fetch-field "Followup-To")
2000 (nnheader-replace-header "Followup-To"
2001 (gnus-decode-newsgroups
2002 (with-current-buffer
2003 gnus-original-article-buffer
2004 (nnmail-fetch-field "Followup-To"))
2005 gnus-newsgroup-name method))))))
2007 (defun article-de-quoted-unreadable (&optional force read-charset)
2008 "Translate a quoted-printable-encoded article.
2009 If FORCE, decode the article whether it is marked as quoted-printable
2011 If READ-CHARSET, ask for a coding system."
2012 (interactive (list 'force current-prefix-arg))
2014 (let ((buffer-read-only nil) type charset)
2015 (if (gnus-buffer-live-p gnus-original-article-buffer)
2016 (with-current-buffer gnus-original-article-buffer
2018 (gnus-fetch-field "content-transfer-encoding"))
2019 (let* ((ct (gnus-fetch-field "content-type"))
2022 (mail-header-parse-content-type ct)))))
2023 (setq charset (and ctl
2024 (mail-content-type-get ctl 'charset)))
2025 (if (stringp charset)
2026 (setq charset (intern (downcase charset)))))))
2028 (setq charset (mm-read-coding-system "Charset: " charset)))
2030 (setq charset gnus-newsgroup-charset))
2032 (and type (let ((case-fold-search t))
2033 (string-match "quoted-printable" type))))
2035 (quoted-printable-decode-region
2036 (point) (point-max) (mm-charset-to-coding-system charset))))))
2038 (defun article-de-base64-unreadable (&optional force read-charset)
2039 "Translate a base64 article.
2040 If FORCE, decode the article whether it is marked as base64 not.
2041 If READ-CHARSET, ask for a coding system."
2042 (interactive (list 'force current-prefix-arg))
2044 (let ((buffer-read-only nil) type charset)
2045 (if (gnus-buffer-live-p gnus-original-article-buffer)
2046 (with-current-buffer gnus-original-article-buffer
2048 (gnus-fetch-field "content-transfer-encoding"))
2049 (let* ((ct (gnus-fetch-field "content-type"))
2052 (mail-header-parse-content-type ct)))))
2053 (setq charset (and ctl
2054 (mail-content-type-get ctl 'charset)))
2055 (if (stringp charset)
2056 (setq charset (intern (downcase charset)))))))
2058 (setq charset (mm-read-coding-system "Charset: " charset)))
2060 (setq charset gnus-newsgroup-charset))
2062 (and type (let ((case-fold-search t))
2063 (string-match "base64" type))))
2066 (narrow-to-region (point) (point-max))
2067 (base64-decode-region (point-min) (point-max))
2068 (mm-decode-coding-region
2069 (point-min) (point-max) (mm-charset-to-coding-system charset)))))))
2074 (defun article-decode-HZ ()
2075 "Translate a HZ-encoded article."
2079 (let ((buffer-read-only nil))
2080 (rfc1843-decode-region (point-min) (point-max)))))
2082 (defun article-unsplit-urls ()
2083 "Remove the newlines that some other mailers insert into URLs."
2086 (let ((buffer-read-only nil))
2087 (goto-char (point-min))
2088 (while (re-search-forward
2089 "^\\(\\(https?\\|ftp\\)://\\S-+\\) *\n\\(\\S-+\\)" nil t)
2090 (replace-match "\\1\\3" t)))
2091 (when (and gnus-display-mime-function (interactive-p))
2092 (funcall gnus-display-mime-function))))
2095 (defun article-wash-html (&optional read-charset)
2096 "Format an html article.
2097 If READ-CHARSET, ask for a coding system."
2100 (let ((buffer-read-only nil)
2102 (if (gnus-buffer-live-p gnus-original-article-buffer)
2103 (with-current-buffer gnus-original-article-buffer
2104 (let* ((ct (gnus-fetch-field "content-type"))
2107 (mail-header-parse-content-type ct)))))
2108 (setq charset (and ctl
2109 (mail-content-type-get ctl 'charset)))
2110 (if (stringp charset)
2111 (setq charset (intern (downcase charset)))))))
2113 (setq charset (mm-read-coding-system "Charset: " charset)))
2115 (setq charset gnus-newsgroup-charset))
2117 (save-window-excursion
2119 (narrow-to-region (point) (point-max))
2120 (let* ((func (or gnus-article-wash-function mm-text-html-renderer))
2121 (entry (assq func mm-text-html-washer-alist)))
2123 (setq func (cdr entry)))
2125 ((gnus-functionp func)
2128 (apply (car func) (cdr func))))))))))
2130 (defun gnus-article-wash-html-with-w3 ()
2131 "Wash the current buffer with w3."
2133 (let ((w3-strict-width (window-width))
2134 (url-standalone-mode t)
2135 (url-gateway-unplugged t)
2136 (w3-honor-stylesheets nil))
2138 (w3-region (point-min) (point-max))
2141 (defun gnus-article-wash-html-with-w3m ()
2142 "Wash the current buffer with emacs-w3m."
2145 (narrow-to-region (point) (point-max))
2146 (let ((w3m-safe-url-regexp (if mm-inline-text-html-with-images
2149 (w3m-display-inline-images mm-inline-text-html-with-images)
2150 w3m-force-redisplay)
2151 (w3m-region (point-min) (point-max)))
2152 (when mm-inline-text-html-with-w3m-keymap
2153 (add-text-properties
2154 (point-min) (point-max)
2155 (append '(mm-inline-text-html-with-w3m t)
2156 (gnus-local-map-property mm-w3m-mode-map))))))
2158 (defun article-hide-list-identifiers ()
2159 "Remove list identifies from the Subject header.
2160 The `gnus-list-identifiers' variable specifies what to do."
2162 (let ((inhibit-point-motion-hooks t)
2163 (regexp (if (consp gnus-list-identifiers)
2164 (mapconcat 'identity gnus-list-identifiers " *\\|")
2165 gnus-list-identifiers))
2170 (article-narrow-to-head)
2171 (goto-char (point-min))
2172 (while (re-search-forward
2173 (concat "^Subject: +\\(R[Ee]: +\\)*\\(" regexp " *\\)")
2175 (delete-region (match-beginning 2) (match-end 0))
2176 (beginning-of-line))
2177 (when (re-search-forward
2178 "^Subject: +\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" nil t)
2179 (delete-region (match-beginning 1) (match-end 1))))))))
2181 (defun article-hide-pgp ()
2182 "Remove any PGP headers and signatures in the current article."
2186 (let ((inhibit-point-motion-hooks t)
2187 buffer-read-only beg end)
2189 ;; Hide the "header".
2190 (when (re-search-forward "^-----BEGIN PGP SIGNED MESSAGE-----\n" nil t)
2191 (gnus-add-wash-type 'pgp)
2192 (delete-region (match-beginning 0) (match-end 0))
2193 ;; Remove armor headers (rfc2440 6.2)
2194 (delete-region (point) (or (re-search-forward "^[ \t]*\n" nil t)
2197 ;; Hide the actual signature.
2198 (and (search-forward "\n-----BEGIN PGP SIGNATURE-----\n" nil t)
2199 (setq end (1+ (match-beginning 0)))
2202 (if (search-forward "\n-----END PGP SIGNATURE-----\n" nil t)
2204 ;; Perhaps we shouldn't hide to the end of the buffer
2205 ;; if there is no end to the signature?
2207 ;; Hide "- " PGP quotation markers.
2209 (narrow-to-region beg end)
2210 (goto-char (point-min))
2211 (while (re-search-forward "^- " nil t)
2213 (match-beginning 0) (match-end 0)))
2215 (gnus-run-hooks 'gnus-article-hide-pgp-hook))))))
2217 (defun article-hide-pem (&optional arg)
2218 "Toggle hiding of any PEM headers and signatures in the current article.
2219 If given a negative prefix, always show; if given a positive prefix,
2221 (interactive (gnus-article-hidden-arg))
2222 (unless (gnus-article-check-hidden-text 'pem arg)
2224 (let (buffer-read-only end)
2225 (goto-char (point-min))
2226 ;; Hide the horrendously ugly "header".
2227 (when (and (search-forward
2228 "\n-----BEGIN PRIVACY-ENHANCED MESSAGE-----\n"
2230 (setq end (1+ (match-beginning 0))))
2231 (gnus-add-wash-type 'pem)
2232 (gnus-article-hide-text-type
2234 (if (search-forward "\n\n" nil t)
2238 ;; Hide the trailer as well
2239 (when (search-forward "\n-----END PRIVACY-ENHANCED MESSAGE-----\n"
2241 (gnus-article-hide-text-type
2242 (match-beginning 0) (match-end 0) 'pem)))))))
2244 (defun article-strip-banner ()
2245 "Strip the banner specified by the `banner' group parameter."
2249 (let ((inhibit-point-motion-hooks t)
2250 (banner (gnus-parameter-banner gnus-newsgroup-name))
2251 (gnus-signature-limit nil)
2252 buffer-read-only beg end)
2256 ((eq banner 'signature)
2257 (when (gnus-article-narrow-to-signature)
2260 (delete-region (point) (point-max))))
2262 (if (setq banner (cdr (assq banner gnus-article-banner-alist)))
2263 (while (re-search-forward banner nil t)
2264 (delete-region (match-beginning 0) (match-end 0)))))
2266 (while (re-search-forward banner nil t)
2267 (delete-region (match-beginning 0) (match-end 0))))))))))
2269 (defun article-babel ()
2270 "Translate article using an online translation service."
2274 (set-buffer gnus-article-buffer)
2275 (when (article-goto-body)
2276 (let* ((buffer-read-only nil)
2279 (orig (buffer-substring start end))
2280 (trans (babel-as-string orig)))
2282 (narrow-to-region start end)
2283 (delete-region start end)
2286 (defun article-hide-signature (&optional arg)
2287 "Hide the signature in the current article.
2288 If given a negative prefix, always show; if given a positive prefix,
2290 (interactive (gnus-article-hidden-arg))
2291 (unless (gnus-article-check-hidden-text 'signature arg)
2294 (let ((buffer-read-only nil))
2295 (when (gnus-article-narrow-to-signature)
2296 (gnus-article-hide-text-type
2297 (point-min) (point-max) 'signature))))))
2298 (gnus-set-mode-line 'article))
2300 (defun article-strip-headers-in-body ()
2301 "Strip offensive headers from bodies."
2305 (let ((case-fold-search t))
2306 (when (looking-at "x-no-archive:")
2307 (gnus-delete-line)))))
2309 (defun article-strip-leading-blank-lines ()
2310 "Remove all blank lines from the beginning of the article."
2313 (let ((inhibit-point-motion-hooks t)
2315 (when (article-goto-body)
2316 (while (and (not (eobp))
2317 (looking-at "[ \t]*$"))
2318 (gnus-delete-line))))))
2320 (defun article-narrow-to-head ()
2321 "Narrow the buffer to the head of the message.
2322 Point is left at the beginning of the narrowed-to region."
2324 (goto-char (point-min))
2325 (if (search-forward "\n\n" nil 1)
2328 (goto-char (point-min)))
2330 (defun article-goto-body ()
2331 "Place point at the start of the body."
2332 (goto-char (point-min))
2334 ;; This variable is only bound when dealing with separate
2336 (article-goto-body-goes-to-point-min-p
2338 ((search-forward "\n\n" nil t)
2341 (goto-char (point-max))
2344 (defun article-strip-multiple-blank-lines ()
2345 "Replace consecutive blank lines with one empty line."
2348 (let ((inhibit-point-motion-hooks t)
2350 ;; First make all blank lines empty.
2352 (while (re-search-forward "^[ \t]+$" nil t)
2353 (unless (gnus-annotation-in-region-p
2354 (match-beginning 0) (match-end 0))
2355 (replace-match "" nil t)))
2356 ;; Then replace multiple empty lines with a single empty line.
2358 (while (re-search-forward "\n\n\\(\n+\\)" nil t)
2359 (unless (gnus-annotation-in-region-p
2360 (match-beginning 0) (match-end 0))
2361 (delete-region (match-beginning 1) (match-end 1)))))))
2363 (defun article-strip-leading-space ()
2364 "Remove all white space from the beginning of the lines in the article."
2367 (let ((inhibit-point-motion-hooks t)
2370 (while (re-search-forward "^[ \t]+" nil t)
2371 (replace-match "" t t)))))
2373 (defun article-strip-trailing-space ()
2374 "Remove all white space from the end of the lines in the article."
2377 (let ((inhibit-point-motion-hooks t)
2380 (while (re-search-forward "[ \t]+$" nil t)
2381 (replace-match "" t t)))))
2383 (defun article-strip-blank-lines ()
2384 "Strip leading, trailing and multiple blank lines."
2386 (article-strip-leading-blank-lines)
2387 (article-remove-trailing-blank-lines)
2388 (article-strip-multiple-blank-lines))
2390 (defun article-strip-all-blank-lines ()
2391 "Strip all blank lines."
2394 (let ((inhibit-point-motion-hooks t)
2397 (while (re-search-forward "^[ \t]*\n" nil t)
2398 (replace-match "" t t)))))
2400 (defun gnus-article-narrow-to-signature ()
2401 "Narrow to the signature; return t if a signature is found, else nil."
2402 (let ((inhibit-point-motion-hooks t))
2403 (when (gnus-article-search-signature)
2405 ;; Check whether we have some limits to what we consider
2406 ;; to be a signature.
2407 (let ((limits (if (listp gnus-signature-limit) gnus-signature-limit
2408 (list gnus-signature-limit)))
2410 (while (setq limit (pop limits))
2411 (if (or (and (integerp limit)
2412 (< (- (point-max) (point)) limit))
2414 (< (count-lines (point) (point-max)) limit))
2415 (and (gnus-functionp limit)
2417 (and (stringp limit)
2418 (not (re-search-forward limit nil t))))
2419 () ; This limit did not succeed.
2423 (narrow-to-region (point) (point-max))
2426 (defun gnus-article-search-signature ()
2427 "Search the current buffer for the signature separator.
2428 Put point at the beginning of the signature separator."
2429 (let ((cur (point)))
2430 (goto-char (point-max))
2431 (if (if (stringp gnus-signature-separator)
2432 (re-search-backward gnus-signature-separator nil t)
2433 (let ((seps gnus-signature-separator))
2435 (not (re-search-backward (car seps) nil t)))
2442 (defun gnus-article-hidden-arg ()
2443 "Return the current prefix arg as a number, or 0 if no prefix."
2444 (list (if current-prefix-arg
2445 (prefix-numeric-value current-prefix-arg)
2448 (defun gnus-article-check-hidden-text (type arg)
2449 "Return nil if hiding is necessary.
2450 Arg can be nil or a number. nil and positive means hide, negative
2451 means show, 0 means toggle."
2454 (let ((hide (gnus-article-hidden-text-p type)))
2460 (gnus-article-show-hidden-text type)
2463 (if (eq hide 'hidden)
2465 (gnus-article-show-hidden-text type)
2469 (defun gnus-article-hidden-text-p (type)
2470 "Say whether the current buffer contains hidden text of type TYPE."
2471 (let ((pos (text-property-any (point-min) (point-max) 'article-type type)))
2473 (not (get-text-property pos 'invisible))
2474 (not (get-text-property pos 'dummy-invisible)))
2476 (text-property-any (1+ pos) (point-max) 'article-type type)))
2481 (defun gnus-article-show-hidden-text (type &optional dummy)
2482 "Show all hidden text of type TYPE.
2483 Originally it is hide instead of DUMMY."
2484 (let ((buffer-read-only nil)
2485 (inhibit-point-motion-hooks t))
2486 (gnus-remove-text-properties-when
2488 (point-min) (point-max)
2489 (cons 'article-type (cons type
2490 gnus-hidden-properties)))
2491 (gnus-delete-wash-type type)))
2493 (defconst article-time-units
2494 `((year . ,(* 365.25 24 60 60))
2495 (week . ,(* 7 24 60 60))
2496 (day . ,(* 24 60 60))
2500 "Mapping from time units to seconds.")
2502 (defun article-date-ut (&optional type highlight header)
2503 "Convert DATE date to universal time in the current article.
2504 If TYPE is `local', convert to local time; if it is `lapsed', output
2505 how much time has lapsed since DATE. For `lapsed', the value of
2506 `gnus-article-date-lapsed-new-header' says whether the \"X-Sent:\" header
2507 should replace the \"Date:\" one, or should be added below it."
2508 (interactive (list 'ut t))
2509 (let* ((header (or header
2510 (message-fetch-field "date")
2512 (tdate-regexp "^Date:[ \t]\\|^X-Sent:[ \t]")
2515 ((not gnus-article-date-lapsed-new-header)
2521 (date (if (vectorp header) (mail-header-date header)
2523 (inhibit-point-motion-hooks t)
2528 (article-narrow-to-head)
2529 (when (re-search-forward tdate-regexp nil t)
2530 (setq bface (get-text-property (gnus-point-at-bol) 'face)
2531 date (or (get-text-property (gnus-point-at-bol)
2534 eface (get-text-property (1- (gnus-point-at-eol)) 'face))
2536 (when (and date (not (string= date "")))
2537 (goto-char (point-min))
2538 (let ((buffer-read-only nil))
2539 ;; Delete any old Date headers.
2540 (while (re-search-forward date-regexp nil t)
2542 (delete-region (progn (beginning-of-line) (point))
2543 (progn (forward-line 1) (point)))
2544 (delete-region (progn (beginning-of-line) (point))
2545 (progn (end-of-line) (point)))
2546 (setq pos (point))))
2547 (when (and (not pos) (re-search-forward tdate-regexp nil t))
2549 (if pos (goto-char pos))
2550 (insert (article-make-date-line date (or type 'ut)))
2556 (when (looking-at "\\([^:]+\\): *\\(.*\\)$")
2557 (put-text-property (match-beginning 1) (1+ (match-end 1))
2558 'original-date date)
2559 (put-text-property (match-beginning 1) (1+ (match-end 1))
2561 (put-text-property (match-beginning 2) (match-end 2)
2564 (defun article-make-date-line (date type)
2565 "Return a DATE line of TYPE."
2566 (unless (memq type '(local ut original user iso8601 lapsed english))
2567 (error "Unknown conversion type: %s" type))
2569 (let ((time (date-to-time date)))
2571 ;; Convert to the local timezone.
2573 (let ((tz (car (current-time-zone time))))
2574 (format "Date: %s %s%02d%02d" (current-time-string time)
2575 (if (> tz 0) "+" "-") (/ (abs tz) 3600)
2576 (/ (% (abs tz) 3600) 60))))
2577 ;; Convert to Universal Time.
2580 (current-time-string
2581 (let* ((e (parse-time-string date))
2582 (tm (apply 'encode-time e))
2584 (ls (- (cadr tm) (car (current-time-zone time)))))
2585 (cond ((< ls 0) (list (1- ms) (+ ls 65536)))
2586 ((> ls 65535) (list (1+ ms) (- ls 65536)))
2589 ;; Get the original date from the article.
2590 ((eq type 'original)
2591 (concat "Date: " (if (string-match "\n+$" date)
2592 (substring date 0 (match-beginning 0))
2594 ;; Let the user define the format.
2596 (if (gnus-functionp gnus-article-time-format)
2597 (funcall gnus-article-time-format time)
2600 (format-time-string gnus-article-time-format time))))
2603 (let ((tz (car (current-time-zone time))))
2606 (format-time-string "%Y%m%dT%H%M%S" time)
2607 (format "%s%02d%02d"
2608 (if (> tz 0) "+" "-") (/ (abs tz) 3600)
2609 (/ (% (abs tz) 3600) 60)))))
2610 ;; Do an X-Sent lapsed format.
2612 ;; If the date is seriously mangled, the timezone functions are
2613 ;; liable to bug out, so we ignore all errors.
2614 (let* ((now (current-time))
2615 (real-time (subtract-time now time))
2616 (real-sec (and real-time
2617 (+ (* (float (car real-time)) 65536)
2619 (sec (and real-time (abs real-sec)))
2629 ;; This is a bit convoluted, but basically we go
2630 ;; through the time units for years, weeks, etc,
2631 ;; and divide things to see whether that results
2632 ;; in positive answers.
2635 (if (zerop (setq num (ffloor (/ sec (cdr unit)))))
2636 ;; The (remaining) seconds are too few to
2637 ;; be divided into this time unit.
2639 ;; It's big enough, so we output it.
2640 (setq sec (- sec (* num (cdr unit))))
2642 (concat (if prev ", " "") (int-to-string
2644 " " (symbol-name (car unit))
2645 (if (> num 1) "s" ""))
2647 article-time-units "")
2648 ;; If dates are odd, then it might appear like the
2649 ;; article was sent in the future.
2652 " in the future"))))))
2653 ;; Display the date in proper English
2655 (let ((dtime (decode-time time)))
2658 (number-to-string (nth 3 dtime))
2659 (let ((digit (% (nth 3 dtime) 10)))
2661 ((memq (nth 3 dtime) '(11 12 13)) "th")
2667 (nth (1- (nth 4 dtime)) gnus-english-month-names)
2669 (number-to-string (nth 5 dtime))
2671 (format "%02d" (nth 2 dtime))
2673 (format "%02d" (nth 1 dtime)))))))
2675 (format "Date: %s (from Gnus)" date))))
2677 (defun article-date-local (&optional highlight)
2678 "Convert the current article date to the local timezone."
2679 (interactive (list t))
2680 (article-date-ut 'local highlight))
2682 (defun article-date-english (&optional highlight)
2683 "Convert the current article date to something that is proper English."
2684 (interactive (list t))
2685 (article-date-ut 'english highlight))
2687 (defun article-date-original (&optional highlight)
2688 "Convert the current article date to what it was originally.
2689 This is only useful if you have used some other date conversion
2690 function and want to see what the date was before converting."
2691 (interactive (list t))
2692 (article-date-ut 'original highlight))
2694 (defun article-date-lapsed (&optional highlight)
2695 "Convert the current article date to time lapsed since it was sent."
2696 (interactive (list t))
2697 (article-date-ut 'lapsed highlight))
2699 (defun article-update-date-lapsed ()
2700 "Function to be run from a timer to update the lapsed time line."
2701 (let (deactivate-mark)
2706 (set-buffer (window-buffer w))
2707 (when (eq major-mode 'gnus-article-mode)
2708 (goto-char (point-min))
2709 (when (re-search-forward "^X-Sent:" nil t)
2710 (article-date-lapsed t))))
2713 (defun gnus-start-date-timer (&optional n)
2714 "Start a timer to update the X-Sent header in the article buffers.
2715 The numerical prefix says how frequently (in seconds) the function
2720 (gnus-stop-date-timer)
2721 (setq article-lapsed-timer
2722 (nnheader-run-at-time 1 n 'article-update-date-lapsed)))
2724 (defun gnus-stop-date-timer ()
2725 "Stop the X-Sent timer."
2727 (when article-lapsed-timer
2728 (nnheader-cancel-timer article-lapsed-timer)
2729 (setq article-lapsed-timer nil)))
2731 (defun article-date-user (&optional highlight)
2732 "Convert the current article date to the user-defined format.
2733 This format is defined by the `gnus-article-time-format' variable."
2734 (interactive (list t))
2735 (article-date-ut 'user highlight))
2737 (defun article-date-iso8601 (&optional highlight)
2738 "Convert the current article date to ISO8601."
2739 (interactive (list t))
2740 (article-date-ut 'iso8601 highlight))
2742 ;; (defun article-show-all ()
2743 ;; "Show all hidden text in the article buffer."
2746 ;; (let ((buffer-read-only nil))
2747 ;; (gnus-article-unhide-text (point-min) (point-max)))))
2749 (defun article-remove-leading-whitespace ()
2750 "Remove excessive whitespace from all headers."
2754 (let ((buffer-read-only nil))
2755 (article-narrow-to-head)
2756 (goto-char (point-min))
2757 (while (re-search-forward "^[^ :]+: \\([ \t]+\\)" nil t)
2758 (delete-region (match-beginning 1) (match-end 1)))))))
2760 (defun article-emphasize (&optional arg)
2761 "Emphasize text according to `gnus-emphasis-alist'."
2762 (interactive (gnus-article-hidden-arg))
2763 (unless (gnus-article-check-hidden-text 'emphasis arg)
2767 (with-current-buffer gnus-summary-buffer
2768 gnus-article-emphasis-alist)
2770 gnus-emphasis-alist))
2771 (buffer-read-only nil)
2772 (props (append '(article-type emphasis)
2773 gnus-hidden-properties))
2774 regexp elem beg invisible visible face)
2777 (while (setq elem (pop alist))
2779 (setq regexp (car elem)
2780 invisible (nth 1 elem)
2781 visible (nth 2 elem)
2783 (while (re-search-forward regexp nil t)
2784 (when (and (match-beginning visible) (match-beginning invisible))
2785 (gnus-article-hide-text
2786 (match-beginning invisible) (match-end invisible) props)
2787 (gnus-article-unhide-text-type
2788 (match-beginning visible) (match-end visible) 'emphasis)
2789 (gnus-put-overlay-excluding-newlines
2790 (match-beginning visible) (match-end visible) 'face face)
2791 (gnus-add-wash-type 'emphasis)
2792 (goto-char (match-end invisible)))))))))
2794 (defun gnus-article-setup-highlight-words (&optional highlight-words)
2795 "Setup newsgroup emphasis alist."
2796 (unless gnus-article-emphasis-alist
2797 (let ((name (and gnus-newsgroup-name
2798 (gnus-group-real-name gnus-newsgroup-name))))
2799 (make-local-variable 'gnus-article-emphasis-alist)
2800 (setq gnus-article-emphasis-alist
2802 (let ((alist gnus-group-highlight-words-alist) elem highlight)
2803 (while (setq elem (pop alist))
2804 (when (and name (string-match (car elem) name))
2806 highlight (copy-sequence (cdr elem)))))
2808 (copy-sequence highlight-words)
2809 (if gnus-newsgroup-name
2810 (copy-sequence (gnus-group-find-parameter
2811 gnus-newsgroup-name 'highlight-words t)))
2812 gnus-emphasis-alist)))))
2815 (defvar gnus-summary-article-menu)
2816 (defvar gnus-summary-post-menu))
2818 ;;; Saving functions.
2820 (defun gnus-article-save (save-buffer file &optional num)
2821 "Save the currently selected article."
2822 (unless gnus-save-all-headers
2823 ;; Remove headers according to `gnus-saved-headers'.
2824 (let ((gnus-visible-headers
2825 (or gnus-saved-headers gnus-visible-headers))
2826 (gnus-article-buffer save-buffer))
2828 (set-buffer save-buffer)
2829 (article-hide-headers 1 t))))
2830 (save-window-excursion
2831 (if (not gnus-default-article-saver)
2832 (error "No default saver is defined")
2833 ;; !!! Magic! The saving functions all save
2834 ;; `gnus-save-article-buffer' (or so they think), but we
2835 ;; bind that variable to our save-buffer.
2836 (set-buffer gnus-article-buffer)
2837 (let* ((gnus-save-article-buffer save-buffer)
2840 ((not gnus-prompt-before-saving) 'default)
2841 ((eq gnus-prompt-before-saving 'always) nil)
2843 (gnus-number-of-articles-to-be-saved
2844 (when (eq gnus-prompt-before-saving t)
2846 (set-buffer gnus-article-current-summary)
2847 (funcall gnus-default-article-saver filename)))))
2849 (defun gnus-read-save-file-name (prompt &optional filename
2850 function group headers variable)
2852 (funcall function group headers (symbol-value variable)))
2857 ((eq filename 'default)
2863 (let* ((split-name (gnus-get-split-value gnus-split-methods))
2866 (if (and gnus-number-of-articles-to-be-saved
2867 (> gnus-number-of-articles-to-be-saved 1))
2868 (format "these %d articles"
2869 gnus-number-of-articles-to-be-saved)
2872 ;; Let the split methods have their say.
2874 ;; No split name was found.
2877 (concat prompt " (default "
2878 (file-name-nondirectory default-name) ") ")
2879 (file-name-directory default-name)
2881 ;; A single group name is returned.
2882 ((stringp split-name)
2884 (funcall function split-name headers
2885 (symbol-value variable)))
2887 (concat prompt " (default "
2888 (file-name-nondirectory default-name) ") ")
2889 (file-name-directory default-name)
2891 ;; A single split name was found
2892 ((= 1 (length split-name))
2893 (let* ((name (expand-file-name
2895 gnus-article-save-directory))
2896 (dir (cond ((file-directory-p name)
2897 (file-name-as-directory name))
2898 ((file-exists-p name) name)
2899 (t gnus-article-save-directory))))
2901 (concat prompt " (default " name ") ")
2903 ;; A list of splits was found.
2905 (setq split-name (nreverse split-name))
2907 (let ((file-name-history
2908 (nconc split-name file-name-history)))
2912 (concat prompt " (`M-p' for defaults) ")
2913 gnus-article-save-directory
2915 gnus-article-save-directory)))
2916 (car (push result file-name-history)))))))
2917 ;; Create the directory.
2918 (gnus-make-directory (file-name-directory file))
2919 ;; If we have read a directory, we append the default file name.
2920 (when (file-directory-p file)
2921 (setq file (expand-file-name (file-name-nondirectory
2923 (file-name-as-directory file))))
2924 ;; Possibly translate some characters.
2925 (nnheader-translate-file-chars file))))))
2926 (gnus-make-directory (file-name-directory result))
2927 (set variable result)))
2929 (defun gnus-article-archive-name (group)
2930 "Return the first instance of an \"Archive-name\" in the current buffer."
2931 (let ((case-fold-search t))
2932 (when (re-search-forward "archive-name: *\\([^ \n\t]+\\)[ \t]*$" nil t)
2933 (nnheader-concat gnus-article-save-directory
2934 (match-string 1)))))
2936 (defun gnus-article-nndoc-name (group)
2937 "If GROUP is an nndoc group, return the name of the parent group."
2938 (when (eq (car (gnus-find-method-for-group group)) 'nndoc)
2939 (gnus-group-get-parameter group 'save-article-group)))
2941 (defun gnus-summary-save-in-rmail (&optional filename)
2942 "Append this article to Rmail file.
2943 Optional argument FILENAME specifies file name.
2944 Directory to save to is default to `gnus-article-save-directory'."
2945 (setq filename (gnus-read-save-file-name
2946 "Save %s in rmail file:" filename
2947 gnus-rmail-save-name gnus-newsgroup-name
2948 gnus-current-headers 'gnus-newsgroup-last-rmail))
2949 (gnus-eval-in-buffer-window gnus-save-article-buffer
2953 (gnus-output-to-rmail filename))))
2956 (defun gnus-summary-save-in-mail (&optional filename)
2957 "Append this article to Unix mail file.
2958 Optional argument FILENAME specifies file name.
2959 Directory to save to is default to `gnus-article-save-directory'."
2960 (setq filename (gnus-read-save-file-name
2961 "Save %s in Unix mail file:" filename
2962 gnus-mail-save-name gnus-newsgroup-name
2963 gnus-current-headers 'gnus-newsgroup-last-mail))
2964 (gnus-eval-in-buffer-window gnus-save-article-buffer
2968 (if (and (file-readable-p filename)
2969 (mail-file-babyl-p filename))
2970 (rmail-output-to-rmail-file filename t)
2971 (gnus-output-to-mail filename)))))
2974 (defun gnus-summary-save-in-file (&optional filename overwrite)
2975 "Append this article to file.
2976 Optional argument FILENAME specifies file name.
2977 Directory to save to is default to `gnus-article-save-directory'."
2978 (setq filename (gnus-read-save-file-name
2979 "Save %s in file:" filename
2980 gnus-file-save-name gnus-newsgroup-name
2981 gnus-current-headers 'gnus-newsgroup-last-file))
2982 (gnus-eval-in-buffer-window gnus-save-article-buffer
2986 (when (and overwrite
2987 (file-exists-p filename))
2988 (delete-file filename))
2989 (gnus-output-to-file filename))))
2992 (defun gnus-summary-write-to-file (&optional filename)
2993 "Write this article to a file, overwriting it if the file exists.
2994 Optional argument FILENAME specifies file name.
2995 The directory to save in defaults to `gnus-article-save-directory'."
2996 (gnus-summary-save-in-file nil t))
2998 (defun gnus-summary-save-body-in-file (&optional filename)
2999 "Append this article body to a file.
3000 Optional argument FILENAME specifies file name.
3001 The directory to save in defaults to `gnus-article-save-directory'."
3002 (setq filename (gnus-read-save-file-name
3003 "Save %s body in file:" filename
3004 gnus-file-save-name gnus-newsgroup-name
3005 gnus-current-headers 'gnus-newsgroup-last-file))
3006 (gnus-eval-in-buffer-window gnus-save-article-buffer
3010 (when (article-goto-body)
3011 (narrow-to-region (point) (point-max)))
3012 (gnus-output-to-file filename))))
3015 (defun gnus-summary-save-in-pipe (&optional command)
3016 "Pipe this article to subprocess."
3018 (cond ((and (eq command 'default)
3019 gnus-last-shell-command)
3020 gnus-last-shell-command)
3025 "Shell command on %s: "
3026 (if (and gnus-number-of-articles-to-be-saved
3027 (> gnus-number-of-articles-to-be-saved 1))
3028 (format "these %d articles"
3029 gnus-number-of-articles-to-be-saved)
3031 gnus-last-shell-command))))
3032 (when (string-equal command "")
3033 (if gnus-last-shell-command
3034 (setq command gnus-last-shell-command)
3035 (error "A command is required")))
3036 (gnus-eval-in-buffer-window gnus-article-buffer
3039 (shell-command-on-region (point-min) (point-max) command nil)))
3040 (setq gnus-last-shell-command command))
3042 (defun gnus-summary-pipe-to-muttprint (&optional command)
3043 "Pipe this article to muttprint."
3044 (setq command (read-string
3045 "Print using command: " gnus-summary-muttprint-program
3046 nil gnus-summary-muttprint-program))
3047 (gnus-summary-save-in-pipe command))
3049 ;;; Article file names when saving.
3051 (defun gnus-capitalize-newsgroup (newsgroup)
3052 "Capitalize NEWSGROUP name."
3053 (when (not (zerop (length newsgroup)))
3054 (concat (char-to-string (upcase (aref newsgroup 0)))
3055 (substring newsgroup 1))))
3057 (defun gnus-Numeric-save-name (newsgroup headers &optional last-file)
3058 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
3059 If variable `gnus-use-long-file-name' is non-nil, it is ~/News/News.group/num.
3060 Otherwise, it is like ~/News/news/group/num."
3063 (concat (if (gnus-use-long-file-name 'not-save)
3064 (gnus-capitalize-newsgroup newsgroup)
3065 (gnus-newsgroup-directory-form newsgroup))
3066 "/" (int-to-string (mail-header-number headers)))
3067 gnus-article-save-directory)))
3069 (string-equal (file-name-directory default)
3070 (file-name-directory last-file))
3071 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
3073 (or last-file default))))
3075 (defun gnus-numeric-save-name (newsgroup headers &optional last-file)
3076 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
3077 If variable `gnus-use-long-file-name' is non-nil, it is
3078 ~/News/news.group/num. Otherwise, it is like ~/News/news/group/num."
3081 (concat (if (gnus-use-long-file-name 'not-save)
3083 (gnus-newsgroup-directory-form newsgroup))
3084 "/" (int-to-string (mail-header-number headers)))
3085 gnus-article-save-directory)))
3087 (string-equal (file-name-directory default)
3088 (file-name-directory last-file))
3089 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
3091 (or last-file default))))
3093 (defun gnus-plain-save-name (newsgroup headers &optional last-file)
3094 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
3095 If variable `gnus-use-long-file-name' is non-nil, it is
3096 ~/News/news.group. Otherwise, it is like ~/News/news/group/news."
3099 (if (gnus-use-long-file-name 'not-save)
3102 (expand-file-name "news" (gnus-newsgroup-directory-form newsgroup))
3104 gnus-article-save-directory)))
3106 (defun gnus-sender-save-name (newsgroup headers &optional last-file)
3107 "Generate file name from sender."
3108 (let ((from (mail-header-from headers)))
3110 (if (and from (string-match "\\([^ <]+\\)@" from))
3111 (match-string 1 from)
3113 gnus-article-save-directory)))
3115 (defun article-verify-x-pgp-sig ()
3118 (if (gnus-buffer-live-p gnus-original-article-buffer)
3119 (let ((sig (with-current-buffer gnus-original-article-buffer
3120 (gnus-fetch-field "X-PGP-Sig")))
3124 (mml2015-clear-verify-function))
3126 (insert-buffer gnus-original-article-buffer)
3127 (setq items (split-string sig))
3128 (message-narrow-to-head)
3129 (let ((inhibit-point-motion-hooks t)
3130 (case-fold-search t))
3131 ;; Don't verify multiple headers.
3132 (setq headers (mapconcat (lambda (header)
3134 (mail-fetch-field header) "\n"))
3135 (split-string (nth 1 items) ",") "")))
3136 (delete-region (point-min) (point-max))
3137 (insert "-----BEGIN PGP SIGNED MESSAGE-----\n\n")
3138 (insert "X-Signed-Headers: " (nth 1 items) "\n")
3143 (if (looking-at "^-")
3146 (insert "\n-----BEGIN PGP SIGNATURE-----\n")
3147 (insert "Version: " (car items) "\n\n")
3148 (insert (mapconcat 'identity (cddr items) "\n"))
3149 (insert "\n-----END PGP SIGNATURE-----\n")
3150 (let ((mm-security-handle (list (format "multipart/signed"))))
3151 (mml2015-clean-buffer)
3152 (let ((coding-system-for-write (or gnus-newsgroup-charset
3154 (funcall (mml2015-clear-verify-function)))
3156 (or (mm-handle-multipart-ctl-parameter
3157 mm-security-handle 'gnus-details)
3158 (mm-handle-multipart-ctl-parameter
3159 mm-security-handle 'gnus-info)))))
3161 (let (buffer-read-only bface eface)
3163 (message-narrow-to-head)
3164 (goto-char (point-max))
3166 (setq bface (get-text-property (gnus-point-at-bol) 'face)
3167 eface (get-text-property (1- (gnus-point-at-eol)) 'face))
3168 (message-remove-header "X-Gnus-PGP-Verify")
3169 (if (re-search-forward "^X-PGP-Sig:" nil t)
3171 (goto-char (point-max)))
3172 (narrow-to-region (point) (point))
3173 (insert "X-Gnus-PGP-Verify: " info "\n")
3174 (goto-char (point-min))
3177 (if (not (looking-at "^[ \t]"))
3181 (goto-char (point-min))
3182 (when (looking-at "\\([^:]+\\): *")
3183 (put-text-property (match-beginning 1) (1+ (match-end 1))
3185 (put-text-property (match-end 0) (point-max)
3186 'face eface)))))))))
3188 (defun article-verify-cancel-lock ()
3189 "Verify Cancel-Lock header."
3191 (if (gnus-buffer-live-p gnus-original-article-buffer)
3192 (canlock-verify gnus-original-article-buffer)))
3199 (setq afunc (car func)
3202 gfunc (intern (format "gnus-%s" func))))
3204 (when (fboundp afunc)
3205 `(lambda (&optional interactive &rest args)
3206 ,(documentation afunc t)
3207 (interactive (list t))
3209 (set-buffer gnus-article-buffer)
3211 (call-interactively ',afunc)
3212 (apply ',afunc args))))))))
3213 '(article-hide-headers
3214 article-verify-x-pgp-sig
3215 article-verify-cancel-lock
3216 article-hide-boring-headers
3217 article-treat-overstrike
3218 article-fill-long-lines
3219 article-capitalize-sentences
3221 article-remove-leading-whitespace
3222 article-display-x-face
3223 article-de-quoted-unreadable
3224 article-de-base64-unreadable
3227 article-unsplit-urls
3228 article-hide-list-identifiers
3230 article-strip-banner
3233 article-hide-signature
3234 article-strip-headers-in-body
3235 article-remove-trailing-blank-lines
3236 article-strip-leading-blank-lines
3237 article-strip-multiple-blank-lines
3238 article-strip-leading-space
3239 article-strip-trailing-space
3240 article-strip-blank-lines
3241 article-strip-all-blank-lines
3242 article-replace-with-quoted-text
3244 article-date-english
3245 article-date-iso8601
3246 article-date-original
3248 article-decode-mime-words
3249 article-decode-charset
3250 article-decode-encoded-words
3254 article-treat-dumbquotes
3255 article-normalize-headers
3256 ;; (article-show-all . gnus-article-show-all-headers)
3260 ;;; Gnus article mode
3263 (put 'gnus-article-mode 'mode-class 'special)
3265 (set-keymap-parent gnus-article-mode-map widget-keymap)
3267 (gnus-define-keys gnus-article-mode-map
3268 " " gnus-article-goto-next-page
3269 "\177" gnus-article-goto-prev-page
3270 [delete] gnus-article-goto-prev-page
3271 [backspace] gnus-article-goto-prev-page
3272 "\C-c^" gnus-article-refer-article
3273 "h" gnus-article-show-summary
3274 "s" gnus-article-show-summary
3275 "\C-c\C-m" gnus-article-mail
3276 "?" gnus-article-describe-briefly
3277 "e" gnus-summary-edit-article
3278 "<" beginning-of-buffer
3280 "\C-c\C-i" gnus-info-find-node
3282 "R" gnus-article-reply-with-original
3283 "F" gnus-article-followup-with-original
3284 "\C-hk" gnus-article-describe-key
3285 "\C-hc" gnus-article-describe-key-briefly
3287 "\C-d" gnus-article-read-summary-keys
3288 "\M-*" gnus-article-read-summary-keys
3289 "\M-#" gnus-article-read-summary-keys
3290 "\M-^" gnus-article-read-summary-keys
3291 "\M-g" gnus-article-read-summary-keys)
3293 (substitute-key-definition
3294 'undefined 'gnus-article-read-summary-keys gnus-article-mode-map)
3296 (defun gnus-article-make-menu-bar ()
3297 (unless (boundp 'gnus-article-commands-menu)
3298 (gnus-summary-make-menu-bar))
3299 (gnus-turn-off-edit-menu 'article)
3300 (unless (boundp 'gnus-article-article-menu)
3302 gnus-article-article-menu gnus-article-mode-map ""
3304 ["Scroll forwards" gnus-article-goto-next-page t]
3305 ["Scroll backwards" gnus-article-goto-prev-page t]
3306 ["Show summary" gnus-article-show-summary t]
3307 ["Fetch Message-ID at point" gnus-article-refer-article t]
3308 ["Mail to address at point" gnus-article-mail t]
3309 ["Send a bug report" gnus-bug t]))
3312 gnus-article-treatment-menu gnus-article-mode-map ""
3313 ;; Fixme: this should use :active (and maybe :visible).
3315 ["Hide headers" gnus-article-hide-headers t]
3316 ["Hide signature" gnus-article-hide-signature t]
3317 ["Hide citation" gnus-article-hide-citation t]
3318 ["Treat overstrike" gnus-article-treat-overstrike t]
3319 ["Remove carriage return" gnus-article-remove-cr t]
3320 ["Remove leading whitespace" gnus-article-remove-leading-whitespace t]
3321 ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]
3322 ["Remove base64" gnus-article-de-base64-unreadable t]
3323 ["Treat html" gnus-article-wash-html t]
3324 ["Remove newlines from within URLs" gnus-article-unsplit-urls t]
3325 ["Decode HZ" gnus-article-decode-HZ t]))
3327 ;; Note "Commands" menu is defined in gnus-sum.el for consistency
3329 ;; Note "Post" menu is defined in gnus-sum.el for consistency
3331 (gnus-run-hooks 'gnus-article-menu-hook)))
3333 ;; Fixme: do something for the Emacs tool bar in Article mode a la
3336 (defun gnus-article-mode ()
3337 "Major mode for displaying an article.
3339 All normal editing commands are switched off.
3341 The following commands are available in addition to all summary mode
3343 \\<gnus-article-mode-map>
3344 \\[gnus-article-next-page]\t Scroll the article one page forwards
3345 \\[gnus-article-prev-page]\t Scroll the article one page backwards
3346 \\[gnus-article-refer-article]\t Go to the article referred to by an article id near point
3347 \\[gnus-article-show-summary]\t Display the summary buffer
3348 \\[gnus-article-mail]\t Send a reply to the address near point
3349 \\[gnus-article-describe-briefly]\t Describe the current mode briefly
3350 \\[gnus-info-find-node]\t Go to the Gnus info node"
3352 (gnus-simplify-mode-line)
3353 (setq mode-name "Article")
3354 (setq major-mode 'gnus-article-mode)
3355 (make-local-variable 'minor-mode-alist)
3356 (use-local-map gnus-article-mode-map)
3357 (when (gnus-visual-p 'article-menu 'menu)
3358 (gnus-article-make-menu-bar))
3359 (gnus-update-format-specifications nil 'article-mode)
3360 (set (make-local-variable 'page-delimiter) gnus-page-delimiter)
3361 (make-local-variable 'gnus-page-broken)
3362 (make-local-variable 'gnus-button-marker-list)
3363 (make-local-variable 'gnus-article-current-summary)
3364 (make-local-variable 'gnus-article-mime-handles)
3365 (make-local-variable 'gnus-article-decoded-p)
3366 (make-local-variable 'gnus-article-mime-handle-alist)
3367 (make-local-variable 'gnus-article-wash-types)
3368 (make-local-variable 'gnus-article-image-alist)
3369 (make-local-variable 'gnus-article-charset)
3370 (make-local-variable 'gnus-article-ignored-charsets)
3371 (gnus-set-default-directory)
3372 (buffer-disable-undo)
3373 (setq buffer-read-only t)
3374 (set-syntax-table gnus-article-mode-syntax-table)
3375 (mm-enable-multibyte)
3376 (gnus-run-hooks 'gnus-article-mode-hook))
3378 (defun gnus-article-setup-buffer ()
3379 "Initialize the article buffer."
3380 (let* ((name (if gnus-single-article-buffer "*Article*"
3381 (concat "*Article " gnus-newsgroup-name "*")))
3383 (progn (string-match "\\*Article" name)
3384 (concat " *Original Article"
3385 (substring name (match-end 0))))))
3386 (setq gnus-article-buffer name)
3387 (setq gnus-original-article-buffer original)
3388 (setq gnus-article-mime-handle-alist nil)
3389 ;; This might be a variable local to the summary buffer.
3390 (unless gnus-single-article-buffer
3392 (set-buffer gnus-summary-buffer)
3393 (setq gnus-article-buffer name)
3394 (setq gnus-original-article-buffer original)
3395 (gnus-set-global-variables)))
3396 (gnus-article-setup-highlight-words)
3397 ;; Init original article buffer.
3399 (set-buffer (gnus-get-buffer-create gnus-original-article-buffer))
3400 (mm-enable-multibyte)
3401 (setq major-mode 'gnus-original-article-mode)
3402 (make-local-variable 'gnus-original-article))
3403 (if (get-buffer name)
3406 (when gnus-article-mime-handles
3407 (mm-destroy-parts gnus-article-mime-handles)
3408 (setq gnus-article-mime-handles nil))
3409 ;; Set it to nil in article-buffer!
3410 (setq gnus-article-mime-handle-alist nil)
3411 (buffer-disable-undo)
3412 (setq buffer-read-only t)
3413 (unless (eq major-mode 'gnus-article-mode)
3414 (gnus-article-mode))
3417 (set-buffer (gnus-get-buffer-create name))
3419 (make-local-variable 'gnus-summary-buffer)
3420 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3421 (current-buffer)))))
3423 ;; Set article window start at LINE, where LINE is the number of lines
3424 ;; from the head of the article.
3425 (defun gnus-article-set-window-start (&optional line)
3427 (gnus-get-buffer-window gnus-article-buffer t)
3429 (set-buffer gnus-article-buffer)
3430 (goto-char (point-min))
3433 (gnus-message 6 "Moved to bookmark")
3434 (search-forward "\n\n" nil t)
3438 (defun gnus-article-prepare (article &optional all-headers header)
3439 "Prepare ARTICLE in article mode buffer.
3440 ARTICLE should either be an article number or a Message-ID.
3441 If ARTICLE is an id, HEADER should be the article headers.
3442 If ALL-HEADERS is non-nil, no headers are hidden."
3444 ;; Make sure we start in a summary buffer.
3445 (unless (eq major-mode 'gnus-summary-mode)
3446 (set-buffer gnus-summary-buffer))
3447 (setq gnus-summary-buffer (current-buffer))
3448 (let* ((gnus-article (if header (mail-header-number header) article))
3449 (summary-buffer (current-buffer))
3450 (gnus-tmp-internal-hook gnus-article-internal-prepare-hook)
3451 (group gnus-newsgroup-name)
3454 (gnus-article-setup-buffer)
3455 (set-buffer gnus-article-buffer)
3456 ;; Deactivate active regions.
3457 (when (and (boundp 'transient-mark-mode)
3458 transient-mark-mode)
3459 (setq mark-active nil))
3460 (if (not (setq result (let ((buffer-read-only nil))
3461 (gnus-request-article-this-buffer
3463 ;; There is no such article.
3465 (when (and (numberp article)
3466 (not (memq article gnus-newsgroup-sparse)))
3467 (setq gnus-article-current
3468 (cons gnus-newsgroup-name article))
3469 (set-buffer gnus-summary-buffer)
3470 (setq gnus-current-article article)
3471 (if (eq (gnus-article-mark article) gnus-undownloaded-mark)
3473 (gnus-summary-set-agent-mark article)
3474 (message "Message marked for downloading"))
3475 (gnus-summary-mark-article article gnus-canceled-mark)
3476 (unless (memq article gnus-newsgroup-sparse)
3477 (gnus-error 1 "No such article (may have expired or been canceled)")))))
3478 (if (or (eq result 'pseudo)
3479 (eq result 'nneething))
3482 (set-buffer summary-buffer)
3483 (push article gnus-newsgroup-history)
3484 (setq gnus-last-article gnus-current-article
3485 gnus-current-article 0
3486 gnus-current-headers nil
3487 gnus-article-current nil)
3488 (if (eq result 'nneething)
3489 (gnus-configure-windows 'summary)
3490 (gnus-configure-windows 'article))
3491 (gnus-set-global-variables))
3492 (let ((gnus-article-mime-handle-alist-1
3493 gnus-article-mime-handle-alist))
3494 (gnus-set-mode-line 'article)))
3495 ;; The result from the `request' was an actual article -
3496 ;; or at least some text that is now displayed in the
3498 (when (and (numberp article)
3499 (not (eq article gnus-current-article)))
3500 ;; Seems like a new article has been selected.
3501 ;; `gnus-current-article' must be an article number.
3503 (set-buffer summary-buffer)
3504 (push article gnus-newsgroup-history)
3505 (setq gnus-last-article gnus-current-article
3506 gnus-current-article article
3507 gnus-current-headers
3508 (gnus-summary-article-header gnus-current-article)
3509 gnus-article-current
3510 (cons gnus-newsgroup-name gnus-current-article))
3511 (unless (vectorp gnus-current-headers)
3512 (setq gnus-current-headers nil))
3513 (gnus-summary-goto-subject gnus-current-article)
3514 (when (gnus-summary-show-thread)
3515 ;; If the summary buffer really was folded, the
3516 ;; previous goto may not actually have gone to
3517 ;; the right article, but the thread root instead.
3519 (gnus-summary-goto-subject gnus-current-article))
3520 (gnus-run-hooks 'gnus-mark-article-hook)
3521 (gnus-set-mode-line 'summary)
3522 (when (gnus-visual-p 'article-highlight 'highlight)
3523 (gnus-run-hooks 'gnus-visual-mark-article-hook))
3524 ;; Set the global newsgroup variables here.
3525 (gnus-set-global-variables)
3526 (setq gnus-have-all-headers
3527 (or all-headers gnus-show-all-headers))))
3529 (gnus-configure-windows 'article))
3530 (when (or (numberp article)
3532 (gnus-article-prepare-display)
3534 (goto-char (point-min))
3535 (setq gnus-page-broken
3536 (when gnus-break-pages
3537 (gnus-narrow-to-page)
3539 (let ((gnus-article-mime-handle-alist-1
3540 gnus-article-mime-handle-alist))
3541 (gnus-set-mode-line 'article))
3545 (set-window-point (get-buffer-window (current-buffer)) (point))
3546 (gnus-configure-windows 'article)
3550 (defun gnus-article-prepare-display ()
3551 "Make the current buffer look like a nice article."
3552 ;; Hooks for getting information from the article.
3553 ;; This hook must be called before being narrowed.
3554 (let ((gnus-article-buffer (current-buffer))
3556 (unless (eq major-mode 'gnus-article-mode)
3557 (gnus-article-mode))
3558 (setq buffer-read-only nil
3559 gnus-article-wash-types nil
3560 gnus-article-image-alist nil)
3561 (gnus-run-hooks 'gnus-tmp-internal-hook)
3562 (when gnus-display-mime-function
3563 (funcall gnus-display-mime-function))
3564 (gnus-run-hooks 'gnus-article-prepare-hook)))
3567 ;;; Gnus MIME viewing functions
3570 (defvar gnus-mime-button-line-format "%{%([%p. %d%T]%)%}%e\n"
3571 "Format of the MIME buttons.
3573 Valid specifiers include:
3575 %T MIME type, along with additional info
3576 %n The `name' parameter
3577 %d The description, if any
3578 %l The length of the encoded part
3579 %p The part identifier number
3580 %e Dots if the part isn't displayed
3582 General format specifiers can also be used. See
3583 (gnus)Formatting Variables.")
3585 (defvar gnus-mime-button-line-format-alist
3586 '((?t gnus-tmp-type ?s)
3587 (?T gnus-tmp-type-long ?s)
3588 (?n gnus-tmp-name ?s)
3589 (?d gnus-tmp-description ?s)
3591 (?l gnus-tmp-length ?d)
3592 (?e gnus-tmp-dots ?s)))
3594 (defvar gnus-mime-button-commands
3595 '((gnus-article-press-button "\r" "Toggle Display")
3596 (gnus-mime-view-part "v" "View Interactively...")
3597 (gnus-mime-view-part-as-type "t" "View As Type...")
3598 (gnus-mime-view-part-as-charset "C" "View As charset...")
3599 (gnus-mime-save-part "o" "Save...")
3600 (gnus-mime-save-part-and-strip "\C-o" "Save and Strip")
3601 (gnus-mime-copy-part "c" "View As Text, In Other Buffer")
3602 (gnus-mime-inline-part "i" "View As Text, In This Buffer")
3603 (gnus-mime-view-part-internally "E" "View Internally")
3604 (gnus-mime-view-part-externally "e" "View Externally")
3605 (gnus-mime-print-part "p" "Print")
3606 (gnus-mime-pipe-part "|" "Pipe To Command...")
3607 (gnus-mime-action-on-part "." "Take action on the part")))
3609 (defun gnus-article-mime-part-status ()
3610 (if gnus-article-mime-handle-alist-1
3611 (if (eq 1 (length gnus-article-mime-handle-alist-1))
3613 (format " (%d parts)" (length gnus-article-mime-handle-alist-1)))
3616 (defvar gnus-mime-button-map
3617 (let ((map (make-sparse-keymap)))
3618 (unless (>= (string-to-number emacs-version) 21)
3619 ;; XEmacs doesn't care.
3620 (set-keymap-parent map gnus-article-mode-map))
3621 (define-key map gnus-mouse-2 'gnus-article-push-button)
3622 (define-key map gnus-down-mouse-3 'gnus-mime-button-menu)
3623 (dolist (c gnus-mime-button-commands)
3624 (define-key map (cadr c) (car c)))
3627 (defun gnus-mime-button-menu (event)
3628 "Construct a context-sensitive menu of MIME commands."
3630 (save-window-excursion
3631 (let ((pos (event-start event)))
3632 (select-window (posn-window pos))
3633 (goto-char (posn-point pos))
3634 (gnus-article-check-buffer)
3635 (let ((response (x-popup-menu
3637 ("" ,@(mapcar (lambda (c)
3638 (cons (caddr c) (car c)))
3639 gnus-mime-button-commands))))))
3641 (call-interactively response))))))
3643 (defun gnus-mime-view-all-parts (&optional handles)
3644 "View all the MIME parts."
3646 (save-current-buffer
3647 (set-buffer gnus-article-buffer)
3648 (let ((handles (or handles gnus-article-mime-handles))
3649 (mail-parse-charset gnus-newsgroup-charset)
3650 (mail-parse-ignored-charsets
3651 (with-current-buffer gnus-summary-buffer
3652 gnus-newsgroup-ignored-charsets)))
3654 (mm-remove-parts handles)
3655 (goto-char (point-min))
3656 (or (search-forward "\n\n") (goto-char (point-max)))
3657 (let (buffer-read-only)
3658 (delete-region (point) (point-max))
3659 (mm-display-parts handles))))))
3661 (defun gnus-mime-save-part-and-strip ()
3662 "Save the MIME part under point then replace it with an external body."
3664 (gnus-article-check-buffer)
3665 (let* ((data (get-text-property (point) 'gnus-data))
3667 (handles gnus-article-mime-handles))
3668 (if (mm-multiple-handles gnus-article-mime-handles)
3669 (error "This function is not implemented"))
3670 (setq file (and data (mm-save-part data)))
3672 (with-current-buffer (mm-handle-buffer data)
3674 (insert "Content-Type: " (mm-handle-media-type data))
3675 (mml-insert-parameter-string (cdr (mm-handle-type data))
3678 (insert "Content-ID: " (message-make-message-id) "\n")
3679 (insert "Content-Transfer-Encoding: binary\n")
3682 (cdr (mm-make-handle nil
3683 `("message/external-body"
3684 (access-type . "LOCAL-FILE")
3686 (set-buffer gnus-summary-buffer)
3687 (gnus-article-edit-article
3690 (let ((mail-parse-charset (or gnus-article-charset
3691 ',gnus-newsgroup-charset))
3692 (mail-parse-ignored-charsets
3693 (or gnus-article-ignored-charsets
3694 ',gnus-newsgroup-ignored-charsets))
3695 (mbl mml-buffer-list))
3696 (setq mml-buffer-list nil)
3697 (insert-buffer gnus-original-article-buffer)
3698 (mime-to-mml ',handles)
3699 (setq gnus-article-mime-handles nil)
3700 (let ((mbl1 mml-buffer-list))
3701 (setq mml-buffer-list mbl)
3702 (set (make-local-variable 'mml-buffer-list) mbl1))
3703 ;; LOCAL argument of add-hook differs between GNU Emacs
3704 ;; and XEmacs. make-local-hook makes sure they are local.
3705 (make-local-hook 'kill-buffer-hook)
3706 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t)))
3707 `(lambda (no-highlight)
3708 (let ((mail-parse-charset (or gnus-article-charset
3709 ',gnus-newsgroup-charset))
3710 (message-options message-options)
3711 (message-options-set-recipient)
3712 (mail-parse-ignored-charsets
3713 (or gnus-article-ignored-charsets
3714 ',gnus-newsgroup-ignored-charsets)))
3716 (mml-destroy-buffers)
3717 (remove-hook 'kill-buffer-hook
3718 'mml-destroy-buffers t)
3719 (kill-local-variable 'mml-buffer-list))
3720 (gnus-summary-edit-article-done
3721 ,(or (mail-header-references gnus-current-headers) "")
3722 ,(gnus-group-read-only-p)
3723 ,gnus-summary-buffer no-highlight))))))
3725 (defun gnus-mime-save-part ()
3726 "Save the MIME part under point."
3728 (gnus-article-check-buffer)
3729 (let ((data (get-text-property (point) 'gnus-data)))
3731 (mm-save-part data))))
3733 (defun gnus-mime-pipe-part ()
3734 "Pipe the MIME part under point to a process."
3736 (gnus-article-check-buffer)
3737 (let ((data (get-text-property (point) 'gnus-data)))
3739 (mm-pipe-part data))))
3741 (defun gnus-mime-view-part ()
3742 "Interactively choose a viewing method for the MIME part under point."
3744 (gnus-article-check-buffer)
3745 (let ((data (get-text-property (point) 'gnus-data)))
3747 (setq gnus-article-mime-handles
3749 gnus-article-mime-handles (setq data (copy-sequence data))))
3750 (mm-interactively-view-part data))))
3752 (defun gnus-mime-view-part-as-type-internal ()
3753 (gnus-article-check-buffer)
3754 (let* ((name (mail-content-type-get
3755 (mm-handle-type (get-text-property (point) 'gnus-data))
3757 (def-type (and name (mm-default-file-encoding name))))
3758 (and def-type (cons def-type 0))))
3760 (defun gnus-mime-view-part-as-type (&optional mime-type)
3761 "Choose a MIME media type, and view the part as such."
3764 (setq mime-type (completing-read
3765 "View as MIME type: "
3766 (mapcar #'list (mailcap-mime-types))
3768 (gnus-mime-view-part-as-type-internal))))
3769 (gnus-article-check-buffer)
3770 (let ((handle (get-text-property (point) 'gnus-data)))
3773 (mm-make-handle (mm-handle-buffer handle)
3774 (cons mime-type (cdr (mm-handle-type handle)))
3775 (mm-handle-encoding handle)
3776 (mm-handle-undisplayer handle)
3777 (mm-handle-disposition handle)
3778 (mm-handle-description handle)
3780 (mm-handle-id handle)))
3781 (setq gnus-article-mime-handles
3782 (mm-merge-handles gnus-article-mime-handles handle))
3783 (gnus-mm-display-part handle))))
3785 (defun gnus-mime-copy-part (&optional handle)
3786 "Put the MIME part under point into a new buffer."
3788 (gnus-article-check-buffer)
3789 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
3790 (contents (and handle (mm-get-part handle)))
3792 (file-name-nondirectory
3794 (mail-content-type-get (mm-handle-type handle) 'name)
3795 (mail-content-type-get (mm-handle-type handle)
3798 (buffer (and base (generate-new-buffer base))))
3800 (switch-to-buffer buffer)
3802 ;; We do it this way to make `normal-mode' set the appropriate mode.
3805 (setq buffer-file-name (expand-file-name base))
3807 (setq buffer-file-name nil))
3808 (goto-char (point-min)))))
3810 (defun gnus-mime-print-part (&optional handle filename)
3811 "Print the MIME part under point."
3812 (interactive (list nil (ps-print-preprint current-prefix-arg)))
3813 (gnus-article-check-buffer)
3814 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
3815 (contents (and handle (mm-get-part handle)))
3816 (file (mm-make-temp-file (expand-file-name "mm." mm-tmp-directory)))
3817 (printer (mailcap-mime-info (mm-handle-type handle) "print")))
3822 (with-temp-file file
3824 (call-process shell-file-name nil
3825 (generate-new-buffer " *mm*")
3827 shell-command-switch
3829 printer file (mm-handle-type handle))))
3833 (gnus-print-buffer))
3834 (ps-despool filename)))))
3836 (defun gnus-mime-inline-part (&optional handle arg)
3837 "Insert the MIME part under point into the current buffer."
3838 (interactive (list nil current-prefix-arg))
3839 (gnus-article-check-buffer)
3840 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
3845 (if (and (not arg) (mm-handle-undisplayer handle))
3846 (mm-remove-part handle)
3847 (setq contents (mm-get-part handle))
3850 (setq charset (or (mail-content-type-get
3851 (mm-handle-type handle) 'charset)
3852 gnus-newsgroup-charset)))
3854 (if (mm-handle-undisplayer handle)
3855 (mm-remove-part handle))
3858 gnus-summary-show-article-charset-alist))
3859 (mm-read-coding-system "Charset: ")))))
3861 (mm-insert-inline handle
3863 (setq charset (mm-charset-to-coding-system
3865 (not (eq charset 'ascii)))
3866 (mm-decode-coding-string contents charset)
3870 (defun gnus-mime-view-part-as-charset (&optional handle arg)
3871 "Insert the MIME part under point into the current buffer using the
3873 (interactive (list nil current-prefix-arg))
3874 (gnus-article-check-buffer)
3875 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
3880 (if (mm-handle-undisplayer handle)
3881 (mm-remove-part handle))
3882 (let ((gnus-newsgroup-charset
3884 gnus-summary-show-article-charset-alist))
3885 (mm-read-coding-system "Charset: ")))
3886 (gnus-newsgroup-ignored-charsets 'gnus-all))
3887 (gnus-article-press-button)))))
3889 (defun gnus-mime-view-part-externally (&optional handle)
3890 "View the MIME part under point with an external viewer."
3892 (gnus-article-check-buffer)
3893 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
3894 (mm-user-display-methods nil)
3895 (mm-inlined-types nil)
3896 (mail-parse-charset gnus-newsgroup-charset)
3897 (mail-parse-ignored-charsets
3898 (save-excursion (set-buffer gnus-summary-buffer)
3899 gnus-newsgroup-ignored-charsets)))
3901 (if (mm-handle-undisplayer handle)
3902 (mm-remove-part handle)
3903 (mm-display-part handle)))))
3905 (defun gnus-mime-view-part-internally (&optional handle)
3906 "View the MIME part under point with an internal viewer.
3907 If no internal viewer is available, use an external viewer."
3909 (gnus-article-check-buffer)
3910 (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
3911 (mm-inlined-types '(".*"))
3912 (mm-inline-large-images t)
3913 (mail-parse-charset gnus-newsgroup-charset)
3914 (mail-parse-ignored-charsets
3915 (save-excursion (set-buffer gnus-summary-buffer)
3916 gnus-newsgroup-ignored-charsets)))
3918 (if (mm-handle-undisplayer handle)
3919 (mm-remove-part handle)
3920 (mm-display-part handle)))))
3922 (defun gnus-mime-action-on-part (&optional action)
3923 "Do something with the MIME attachment at \(point\)."
3925 (list (completing-read "Action: " gnus-mime-action-alist)))
3926 (gnus-article-check-buffer)
3927 (let ((action-pair (assoc action gnus-mime-action-alist)))
3929 (funcall (cdr action-pair)))))
3931 (defun gnus-article-part-wrapper (n function)
3932 (save-current-buffer
3933 (set-buffer gnus-article-buffer)
3934 (when (> n (length gnus-article-mime-handle-alist))
3935 (error "No such part"))
3936 (gnus-article-goto-part n)
3937 (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
3938 (funcall function handle))))
3940 (defun gnus-article-pipe-part (n)
3941 "Pipe MIME part N, which is the numerical prefix."
3943 (gnus-article-part-wrapper n 'mm-pipe-part))
3945 (defun gnus-article-save-part (n)
3946 "Save MIME part N, which is the numerical prefix."
3948 (gnus-article-part-wrapper n 'mm-save-part))
3950 (defun gnus-article-interactively-view-part (n)
3951 "View MIME part N interactively, which is the numerical prefix."
3953 (gnus-article-part-wrapper n 'mm-interactively-view-part))
3955 (defun gnus-article-copy-part (n)
3956 "Copy MIME part N, which is the numerical prefix."
3958 (gnus-article-part-wrapper n 'gnus-mime-copy-part))
3960 (defun gnus-article-view-part-as-charset (n)
3961 "Copy MIME part N, which is the numerical prefix."
3963 (gnus-article-part-wrapper n 'gnus-mime-view-part-as-charset))
3965 (defun gnus-article-view-part-externally (n)
3966 "View MIME part N externally, which is the numerical prefix."
3968 (gnus-article-part-wrapper n 'gnus-mime-view-part-externally))
3970 (defun gnus-article-inline-part (n)
3971 "Inline MIME part N, which is the numerical prefix."
3973 (gnus-article-part-wrapper n 'gnus-mime-inline-part))
3975 (defun gnus-article-mime-match-handle-first (condition)
3977 (let ((alist gnus-article-mime-handle-alist) ihandle n)
3978 (while (setq ihandle (pop alist))
3980 ((functionp condition)
3981 (funcall condition (cdr ihandle)))
3982 ((eq condition 'undisplayed)
3983 (not (or (mm-handle-undisplayer (cdr ihandle))
3984 (equal (mm-handle-media-type (cdr ihandle))
3985 "multipart/alternative"))))
3986 ((eq condition 'undisplayed-alternative)
3987 (not (mm-handle-undisplayer (cdr ihandle))))
3989 (gnus-article-goto-part (car ihandle))
3990 (or (not n) (< (car ihandle) n)))
3991 (setq n (car ihandle))))
3995 (defun gnus-article-view-part (&optional n)
3996 "View MIME part N, which is the numerical prefix."
3998 (save-current-buffer
3999 (set-buffer gnus-article-buffer)
4000 (or (numberp n) (setq n (gnus-article-mime-match-handle-first
4001 gnus-article-mime-match-handle-function)))
4002 (when (> n (length gnus-article-mime-handle-alist))
4003 (error "No such part"))
4004 (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
4005 (when (gnus-article-goto-part n)
4006 (if (equal (car handle) "multipart/alternative")
4007 (gnus-article-press-button)
4008 (when (eq (gnus-mm-display-part handle) 'internal)
4009 (gnus-set-window-start)))))))
4011 (defsubst gnus-article-mime-total-parts ()
4012 (if (bufferp (car gnus-article-mime-handles))
4014 (1- (length gnus-article-mime-handles))))
4016 (defun gnus-mm-display-part (handle)
4017 "Display HANDLE and fix MIME button."
4018 (let ((id (get-text-property (point) 'gnus-part))
4023 (let ((window (selected-window))
4024 (mail-parse-charset gnus-newsgroup-charset)
4025 (mail-parse-ignored-charsets
4026 (if (gnus-buffer-live-p gnus-summary-buffer)
4028 (set-buffer gnus-summary-buffer)
4029 gnus-newsgroup-ignored-charsets)
4033 (let ((win (gnus-get-buffer-window (current-buffer) t))
4036 (select-window win))
4039 (if (mm-handle-displayed-p handle)
4040 ;; This will remove the part.
4041 (mm-display-part handle)
4043 (narrow-to-region (point)
4044 (if (eobp) (point) (1+ (point))))
4045 (mm-display-part handle)
4046 ;; We narrow to the part itself and
4047 ;; then call the treatment functions.
4048 (goto-char (point-min))
4050 (narrow-to-region (point) (point-max))
4053 (gnus-article-mime-total-parts)
4054 (mm-handle-media-type handle)))))
4055 (if (window-live-p window)
4056 (select-window window)))))
4058 (delete-region (gnus-point-at-bol) (progn (forward-line 1) (point)))
4059 (gnus-insert-mime-button
4060 handle id (list (mm-handle-displayed-p handle)))
4061 (goto-char point))))
4063 (defun gnus-article-goto-part (n)
4064 "Go to MIME part N."
4065 (let ((point (text-property-any (point-min) (point-max) 'gnus-part n)))
4067 (goto-char point))))
4069 (defun gnus-insert-mime-button (handle gnus-tmp-id &optional displayed)
4070 (let ((gnus-tmp-name
4071 (or (mail-content-type-get (mm-handle-type handle) 'name)
4072 (mail-content-type-get (mm-handle-disposition handle) 'filename)
4073 (mail-content-type-get (mm-handle-type handle) 'url)
4075 (gnus-tmp-type (mm-handle-media-type handle))
4076 (gnus-tmp-description
4077 (mail-decode-encoded-word-string (or (mm-handle-description handle)
4080 (if (if displayed (car displayed)
4081 (mm-handle-displayed-p handle))
4083 (gnus-tmp-length (with-current-buffer (mm-handle-buffer handle)
4085 gnus-tmp-type-long b e)
4086 (when (string-match ".*/" gnus-tmp-name)
4087 (setq gnus-tmp-name (replace-match "" t t gnus-tmp-name)))
4088 (setq gnus-tmp-type-long (concat gnus-tmp-type
4089 (and (not (equal gnus-tmp-name ""))
4090 (concat "; " gnus-tmp-name))))
4091 (unless (equal gnus-tmp-description "")
4092 (setq gnus-tmp-type-long (concat " --- " gnus-tmp-type-long)))
4097 gnus-mime-button-line-format gnus-mime-button-line-format-alist
4098 `(,@(gnus-local-map-property gnus-mime-button-map)
4099 gnus-callback gnus-mm-display-part
4100 gnus-part ,gnus-tmp-id
4101 article-type annotation
4104 (widget-convert-button
4107 :action 'gnus-widget-press-button
4108 :button-keymap gnus-mime-button-map
4110 (lambda (widget/window &optional overlay pos)
4111 ;; Needed to properly clear the message due to a bug in
4112 ;; wid-edit (XEmacs only).
4113 (if (boundp 'help-echo-owns-message)
4114 (setq help-echo-owns-message t))
4116 "%S: %s the MIME part; %S: more options"
4117 (aref gnus-mouse-2 0)
4118 ;; XEmacs will get a single widget arg; Emacs 21 will get
4119 ;; window, overlay, position.
4120 (if (mm-handle-displayed-p
4122 (with-current-buffer (gnus-overlay-buffer overlay)
4123 (widget-get (widget-at (gnus-overlay-start overlay))
4125 (widget-get widget/window :mime-handle)))
4127 (aref gnus-down-mouse-3 0))))))
4129 (defun gnus-widget-press-button (elems el)
4130 (goto-char (widget-get elems :from))
4131 (gnus-article-press-button))
4133 (defvar gnus-displaying-mime nil)
4135 (defun gnus-display-mime (&optional ihandles)
4136 "Display the MIME parts."
4138 (save-selected-window
4139 (let ((window (get-buffer-window gnus-article-buffer))
4142 (select-window window)
4143 ;; We have to do this since selecting the window
4144 ;; may change the point. So we set the window point.
4145 (set-window-point window point)))
4146 (let* ((handles (or ihandles (mm-dissect-buffer
4147 nil gnus-article-loose-mime)
4149 buffer-read-only handle name type b e display)
4150 (when (and (not ihandles)
4151 (not gnus-displaying-mime))
4152 ;; Top-level call; we clean up.
4153 (when gnus-article-mime-handles
4154 (mm-destroy-parts gnus-article-mime-handles)
4155 (setq gnus-article-mime-handle-alist nil));; A trick.
4156 (setq gnus-article-mime-handles handles)
4157 ;; We allow users to glean info from the handles.
4158 (when gnus-article-mime-part-function
4159 (gnus-mime-part-function handles)))
4161 (or (not (stringp (car handles)))
4164 (when (and (not ihandles)
4165 (not gnus-displaying-mime))
4166 ;; Clean up for mime parts.
4168 (delete-region (point) (point-max)))
4169 (let ((gnus-displaying-mime t))
4170 (gnus-mime-display-part handles)))
4173 (narrow-to-region (point) (point-max))
4174 (gnus-treat-article nil 1 1)
4177 ;; Highlight the headers.
4181 (narrow-to-region (point-min) (point))
4182 (gnus-treat-article 'head))))))))
4184 (defvar gnus-mime-display-multipart-as-mixed nil)
4185 (defvar gnus-mime-display-multipart-alternative-as-mixed nil)
4186 (defvar gnus-mime-display-multipart-related-as-mixed nil)
4188 (defun gnus-mime-display-part (handle)
4191 ((not (stringp (car handle)))
4192 (gnus-mime-display-single handle))
4193 ;; User-defined multipart
4194 ((cdr (assoc (car handle) gnus-mime-multipart-functions))
4195 (funcall (cdr (assoc (car handle) gnus-mime-multipart-functions))
4197 ;; multipart/alternative
4198 ((and (equal (car handle) "multipart/alternative")
4199 (not (or gnus-mime-display-multipart-as-mixed
4200 gnus-mime-display-multipart-alternative-as-mixed)))
4201 (let ((id (1+ (length gnus-article-mime-handle-alist))))
4202 (push (cons id handle) gnus-article-mime-handle-alist)
4203 (gnus-mime-display-alternative (cdr handle) nil nil id)))
4204 ;; multipart/related
4205 ((and (equal (car handle) "multipart/related")
4206 (not (or gnus-mime-display-multipart-as-mixed
4207 gnus-mime-display-multipart-related-as-mixed)))
4208 ;;;!!!We should find the start part, but we just default
4209 ;;;!!!to the first part.
4210 ;;(gnus-mime-display-part (cadr handle))
4211 ;;;!!! Most multipart/related is an HTML message plus images.
4212 ;;;!!! Unfortunately we are unable to let W3 display those
4213 ;;;!!! included images, so we just display it as a mixed multipart.
4214 ;;(gnus-mime-display-mixed (cdr handle))
4215 ;;;!!! No, w3 can display everything just fine.
4216 (gnus-mime-display-part (cadr handle)))
4217 ((equal (car handle) "multipart/signed")
4218 (gnus-add-wash-type 'signed)
4219 (gnus-mime-display-security handle))
4220 ((equal (car handle) "multipart/encrypted")
4221 (gnus-add-wash-type 'encrypted)
4222 (gnus-mime-display-security handle))
4223 ;; Other multiparts are handled like multipart/mixed.
4225 (gnus-mime-display-mixed (cdr handle)))))
4227 (defun gnus-mime-part-function (handles)
4228 (if (stringp (car handles))
4229 (mapcar 'gnus-mime-part-function (cdr handles))
4230 (funcall gnus-article-mime-part-function handles)))
4232 (defun gnus-mime-display-mixed (handles)
4233 (mapcar 'gnus-mime-display-part handles))
4235 (defun gnus-mime-display-single (handle)
4236 (let ((type (mm-handle-media-type handle))
4237 (ignored gnus-ignored-mime-types)
4244 (when (string-match (pop ignored) type)
4245 (throw 'ignored nil)))
4246 (if (and (setq not-attachment
4247 (and (not (mm-inline-override-p handle))
4248 (or (not (mm-handle-disposition handle))
4249 (equal (car (mm-handle-disposition handle))
4251 (mm-attachment-override-p handle))))
4252 (mm-automatic-display-p handle)
4254 (mm-inlinable-p handle)
4255 (mm-inlined-p handle))
4256 (mm-automatic-external-display-p type)))
4258 (when (equal (mm-handle-media-supertype handle) "text")
4260 (let ((id (1+ (length gnus-article-mime-handle-alist)))
4262 (push (cons id handle) gnus-article-mime-handle-alist)
4263 (when (or (not display)
4264 (not (gnus-unbuttonized-mime-type-p type)))
4265 ;(gnus-article-insert-newline)
4266 (gnus-insert-mime-button
4267 handle id (list (or display (and not-attachment text))))
4268 (gnus-article-insert-newline)
4269 ;(gnus-article-insert-newline)
4270 ;; Remember modify the number of forward lines.
4278 (let ((mail-parse-charset gnus-newsgroup-charset)
4279 (mail-parse-ignored-charsets
4280 (save-excursion (condition-case ()
4281 (set-buffer gnus-summary-buffer)
4283 gnus-newsgroup-ignored-charsets)))
4284 (mm-display-part handle t))
4285 (goto-char (point-max)))
4286 ((and text not-attachment)
4290 (gnus-article-insert-newline)
4291 (mm-insert-inline handle (mm-get-part handle))
4292 (goto-char (point-max))))
4296 (narrow-to-region beg (point))
4299 (gnus-article-mime-total-parts)
4300 (mm-handle-media-type handle)))))))))
4302 (defun gnus-unbuttonized-mime-type-p (type)
4303 "Say whether TYPE is to be unbuttonized."
4304 (unless gnus-inhibit-mime-unbuttonizing
4306 (let ((types gnus-unbuttonized-mime-types))
4308 (when (string-match (pop types) type)
4309 (throw 'found t)))))
4311 (let ((types gnus-buttonized-mime-types))
4313 (when (string-match (pop types) type)
4314 (throw 'found t)))))))))
4316 (defun gnus-article-insert-newline ()
4317 "Insert a newline, but mark it as undeletable."
4318 (gnus-put-text-property
4319 (point) (progn (insert "\n") (point)) 'gnus-undeletable t))
4321 (defun gnus-mime-display-alternative (handles &optional preferred ibegend id)
4322 (let* ((preferred (or preferred (mm-preferred-alternative handles)))
4325 handle buffer-read-only from props begend not-pref)
4326 (save-window-excursion
4329 (narrow-to-region (car ibegend)
4332 (goto-char (car ibegend))
4335 (delete-region (point-min) (point-max))
4336 (mm-remove-parts handles))
4337 (setq begend (list (point-marker)))
4339 (unless (setq not-pref (cadr (member preferred ihandles)))
4340 (setq not-pref (car ihandles)))
4343 (not (gnus-unbuttonized-mime-type-p
4344 "multipart/alternative")))
4345 (gnus-add-text-properties
4348 (insert (format "%d. " id))
4352 (unless ,(not ibegend)
4353 (setq gnus-article-mime-handle-alist
4354 ',gnus-article-mime-handle-alist))
4355 (gnus-mime-display-alternative
4356 ',ihandles ',not-pref ',begend ,id))
4357 ,@(gnus-local-map-property gnus-mime-button-map)
4358 ,gnus-mouse-face-prop ,gnus-article-mouse-face
4359 face ,gnus-article-button-face
4362 (widget-convert-button 'link from (point)
4363 :action 'gnus-widget-press-button
4364 :button-keymap gnus-widget-button-keymap)
4366 (while (setq handle (pop handles))
4367 (gnus-add-text-properties
4370 (insert (format "(%c) %-18s"
4371 (if (equal handle preferred) ?* ? )
4372 (mm-handle-media-type handle)))
4376 (unless ,(not ibegend)
4377 (setq gnus-article-mime-handle-alist
4378 ',gnus-article-mime-handle-alist))
4379 (gnus-mime-display-alternative
4380 ',ihandles ',handle ',begend ,id))
4381 ,@(gnus-local-map-property gnus-mime-button-map)
4382 ,gnus-mouse-face-prop ,gnus-article-mouse-face
4383 face ,gnus-article-button-face
4386 (widget-convert-button 'link from (point)
4387 :action 'gnus-widget-press-button
4388 :button-keymap gnus-widget-button-keymap)
4392 (if (stringp (car preferred))
4393 (gnus-display-mime preferred)
4394 (let ((mail-parse-charset gnus-newsgroup-charset)
4395 (mail-parse-ignored-charsets
4396 (save-excursion (set-buffer gnus-summary-buffer)
4397 gnus-newsgroup-ignored-charsets)))
4398 (mm-display-part preferred)
4402 (narrow-to-region (car begend) (point-max))
4404 nil (length gnus-article-mime-handle-alist)
4405 (gnus-article-mime-total-parts)
4406 (mm-handle-media-type handle))))))
4407 (goto-char (point-max))
4408 (setcdr begend (point-marker)))))
4410 (goto-char point))))
4412 (defconst gnus-article-wash-status-strings
4413 (let ((alist '((cite "c" "Possible hidden citation text"
4414 " " "All citation text visible")
4415 (headers "h" "Hidden headers"
4416 " " "All headers visible.")
4417 (pgp "p" "Encrypted or signed message status hidden"
4418 " " "No hidden encryption nor digital signature status")
4419 (signature "s" "Signature has been hidden"
4420 " " "Signature is visible")
4421 (overstrike "o" "Overstrike (^H) characters applied"
4422 " " "No overstrike characters applied")
4423 (emphasis "e" "/*_Emphasis_*/ characters applied"
4424 " " "No /*_emphasis_*/ characters applied")))
4426 (dolist (entry alist result)
4427 (let ((key (nth 0 entry))
4428 (on (copy-sequence (nth 1 entry)))
4429 (on-help (nth 2 entry))
4430 (off (copy-sequence (nth 3 entry)))
4431 (off-help (nth 4 entry)))
4432 (put-text-property 0 1 'help-echo on-help on)
4433 (put-text-property 0 1 'help-echo off-help off)
4434 (push (list key on off) result))))
4435 "Alist of strings describing wash status in the mode line.
4436 Each entry has the form (KEY ON OF), where the KEY is a symbol
4437 representing the particular washing function, ON is the string to use
4438 in the article mode line when the washing function is active, and OFF
4439 is the string to use when it is inactive.")
4441 (defun gnus-article-wash-status-entry (key value)
4442 (let ((entry (assoc key gnus-article-wash-status-strings)))
4443 (if value (nth 1 entry) (nth 2 entry))))
4445 (defun gnus-article-wash-status ()
4446 "Return a string which display status of article washing."
4448 (set-buffer gnus-article-buffer)
4449 (let ((cite (memq 'cite gnus-article-wash-types))
4450 (headers (memq 'headers gnus-article-wash-types))
4451 (boring (memq 'boring-headers gnus-article-wash-types))
4452 (pgp (memq 'pgp gnus-article-wash-types))
4453 (pem (memq 'pem gnus-article-wash-types))
4454 (signed (memq 'signed gnus-article-wash-types))
4455 (encrypted (memq 'encrypted gnus-article-wash-types))
4456 (signature (memq 'signature gnus-article-wash-types))
4457 (overstrike (memq 'overstrike gnus-article-wash-types))
4458 (emphasis (memq 'emphasis gnus-article-wash-types)))
4460 (gnus-article-wash-status-entry 'cite cite)
4461 (gnus-article-wash-status-entry 'headers (or headers boring))
4462 (gnus-article-wash-status-entry 'pgp (or pgp pem signed encrypted))
4463 (gnus-article-wash-status-entry 'signature signature)
4464 (gnus-article-wash-status-entry 'overstrike overstrike)
4465 (gnus-article-wash-status-entry 'emphasis emphasis)))))
4467 (defun gnus-add-wash-type (type)
4468 "Add a washing of TYPE to the current status."
4469 (add-to-list 'gnus-article-wash-types type))
4471 (defun gnus-delete-wash-type (type)
4472 "Add a washing of TYPE to the current status."
4473 (setq gnus-article-wash-types (delq type gnus-article-wash-types)))
4475 (defun gnus-add-image (category image)
4476 "Add IMAGE of CATEGORY to the list of displayed images."
4477 (let ((entry (assq category gnus-article-image-alist)))
4479 (setq entry (list category))
4480 (push entry gnus-article-image-alist))
4481 (nconc entry (list image))))
4483 (defun gnus-delete-images (category)
4484 "Delete all images in CATEGORY."
4485 (let ((entry (assq category gnus-article-image-alist)))
4486 (dolist (image (cdr entry))
4487 (gnus-remove-image image))
4488 (setq gnus-article-image-alist (delq entry gnus-article-image-alist))
4489 (gnus-delete-wash-type category)))
4491 (defalias 'gnus-article-hide-headers-if-wanted 'gnus-article-maybe-hide-headers)
4493 (defun gnus-article-maybe-hide-headers ()
4494 "Hide unwanted headers if `gnus-have-all-headers' is nil.
4495 Provided for backwards compatibility."
4496 (when (and (or (not (gnus-buffer-live-p gnus-summary-buffer))
4497 (not (save-excursion (set-buffer gnus-summary-buffer)
4498 gnus-have-all-headers)))
4499 (not gnus-inhibit-hiding))
4500 (gnus-article-hide-headers)))
4504 (defun gnus-output-to-file (file-name)
4505 "Append the current article to a file named FILE-NAME."
4506 (let ((artbuf (current-buffer)))
4508 (insert-buffer-substring artbuf)
4509 ;; Append newline at end of the buffer as separator, and then
4511 (goto-char (point-max))
4513 (let ((file-name-coding-system nnmail-pathname-coding-system))
4514 (mm-append-to-file (point-min) (point-max) file-name))
4517 (defun gnus-narrow-to-page (&optional arg)
4518 "Narrow the article buffer to a page.
4519 If given a numerical ARG, move forward ARG pages."
4521 (setq arg (if arg (prefix-numeric-value arg) 0))
4523 (set-buffer gnus-article-buffer)
4524 (goto-char (point-min))
4526 ;; Remove any old next/prev buttons.
4527 (when (gnus-visual-p 'page-marker)
4528 (let ((buffer-read-only nil))
4529 (gnus-remove-text-with-property 'gnus-prev)
4530 (gnus-remove-text-with-property 'gnus-next)))
4533 (re-search-backward page-delimiter nil 'move (1+ (abs arg))))
4535 (re-search-forward page-delimiter nil 'move arg)))
4536 (goto-char (match-end 0)))
4539 (if (re-search-forward page-delimiter nil 'move)
4542 (when (and (gnus-visual-p 'page-marker)
4543 (not (= (point-min) 1)))
4545 (goto-char (point-min))
4546 (gnus-insert-prev-page-button)))
4547 (when (and (gnus-visual-p 'page-marker)
4548 (< (+ (point-max) 2) (buffer-size)))
4550 (goto-char (point-max))
4551 (gnus-insert-next-page-button)))))
4553 ;; Article mode commands
4555 (defun gnus-article-goto-next-page ()
4556 "Show the next page of the article."
4558 (when (gnus-article-next-page)
4559 (goto-char (point-min))
4560 (gnus-article-read-summary-keys nil (gnus-character-to-event ?n))))
4562 (defun gnus-article-goto-prev-page ()
4563 "Show the next page of the article."
4565 (if (bobp) (gnus-article-read-summary-keys nil (gnus-character-to-event ?p))
4566 (gnus-article-prev-page nil)))
4568 (defun gnus-article-next-page (&optional lines)
4569 "Show the next page of the current article.
4570 If end of article, return non-nil. Otherwise return nil.
4571 Argument LINES specifies lines to be scrolled up."
4573 (move-to-window-line -1)
4576 (and (pos-visible-in-window-p) ;Not continuation line.
4578 ;; Nothing in this page.
4579 (if (or (not gnus-page-broken)
4582 (widen) (forward-line 1) (eobp)))) ;Real end-of-buffer?
4584 (gnus-narrow-to-page 1) ;Go to next page.
4586 ;; More in this page.
4587 (let ((scroll-in-place nil))
4591 ;; Long lines may cause an end-of-buffer error.
4592 (goto-char (point-max)))))
4593 (move-to-window-line 0)
4596 (defun gnus-article-prev-page (&optional lines)
4597 "Show previous page of current article.
4598 Argument LINES specifies lines to be scrolled down."
4600 (move-to-window-line 0)
4601 (if (and gnus-page-broken
4603 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
4605 (gnus-narrow-to-page -1) ;Go to previous page.
4606 (goto-char (point-max))
4608 (let ((scroll-in-place nil))
4612 (beginning-of-buffer
4613 (goto-char (point-min))))
4614 (move-to-window-line 0)))))
4616 (defun gnus-article-refer-article ()
4617 "Read article specified by message-id around point."
4619 (let ((point (point)))
4620 (search-forward ">" nil t) ;Move point to end of "<....>".
4621 (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
4622 (let ((message-id (match-string 1)))
4624 (set-buffer gnus-summary-buffer)
4625 (gnus-summary-refer-article message-id))
4627 (error "No references around point"))))
4629 (defun gnus-article-show-summary ()
4630 "Reconfigure windows to show summary buffer."
4632 (if (not (gnus-buffer-live-p gnus-summary-buffer))
4633 (error "There is no summary buffer for this article buffer")
4634 (gnus-article-set-globals)
4635 (gnus-configure-windows 'article)
4636 (gnus-summary-goto-subject gnus-current-article)
4637 (gnus-summary-position-point)))
4639 (defun gnus-article-describe-briefly ()
4640 "Describe article mode commands briefly."
4642 (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")))
4644 (defun gnus-article-summary-command ()
4645 "Execute the last keystroke in the summary buffer."
4647 (let ((obuf (current-buffer))
4648 (owin (current-window-configuration))
4650 (switch-to-buffer gnus-article-current-summary 'norecord)
4651 (setq func (lookup-key (current-local-map) (this-command-keys)))
4652 (call-interactively func)
4654 (set-window-configuration owin)
4655 (set-window-point (get-buffer-window (current-buffer)) (point))))
4657 (defun gnus-article-summary-command-nosave ()
4658 "Execute the last keystroke in the summary buffer."
4661 (pop-to-buffer gnus-article-current-summary 'norecord)
4662 (setq func (lookup-key (current-local-map) (this-command-keys)))
4663 (call-interactively func)))
4665 (defun gnus-article-check-buffer ()
4666 "Beep if not in an article buffer."
4667 (unless (equal major-mode 'gnus-article-mode)
4668 (error "Command invoked outside of a Gnus article buffer")))
4670 (defun gnus-article-read-summary-keys (&optional arg key not-restore-window)
4671 "Read a summary buffer key sequence and execute it from the article buffer."
4673 (gnus-article-check-buffer)
4675 '("q" "Q" "c" "r" "\C-c\C-f" "m" "a" "f"
4676 "Zc" "ZC" "ZE" "ZQ" "ZZ" "Zn" "ZR" "ZG" "ZN" "ZP"
4677 "=" "^" "\M-^" "|"))
4683 '("n" "Gn" "p" "Gp"))
4686 (set-buffer gnus-article-current-summary)
4687 (let (gnus-pick-mode)
4688 (push (or key last-command-event) unread-command-events)
4689 (setq keys (if (featurep 'xemacs)
4690 (events-to-keys (read-key-sequence nil))
4691 (read-key-sequence nil)))))
4695 (if (or (member keys nosaves)
4696 (member keys nosave-but-article)
4697 (member keys nosave-in-article))
4699 (save-window-excursion
4700 (pop-to-buffer gnus-article-current-summary 'norecord)
4701 ;; We disable the pick minor mode commands.
4702 (let (gnus-pick-mode)
4703 (setq func (lookup-key (current-local-map) keys))))
4707 (unless (member keys nosave-in-article)
4708 (set-buffer gnus-article-current-summary))
4709 (call-interactively func)
4710 (setq new-sum-point (point)))
4711 (when (member keys nosave-but-article)
4712 (pop-to-buffer gnus-article-buffer 'norecord)))
4713 ;; These commands should restore window configuration.
4714 (let ((obuf (current-buffer))
4715 (owin (current-window-configuration))
4717 (summary gnus-article-current-summary)
4718 func in-buffer selected)
4719 (if not-restore-window
4720 (pop-to-buffer summary 'norecord)
4721 (switch-to-buffer summary 'norecord))
4722 (setq in-buffer (current-buffer))
4723 ;; We disable the pick minor mode commands.
4724 (if (and (setq func (let (gnus-pick-mode)
4725 (lookup-key (current-local-map) keys)))
4728 (call-interactively func)
4729 (setq new-sum-point (point))
4730 (when (eq in-buffer (current-buffer))
4731 (setq selected (gnus-summary-select-article))
4733 (unless not-restore-window
4734 (set-window-configuration owin))
4735 (when (eq selected 'old)
4737 (set-window-start (get-buffer-window (current-buffer))
4739 (set-window-point (get-buffer-window (current-buffer))
4741 (let ((win (get-buffer-window gnus-article-current-summary)))
4743 (set-window-point win new-sum-point)))) )
4744 (switch-to-buffer gnus-article-buffer)
4747 (defun gnus-article-describe-key (key)
4748 "Display documentation of the function invoked by KEY. KEY is a string."
4749 (interactive "kDescribe key: ")
4750 (gnus-article-check-buffer)
4751 (if (eq (key-binding key) 'gnus-article-read-summary-keys)
4753 (set-buffer gnus-article-current-summary)
4754 (let (gnus-pick-mode)
4755 (if (featurep 'xemacs)
4757 (push (elt key 0) unread-command-events)
4758 (setq key (events-to-keys
4759 (read-key-sequence "Describe key: "))))
4760 (setq unread-command-events
4762 (lambda (x) (if (>= x 128) (list 'meta (- x 128)) x))
4763 (string-to-list key)))
4764 (setq key (read-key-sequence "Describe key: "))))
4766 (describe-key key)))
4768 (defun gnus-article-describe-key-briefly (key &optional insert)
4769 "Display documentation of the function invoked by KEY. KEY is a string."
4770 (interactive "kDescribe key: \nP")
4771 (gnus-article-check-buffer)
4772 (if (eq (key-binding key) 'gnus-article-read-summary-keys)
4774 (set-buffer gnus-article-current-summary)
4775 (let (gnus-pick-mode)
4776 (if (featurep 'xemacs)
4778 (push (elt key 0) unread-command-events)
4779 (setq key (events-to-keys
4780 (read-key-sequence "Describe key: "))))
4781 (setq unread-command-events
4783 (lambda (x) (if (>= x 128) (list 'meta (- x 128)) x))
4784 (string-to-list key)))
4785 (setq key (read-key-sequence "Describe key: "))))
4786 (describe-key-briefly key insert))
4787 (describe-key-briefly key insert)))
4789 (defun gnus-article-reply-with-original (&optional wide)
4790 "Start composing a reply mail to the current message.
4791 The text in the region will be yanked. If the region isn't active,
4792 the entire article will be yanked."
4794 (let ((article (cdr gnus-article-current)) cont)
4796 (gnus-summary-reply (list (list article)) wide)
4797 (setq cont (buffer-substring (point) (mark t)))
4798 ;; Deactivate active regions.
4799 (when (and (boundp 'transient-mark-mode)
4800 transient-mark-mode)
4801 (setq mark-active nil))
4803 (list (list article cont)) wide))))
4805 (defun gnus-article-followup-with-original ()
4806 "Compose a followup to the current article.
4807 The text in the region will be yanked. If the region isn't active,
4808 the entire article will be yanked."
4810 (let ((article (cdr gnus-article-current))
4813 (gnus-summary-followup (list (list article)))
4814 (setq cont (buffer-substring (point) (mark t)))
4815 ;; Deactivate active regions.
4816 (when (and (boundp 'transient-mark-mode)
4817 transient-mark-mode)
4818 (setq mark-active nil))
4819 (gnus-summary-followup
4820 (list (list article cont))))))
4822 (defun gnus-article-hide (&optional arg force)
4823 "Hide all the gruft in the current article.
4824 This means that PGP stuff, signatures, cited text and (some)
4825 headers will be hidden.
4826 If given a prefix, show the hidden text instead."
4827 (interactive (append (gnus-article-hidden-arg) (list 'force)))
4828 (gnus-article-hide-headers arg)
4829 (gnus-article-hide-list-identifiers arg)
4830 (gnus-article-hide-pgp arg)
4831 (gnus-article-hide-citation-maybe arg force)
4832 (gnus-article-hide-signature arg))
4834 (defun gnus-article-maybe-highlight ()
4835 "Do some article highlighting if article highlighting is requested."
4836 (when (gnus-visual-p 'article-highlight 'highlight)
4837 (gnus-article-highlight-some)))
4839 (defun gnus-check-group-server ()
4840 ;; Make sure the connection to the server is alive.
4841 (unless (gnus-server-opened
4842 (gnus-find-method-for-group gnus-newsgroup-name))
4843 (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
4844 (gnus-request-group gnus-newsgroup-name t)))
4847 (autoload 'nneething-get-file-name "nneething"))
4849 (defun gnus-request-article-this-buffer (article group)
4850 "Get an article and insert it into this buffer."
4851 (let (do-update-line sparse-header)
4855 (gnus-kill-all-overlays)
4856 (setq group (or group gnus-newsgroup-name))
4858 ;; Using `gnus-request-article' directly will insert the article into
4859 ;; `nntp-server-buffer' - so we'll save some time by not having to
4860 ;; copy it from the server buffer into the article buffer.
4862 ;; We only request an article by message-id when we do not have the
4863 ;; headers for it, so we'll have to get those.
4864 (when (stringp article)
4865 (gnus-read-header article))
4867 ;; If the article number is negative, that means that this article
4868 ;; doesn't belong in this newsgroup (possibly), so we find its
4869 ;; message-id and request it by id instead of number.
4870 (when (and (numberp article)
4872 (get-buffer gnus-summary-buffer)
4873 (gnus-buffer-exists-p gnus-summary-buffer))
4875 (set-buffer gnus-summary-buffer)
4876 (let ((header (gnus-summary-article-header article)))
4879 ((memq article gnus-newsgroup-sparse)
4880 ;; This is a sparse gap article.
4881 (setq do-update-line article)
4882 (setq article (mail-header-id header))
4883 (setq sparse-header (gnus-read-header article))
4884 (setq gnus-newsgroup-sparse
4885 (delq article gnus-newsgroup-sparse)))
4887 ;; It's a real article.
4888 (setq article (mail-header-id header)))
4890 ;; It is an extracted pseudo-article.
4891 (setq article 'pseudo)
4892 (gnus-request-pseudo-article header))))
4894 (let ((method (gnus-find-method-for-group
4895 gnus-newsgroup-name)))
4896 (when (and (eq (car method) 'nneething)
4898 (let ((dir (nneething-get-file-name
4899 (mail-header-id header))))
4900 (when (and (stringp dir)
4901 (file-directory-p dir))
4902 (setq article 'nneething)
4903 (gnus-group-enter-directory dir))))))))
4906 ;; Refuse to select canceled articles.
4907 ((and (numberp article)
4909 (get-buffer gnus-summary-buffer)
4910 (gnus-buffer-exists-p gnus-summary-buffer)
4911 (eq (cdr (save-excursion
4912 (set-buffer gnus-summary-buffer)
4913 (assq article gnus-newsgroup-reads)))
4914 gnus-canceled-mark))
4916 ;; We first check `gnus-original-article-buffer'.
4917 ((and (get-buffer gnus-original-article-buffer)
4920 (set-buffer gnus-original-article-buffer)
4921 (and (equal (car gnus-original-article) group)
4922 (eq (cdr gnus-original-article) article))))
4923 (insert-buffer-substring gnus-original-article-buffer)
4925 ;; Check the backlog.
4926 ((and gnus-keep-backlog
4927 (gnus-backlog-request-article group article (current-buffer)))
4929 ;; Check asynchronous pre-fetch.
4930 ((gnus-async-request-fetched-article group article (current-buffer))
4931 (gnus-async-prefetch-next group article gnus-summary-buffer)
4932 (when (and (numberp article) gnus-keep-backlog)
4933 (gnus-backlog-enter-article group article (current-buffer)))
4936 ((and gnus-use-cache
4938 (gnus-cache-request-article article group))
4940 ;; Check the agent cache.
4941 ((and gnus-agent gnus-agent-cache gnus-plugged
4943 (gnus-agent-request-article article group))
4945 ;; Get the article and put into the article buffer.
4946 ((or (stringp article)
4948 (let ((gnus-override-method gnus-override-method)
4949 (methods (and (stringp article)
4950 gnus-refer-article-method))
4951 (backend (car (gnus-find-method-for-group
4952 gnus-newsgroup-name)))
4954 (buffer-read-only nil))
4955 (if (or (not (listp methods))
4956 (and (symbolp (car methods))
4957 (assq (car methods) nnoo-definition-alist)))
4958 (setq methods (list methods)))
4959 (when (and (null gnus-override-method)
4961 (setq gnus-override-method (pop methods)))
4963 (when (eq gnus-override-method 'current)
4964 (setq gnus-override-method
4965 (with-current-buffer gnus-summary-buffer
4966 gnus-current-select-method)))
4968 (gnus-kill-all-overlays)
4969 (let ((gnus-newsgroup-name group))
4970 (gnus-check-group-server))
4972 ((gnus-request-article article group (current-buffer))
4973 (when (numberp article)
4974 (gnus-async-prefetch-next group article
4975 gnus-summary-buffer)
4976 (when gnus-keep-backlog
4977 (gnus-backlog-enter-article
4978 group article (current-buffer))))
4979 (setq result 'article))
4981 (setq gnus-override-method (pop methods)))
4982 ((not (string-match "^400 "
4983 (nnheader-get-report backend)))
4984 ;; If we get 400 server disconnect, reconnect and
4985 ;; retry; otherwise, assume the article has expired.
4986 (setq result 'done))))
4987 (and (eq result 'article) 'article)))
4991 ;; Associate this article with the current summary buffer.
4992 (setq gnus-article-current-summary gnus-summary-buffer)
4994 ;; Take the article from the original article buffer
4995 ;; and place it in the buffer it's supposed to be in.
4996 (when (and (get-buffer gnus-article-buffer)
4997 (equal (buffer-name (current-buffer))
4998 (buffer-name (get-buffer gnus-article-buffer))))
5000 (if (get-buffer gnus-original-article-buffer)
5001 (set-buffer gnus-original-article-buffer)
5002 (set-buffer (gnus-get-buffer-create gnus-original-article-buffer))
5003 (buffer-disable-undo)
5004 (setq major-mode 'gnus-original-article-mode)
5005 (setq buffer-read-only t))
5006 (let (buffer-read-only)
5008 (insert-buffer-substring gnus-article-buffer))
5009 (setq gnus-original-article (cons group article)))
5012 (run-hooks 'gnus-article-decode-hook)
5013 ;; Mark article as decoded or not.
5014 (setq gnus-article-decoded-p gnus-article-decode-hook))
5016 ;; Update sparse articles.
5017 (when (and do-update-line
5018 (or (numberp article)
5020 (let ((buf (current-buffer)))
5021 (set-buffer gnus-summary-buffer)
5022 (gnus-summary-update-article do-update-line sparse-header)
5023 (gnus-summary-goto-subject do-update-line nil t)
5024 (set-window-point (gnus-get-buffer-window (current-buffer) t)
5026 (set-buffer buf))))))
5032 (defcustom gnus-article-edit-mode-hook nil
5033 "Hook run in article edit mode buffers."
5034 :group 'gnus-article-various
5037 (defvar gnus-article-edit-done-function nil)
5039 (defvar gnus-article-edit-mode-map nil)
5041 ;; Should we be using derived.el for this?
5042 (unless gnus-article-edit-mode-map
5043 (setq gnus-article-edit-mode-map (make-keymap))
5044 (set-keymap-parent gnus-article-edit-mode-map text-mode-map)
5047 (gnus-define-keys gnus-article-edit-mode-map
5048 "\C-c?" describe-mode
5049 "\C-c\C-c" gnus-article-edit-done
5050 "\C-c\C-k" gnus-article-edit-exit
5051 "\C-c\C-f\C-t" message-goto-to
5052 "\C-c\C-f\C-o" message-goto-from
5053 "\C-c\C-f\C-b" message-goto-bcc
5054 ;;"\C-c\C-f\C-w" message-goto-fcc
5055 "\C-c\C-f\C-c" message-goto-cc
5056 "\C-c\C-f\C-s" message-goto-subject
5057 "\C-c\C-f\C-r" message-goto-reply-to
5058 "\C-c\C-f\C-n" message-goto-newsgroups
5059 "\C-c\C-f\C-d" message-goto-distribution
5060 "\C-c\C-f\C-f" message-goto-followup-to
5061 "\C-c\C-f\C-m" message-goto-mail-followup-to
5062 "\C-c\C-f\C-k" message-goto-keywords
5063 "\C-c\C-f\C-u" message-goto-summary
5064 "\C-c\C-f\C-i" message-insert-or-toggle-importance
5065 "\C-c\C-f\C-a" message-gen-unsubscribed-mft
5066 "\C-c\C-b" message-goto-body
5067 "\C-c\C-i" message-goto-signature
5069 "\C-c\C-t" message-insert-to
5070 "\C-c\C-n" message-insert-newsgroups
5071 "\C-c\C-o" message-sort-headers
5072 "\C-c\C-e" message-elide-region
5073 "\C-c\C-v" message-delete-not-region
5074 "\C-c\C-z" message-kill-to-signature
5075 "\M-\r" message-newline-and-reformat
5076 "\C-c\C-a" mml-attach-file
5077 "\C-a" message-beginning-of-line
5079 "\M-;" comment-region)
5081 (gnus-define-keys (gnus-article-edit-wash-map
5082 "\C-c\C-w" gnus-article-edit-mode-map)
5083 "f" gnus-article-edit-full-stops))
5086 gnus-article-edit-mode-field-menu gnus-article-edit-mode-map ""
5088 ["Fetch To" message-insert-to t]
5089 ["Fetch Newsgroups" message-insert-newsgroups t]
5091 ["To" message-goto-to t]
5092 ["From" message-goto-from t]
5093 ["Subject" message-goto-subject t]
5094 ["Cc" message-goto-cc t]
5095 ["Reply-To" message-goto-reply-to t]
5096 ["Summary" message-goto-summary t]
5097 ["Keywords" message-goto-keywords t]
5098 ["Newsgroups" message-goto-newsgroups t]
5099 ["Followup-To" message-goto-followup-to t]
5100 ["Mail-Followup-To" message-goto-mail-followup-to t]
5101 ["Distribution" message-goto-distribution t]
5102 ["Body" message-goto-body t]
5103 ["Signature" message-goto-signature t]))
5105 (define-derived-mode gnus-article-edit-mode text-mode "Article Edit"
5106 "Major mode for editing articles.
5107 This is an extended text-mode.
5109 \\{gnus-article-edit-mode-map}"
5110 (make-local-variable 'gnus-article-edit-done-function)
5111 (make-local-variable 'gnus-prev-winconf)
5112 (set (make-local-variable 'font-lock-defaults)
5113 '(message-font-lock-keywords t))
5114 (set (make-local-variable 'mail-header-separator) "")
5115 (easy-menu-add message-mode-field-menu message-mode-map)
5117 (setq buffer-read-only nil)
5118 (buffer-enable-undo)
5121 (defun gnus-article-edit (&optional force)
5122 "Edit the current article.
5123 This will have permanent effect only in mail groups.
5124 If FORCE is non-nil, allow editing of articles even in read-only
5127 (when (and (not force)
5128 (gnus-group-read-only-p))
5129 (error "The current newsgroup does not support article editing"))
5130 (gnus-article-date-original)
5131 (gnus-article-edit-article
5133 `(lambda (no-highlight)
5135 (gnus-summary-edit-article-done
5136 ,(or (mail-header-references gnus-current-headers) "")
5137 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight))))
5139 (defun gnus-article-edit-article (start-func exit-func)
5140 "Start editing the contents of the current article buffer."
5141 (let ((winconf (current-window-configuration)))
5142 (set-buffer gnus-article-buffer)
5143 (gnus-article-edit-mode)
5144 (funcall start-func)
5145 (set-buffer-modified-p nil)
5146 (gnus-configure-windows 'edit-article)
5147 (setq gnus-article-edit-done-function exit-func)
5148 (setq gnus-prev-winconf winconf)
5149 (gnus-message 6 "C-c C-c to end edits")))
5151 (defun gnus-article-edit-done (&optional arg)
5152 "Update the article edits and exit."
5154 (let ((func gnus-article-edit-done-function)
5155 (buf (current-buffer))
5156 (start (window-start))
5158 (winconf gnus-prev-winconf))
5159 (widen) ;; Widen it in case that users narrowed the buffer.
5162 ;; The cache and backlog have to be flushed somewhat.
5163 (when gnus-keep-backlog
5164 (gnus-backlog-remove-article
5165 (car gnus-article-current) (cdr gnus-article-current)))
5166 ;; Flush original article as well.
5168 (when (get-buffer gnus-original-article-buffer)
5169 (set-buffer gnus-original-article-buffer)
5170 (setq gnus-original-article nil)))
5171 (when gnus-use-cache
5172 (gnus-cache-update-article
5173 (car gnus-article-current) (cdr gnus-article-current)))
5174 ;; We remove all text props from the article buffer.
5175 (kill-all-local-variables)
5176 (gnus-set-text-properties (point-min) (point-max) nil)
5178 (set-window-configuration winconf)
5180 (set-window-start (get-buffer-window buf) start)
5181 (set-window-point (get-buffer-window buf) (point))))
5183 (defun gnus-article-edit-exit ()
5184 "Exit the article editing without updating."
5186 (when (or (not (buffer-modified-p))
5187 (yes-or-no-p "Article modified; kill anyway? "))
5188 (let ((curbuf (current-buffer))
5190 (window-start (window-start)))
5192 (if (gnus-buffer-live-p gnus-original-article-buffer)
5193 (insert-buffer gnus-original-article-buffer))
5194 (let ((winconf gnus-prev-winconf))
5196 (set-window-configuration winconf)
5197 ;; Tippy-toe some to make sure that point remains where it was.
5198 (save-current-buffer
5200 (set-window-start (get-buffer-window (current-buffer)) window-start)
5203 (defun gnus-article-edit-full-stops ()
5204 "Interactively repair spacing at end of sentences."
5207 (goto-char (point-min))
5208 (search-forward-regexp "^$" nil t)
5209 (let ((case-fold-search nil))
5210 (query-replace-regexp "\\([.!?][])}]* \\)\\([[({A-Z]\\)" "\\1 \\2"))))
5213 ;;; Article highlights
5216 ;; Written by Per Abrahamsen <abraham@iesd.auc.dk>.
5218 ;;; Internal Variables:
5220 (defcustom gnus-button-url-regexp "\\b\\(\\(www\\.\\|\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\|info\\):\\)\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?\\([-a-zA-Z0-9_=!?#$@~`%&*+|\\/:;.,]\\|\\w\\)+\\([-a-zA-Z0-9_=#$@~`%&*+|\\/]\\|\\w\\)\\)"
5221 "Regular expression that matches URLs."
5222 :group 'gnus-article-buttons
5225 (defcustom gnus-button-alist
5226 `(("<\\(url:[>\n\t ]*?\\)?\\(nntp\\|news\\):[>\n\t ]*\\([^>\n\t ]*@[^>\n\t ]*\\)>"
5227 0 t gnus-button-handle-news 3)
5228 ("\\b\\(nntp\\|news\\):\\([^>\n\t ]*@[^>)!;:,\n\t ]*\\)" 0 t
5229 gnus-button-handle-news 2)
5230 ("\\(\\b<\\(url:[>\n\t ]*\\)?news:[>\n\t ]*\\(//\\)?\\([^>\n\t ]*\\)>\\)"
5232 gnus-button-fetch-group 4)
5233 ("\\bnews:\\(//\\)?\\([^'\">\n\t ]+\\)" 0 t gnus-button-fetch-group 2)
5234 ("\\bin\\( +article\\| +message\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2
5235 t gnus-button-message-id 3)
5236 ("\\(<URL: *\\)mailto: *\\([^> \n\t]+\\)>" 0 t gnus-url-mailto 2)
5237 ("mailto:\\([-a-zA-Z.@_+0-9%=?]+\\)" 0 t gnus-url-mailto 1)
5238 ("\\bmailto:\\([^ \n\t]+\\)" 0 t gnus-url-mailto 1)
5240 ("\\binfo:\\(//\\)?\\([^'\">\n\t ]+\\)" 0 t
5241 gnus-button-handle-info 2)
5242 ;; This is how URLs _should_ be embedded in text...
5243 ("<URL: *\\([^<>]*\\)>" 1 t gnus-button-embedded-url 1)
5245 (gnus-button-url-regexp 0 t browse-url 0))
5246 "*Alist of regexps matching buttons in article bodies.
5248 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
5249 REGEXP: is the string matching text around the button,
5250 BUTTON: is the number of the regexp grouping actually matching the button,
5251 FORM: is a lisp expression which must eval to true for the button to
5253 CALLBACK: is the function to call when the user push this button, and each
5254 PAR: is a number of a regexp grouping whose text will be passed to CALLBACK.
5256 CALLBACK can also be a variable, in that case the value of that
5257 variable it the real callback function."
5258 :group 'gnus-article-buttons
5259 :type '(repeat (list (choice regexp variable)
5260 (integer :tag "Button")
5262 (function :tag "Callback")
5265 (integer :tag "Regexp group")))))
5267 (defcustom gnus-header-button-alist
5268 `(("^\\(References\\|Message-I[Dd]\\):" "<[^<>]+>"
5269 0 t gnus-button-message-id 0)
5270 ("^\\(From\\|Reply-To\\):" ": *\\(.+\\)$" 1 t gnus-button-reply 1)
5271 ("^\\(Cc\\|To\\):" "[^ \t\n<>,()\"]+@[^ \t\n<>,()\"]+"
5272 0 t gnus-button-mailto 0)
5273 ("^X-[Uu][Rr][Ll]:" ,gnus-button-url-regexp 0 t browse-url 0)
5274 ("^Subject:" ,gnus-button-url-regexp 0 t browse-url 0)
5275 ("^[^:]+:" ,gnus-button-url-regexp 0 t browse-url 0)
5276 ("^[^:]+:" "\\bmailto:\\([-a-zA-Z.@_+0-9%=?]+\\)" 0 t gnus-url-mailto 1)
5277 ("^[^:]+:" "\\(<\\(url: \\)?news:\\([^>\n ]*\\)>\\)" 1 t
5278 gnus-button-message-id 3))
5279 "*Alist of headers and regexps to match buttons in article heads.
5281 This alist is very similar to `gnus-button-alist', except that each
5282 alist has an additional HEADER element first in each entry:
5284 \(HEADER REGEXP BUTTON FORM CALLBACK PAR)
5286 HEADER is a regexp to match a header. For a fuller explanation, see
5287 `gnus-button-alist'."
5288 :group 'gnus-article-buttons
5289 :group 'gnus-article-headers
5290 :type '(repeat (list (regexp :tag "Header")
5292 (integer :tag "Button")
5294 (function :tag "Callback")
5297 (integer :tag "Regexp group")))))
5299 (defvar gnus-button-regexp nil)
5300 (defvar gnus-button-marker-list nil)
5301 ;; Regexp matching any of the regexps from `gnus-button-alist'.
5303 (defvar gnus-button-last nil)
5304 ;; The value of `gnus-button-alist' when `gnus-button-regexp' was build.
5308 (defun gnus-article-push-button (event)
5309 "Check text under the mouse pointer for a callback function.
5310 If the text under the mouse pointer has a `gnus-callback' property,
5311 call it with the value of the `gnus-data' text property."
5313 (set-buffer (window-buffer (posn-window (event-start event))))
5314 (let* ((pos (posn-point (event-start event)))
5315 (data (get-text-property pos 'gnus-data))
5316 (fun (get-text-property pos 'gnus-callback)))
5319 (funcall fun data))))
5321 (defun gnus-article-press-button ()
5322 "Check text at point for a callback function.
5323 If the text at point has a `gnus-callback' property,
5324 call it with the value of the `gnus-data' text property."
5326 (let* ((data (get-text-property (point) 'gnus-data))
5327 (fun (get-text-property (point) 'gnus-callback)))
5329 (funcall fun data))))
5331 (defun gnus-article-highlight (&optional force)
5332 "Highlight current article.
5333 This function calls `gnus-article-highlight-headers',
5334 `gnus-article-highlight-citation',
5335 `gnus-article-highlight-signature', and `gnus-article-add-buttons' to
5336 do the highlighting. See the documentation for those functions."
5337 (interactive (list 'force))
5338 (gnus-article-highlight-headers)
5339 (gnus-article-highlight-citation force)
5340 (gnus-article-highlight-signature)
5341 (gnus-article-add-buttons force)
5342 (gnus-article-add-buttons-to-head))
5344 (defun gnus-article-highlight-some (&optional force)
5345 "Highlight current article.
5346 This function calls `gnus-article-highlight-headers',
5347 `gnus-article-highlight-signature', and `gnus-article-add-buttons' to
5348 do the highlighting. See the documentation for those functions."
5349 (interactive (list 'force))
5350 (gnus-article-highlight-headers)
5351 (gnus-article-highlight-signature)
5352 (gnus-article-add-buttons))
5354 (defun gnus-article-highlight-headers ()
5355 "Highlight article headers as specified by `gnus-header-face-alist'."
5358 (set-buffer gnus-article-buffer)
5360 (let ((alist gnus-header-face-alist)
5361 (buffer-read-only nil)
5362 (case-fold-search t)
5363 (inhibit-point-motion-hooks t)
5364 entry regexp header-face field-face from hpoints fpoints)
5365 (article-narrow-to-head)
5366 (while (setq entry (pop alist))
5367 (goto-char (point-min))
5368 (setq regexp (concat "^\\("
5369 (if (string-equal "" (nth 0 entry))
5373 header-face (nth 1 entry)
5374 field-face (nth 2 entry))
5375 (while (and (re-search-forward regexp nil t)
5379 (unless (search-forward ":" nil t)
5381 (when (and header-face
5382 (not (memq (point) hpoints)))
5383 (push (point) hpoints)
5384 (gnus-put-text-property from (point) 'face header-face))
5385 (when (and field-face
5386 (not (memq (setq from (point)) fpoints)))
5388 (if (re-search-forward "^[^ \t]" nil t)
5390 (goto-char (point-max)))
5391 (gnus-put-text-property from (point) 'face field-face))))))))
5393 (defun gnus-article-highlight-signature ()
5394 "Highlight the signature in an article.
5395 It does this by highlighting everything after
5396 `gnus-signature-separator' using `gnus-signature-face'."
5399 (set-buffer gnus-article-buffer)
5400 (let ((buffer-read-only nil)
5401 (inhibit-point-motion-hooks t))
5403 (when (and gnus-signature-face
5404 (gnus-article-narrow-to-signature))
5405 (gnus-overlay-put (gnus-make-overlay (point-min) (point-max))
5406 'face gnus-signature-face)
5408 (gnus-article-search-signature)
5409 (let ((start (match-beginning 0))
5410 (end (set-marker (make-marker) (1+ (match-end 0)))))
5411 (gnus-article-add-button start (1- end) 'gnus-signature-toggle
5414 (defun gnus-button-in-region-p (b e prop)
5415 "Say whether PROP exists in the region."
5416 (text-property-not-all b e prop nil))
5418 (defun gnus-article-add-buttons (&optional force)
5419 "Find external references in the article and make buttons of them.
5420 \"External references\" are things like Message-IDs and URLs, as
5421 specified by `gnus-button-alist'."
5422 (interactive (list 'force))
5424 (set-buffer gnus-article-buffer)
5425 (let ((buffer-read-only nil)
5426 (inhibit-point-motion-hooks t)
5427 (case-fold-search t)
5428 (alist gnus-button-alist)
5430 ;; Remove all old markers.
5431 (let (marker entry new-list)
5432 (while (setq marker (pop gnus-button-marker-list))
5433 (if (or (< marker (point-min)) (>= marker (point-max)))
5434 (push marker new-list)
5436 (when (setq entry (gnus-button-entry))
5437 (put-text-property (match-beginning (nth 1 entry))
5438 (match-end (nth 1 entry))
5439 'gnus-callback nil))
5440 (set-marker marker nil)))
5441 (setq gnus-button-marker-list new-list))
5442 ;; We skip the headers.
5445 (while (setq entry (pop alist))
5446 (setq regexp (eval (car entry)))
5448 (while (re-search-forward regexp nil t)
5449 (let* ((start (and entry (match-beginning (nth 1 entry))))
5450 (end (and entry (match-end (nth 1 entry))))
5451 (from (match-beginning 0)))
5452 (when (and (or (eq t (nth 2 entry))
5453 (eval (nth 2 entry)))
5454 (not (gnus-button-in-region-p
5455 start end 'gnus-callback)))
5456 ;; That optional form returned non-nil, so we add the
5458 (gnus-article-add-button
5459 start end 'gnus-button-push
5460 (car (push (set-marker (make-marker) from)
5461 gnus-button-marker-list))))))))))
5463 ;; Add buttons to the head of an article.
5464 (defun gnus-article-add-buttons-to-head ()
5465 "Add buttons to the head of the article."
5468 (set-buffer gnus-article-buffer)
5470 (let ((buffer-read-only nil)
5471 (inhibit-point-motion-hooks t)
5472 (case-fold-search t)
5473 (alist gnus-header-button-alist)
5475 (article-narrow-to-head)
5477 ;; Each alist entry.
5478 (setq entry (car alist)
5480 (goto-char (point-min))
5481 (while (re-search-forward (car entry) nil t)
5482 ;; Each header matching the entry.
5483 (setq beg (match-beginning 0))
5484 (setq end (or (and (re-search-forward "^[^ \t]" nil t)
5485 (match-beginning 0))
5488 (while (re-search-forward (nth 1 entry) end t)
5489 ;; Each match within a header.
5490 (let* ((entry (cdr entry))
5491 (start (match-beginning (nth 1 entry)))
5492 (end (match-end (nth 1 entry)))
5493 (form (nth 2 entry)))
5494 (goto-char (match-end 0))
5496 (gnus-article-add-button
5497 start end (nth 3 entry)
5498 (buffer-substring (match-beginning (nth 4 entry))
5499 (match-end (nth 4 entry)))))))
5500 (goto-char end)))))))
5502 ;;; External functions:
5504 (defun gnus-article-add-button (from to fun &optional data)
5505 "Create a button between FROM and TO with callback FUN and data DATA."
5506 (when gnus-article-button-face
5507 (gnus-overlay-put (gnus-make-overlay from to)
5508 'face gnus-article-button-face))
5509 (gnus-add-text-properties
5511 (nconc (and gnus-article-mouse-face
5512 (list gnus-mouse-face-prop gnus-article-mouse-face))
5513 (list 'gnus-callback fun)
5514 (and data (list 'gnus-data data))))
5515 (widget-convert-button 'link from to :action 'gnus-widget-press-button
5516 :button-keymap gnus-widget-button-keymap))
5518 ;;; Internal functions:
5520 (defun gnus-article-set-globals ()
5522 (set-buffer gnus-summary-buffer)
5523 (gnus-set-global-variables)))
5525 (defun gnus-signature-toggle (end)
5527 (set-buffer gnus-article-buffer)
5528 (let ((buffer-read-only nil)
5529 (inhibit-point-motion-hooks t))
5530 (if (text-property-any end (point-max) 'article-type 'signature)
5532 (gnus-delete-wash-type 'signature)
5533 (gnus-remove-text-properties-when
5534 'article-type 'signature end (point-max)
5535 (cons 'article-type (cons 'signature
5536 gnus-hidden-properties))))
5537 (gnus-add-wash-type 'signature)
5538 (gnus-add-text-properties-when
5539 'article-type nil end (point-max)
5540 (cons 'article-type (cons 'signature
5541 gnus-hidden-properties)))))
5542 (let ((gnus-article-mime-handle-alist-1 gnus-article-mime-handle-alist))
5543 (gnus-set-mode-line 'article))))
5545 (defun gnus-button-entry ()
5546 ;; Return the first entry in `gnus-button-alist' matching this place.
5547 (let ((alist gnus-button-alist)
5550 (setq entry (pop alist))
5551 (if (looking-at (eval (car entry)))
5556 (defun gnus-button-push (marker)
5557 ;; Push button starting at MARKER.
5560 (let* ((entry (gnus-button-entry))
5561 (inhibit-point-motion-hooks t)
5563 (args (mapcar (lambda (group)
5564 (let ((string (match-string group)))
5565 (gnus-set-text-properties
5566 0 (length string) nil string)
5573 (fboundp (symbol-value fun)))
5574 (apply (symbol-value fun) args))
5576 (gnus-message 1 "You must define `%S' to use this button"
5577 (cons fun args)))))))
5579 (defun gnus-parse-news-url (url)
5580 (let (scheme server group message-id articles)
5583 (goto-char (point-min))
5584 (when (looking-at "\\([A-Za-z]+\\):")
5585 (setq scheme (match-string 1))
5586 (goto-char (match-end 0)))
5587 (when (looking-at "//\\([^/]+\\)/")
5588 (setq server (match-string 1))
5589 (goto-char (match-end 0)))
5592 ((looking-at "\\(.*@.*\\)")
5593 (setq message-id (match-string 1)))
5594 ((looking-at "\\([^/]+\\)/\\([-0-9]+\\)")
5595 (setq group (match-string 1)
5596 articles (split-string (match-string 2) "-")))
5597 ((looking-at "\\([^/]+\\)/?")
5598 (setq group (match-string 1)))
5600 (error "Unknown news URL syntax"))))
5601 (list scheme server group message-id articles)))
5603 (defun gnus-button-handle-news (url)
5605 (destructuring-bind (scheme server group message-id articles)
5606 (gnus-parse-news-url url)
5610 (set-buffer gnus-summary-buffer)
5612 (let ((gnus-refer-article-method (list (list 'nntp server))))
5613 (gnus-summary-refer-article message-id))
5614 (gnus-summary-refer-article message-id))))
5616 (gnus-button-fetch-group url)))))
5618 (defun gnus-button-handle-info (url)
5619 "Fetch an info URL."
5621 "^\\([^:/]+\\)?/\\(.*\\)"
5623 (gnus-info-find-node
5624 (concat "(" (or (gnus-url-unhex-string (match-string 1 url))
5627 (gnus-url-unhex-string (match-string 2 url))))
5628 (error "Can't parse %s" url)))
5630 (defun gnus-button-message-id (message-id)
5633 (set-buffer gnus-summary-buffer)
5634 (gnus-summary-refer-article message-id)))
5636 (defun gnus-button-fetch-group (address)
5637 "Fetch GROUP specified by ADDRESS."
5638 (if (not (string-match "[:/]" address))
5639 ;; This is just a simple group url.
5640 (gnus-group-read-ephemeral-group address gnus-select-method)
5643 "^\\([^:/]+\\)\\(:\\([^/]+\\)\\)?/\\([^/]+\\)\\(/\\([0-9]+\\)\\)?"
5645 (error "Can't parse %s" address)
5646 (gnus-group-read-ephemeral-group
5647 (match-string 4 address)
5648 `(nntp ,(match-string 1 address)
5649 (nntp-address ,(match-string 1 address))
5650 (nntp-port-number ,(if (match-end 3)
5651 (match-string 3 address)
5654 (and (match-end 6) (list (string-to-int (match-string 6 address))))))))
5656 (defun gnus-url-parse-query-string (query &optional downcase)
5657 (let (retval pairs cur key val)
5658 (setq pairs (split-string query "&"))
5660 (setq cur (car pairs)
5662 (if (not (string-match "=" cur))
5664 (setq key (gnus-url-unhex-string (substring cur 0 (match-beginning 0)))
5665 val (gnus-url-unhex-string (substring cur (match-end 0) nil) t))
5667 (setq key (downcase key)))
5668 (setq cur (assoc key retval))
5670 (setcdr cur (cons val (cdr cur)))
5671 (setq retval (cons (list key val) retval)))))
5674 (defun gnus-url-mailto (url)
5675 ;; Send mail to someone
5676 (when (string-match "mailto:/*\\(.*\\)" url)
5677 (setq url (substring url (match-beginning 1) nil)))
5678 (let (to args subject func)
5679 (if (string-match (regexp-quote "?") url)
5680 (setq to (gnus-url-unhex-string (substring url 0 (match-beginning 0)))
5681 args (gnus-url-parse-query-string
5682 (substring url (match-end 0) nil) t))
5683 (setq to (gnus-url-unhex-string url)))
5684 (setq args (cons (list "to" to) args)
5685 subject (cdr-safe (assoc "subject" args)))
5688 (setq func (intern-soft (concat "message-goto-" (downcase (caar args)))))
5691 (message-position-on-field (caar args)))
5692 (insert (mapconcat 'identity (cdar args) ", "))
5693 (setq args (cdr args)))
5696 (message-goto-subject))))
5698 (defun gnus-button-embedded-url (address)
5699 "Activate ADDRESS with `browse-url'."
5700 (browse-url (gnus-strip-whitespace address)))
5702 ;;; Next/prev buttons in the article buffer.
5704 (defvar gnus-next-page-line-format "%{%(Next page...%)%}\n")
5705 (defvar gnus-prev-page-line-format "%{%(Previous page...%)%}\n")
5707 (defvar gnus-prev-page-map
5708 (let ((map (make-sparse-keymap)))
5709 (unless (>= emacs-major-version 21)
5710 ;; XEmacs doesn't care.
5711 (set-keymap-parent map gnus-article-mode-map))
5712 (define-key map gnus-mouse-2 'gnus-button-prev-page)
5713 (define-key map "\r" 'gnus-button-prev-page)
5716 (defun gnus-insert-prev-page-button ()
5718 (buffer-read-only nil))
5720 gnus-prev-page-line-format nil
5721 `(,@(gnus-local-map-property gnus-prev-page-map)
5723 gnus-callback gnus-article-button-prev-page
5724 article-type annotation))
5725 (widget-convert-button
5727 :action 'gnus-button-prev-page
5728 :button-keymap gnus-prev-page-map)))
5730 (defvar gnus-prev-page-map
5731 (let ((map (make-sparse-keymap)))
5732 (unless (>= emacs-major-version 21)
5733 ;; XEmacs doesn't care.
5734 (set-keymap-parent map gnus-article-mode-map))
5735 (define-key map gnus-mouse-2 'gnus-button-prev-page)
5736 (define-key map "\r" 'gnus-button-prev-page)
5739 (defvar gnus-next-page-map
5740 (let ((map (make-sparse-keymap)))
5741 (unless (>= emacs-major-version 21)
5742 ;; XEmacs doesn't care.
5743 (set-keymap-parent map gnus-article-mode-map))
5744 (define-key map gnus-mouse-2 'gnus-button-next-page)
5745 (define-key map "\r" 'gnus-button-next-page)
5748 (defun gnus-button-next-page (&optional args more-args)
5749 "Go to the next page."
5751 (let ((win (selected-window)))
5752 (select-window (gnus-get-buffer-window gnus-article-buffer t))
5753 (gnus-article-next-page)
5754 (select-window win)))
5756 (defun gnus-button-prev-page (&optional args more-args)
5757 "Go to the prev page."
5759 (let ((win (selected-window)))
5760 (select-window (gnus-get-buffer-window gnus-article-buffer t))
5761 (gnus-article-prev-page)
5762 (select-window win)))
5764 (defun gnus-insert-next-page-button ()
5766 (buffer-read-only nil))
5767 (gnus-eval-format gnus-next-page-line-format nil
5768 `(,@(gnus-local-map-property gnus-next-page-map)
5770 gnus-callback gnus-article-button-next-page
5771 article-type annotation))
5772 (widget-convert-button
5774 :action 'gnus-button-next-page
5775 :button-keymap gnus-next-page-map)))
5777 (defun gnus-article-button-next-page (arg)
5778 "Go to the next page."
5780 (let ((win (selected-window)))
5781 (select-window (gnus-get-buffer-window gnus-article-buffer t))
5782 (gnus-article-next-page)
5783 (select-window win)))
5785 (defun gnus-article-button-prev-page (arg)
5786 "Go to the prev page."
5788 (let ((win (selected-window)))
5789 (select-window (gnus-get-buffer-window gnus-article-buffer t))
5790 (gnus-article-prev-page)
5791 (select-window win)))
5793 (defvar gnus-decode-header-methods
5794 '(mail-decode-encoded-word-region)
5795 "List of methods used to decode headers.
5797 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
5798 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
5799 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
5800 whose names match REGEXP.
5803 \((\"chinese\" . gnus-decode-encoded-word-region-by-guess)
5804 mail-decode-encoded-word-region
5805 (\"chinese\" . rfc1843-decode-region))
5808 (defvar gnus-decode-header-methods-cache nil)
5810 (defun gnus-multi-decode-header (start end)
5811 "Apply the functions from `gnus-encoded-word-methods' that match."
5812 (unless (and gnus-decode-header-methods-cache
5813 (eq gnus-newsgroup-name
5814 (car gnus-decode-header-methods-cache)))
5815 (setq gnus-decode-header-methods-cache (list gnus-newsgroup-name))
5818 (nconc gnus-decode-header-methods-cache (list x))
5819 (if (and gnus-newsgroup-name
5820 (string-match (car x) gnus-newsgroup-name))
5821 (nconc gnus-decode-header-methods-cache
5823 gnus-decode-header-methods))
5824 (let ((xlist gnus-decode-header-methods-cache))
5827 (narrow-to-region start end)
5829 (funcall (pop xlist) (point-min) (point-max))))))
5832 ;;; Treatment top-level handling.
5835 (defun gnus-treat-article (condition &optional part-number total-parts type)
5836 (let ((length (- (point-max) (point-min)))
5837 (alist gnus-treatment-function-alist)
5838 (article-goto-body-goes-to-point-min-p t)
5842 (let ((list gnus-article-treat-types))
5844 (when (string-match (pop list) type)
5845 (throw 'found t)))))))
5846 (highlightp (gnus-visual-p 'article-highlight 'highlight))
5848 (gnus-run-hooks 'gnus-part-display-hook)
5849 (while (setq elem (pop alist))
5852 (if (gnus-buffer-live-p gnus-summary-buffer)
5853 (set-buffer gnus-summary-buffer))
5854 (symbol-value (car elem))))
5855 (when (and (or (consp val)
5857 (gnus-treat-predicate val)
5858 (or (not (get (car elem) 'highlight))
5861 (funcall (cadr elem)))))))
5863 ;; Dynamic variables.
5865 (defvar part-number)
5866 (defvar total-parts)
5871 (defun gnus-treat-predicate (val)
5876 (stringp (car val)))
5877 (apply 'gnus-or (mapcar `(lambda (s)
5878 (string-match s ,(or gnus-newsgroup-name "")))
5881 (let ((pred (pop val)))
5884 (apply 'gnus-or (mapcar 'gnus-treat-predicate val)))
5886 (apply 'gnus-and (mapcar 'gnus-treat-predicate val)))
5888 (not (gnus-treat-predicate (car val))))
5890 (equal (car val) type))
5892 (error "%S is not a valid predicate" pred)))))
5900 (eq part-number total-parts))
5904 (error "%S is not a valid value" val))))
5906 (defun gnus-article-encrypt-body (protocol &optional n)
5907 "Encrypt the article body."
5910 (or gnus-article-encrypt-protocol
5911 (completing-read "Encrypt protocol: "
5912 gnus-article-encrypt-protocol-alist
5914 current-prefix-arg))
5915 (let ((func (cdr (assoc protocol gnus-article-encrypt-protocol-alist))))
5917 (error (format "Can't find the encrypt protocol %s" protocol)))
5918 (if (equal gnus-newsgroup-name "nndraft:drafts")
5919 (error "Can't encrypt the article in group nndraft:drafts"))
5920 (if (equal gnus-newsgroup-name "nndraft:queue")
5921 (error "Don't encrypt the article in group nndraft:queue"))
5922 (gnus-summary-iterate n
5924 (set-buffer gnus-summary-buffer)
5925 (let ((mail-parse-charset gnus-newsgroup-charset)
5926 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5927 (summary-buffer gnus-summary-buffer)
5929 (gnus-set-global-variables)
5930 (when (gnus-group-read-only-p)
5931 (error "The current newsgroup does not support article encrypt"))
5932 (gnus-summary-show-article t)
5934 (or (mail-header-references gnus-current-headers) ""))
5935 (set-buffer gnus-article-buffer)
5936 (let* ((buffer-read-only nil)
5938 (mapcar (lambda (field)
5939 (and (save-restriction
5940 (message-narrow-to-head)
5941 (goto-char (point-min))
5942 (search-forward field nil t))
5944 (message-narrow-to-field)
5945 (buffer-substring (point-min) (point-max))
5946 (delete-region (point-min) (point-max))
5948 '("Content-Type:" "Content-Transfer-Encoding:"
5949 "Content-Disposition:"))))
5950 (message-narrow-to-head)
5951 (message-remove-header "MIME-Version")
5952 (goto-char (point-max))
5953 (setq point (point))
5954 (insert (apply 'concat headers))
5956 (narrow-to-region point (point-max))
5957 (let ((message-options message-options))
5958 (message-options-set 'message-sender user-mail-address)
5959 (message-options-set 'message-recipients user-mail-address)
5960 (message-options-set 'message-sign-encrypt 'not)
5962 (goto-char (point-min))
5963 (insert "MIME-Version: 1.0\n")
5965 (gnus-summary-edit-article-done
5966 references nil summary-buffer t))
5967 (when gnus-keep-backlog
5968 (gnus-backlog-remove-article
5969 (car gnus-article-current) (cdr gnus-article-current)))
5971 (when (get-buffer gnus-original-article-buffer)
5972 (set-buffer gnus-original-article-buffer)
5973 (setq gnus-original-article nil)))
5974 (when gnus-use-cache
5975 (gnus-cache-update-article
5976 (car gnus-article-current) (cdr gnus-article-current))))))))
5978 (defvar gnus-mime-security-button-line-format "%{%([[%t:%i]%D]%)%}\n"
5979 "The following specs can be used:
5980 %t The security MIME type
5983 %D Details if button is pressed")
5985 (defvar gnus-mime-security-button-end-line-format "%{%([[End of %t]%D]%)%}\n"
5986 "The following specs can be used:
5987 %t The security MIME type
5990 %D Details if button is pressed")
5992 (defvar gnus-mime-security-button-line-format-alist
5993 '((?t gnus-tmp-type ?s)
5994 (?i gnus-tmp-info ?s)
5995 (?d gnus-tmp-details ?s)
5996 (?D gnus-tmp-pressed-details ?s)))
5998 (defvar gnus-mime-security-button-map
5999 (let ((map (make-sparse-keymap)))
6000 (unless (>= (string-to-number emacs-version) 21)
6001 (set-keymap-parent map gnus-article-mode-map))
6002 (define-key map gnus-mouse-2 'gnus-article-push-button)
6003 (define-key map "\r" 'gnus-article-press-button)
6006 (defvar gnus-mime-security-details-buffer nil)
6008 (defvar gnus-mime-security-button-pressed nil)
6010 (defvar gnus-mime-security-show-details-inline t
6011 "If non-nil, show details in the article buffer.")
6013 (defun gnus-mime-security-verify-or-decrypt (handle)
6014 (mm-remove-parts (cdr handle))
6015 (let ((region (mm-handle-multipart-ctl-parameter handle 'gnus-region))
6016 point buffer-read-only)
6018 (goto-char (car region)))
6020 (narrow-to-region (point) (point))
6021 (with-current-buffer (mm-handle-multipart-original-buffer handle)
6022 (let* ((mm-verify-option 'known)
6023 (mm-decrypt-option 'known)
6024 (nparts (mm-possibly-verify-or-decrypt (cdr handle) handle)))
6025 (unless (eq nparts (cdr handle))
6026 (mm-destroy-parts (cdr handle))
6027 (setcdr handle nparts))))
6028 (setq point (point))
6029 (gnus-mime-display-security handle)
6030 (goto-char (point-max)))
6032 (delete-region (point) (cdr region))
6033 (set-marker (car region) nil)
6034 (set-marker (cdr region) nil))
6037 (defun gnus-mime-security-show-details (handle)
6038 (let ((details (mm-handle-multipart-ctl-parameter handle 'gnus-details)))
6040 (if gnus-mime-security-show-details-inline
6041 (let ((gnus-mime-security-button-pressed t)
6042 (gnus-mime-security-button-line-format
6043 (get-text-property (point) 'gnus-line-format))
6046 (while (eq (get-text-property (point) 'gnus-line-format)
6047 gnus-mime-security-button-line-format)
6051 (narrow-to-region (point) (point))
6052 (gnus-insert-mime-security-button handle))
6053 (delete-region (point)
6054 (or (text-property-not-all
6057 gnus-mime-security-button-line-format)
6059 (if (gnus-buffer-live-p gnus-mime-security-details-buffer)
6060 (with-current-buffer gnus-mime-security-details-buffer
6063 (setq gnus-mime-security-details-buffer
6064 (gnus-get-buffer-create "*MIME Security Details*")))
6065 (with-current-buffer gnus-mime-security-details-buffer
6067 (goto-char (point-min)))
6068 (pop-to-buffer gnus-mime-security-details-buffer))
6069 (gnus-message 5 "No details."))))
6071 (defun gnus-mime-security-press-button (handle)
6072 (if (mm-handle-multipart-ctl-parameter handle 'gnus-info)
6073 (gnus-mime-security-show-details handle)
6074 (gnus-mime-security-verify-or-decrypt handle)))
6076 (defun gnus-insert-mime-security-button (handle &optional displayed)
6077 (let* ((protocol (mm-handle-multipart-ctl-parameter handle 'protocol))
6080 (or (nth 2 (assoc protocol mm-verify-function-alist))
6081 (nth 2 (assoc protocol mm-decrypt-function-alist))
6083 (if (equal (car handle) "multipart/signed")
6084 " Signed" " Encrypted")
6087 (or (mm-handle-multipart-ctl-parameter handle 'gnus-info)
6090 (mm-handle-multipart-ctl-parameter handle 'gnus-details))
6091 gnus-tmp-pressed-details
6093 (setq gnus-tmp-details
6094 (if gnus-tmp-details
6095 (concat "\n" gnus-tmp-details) ""))
6096 (setq gnus-tmp-pressed-details
6097 (if gnus-mime-security-button-pressed gnus-tmp-details ""))
6102 gnus-mime-security-button-line-format
6103 gnus-mime-security-button-line-format-alist
6104 `(,@(gnus-local-map-property gnus-mime-security-button-map)
6105 gnus-callback gnus-mime-security-press-button
6106 gnus-line-format ,gnus-mime-security-button-line-format
6107 article-type annotation
6110 (widget-convert-button
6113 :action 'gnus-widget-press-button
6114 :button-keymap gnus-mime-security-button-map
6116 (lambda (widget/window &optional overlay pos)
6117 ;; Needed to properly clear the message due to a bug in
6118 ;; wid-edit (XEmacs only).
6119 (if (boundp 'help-echo-owns-message)
6120 (setq help-echo-owns-message t))
6123 (aref gnus-mouse-2 0))))))
6125 (defun gnus-mime-display-security (handle)
6127 (narrow-to-region (point) (point))
6128 (unless (gnus-unbuttonized-mime-type-p (car handle))
6129 (gnus-insert-mime-security-button handle))
6130 (gnus-mime-display-mixed (cdr handle))
6133 (unless (gnus-unbuttonized-mime-type-p (car handle))
6134 (let ((gnus-mime-security-button-line-format
6135 gnus-mime-security-button-end-line-format))
6136 (gnus-insert-mime-security-button handle)))
6137 (mm-set-handle-multipart-parameter
6139 (cons (set-marker (make-marker) (point-min))
6140 (set-marker (make-marker) (point-max))))))
6146 (run-hooks 'gnus-art-load-hook)
6148 ;;; gnus-art.el ends here