diff options
author | Julien Danjou <julien@danjou.info> | 2011-03-22 13:40:41 +0000 |
---|---|---|
committer | Katsumi Yamaoka <yamaoka@jpl.org> | 2011-03-22 13:40:41 +0000 |
commit | 247c22e185554cfa49736f2e587539d6a92732ed (patch) | |
tree | 4f3d080c45c32e37fa623450c7562ce94fda4ede /lisp/gnus/mm-view.el | |
parent | 5fd6245244e1ec0720a8236a90f352bc8921fa38 (diff) | |
download | emacs-247c22e185554cfa49736f2e587539d6a92732ed.tar.gz emacs-247c22e185554cfa49736f2e587539d6a92732ed.tar.bz2 emacs-247c22e185554cfa49736f2e587539d6a92732ed.zip |
mm-view.el (mm-display-inline-fontify): Make mode optional, and call normal-mode if not set. Set temp buffer unmodified to avoid kill-buffer query.
(mm-inline-text): Render normal text with fontification whenever possible.
gnus-sum.el (gnus-summary-save-parts-1):
gnus-art.el (gnus-article-browse-html-save-cid-content)
(gnus-article-browse-html-parts, gnus-mime-delete-part)
(gnus-mime-copy-part, gnus-mime-inline-part, gnus-insert-mime-button):
Use `mm-handle-filename'.
mm-util.el (mm-handle-filename): New function, return the filename of an handle.
Diffstat (limited to 'lisp/gnus/mm-view.el')
-rw-r--r-- | lisp/gnus/mm-view.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index d63d20239dc..39d49af0600 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -455,7 +455,7 @@ (narrow-to-region (point) (point)) (mm-insert-part handle) (goto-char (point-max))) - (insert (mm-decode-string (mm-get-part handle) charset))) + (mm-display-inline-fontify handle)) (when (and mm-fill-flowed (equal type "plain") (equal (cdr (assoc 'format (mm-handle-type handle))) @@ -565,15 +565,16 @@ (face-property 'default prop) (current-buffer)))) (delete-region ,(point-min-marker) ,(point-max-marker))))))))) -(defun mm-display-inline-fontify (handle mode) +(defun mm-display-inline-fontify (handle &optional mode) + "Insert HANDLE inline fontifying with MODE. +If MODE is not set, try to find mode automatically." (let ((charset (mail-content-type-get (mm-handle-type handle) 'charset)) text coding-system) (unless (eq charset 'gnus-decoded) (mm-with-unibyte-buffer (mm-insert-part handle) (mm-decompress-buffer - (or (mail-content-type-get (mm-handle-disposition handle) 'name) - (mail-content-type-get (mm-handle-disposition handle) 'filename)) + (mm-handle-filename handle) t t) (unless charset (setq coding-system (mm-find-buffer-file-coding-system))) @@ -601,7 +602,10 @@ (font-lock-support-mode nil) ;; I find font-lock a bit too verbose. (font-lock-verbose nil)) - (funcall mode) + (setq buffer-file-name (mm-handle-filename handle)) + (if mode + (funcall mode) + (normal-mode)) ;; The mode function might have already turned on font-lock. (unless (symbol-value 'font-lock-mode) (font-lock-fontify-buffer))) @@ -614,6 +618,9 @@ nil) nil nil nil nil nil 'text-prop)) (setq text (buffer-string)) + ;; Set buffer unmodified to avoid confirmation when killing the + ;; buffer. + (set-buffer-modified-p nil) (kill-buffer (current-buffer))) (mm-insert-inline handle text))) |