X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lisp%2Fmm-view.el;h=f5651f4a5f0b1d62c7f752bec598b84fbc768a94;hb=6c1cc3f8b3cb1cd33a6d8fd658721714f2310503;hp=d1993a4832058a46f920498588f458bef590575b;hpb=e0b65c6edd6df4d9bdb61cacef954355172476c7;p=elisp%2Fgnus.git- diff --git a/lisp/mm-view.el b/lisp/mm-view.el index d1993a4..f5651f4 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -33,6 +33,9 @@ (autoload 'vcard-parse-string "vcard") (autoload 'vcard-format-string "vcard")) +;; Avoid byte compile warning. +(defvar gnus-article-mime-handles) + ;;; ;;; Functions for displaying various formats inline ;;; @@ -63,7 +66,7 @@ (setq mm-w3-setup t))) (defun mm-inline-text (handle) - (let ((type (cadr (split-string (car (mm-handle-type handle)) "/"))) + (let ((type (mm-handle-media-subtype handle)) text buffer-read-only) (cond ((equal type "html") @@ -81,15 +84,18 @@ (save-restriction (narrow-to-region b (point)) (goto-char (point-min)) - (if (or (re-search-forward - w3-meta-content-type-charset-regexp nil t) - (re-search-forward - w3-meta-charset-content-type-regexp nil t)) + (if (or (and (boundp 'w3-meta-content-type-charset-regexp) + (re-search-forward + w3-meta-content-type-charset-regexp nil t)) + (and (boundp 'w3-meta-charset-content-type-regexp) + (re-search-forward + w3-meta-charset-content-type-regexp nil t))) (setq charset (w3-coding-system-for-mime-charset (buffer-substring-no-properties (match-beginning 2) (match-end 2))))) - (mm-decode-body charset) + (delete-region (point-min) (point-max)) + (insert (mm-decode-string text charset)) (save-window-excursion (save-restriction (let ((w3-strict-width width) @@ -97,7 +103,6 @@ (condition-case var (w3-region (point-min) (point-max)) (error))))) -;;; (narrow-to-region (1+ (point-min)) (point-max)) (mm-handle-set-undisplayer handle `(lambda () @@ -171,7 +176,8 @@ (goto-char (point-min))) (defun mm-inline-message (handle) - (let ((b (point)) gnus-displaying-mime handles) + (let ((b (point)) + gnus-displaying-mime handles) (save-excursion (save-restriction (narrow-to-region b b) @@ -180,17 +186,21 @@ (run-hooks 'gnus-article-decode-hook) (gnus-article-prepare-display) (setq handles gnus-article-mime-handles)) - (if handles - (setq gnus-article-mime-handles - (append gnus-article-mime-handles handles))) + (when handles + (setq gnus-article-mime-handles + (nconc gnus-article-mime-handles + (if (listp (car handles)) + handles (list handles))))) (mm-handle-set-undisplayer handle `(lambda () (let (buffer-read-only) - (mapc (lambda (prop) - (remove-specifier - (face-property 'default prop) (current-buffer))) - '(background background-pixmap foreground)) + (ignore-errors + ;; This is only valid on XEmacs. + (mapc (lambda (prop) + (remove-specifier + (face-property 'default prop) (current-buffer))) + '(background background-pixmap foreground))) (delete-region ,(point-min-marker) ,(point-max-marker))))))))) (provide 'mm-view)