1 ;;; mm-decode.el --- Functions for decoding MIME things
2 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
31 (eval-when-compile (require 'cl
)
35 (autoload 'executable-find
"executable")
36 (autoload 'mm-inline-partial
"mm-partial")
37 (autoload 'mm-inline-external-body
"mm-extern")
38 (autoload 'mm-insert-inline
"mm-view"))
40 (add-hook 'gnus-exit-gnus-hook
'mm-destroy-postponed-undisplay-list
)
42 (defgroup mime-display
()
43 "Display of MIME in mail and news articles."
44 :link
'(custom-manual "(emacs-mime)Display Customization")
50 (defgroup mime-security
()
51 "MIME security in mail and news articles."
52 :link
'(custom-manual "(emacs-mime)Display Customization")
57 ;;; Convenience macros.
59 (defmacro mm-handle-buffer
(handle)
61 (defmacro mm-handle-type
(handle)
63 (defsubst mm-handle-media-type
(handle)
64 (if (stringp (car handle
))
66 (car (mm-handle-type handle
))))
67 (defsubst mm-handle-media-supertype
(handle)
68 (car (split-string (mm-handle-media-type handle
) "/")))
69 (defsubst mm-handle-media-subtype
(handle)
70 (cadr (split-string (mm-handle-media-type handle
) "/")))
71 (defmacro mm-handle-encoding
(handle)
73 (defmacro mm-handle-undisplayer
(handle)
75 (defmacro mm-handle-set-undisplayer
(handle function
)
76 `(setcar (nthcdr 3 ,handle
) ,function
))
77 (defmacro mm-handle-disposition
(handle)
79 (defmacro mm-handle-description
(handle)
81 (defmacro mm-handle-cache
(handle)
83 (defmacro mm-handle-set-cache
(handle contents
)
84 `(setcar (nthcdr 6 ,handle
) ,contents
))
85 (defmacro mm-handle-id
(handle)
87 (defmacro mm-handle-multipart-original-buffer
(handle)
88 `(get-text-property 0 'buffer
(car ,handle
)))
89 (defmacro mm-handle-multipart-from
(handle)
90 `(get-text-property 0 'from
(car ,handle
)))
91 (defmacro mm-handle-multipart-ctl-parameter
(handle parameter
)
92 `(get-text-property 0 ,parameter
(car ,handle
)))
94 (defmacro mm-make-handle
(&optional buffer type encoding undisplayer
95 disposition description cache
97 `(list ,buffer
,type
,encoding
,undisplayer
98 ,disposition
,description
,cache
,id
))
100 (defcustom mm-text-html-renderer
101 (cond ((locate-library "w3") 'w3
)
102 ((executable-find "w3m") (if (locate-library "w3m")
105 ((executable-find "links") 'links
)
106 ((executable-find "lynx") 'lynx
)
108 "Render of HTML contents.
109 It is one of defined renderer types, or a rendering function.
110 The defined renderer types are:
112 `w3m' : use emacs-w3m;
113 `w3m-standalone': use w3m;
116 `html2text' : use html2text;
117 nil : use external viewer."
119 :type
'(choice (const w3
)
121 (const w3m-standalone
)
127 :group
'mime-display
)
129 (defvar mm-inline-text-html-renderer nil
130 "Function used for rendering inline HTML contents.
131 It is suggested to customize `mm-text-html-renderer' instead.")
133 (defcustom mm-inline-text-html-with-images nil
134 "If non-nil, Gnus will allow retrieving images in HTML contents with
135 the <img> tags. It has no effect on Emacs/w3. See also the
136 documentation for the `mm-w3m-safe-url-regexp' variable."
139 :group
'mime-display
)
141 (defcustom mm-w3m-safe-url-regexp
"\\`cid:"
142 "Regexp matching URLs which are considered to be safe.
143 Some HTML mails might contain a nasty trick used by spammers, using
144 the <img> tag which is far more evil than the [Click Here!] button.
145 It is most likely intended to check whether the ominous spam mail has
146 reached your eyes or not, in which case the spammer knows for sure
147 that your email address is valid. It is done by embedding an
148 identifier string into a URL that you might automatically retrieve
149 when displaying the image. The default value is \"\\\\`cid:\" which only
150 matches parts embedded to the Multipart/Related type MIME contents and
151 Gnus will never connect to the spammer's site arbitrarily. You may
152 set this variable to nil if you consider all urls to be safe."
154 :type
'(choice (regexp :tag
"Regexp")
155 (const :tag
"All URLs are safe" nil
))
156 :group
'mime-display
)
158 (defcustom mm-inline-text-html-with-w3m-keymap t
159 "If non-nil, use emacs-w3m command keys in the article buffer."
162 :group
'mime-display
)
164 (defcustom mm-enable-external t
165 "Indicate whether external MIME handlers should be used.
167 If t, all defined external MIME handlers are used. If nil, files are saved by
168 `mailcap-save-binary-file'. If it is the symbol `ask', you are prompted
169 before the external MIME handler is invoked."
171 :type
'(choice (const :tag
"Always" t
)
172 (const :tag
"Never" nil
)
173 (const :tag
"Ask" ask
))
174 :group
'mime-display
)
176 (defcustom mm-inline-media-tests
180 (mm-valid-and-fit-image-p 'jpeg handle
)))
184 (mm-valid-and-fit-image-p 'png handle
)))
188 (mm-valid-and-fit-image-p 'gif handle
)))
192 (mm-valid-and-fit-image-p 'tiff handle
)) )
196 (mm-valid-and-fit-image-p 'xbm handle
)))
200 (mm-valid-and-fit-image-p 'xbm handle
)))
204 (mm-valid-and-fit-image-p 'xpm handle
)))
208 (mm-valid-and-fit-image-p 'xpm handle
)))
212 (mm-valid-and-fit-image-p 'bmp handle
)))
213 ("image/x-portable-bitmap"
216 (mm-valid-and-fit-image-p 'pbm handle
)))
217 ("text/plain" mm-inline-text identity
)
218 ("text/enriched" mm-inline-text identity
)
219 ("text/richtext" mm-inline-text identity
)
220 ("text/x-patch" mm-display-patch-inline
222 (locate-library "diff-mode")))
223 ("application/emacs-lisp" mm-display-elisp-inline identity
)
224 ("application/x-emacs-lisp" mm-display-elisp-inline identity
)
228 (or mm-inline-text-html-renderer
229 mm-text-html-renderer
)))
233 (or (featurep 'vcard
)
234 (locate-library "vcard"))))
235 ("message/delivery-status" mm-inline-text identity
)
236 ("message/rfc822" mm-inline-message identity
)
237 ("message/partial" mm-inline-partial identity
)
238 ("message/external-body" mm-inline-external-body identity
)
239 ("text/.*" mm-inline-text identity
)
240 ("audio/wav" mm-inline-audio
242 (and (or (featurep 'nas-sound
) (featurep 'native-sound
))
243 (device-sound-enabled-p))))
247 (and (or (featurep 'nas-sound
) (featurep 'native-sound
))
248 (device-sound-enabled-p))))
249 ("application/pgp-signature" ignore identity
)
250 ("application/x-pkcs7-signature" ignore identity
)
251 ("application/pkcs7-signature" ignore identity
)
252 ("application/x-pkcs7-mime" ignore identity
)
253 ("application/pkcs7-mime" ignore identity
)
254 ("multipart/alternative" ignore identity
)
255 ("multipart/mixed" ignore identity
)
256 ("multipart/related" ignore identity
)
257 ;; Disable audio and image
258 ("audio/.*" ignore ignore
)
259 ("image/.*" ignore ignore
)
260 ;; Default to displaying as text
261 (".*" mm-inline-text mm-readable-p
))
262 "Alist of media types/tests saying whether types can be displayed inline."
263 :type
'(repeat (list (regexp :tag
"MIME type")
264 (function :tag
"Display function")
265 (function :tag
"Display test")))
266 :group
'mime-display
)
268 (defcustom mm-inlined-types
269 '("image/.*" "text/.*" "message/delivery-status" "message/rfc822"
270 "message/partial" "message/external-body" "application/emacs-lisp"
271 "application/x-emacs-lisp"
272 "application/pgp-signature" "application/x-pkcs7-signature"
273 "application/pkcs7-signature" "application/x-pkcs7-mime"
274 "application/pkcs7-mime")
275 "List of media types that are to be displayed inline.
276 See also `mm-inline-media-tests', which says how to display a media
278 :type
'(repeat string
)
279 :group
'mime-display
)
281 (defcustom mm-keep-viewer-alive-types
282 '("application/postscript" "application/msword" "application/vnd.ms-excel"
283 "application/pdf" "application/x-dvi")
284 "List of media types for which the external viewer will not be killed
285 when selecting a different article."
287 :type
'(repeat string
)
288 :group
'mime-display
)
290 (defcustom mm-automatic-display
291 '("text/plain" "text/enriched" "text/richtext" "text/html"
292 "text/x-vcard" "image/.*" "message/delivery-status" "multipart/.*"
293 "message/rfc822" "text/x-patch" "application/pgp-signature"
294 "application/emacs-lisp" "application/x-emacs-lisp"
295 "application/x-pkcs7-signature"
296 "application/pkcs7-signature" "application/x-pkcs7-mime"
297 "application/pkcs7-mime")
298 "A list of MIME types to be displayed automatically."
299 :type
'(repeat string
)
300 :group
'mime-display
)
302 (defcustom mm-attachment-override-types
'("text/x-vcard"
303 "application/pkcs7-mime"
304 "application/x-pkcs7-mime"
305 "application/pkcs7-signature"
306 "application/x-pkcs7-signature")
307 "Types to have \"attachment\" ignored if they can be displayed inline."
308 :type
'(repeat string
)
309 :group
'mime-display
)
311 (defcustom mm-inline-override-types nil
312 "Types to be treated as attachments even if they can be displayed inline."
313 :type
'(repeat string
)
314 :group
'mime-display
)
316 (defcustom mm-automatic-external-display nil
317 "List of MIME type regexps that will be displayed externally automatically."
318 :type
'(repeat string
)
319 :group
'mime-display
)
321 (defcustom mm-discouraged-alternatives nil
322 "List of MIME types that are discouraged when viewing multipart/alternative.
323 Viewing agents are supposed to view the last possible part of a message,
324 as that is supposed to be the richest. However, users may prefer other
325 types instead, and this list says what types are most unwanted. If,
326 for instance, text/html parts are very unwanted, and text/richtext are
327 somewhat unwanted, then the value of this variable should be set
330 (\"text/html\" \"text/richtext\")"
331 :type
'(repeat string
)
332 :group
'mime-display
)
334 (defcustom mm-tmp-directory
335 (if (fboundp 'temp-directory
)
337 (if (boundp 'temporary-file-directory
)
338 temporary-file-directory
340 "Where mm will store its temporary files."
342 :group
'mime-display
)
344 (defcustom mm-inline-large-images nil
345 "If non-nil, then all images fit in the buffer."
347 :group
'mime-display
)
349 (defvar mm-file-name-rewrite-functions
350 '(mm-file-name-delete-control mm-file-name-delete-gotchas
)
351 "*List of functions used for rewriting file names of MIME parts.
352 Each function takes a file name as input and returns a file name.
354 Ready-made functions include
355 `mm-file-name-delete-control'
356 `mm-file-name-delete-gotchas'
357 `mm-file-name-delete-whitespace',
358 `mm-file-name-trim-whitespace',
359 `mm-file-name-collapse-whitespace',
360 `mm-file-name-replace-whitespace',
361 `capitalize', `downcase', `upcase', and
364 (defvar mm-path-name-rewrite-functions nil
365 "*List of functions for rewriting the full file names of MIME parts.
366 This is used when viewing parts externally, and is meant for
367 transforming the absolute name so that non-compliant programs can find
368 the file where it's saved.
370 Each function takes a file name as input and returns a file name.")
372 (defvar mm-file-name-replace-whitespace nil
373 "String used for replacing whitespace characters; default is `\"_\"'.")
375 (defcustom mm-default-directory nil
376 "The default directory where mm will save files.
377 If not set, `default-directory' will be used."
378 :type
'(choice directory
(const :tag
"Default" nil
))
379 :group
'mime-display
)
381 (defcustom mm-attachment-file-modes
384
382 "Set the mode bits of saved attachments to this integer."
385 :group
'mime-display
)
387 (defcustom mm-external-terminal-program
"xterm"
388 "The program to start an external terminal."
391 :group
'mime-display
)
393 ;;; Internal variables.
395 (defvar mm-last-shell-command
"")
396 (defvar mm-content-id-alist nil
)
397 (defvar mm-postponed-undisplay-list nil
)
399 ;; According to RFC2046, in particular, in a digest, the default
400 ;; Content-Type value for a body part is changed from "text/plain" to
402 (defvar mm-dissect-default-type
"text/plain")
404 (autoload 'mml2015-verify
"mml2015")
405 (autoload 'mml2015-verify-test
"mml2015")
406 (autoload 'mml-smime-verify
"mml-smime")
407 (autoload 'mml-smime-verify-test
"mml-smime")
409 (defvar mm-verify-function-alist
410 '(("application/pgp-signature" mml2015-verify
"PGP" mml2015-verify-test
)
411 ("application/x-gnus-pgp-signature" mm-uu-pgp-signed-extract-1
"PGP"
412 mm-uu-pgp-signed-test
)
413 ("application/pkcs7-signature" mml-smime-verify
"S/MIME"
414 mml-smime-verify-test
)
415 ("application/x-pkcs7-signature" mml-smime-verify
"S/MIME"
416 mml-smime-verify-test
)))
418 (defcustom mm-verify-option
'never
419 "Option of verifying signed parts.
420 `never', not verify; `always', always verify;
421 `known', only verify known protocols. Otherwise, ask user."
423 :type
'(choice (item always
)
425 (item :tag
"only known protocols" known
)
426 (item :tag
"ask" nil
))
427 :group
'mime-security
)
429 (autoload 'mml2015-decrypt
"mml2015")
430 (autoload 'mml2015-decrypt-test
"mml2015")
432 (defvar mm-decrypt-function-alist
433 '(("application/pgp-encrypted" mml2015-decrypt
"PGP" mml2015-decrypt-test
)
434 ("application/x-gnus-pgp-encrypted" mm-uu-pgp-encrypted-extract-1
"PGP"
435 mm-uu-pgp-encrypted-test
)))
437 (defcustom mm-decrypt-option nil
438 "Option of decrypting encrypted parts.
439 `never', not decrypt; `always', always decrypt;
440 `known', only decrypt known protocols. Otherwise, ask user."
442 :type
'(choice (item always
)
444 (item :tag
"only known protocols" known
)
445 (item :tag
"ask" nil
))
446 :group
'mime-security
)
448 (defvar mm-viewer-completion-map
449 (let ((map (make-sparse-keymap 'mm-viewer-completion-map
)))
450 (set-keymap-parent map minibuffer-local-completion-map
)
452 "Keymap for input viewer with completion.")
454 ;; Should we bind other key to minibuffer-complete-word?
455 (define-key mm-viewer-completion-map
" " 'self-insert-command
)
457 (defvar mm-viewer-completion-map
458 (let ((map (make-sparse-keymap 'mm-viewer-completion-map
)))
459 (set-keymap-parent map minibuffer-local-completion-map
)
461 "Keymap for input viewer with completion.")
463 ;; Should we bind other key to minibuffer-complete-word?
464 (define-key mm-viewer-completion-map
" " 'self-insert-command
)
468 (defun mm-alist-to-plist (alist)
469 "Convert association list ALIST into the equivalent property-list form.
470 The plist is returned. This converts from
472 \((a . 1) (b . 2) (c . 3))
478 The original alist is not modified. See also `destructive-alist-to-plist'."
481 (let ((el (car alist
)))
482 (setq plist
(cons (cdr el
) (cons (car el
) plist
))))
483 (setq alist
(cdr alist
)))
486 (defun mm-keep-viewer-alive-p (handle)
487 "Say whether external viewer for HANDLE should stay alive."
488 (let ((types mm-keep-viewer-alive-types
)
489 (type (mm-handle-media-type handle
))
492 (while (setq ty
(pop types
))
493 (when (string-match ty type
)
494 (throw 'found t
))))))
496 (defun mm-handle-set-external-undisplayer (handle function
)
497 "Set the undisplayer for HANDLE to FUNCTION.
498 Postpone undisplaying of viewers for types in
499 `mm-keep-viewer-alive-types'."
500 (if (mm-keep-viewer-alive-p handle
)
501 (let ((new-handle (copy-sequence handle
)))
502 (mm-handle-set-undisplayer new-handle function
)
503 (mm-handle-set-undisplayer handle nil
)
504 (push new-handle mm-postponed-undisplay-list
))
505 (mm-handle-set-undisplayer handle function
)))
507 (defun mm-destroy-postponed-undisplay-list ()
508 (when mm-postponed-undisplay-list
509 (message "Destroying external MIME viewers")
510 (mm-destroy-parts mm-postponed-undisplay-list
)))
512 (defun mm-dissect-buffer (&optional no-strict-mime loose-mime from
)
513 "Dissect the current buffer and return a list of MIME handles."
515 (let (ct ctl type subtype cte cd description id result
)
517 (mail-narrow-to-head)
518 (when (or no-strict-mime
520 (mail-fetch-field "mime-version"))
521 (setq ct
(mail-fetch-field "content-type")
522 ctl
(ignore-errors (mail-header-parse-content-type ct
))
523 cte
(mail-fetch-field "content-transfer-encoding")
524 cd
(mail-fetch-field "content-disposition")
525 description
(mail-fetch-field "content-description")
526 id
(mail-fetch-field "content-id"))
528 (setq from
(mail-fetch-field "from")))
529 ;; FIXME: In some circumstances, this code is running within
530 ;; an unibyte macro. mail-extract-address-components
531 ;; creates unibyte buffers. This `if', though not a perfect
532 ;; solution, avoids most of them.
534 (setq from
(cadr (mail-extract-address-components from
))))))
536 (setq cte
(mail-header-strip cte
)))
538 (not (string-match "/" (car ctl
))))
539 (mm-dissect-singlepart
540 (list mm-dissect-default-type
)
541 (and cte
(intern (downcase (mail-header-remove-whitespace
542 (mail-header-remove-comments
545 (and cd
(ignore-errors (mail-header-parse-content-disposition cd
)))
547 (setq type
(split-string (car ctl
) "/"))
548 (setq subtype
(cadr type
)
553 ((equal type
"multipart")
554 (let ((mm-dissect-default-type (if (equal subtype
"digest")
557 (start (cdr (assq 'start
(cdr ctl
)))))
558 (add-text-properties 0 (length (car ctl
))
559 (mm-alist-to-plist (cdr ctl
)) (car ctl
))
561 ;; what really needs to be done here is a way to link a
562 ;; MIME handle back to it's parent MIME handle (in a multilevel
563 ;; MIME article). That would probably require changing
564 ;; the mm-handle API so we simply store the multipart buffert
565 ;; name as a text property of the "multipart/whatever" string.
566 (add-text-properties 0 (length (car ctl
))
567 (list 'buffer
(mm-copy-to-buffer)
571 (cons (car ctl
) (mm-dissect-multipart ctl from
))))
573 (mm-possibly-verify-or-decrypt
574 (mm-dissect-singlepart
576 (and cte
(intern (downcase (mail-header-remove-whitespace
577 (mail-header-remove-comments
580 (and cd
(ignore-errors
581 (mail-header-parse-content-disposition cd
)))
585 (when (string-match " *<\\(.*\\)> *" id
)
586 (setq id
(match-string 1 id
)))
587 (push (cons id result
) mm-content-id-alist
))
590 (defun mm-dissect-singlepart (ctl cte
&optional force cdl description id
)
592 (if (equal "text/plain" (car ctl
))
596 (mm-copy-to-buffer) ctl cte nil cdl description nil id
)))
598 (defun mm-dissect-multipart (ctl from
)
599 (goto-char (point-min))
600 (let* ((boundary (concat "\n--" (mail-content-type-get ctl
'boundary
)))
601 (close-delimiter (concat (regexp-quote boundary
) "--[ \t]*$"))
604 (goto-char (point-max))
605 (if (re-search-backward close-delimiter nil t
)
608 (setq boundary
(concat (regexp-quote boundary
) "[ \t]*$"))
609 (while (and (< (point) end
) (re-search-forward boundary end t
))
610 (goto-char (match-beginning 0))
614 (narrow-to-region start
(point))
615 (setq parts
(nconc (list (mm-dissect-buffer t nil from
)) parts
)))))
617 (or (looking-at boundary
)
619 (setq start
(point)))
620 (when (and start
(< start end
))
623 (narrow-to-region start end
)
624 (setq parts
(nconc (list (mm-dissect-buffer t nil from
)) parts
)))))
625 (mm-possibly-verify-or-decrypt (nreverse parts
) ctl
)))
627 (defun mm-copy-to-buffer ()
628 "Copy the contents of the current buffer to a fresh buffer."
630 (let ((obuf (current-buffer))
632 (goto-char (point-min))
633 (search-forward-regexp "^\n" nil t
)
636 ;; Preserve the data's unibyteness (for url-insert-file-contents).
637 (let ((default-enable-multibyte-characters (mm-multibyte-p)))
638 (generate-new-buffer " *mm*")))
639 (insert-buffer-substring obuf beg
)
642 (defun mm-display-parts (handle &optional no-default
)
643 (if (stringp (car handle
))
644 (mapcar 'mm-display-parts
(cdr handle
))
645 (if (bufferp (car handle
))
647 (narrow-to-region (point) (point))
648 (mm-display-part handle
)
649 (goto-char (point-max)))
650 (mapcar 'mm-display-parts handle
))))
652 (defun mm-display-part (handle &optional no-default
)
653 "Display the MIME part represented by HANDLE.
654 Returns nil if the part is removed; inline if displayed inline;
655 external if displayed external."
657 (mailcap-parse-mailcaps)
658 (if (mm-handle-displayed-p handle
)
659 (mm-remove-part handle
)
660 (let* ((type (mm-handle-media-type handle
))
661 (method (mailcap-mime-info type
))
662 (filename (or (mail-content-type-get
663 (mm-handle-disposition handle
) 'filename
)
664 (mail-content-type-get
665 (mm-handle-type handle
) 'name
)
667 (external mm-enable-external
))
668 (if (and (mm-inlinable-p handle
)
669 (mm-inlined-p handle
))
672 (mm-display-inline handle
)
676 (if (and (not method
)
677 (equal "text" (car (split-string type
))))
680 (mm-insert-inline handle
(mm-get-part handle
))
682 (if (and method
;; If nil, we always use "save".
683 (stringp method
) ;; 'mailcap-save-binary-file
684 (or (eq mm-enable-external t
)
685 (and (eq mm-enable-external
'ask
)
688 "Display part (" type
689 ") using external program"
690 ;; Can non-string method ever happen?
693 " \"" (format method filename
) "\"")
700 handle
(or method
'mailcap-save-binary-file
))
702 handle
'mailcap-save-binary-file
)))))))))
704 (defun mm-display-external (handle method
)
705 "Display HANDLE using METHOD."
706 (let ((outbuf (current-buffer)))
707 (mm-with-unibyte-buffer
708 (if (functionp method
)
709 (let ((cur (current-buffer)))
710 (if (eq method
'mailcap-save-binary-file
)
712 (set-buffer (generate-new-buffer " *mm*"))
714 (mm-insert-part handle
)
715 (let ((win (get-buffer-window cur t
)))
717 (select-window win
)))
718 (switch-to-buffer (generate-new-buffer " *mm*")))
719 (buffer-disable-undo)
720 (mm-set-buffer-file-coding-system mm-binary-coding-system
)
721 (insert-buffer-substring cur
)
722 (goto-char (point-min))
724 (message "Viewing with %s" method
))
725 (let ((mm (current-buffer))
726 (non-viewer (assq 'non-viewer
728 (mm-handle-media-type handle
) t
))))
732 (mm-save-part handle
))
733 (when (and (not non-viewer
)
735 (mm-handle-set-undisplayer handle mm
)))))
736 ;; The function is a string to be executed.
737 (mm-insert-part handle
)
738 (let* ((dir (mm-make-temp-file
739 (expand-file-name "emm." mm-tmp-directory
) 'dir
))
741 (mail-content-type-get
742 (mm-handle-disposition handle
) 'filename
)
743 (mail-content-type-get
744 (mm-handle-type handle
) 'name
)))
745 (mime-info (mailcap-mime-info
746 (mm-handle-media-type handle
) t
))
747 (needsterm (or (assoc "needsterm" mime-info
)
748 (assoc "needsterminal" mime-info
)))
749 (copiousoutput (assoc "copiousoutput" mime-info
))
751 ;; We create a private sub-directory where we store our files.
752 (set-file-modes dir
448)
754 (setq file
(expand-file-name
755 (gnus-map-function mm-file-name-rewrite-functions
756 (file-name-nondirectory filename
))
758 (setq file
(mm-make-temp-file (expand-file-name "mm." dir
))))
759 (let ((coding-system-for-write mm-binary-coding-system
))
760 (write-region (point-min) (point-max) file nil
'nomesg
))
761 (message "Viewing with %s" method
)
764 (let ((command (mm-mailcap-command
765 method file
(mm-handle-type handle
))))
768 (start-process "*display*" nil
769 mm-external-terminal-program
771 shell-command-switch command
)
779 shell-command-switch command
)))
782 (set-process-sentinel
783 (get-buffer-process buffer
)
784 `(lambda (process state
)
785 (if (eq 'exit
(process-status process
))
786 (gnus-configure-windows
787 ',gnus-current-window-configuration
))))
788 (gnus-configure-windows 'display-term
))
789 (mm-handle-set-external-undisplayer handle
(cons file buffer
)))
790 (message "Displaying %s..." command
))
793 (with-current-buffer outbuf
799 (call-process shell-file-name nil
801 (generate-new-buffer " *mm*"))
805 method file
(mm-handle-type handle
)))
806 (if (buffer-live-p buffer
)
811 (ignore-errors (delete-file file
))
812 (ignore-errors (delete-directory
813 (file-name-directory file
)))
814 (ignore-errors (kill-buffer buffer
))))))
817 (let ((command (mm-mailcap-command
818 method file
(mm-handle-type handle
))))
820 (start-process "*display*"
822 (generate-new-buffer " *mm*"))
824 shell-command-switch command
)
825 (mm-handle-set-external-undisplayer
826 handle
(cons file buffer
)))
827 (message "Displaying %s..." command
))
830 (defun mm-mailcap-command (method file type-list
)
831 (let ((ctl (cdr type-list
))
835 (while (string-match "%{\\([^}]+\\)}\\|'%s'\\|\"%s\"\\|%s\\|%t\\|%%"
837 (push (substring method beg
(match-beginning 0)) out
)
838 (setq beg
(match-end 0)
839 total
(match-string 0 method
)
840 sub
(match-string 1 method
))
842 ((string= total
"%%")
844 ((or (string= total
"%s")
845 ;; We do our own quoting.
846 (string= total
"'%s'")
847 (string= total
"\"%s\""))
848 (setq uses-stdin nil
)
850 (gnus-map-function mm-path-name-rewrite-functions file
)) out
))
851 ((string= total
"%t")
852 (push (mm-quote-arg (car type-list
)) out
))
854 (push (mm-quote-arg (or (cdr (assq (intern sub
) ctl
)) "")) out
))))
855 (push (substring method beg
(length method
)) out
)
859 (gnus-map-function mm-path-name-rewrite-functions file
))
861 (mapconcat 'identity
(nreverse out
) "")))
863 (defun mm-remove-parts (handles)
864 "Remove the displayed MIME parts represented by HANDLES."
865 (if (and (listp handles
)
866 (bufferp (car handles
)))
867 (mm-remove-part handles
)
869 (while (setq handle
(pop handles
))
872 (when (buffer-live-p (get-text-property 0 'buffer handle
))
873 (kill-buffer (get-text-property 0 'buffer handle
))))
875 (stringp (car handle
)))
876 (mm-remove-parts (cdr handle
)))
878 (mm-remove-part handle
)))))))
880 (defun mm-destroy-parts (handles)
881 "Remove the displayed MIME parts represented by HANDLES."
882 (if (and (listp handles
)
883 (bufferp (car handles
)))
884 (mm-destroy-part handles
)
886 (while (setq handle
(pop handles
))
889 (when (buffer-live-p (get-text-property 0 'buffer handle
))
890 (kill-buffer (get-text-property 0 'buffer handle
))))
892 (stringp (car handle
)))
893 (mm-destroy-parts handle
))
895 (mm-destroy-part handle
)))))))
897 (defun mm-remove-part (handle)
898 "Remove the displayed MIME part represented by HANDLE."
900 (let ((object (mm-handle-undisplayer handle
)))
903 ;; Internally displayed part.
904 ((mm-annotationp object
)
905 (delete-annotation object
))
906 ((or (functionp object
)
908 (eq (car object
) 'lambda
)))
910 ;; Externally displayed part.
913 (while (get-buffer-process (cdr object
))
914 (interrupt-process (get-buffer-process (cdr object
)))
915 (message "Waiting for external displayer to die...")
919 (ignore-errors (and (cdr object
) (kill-buffer (cdr object
))))
920 (message "Waiting for external displayer to die...done")
921 (ignore-errors (delete-file (car object
)))
922 (ignore-errors (delete-directory (file-name-directory
925 (when (buffer-live-p object
)
926 (kill-buffer object
)))))
927 (mm-handle-set-undisplayer handle nil
))))
929 (defun mm-display-inline (handle)
930 (let* ((type (mm-handle-media-type handle
))
931 (function (cadr (mm-assoc-string-match mm-inline-media-tests type
))))
932 (funcall function handle
)
933 (goto-char (point-min))))
935 (defun mm-assoc-string-match (alist type
)
937 (when (string-match (car elem
) type
)
940 (defun mm-automatic-display-p (handle)
941 "Say whether the user wants HANDLE to be displayed automatically."
942 (let ((methods mm-automatic-display
)
943 (type (mm-handle-media-type handle
))
945 (while (setq method
(pop methods
))
946 (when (and (not (mm-inline-override-p handle
))
947 (string-match method type
))
952 (defun mm-inlinable-p (handle)
953 "Say whether HANDLE can be displayed inline."
954 (let ((alist mm-inline-media-tests
)
955 (type (mm-handle-media-type handle
))
958 (when (string-match (caar alist
) type
)
959 (setq test
(caddar alist
)
961 (setq test
(funcall test handle
)))
965 (defun mm-inlined-p (handle)
966 "Say whether the user wants HANDLE to be displayed inline."
967 (let ((methods mm-inlined-types
)
968 (type (mm-handle-media-type handle
))
970 (while (setq method
(pop methods
))
971 (when (and (not (mm-inline-override-p handle
))
972 (string-match method type
))
977 (defun mm-attachment-override-p (handle)
978 "Say whether HANDLE should have attachment behavior overridden."
979 (let ((types mm-attachment-override-types
)
980 (type (mm-handle-media-type handle
))
983 (while (setq ty
(pop types
))
984 (when (and (string-match ty type
)
985 (mm-inlinable-p handle
))
986 (throw 'found t
))))))
988 (defun mm-inline-override-p (handle)
989 "Say whether HANDLE should have inline behavior overridden."
990 (let ((types mm-inline-override-types
)
991 (type (mm-handle-media-type handle
))
994 (while (setq ty
(pop types
))
995 (when (string-match ty type
)
996 (throw 'found t
))))))
998 (defun mm-automatic-external-display-p (type)
999 "Return the user-defined method for TYPE."
1000 (let ((methods mm-automatic-external-display
)
1002 (while (setq method
(pop methods
))
1003 (when (string-match method type
)
1008 (defun mm-destroy-part (handle)
1009 "Destroy the data structures connected to HANDLE."
1010 (when (listp handle
)
1011 (mm-remove-part handle
)
1012 (when (buffer-live-p (mm-handle-buffer handle
))
1013 (kill-buffer (mm-handle-buffer handle
)))))
1015 (defun mm-handle-displayed-p (handle)
1016 "Say whether HANDLE is displayed or not."
1017 (mm-handle-undisplayer handle
))
1020 ;;; Functions for outputting parts
1023 (defun mm-get-part (handle)
1024 "Return the contents of HANDLE as a string."
1025 (mm-with-unibyte-buffer
1026 (insert (with-current-buffer (mm-handle-buffer handle
)
1027 (mm-with-unibyte-current-buffer
1029 (mm-decode-content-transfer-encoding
1030 (mm-handle-encoding handle
)
1031 (mm-handle-media-type handle
))
1034 (defun mm-insert-part (handle)
1035 "Insert the contents of HANDLE in the current buffer."
1037 (insert (if (mm-multibyte-p)
1038 (mm-string-as-multibyte (mm-get-part handle
))
1039 (mm-get-part handle
)))))
1041 (defun mm-file-name-delete-whitespace (file-name)
1042 "Remove all whitespace characters from FILE-NAME."
1043 (while (string-match "\\s-+" file-name
)
1044 (setq file-name
(replace-match "" t t file-name
)))
1047 (defun mm-file-name-trim-whitespace (file-name)
1048 "Remove leading and trailing whitespace characters from FILE-NAME."
1049 (when (string-match "\\`\\s-+" file-name
)
1050 (setq file-name
(substring file-name
(match-end 0))))
1051 (when (string-match "\\s-+\\'" file-name
)
1052 (setq file-name
(substring file-name
0 (match-beginning 0))))
1055 (defun mm-file-name-collapse-whitespace (file-name)
1056 "Collapse multiple whitespace characters in FILE-NAME."
1057 (while (string-match "\\s-\\s-+" file-name
)
1058 (setq file-name
(replace-match " " t t file-name
)))
1061 (defun mm-file-name-replace-whitespace (file-name)
1062 "Replace whitespace characters in FILE-NAME with underscores.
1063 Set the option `mm-file-name-replace-whitespace' to any other
1064 string if you do not like underscores."
1065 (let ((s (or mm-file-name-replace-whitespace
"_")))
1066 (while (string-match "\\s-" file-name
)
1067 (setq file-name
(replace-match s t t file-name
))))
1070 (defun mm-file-name-delete-control (filename)
1071 "Delete control characters from FILENAME."
1072 (gnus-replace-in-string filename
"[\x00-\x1f\x7f]" ""))
1074 (defun mm-file-name-delete-gotchas (filename)
1075 "Delete shell gotchas from FILENAME."
1076 (setq filename
(gnus-replace-in-string filename
"[<>|]" ""))
1077 (gnus-replace-in-string filename
"^[.-]+" ""))
1079 (defun mm-save-part (handle)
1080 "Write HANDLE to a file."
1081 (let* ((name (mail-content-type-get (mm-handle-type handle
) 'name
))
1082 (filename (mail-content-type-get
1083 (mm-handle-disposition handle
) 'filename
))
1086 (setq filename
(gnus-map-function mm-file-name-rewrite-functions
1087 (file-name-nondirectory filename
))))
1090 (read-file-name "Save MIME part to: "
1091 (or mm-default-directory default-directory
)
1092 nil nil
(or filename name
""))))
1093 (setq mm-default-directory
(file-name-directory file
))
1094 (and (or (not (file-exists-p file
))
1095 (yes-or-no-p (format "File %s already exists; overwrite? "
1098 (mm-save-part-to-file handle file
)
1101 (defun mm-save-part-to-file (handle file
)
1102 (mm-with-unibyte-buffer
1103 (mm-insert-part handle
)
1104 (let ((coding-system-for-write 'binary
)
1105 (current-file-modes (default-file-modes))
1106 ;; Don't re-compress .gz & al. Arguably we should make
1107 ;; `file-name-handler-alist' nil, but that would chop
1108 ;; ange-ftp, which is reasonable to use here.
1109 (inhibit-file-name-operation 'write-region
)
1110 (inhibit-file-name-handlers
1111 (cons 'jka-compr-handler inhibit-file-name-handlers
)))
1112 (set-default-file-modes mm-attachment-file-modes
)
1114 (write-region (point-min) (point-max) file
)
1115 (set-default-file-modes current-file-modes
)))))
1117 (defun mm-pipe-part (handle)
1118 "Pipe HANDLE to a process."
1119 (let* ((name (mail-content-type-get (mm-handle-type handle
) 'name
))
1121 (read-string "Shell command on MIME part: " mm-last-shell-command
)))
1122 (mm-with-unibyte-buffer
1123 (mm-insert-part handle
)
1124 (let ((coding-system-for-write 'binary
))
1125 (shell-command-on-region (point-min) (point-max) command nil
)))))
1127 (defun mm-interactively-view-part (handle)
1128 "Display HANDLE using METHOD."
1129 (let* ((type (mm-handle-media-type handle
))
1131 (mapcar (lambda (i) (list (cdr (assoc 'viewer i
))))
1132 (mailcap-mime-info type
'all
)))
1133 (method (let ((minibuffer-local-completion-map
1134 mm-viewer-completion-map
))
1135 (completing-read "Viewer: " methods
))))
1136 (when (string= method
"")
1137 (error "No method given"))
1138 (if (string-match "^[^% \t]+$" method
)
1139 (setq method
(concat method
" %s")))
1140 (mm-display-external handle method
)))
1142 (defun mm-preferred-alternative (handles &optional preferred
)
1143 "Say which of HANDLES are preferred."
1144 (let ((prec (if preferred
(list preferred
)
1145 (mm-preferred-alternative-precedence handles
)))
1146 p h result type handle
)
1147 (while (setq p
(pop prec
))
1150 (setq handle
(car h
))
1151 (setq type
(mm-handle-media-type handle
))
1152 (when (and (equal p type
)
1153 (mm-automatic-display-p handle
)
1154 (or (stringp (car handle
))
1155 (not (mm-handle-disposition handle
))
1156 (equal (car (mm-handle-disposition handle
))
1164 (defun mm-preferred-alternative-precedence (handles)
1165 "Return the precedence based on HANDLES and `mm-discouraged-alternatives'."
1166 (let ((seq (nreverse (mapcar #'mm-handle-media-type
1168 (dolist (disc (reverse mm-discouraged-alternatives
))
1169 (dolist (elem (copy-sequence seq
))
1170 (when (string-match disc elem
)
1171 (setq seq
(nconc (delete elem seq
) (list elem
))))))
1174 (defun mm-get-content-id (id)
1175 "Return the handle(s) referred to by ID."
1176 (cdr (assoc id mm-content-id-alist
)))
1178 (defconst mm-image-type-regexps
1179 '(("/\\*.*XPM.\\*/" . xpm
)
1183 ("\211PNG\r\n" . png
)
1185 ("\\(MM\0\\*\\)\\|\\(II\\*\0\\)" . tiff
)
1186 ("%!PS" . postscript
))
1187 "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
1188 When the first bytes of an image file match REGEXP, it is assumed to
1189 be of image type IMAGE-TYPE.")
1191 ;; Steal from image.el. image-type-from-data suffers multi-line matching bug.
1192 (defun mm-image-type-from-buffer ()
1193 "Determine the image type from data in the current buffer.
1194 Value is a symbol specifying the image type or nil if type cannot
1196 (let ((types mm-image-type-regexps
)
1198 (goto-char (point-min))
1199 (while (and types
(null type
))
1200 (let ((regexp (car (car types
)))
1201 (image-type (cdr (car types
))))
1202 (when (looking-at regexp
)
1203 (setq type image-type
))
1204 (setq types
(cdr types
))))
1207 (defun mm-get-image (handle)
1208 "Return an image instance based on HANDLE."
1209 (let ((type (mm-handle-media-subtype handle
))
1211 ;; Allow some common translations.
1214 ((equal type
"x-pixmap")
1216 ((equal type
"x-xbitmap")
1218 ((equal type
"x-portable-bitmap")
1221 (or (mm-handle-cache handle
)
1222 (mm-with-unibyte-buffer
1223 (mm-insert-part handle
)
1227 ;; Avoid testing `make-glyph' since W3 may define
1228 ;; a bogus version of it.
1229 (if (fboundp 'create-image
)
1230 (create-image (buffer-string)
1231 (or (mm-image-type-from-buffer)
1234 (mm-create-image-xemacs type
))))
1235 (mm-handle-set-cache handle spec
))))))
1237 (defun mm-create-image-xemacs (type)
1240 ;; xbm images require special handling, since
1241 ;; the only way to create glyphs from these
1242 ;; (without a ton of work) is to write them
1243 ;; out to a file, and then create a file
1245 (let ((file (mm-make-temp-file
1246 (expand-file-name "emm.xbm"
1247 mm-tmp-directory
))))
1250 (write-region (point-min) (point-max) file
)
1251 (make-glyph (list (cons 'x file
))))
1253 (delete-file file
)))))
1257 (or (mm-image-type-from-buffer)
1259 :data
(buffer-string))))))
1261 (defun mm-image-fit-p (handle)
1262 "Say whether the image in HANDLE will fit the current window."
1263 (let ((image (mm-get-image handle
)))
1264 (if (fboundp 'glyph-width
)
1265 ;; XEmacs' glyphs can actually tell us about their width, so
1266 ;; lets be nice and smart about them.
1267 (or mm-inline-large-images
1268 (and (< (glyph-width image
) (window-pixel-width))
1269 (< (glyph-height image
) (window-pixel-height))))
1270 (let* ((size (image-size image
))
1273 (or mm-inline-large-images
1274 (and (< h
(1- (window-height))) ; Don't include mode line.
1275 (< w
(window-width))))))))
1277 (defun mm-valid-image-format-p (format)
1278 "Say whether FORMAT can be displayed natively by Emacs."
1281 ((fboundp 'valid-image-instantiator-format-p
)
1282 (valid-image-instantiator-format-p format
))
1284 ((fboundp 'image-type-available-p
)
1285 (and (display-graphic-p)
1286 (image-type-available-p format
)))
1287 ;; Nobody else can do images yet.
1291 (defun mm-valid-and-fit-image-p (format handle
)
1292 "Say whether FORMAT can be displayed natively and HANDLE fits the window."
1293 (and (mm-valid-image-format-p format
)
1294 (mm-image-fit-p handle
)))
1296 (defun mm-find-part-by-type (handles type
&optional notp recursive
)
1297 "Search in HANDLES for part with TYPE.
1298 If NOTP, returns first non-matching part.
1299 If RECURSIVE, search recursively."
1302 (if (and recursive
(stringp (caar handles
)))
1303 (if (setq handle
(mm-find-part-by-type (cdar handles
) type
1307 (not (equal (mm-handle-media-type (car handles
)) type
))
1308 (equal (mm-handle-media-type (car handles
)) type
))
1309 (setq handle
(car handles
)
1311 (setq handles
(cdr handles
)))
1314 (defun mm-find-raw-part-by-type (ctl type
&optional notp
)
1315 (goto-char (point-min))
1316 (let* ((boundary (concat "--" (mm-handle-multipart-ctl-parameter ctl
1318 (close-delimiter (concat "^" (regexp-quote boundary
) "--[ \t]*$"))
1320 (end (save-excursion
1321 (goto-char (point-max))
1322 (if (re-search-backward close-delimiter nil t
)
1326 (setq boundary
(concat "^" (regexp-quote boundary
) "[ \t]*$"))
1327 (while (and (not result
)
1328 (re-search-forward boundary end t
))
1329 (goto-char (match-beginning 0))
1333 (narrow-to-region start
(1- (point)))
1334 (when (let ((ctl (ignore-errors
1335 (mail-header-parse-content-type
1336 (mail-fetch-field "content-type")))))
1338 (not (equal (car ctl
) type
))
1339 (equal (car ctl
) type
)))
1340 (setq result
(buffer-string))))))
1342 (setq start
(point)))
1343 (when (and (not result
) start
)
1346 (narrow-to-region start end
)
1347 (when (let ((ctl (ignore-errors
1348 (mail-header-parse-content-type
1349 (mail-fetch-field "content-type")))))
1351 (not (equal (car ctl
) type
))
1352 (equal (car ctl
) type
)))
1353 (setq result
(buffer-string))))))
1356 (defvar mm-security-handle nil
)
1358 (defsubst mm-set-handle-multipart-parameter
(handle parameter value
)
1359 ;; HANDLE could be a CTL.
1361 (put-text-property 0 (length (car handle
)) parameter value
1364 (defun mm-possibly-verify-or-decrypt (parts ctl
)
1365 (let ((type (car ctl
))
1366 (subtype (cadr (split-string (car ctl
) "/")))
1367 (mm-security-handle ctl
) ;; (car CTL) is the type.
1368 protocol func functest
)
1370 ((or (equal type
"application/x-pkcs7-mime")
1371 (equal type
"application/pkcs7-mime"))
1374 ((eq mm-decrypt-option
'never
) nil
)
1375 ((eq mm-decrypt-option
'always
) t
)
1376 ((eq mm-decrypt-option
'known
) t
)
1378 (format "Decrypt (S/MIME) part? "))))
1379 (mm-view-pkcs7 parts
))
1380 (setq parts
(mm-dissect-buffer t
)))))
1381 ((equal subtype
"signed")
1382 (unless (and (setq protocol
1383 (mm-handle-multipart-ctl-parameter ctl
'protocol
))
1384 (not (equal protocol
"multipart/mixed")))
1385 ;; The message is broken or draft-ietf-openpgp-multsig-01.
1386 (let ((protocols mm-verify-function-alist
))
1388 (if (and (or (not (setq functest
(nth 3 (car protocols
))))
1389 (funcall functest parts ctl
))
1390 (mm-find-part-by-type parts
(caar protocols
) nil t
))
1391 (setq protocol
(caar protocols
)
1393 (setq protocols
(cdr protocols
))))))
1394 (setq func
(nth 1 (assoc protocol mm-verify-function-alist
)))
1396 ((eq mm-verify-option
'never
) nil
)
1397 ((eq mm-verify-option
'always
) t
)
1398 ((eq mm-verify-option
'known
)
1400 (or (not (setq functest
1401 (nth 3 (assoc protocol
1402 mm-verify-function-alist
))))
1403 (funcall functest parts ctl
))))
1406 (format "Verify signed (%s) part? "
1407 (or (nth 2 (assoc protocol mm-verify-function-alist
))
1408 (format "protocol=%s" protocol
))))))
1411 (funcall func parts ctl
)
1412 (mm-set-handle-multipart-parameter
1413 mm-security-handle
'gnus-details
1414 (format "Unknown sign protocol (%s)" protocol
))))))
1415 ((equal subtype
"encrypted")
1416 (unless (setq protocol
1417 (mm-handle-multipart-ctl-parameter ctl
'protocol
))
1418 ;; The message is broken.
1419 (let ((parts parts
))
1421 (if (assoc (mm-handle-media-type (car parts
))
1422 mm-decrypt-function-alist
)
1423 (setq protocol
(mm-handle-media-type (car parts
))
1425 (setq parts
(cdr parts
))))))
1426 (setq func
(nth 1 (assoc protocol mm-decrypt-function-alist
)))
1428 ((eq mm-decrypt-option
'never
) nil
)
1429 ((eq mm-decrypt-option
'always
) t
)
1430 ((eq mm-decrypt-option
'known
)
1432 (or (not (setq functest
1433 (nth 3 (assoc protocol
1434 mm-decrypt-function-alist
))))
1435 (funcall functest parts ctl
))))
1438 (format "Decrypt (%s) part? "
1439 (or (nth 2 (assoc protocol mm-decrypt-function-alist
))
1440 (format "protocol=%s" protocol
))))))
1443 (setq parts
(funcall func parts ctl
))
1444 (mm-set-handle-multipart-parameter
1445 mm-security-handle
'gnus-details
1446 (format "Unknown encrypt protocol (%s)" protocol
))))))
1450 (defun mm-multiple-handles (handles)
1451 (and (listp handles
)
1452 (> (length handles
) 1)
1453 (or (listp (car handles
))
1454 (stringp (car handles
)))))
1456 (defun mm-complicated-handles (handles)
1457 (and (listp (car handles
))
1458 (> (length handles
) 1)))
1460 (defun mm-merge-handles (handles1 handles2
)
1462 (if (listp (car handles1
))
1465 (if (listp (car handles2
))
1469 (defun mm-readable-p (handle)
1470 "Say whether the content of HANDLE is readable."
1471 (and (< (with-current-buffer (mm-handle-buffer handle
)
1472 (buffer-size)) 10000)
1473 (mm-with-unibyte-buffer
1474 (mm-insert-part handle
)
1475 (and (eq (mm-body-7-or-8) '7bit
)
1476 (not (mm-long-lines-p 76))))))
1478 (provide 'mm-decode
)
1480 ;; arch-tag: 4f35d360-56b8-4030-9388-3ed82d359b9b
1481 ;;; mm-decode.el ends here