X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmm-view.el;h=6dcc35f6ebbf9e5e7d0c293c346a23c79b5ae5b1;hb=d9e124f855025b9053a8a90f023911a30328ebcb;hp=9c42e0fc7576bca4a664077f58c63dfa24e011e2;hpb=b8d62d4b579df8756470c8f6ff4e486804390982;p=gnus diff --git a/lisp/mm-view.el b/lisp/mm-view.el index 9c42e0fc7..6dcc35f6e 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -23,6 +23,7 @@ ;;; Code: +(eval-when-compile (require 'cl)) (require 'mail-parse) (require 'mailcap) (require 'mm-bodies) @@ -31,7 +32,8 @@ (eval-and-compile (autoload 'gnus-article-prepare-display "gnus-art") (autoload 'vcard-parse-string "vcard") - (autoload 'vcard-format-string "vcard")) + (autoload 'vcard-format-string "vcard") + (autoload 'diff-mode "diff-mode")) ;;; ;;; Functions for displaying various formats inline @@ -105,10 +107,11 @@ `(lambda () (let (buffer-read-only) (if (functionp 'remove-specifier) - (mapc (lambda (prop) - (remove-specifier - (face-property 'default prop) (current-buffer))) - '(background background-pixmap foreground))) + (mapcar (lambda (prop) + (remove-specifier + (face-property 'default prop) + (current-buffer))) + '(background background-pixmap foreground))) (delete-region ,(point-min-marker) ,(point-max-marker))))))))) ((or (equal type "enriched") @@ -167,19 +170,37 @@ (defun mm-view-message () (mm-enable-multibyte) - (gnus-article-prepare-display) - (run-hooks 'gnus-article-decode-hook) + (let (handles) + (let (gnus-article-mime-handles) + ;; Double decode problem may happen. See mm-inline-message. + (run-hooks 'gnus-article-decode-hook) + (gnus-article-prepare-display) + (setq handles gnus-article-mime-handles)) + (when handles + (setq gnus-article-mime-handles + (nconc gnus-article-mime-handles + (if (listp (car handles)) + handles (list handles)))))) (fundamental-mode) (goto-char (point-min))) (defun mm-inline-message (handle) (let ((b (point)) + (charset (mail-content-type-get + (mm-handle-type handle) 'charset)) gnus-displaying-mime handles) + (when (and charset + (stringp charset)) + (setq charset (intern (downcase charset))) + (when (eq charset 'us-ascii) + (setq charset nil))) (save-excursion (save-restriction (narrow-to-region b b) (mm-insert-part handle) - (let (gnus-article-mime-handles) + (let (gnus-article-mime-handles + (gnus-newsgroup-charset + (or charset gnus-newsgroup-charset))) (run-hooks 'gnus-article-decode-hook) (gnus-article-prepare-display) (setq handles gnus-article-mime-handles)) @@ -196,12 +217,13 @@ handle `(lambda () (let (buffer-read-only) - (ignore-errors - ;; This is only valid on XEmacs. - (mapc (lambda (prop) - (remove-specifier - (face-property 'default prop) (current-buffer))) - '(background background-pixmap foreground))) + (condition-case nil + ;; This is only valid on XEmacs. + (mapcar (lambda (prop) + (remove-specifier + (face-property 'default prop) (current-buffer))) + '(background background-pixmap foreground)) + (error nil)) (delete-region ,(point-min-marker) ,(point-max-marker))))))))) (defun mm-display-patch-inline (handle)