"Display of MIME in mail and news articles."
:link '(custom-manual "(emacs-mime)Customization")
:group 'mail
- :group 'news)
+ :group 'news
+ :group 'multimedia)
;;; Convenience macros.
("text/x-patch" mm-display-patch-inline
(lambda (handle)
(locate-library "diff-mode")))
+ ("application/emacs-lisp" mm-display-elisp-inline identity)
("text/html"
mm-inline-text
(lambda (handle)
(defcustom mm-inlined-types
'("image/.*" "text/.*" "message/delivery-status" "message/rfc822"
- "message/partial"
+ "message/partial" "application/emacs-lisp"
"application/pgp-signature")
"List of media types that are to be displayed inline."
:type '(repeat string)
(defcustom mm-automatic-display
'("text/plain" "text/enriched" "text/richtext" "text/html"
"text/x-vcard" "image/.*" "message/delivery-status" "multipart/.*"
- "message/rfc822" "text/x-patch" "application/pgp-signature")
+ "message/rfc822" "text/x-patch" "application/pgp-signature"
+ "application/emacs-lisp")
"A list of MIME types to be displayed automatically."
:type '(repeat string)
:group 'mime-display)
(if (re-search-backward close-delimiter nil t)
(match-beginning 0)
(point-max)))))
- (while (search-forward boundary end t)
+ (setq boundary (concat (regexp-quote boundary) "[ \t]*$"))
+ (while (re-search-forward boundary end t)
(goto-char (match-beginning 0))
(when start
(save-excursion
(buffer-disable-undo)
(mm-set-buffer-file-coding-system mm-binary-coding-system)
(insert-buffer-substring cur)
+ (goto-char (point-min))
(message "Viewing with %s" method)
(let ((mm (current-buffer))
(non-viewer (assq 'non-viewer
(save-excursion
(if (member (mm-handle-media-supertype handle) '("text" "message"))
(with-temp-buffer
- (if (eq (or (mm-handle-encoding handle)
- (with-current-buffer (mm-handle-buffer handle)
- (mm-body-7-or-8)))
- '8bit)
- ;; Emacs MULE can not handle some 8bit characters in
- ;; multibyte character!!
- (let ((text (with-current-buffer
- (mm-handle-buffer handle)
- (mm-with-unibyte-current-buffer
- (buffer-string)))))
- (mm-with-unibyte-current-buffer
- (insert text)))
- (insert-buffer-substring (mm-handle-buffer handle)))
+ (insert-buffer-substring (mm-handle-buffer handle))
(mm-decode-content-transfer-encoding
(mm-handle-encoding handle)
(mm-handle-media-type handle))
(prog1
(setq spec
(ignore-errors
- (if (fboundp 'make-glyph)
- (cond
- ((equal type "xbm")
- ;; xbm images require special handling, since
- ;; the only way to create glyphs from these
- ;; (without a ton of work) is to write them
- ;; out to a file, and then create a file
- ;; specifier.
- (let ((file (make-temp-name
- (expand-file-name "emm.xbm"
- mm-tmp-directory))))
- (unwind-protect
- (progn
- (write-region (point-min) (point-max) file)
- (make-glyph (list (cons 'x file))))
- (ignore-errors
- (delete-file file)))))
- (t
- (make-glyph
- (vector (intern type) :data (buffer-string)))))
- (create-image (buffer-string) (intern type) 'data-p))))
+ ;; Avoid testing `make-glyph' since W3 may define
+ ;; a bogus version of it.
+ (if (fboundp 'create-image)
+ (create-image (buffer-string) (intern type) 'data-p)
+ (cond
+ ((equal type "xbm")
+ ;; xbm images require special handling, since
+ ;; the only way to create glyphs from these
+ ;; (without a ton of work) is to write them
+ ;; out to a file, and then create a file
+ ;; specifier.
+ (let ((file (make-temp-name
+ (expand-file-name "emm.xbm"
+ mm-tmp-directory))))
+ (unwind-protect
+ (progn
+ (write-region (point-min) (point-max) file)
+ (make-glyph (list (cons 'x file))))
+ (ignore-errors
+ (delete-file file)))))
+ (t
+ (make-glyph
+ (vector (intern type) :data (buffer-string))))))))
(mm-handle-set-cache handle spec))))))
(defun mm-image-fit-p (handle)
(or mm-inline-large-images
(and (< (glyph-width image) (window-pixel-width))
(< (glyph-height image) (window-pixel-height))))
- ;; Let's just inline everything under Emacs 21, since the image
- ;; specification there doesn't actually get the width/height
- ;; until you render the image.
- t)))
+ (let* ((size (image-size image))
+ (w (car size))
+ (h (cdr size)))
+ (or mm-inline-large-images
+ (and (< h (1- (window-height))) ; Don't include mode line.
+ (< w (window-width))))))))
(defun mm-valid-image-format-p (format)
"Say whether FORMAT can be displayed natively by Emacs."