1 ;;; mm-decode.el --- Functions for decoding MIME things
2 ;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; This file is part of GNU Emacs.
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU Emacs is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU Emacs; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
30 (eval-when-compile (require 'cl))
33 (autoload 'mm-inline-partial "mm-partial"))
35 (defgroup mime-display ()
36 "Display of MIME in mail and news articles."
37 :link '(custom-manual "(emacs-mime)Customization")
42 ;;; Convenience macros.
44 (defmacro mm-handle-buffer (handle)
46 (defmacro mm-handle-type (handle)
48 (defsubst mm-handle-media-type (handle)
49 (if (stringp (car handle))
51 (car (mm-handle-type handle))))
52 (defsubst mm-handle-media-supertype (handle)
53 (car (split-string (mm-handle-media-type handle) "/")))
54 (defsubst mm-handle-media-subtype (handle)
55 (cadr (split-string (mm-handle-media-type handle) "/")))
56 (defmacro mm-handle-encoding (handle)
58 (defmacro mm-handle-undisplayer (handle)
60 (defmacro mm-handle-set-undisplayer (handle function)
61 `(setcar (nthcdr 3 ,handle) ,function))
62 (defmacro mm-handle-disposition (handle)
64 (defmacro mm-handle-description (handle)
66 (defmacro mm-handle-cache (handle)
68 (defmacro mm-handle-set-cache (handle contents)
69 `(setcar (nthcdr 6 ,handle) ,contents))
70 (defmacro mm-handle-id (handle)
72 (defmacro mm-make-handle (&optional buffer type encoding undisplayer
73 disposition description cache
75 `(list ,buffer ,type ,encoding ,undisplayer
76 ,disposition ,description ,cache ,id))
78 (defcustom mm-inline-media-tests
82 (mm-valid-and-fit-image-p 'jpeg handle)))
86 (mm-valid-and-fit-image-p 'png handle)))
90 (mm-valid-and-fit-image-p 'gif handle)))
94 (mm-valid-and-fit-image-p 'tiff handle)) )
98 (mm-valid-and-fit-image-p 'xbm handle)))
102 (mm-valid-and-fit-image-p 'xbm handle)))
106 (mm-valid-and-fit-image-p 'xpm handle)))
110 (mm-valid-and-fit-image-p 'xpm handle)))
114 (mm-valid-and-fit-image-p 'bmp handle)))
115 ("text/plain" mm-inline-text identity)
116 ("text/enriched" mm-inline-text identity)
117 ("text/richtext" mm-inline-text identity)
118 ("text/x-patch" mm-display-patch-inline
120 (locate-library "diff-mode")))
121 ("application/emacs-lisp" mm-display-elisp-inline identity)