Support extended group name.
[gnus] / lisp / mm-view.el
index 9c42e0f..6dcc35f 100644 (file)
@@ -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
             `(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")
 
 (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))
         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)