(gnus-mime-display-part-with-mime-view): Bind `mime-display-text/plain-hook'
authorkeiichi <keiichi>
Sun, 26 Dec 1999 09:30:46 +0000 (09:30 +0000)
committerkeiichi <keiichi>
Sun, 26 Dec 1999 09:30:46 +0000 (09:30 +0000)
for `gnus-treat-article'.

lisp/gnus-art.el

index 7ff312f..f895473 100644 (file)
@@ -3140,27 +3140,47 @@ In no internal viewer is available, use an external viewer."
                  (gnus-treat-article 'head)))))))))
 
 (eval-when-compile
-  (defvar mime-display-header-hook))
+  (defvar mime-display-header-hook)
+  (defvar mime-display-text/plain-hook))
 (defun gnus-mime-display-part-with-mime-view (ihandles handles)
-  (let ((charset (with-current-buffer gnus-summary-buffer
-                 gnus-newsgroup-charset))
-       (mime-display-header-hook (and (boundp 'mime-display-header-hook)
-                                      mime-display-header-hook)))
-    (unless ihandles
-      (add-hook 'mime-display-header-hook
-               (function (lambda ()
-                           (save-excursion
-                             (save-restriction
-                               (article-goto-body)
-                               (narrow-to-region (point-min) (point))
-                               (gnus-treat-article 'head)))))))
+  (let* ((charset (with-current-buffer gnus-summary-buffer
+                   gnus-newsgroup-charset))
+        entity
+        (mime-display-header-hook (and (boundp 'mime-display-header-hook)
+                                       mime-display-header-hook))
+        (mime-display-text/plain-hook
+         (and (boundp 'mime-display-text/plain-hook) 
+              mime-display-text/plain-hook)))
+    (add-hook 'mime-display-header-hook
+             (function (lambda ()
+                         (save-excursion
+                           (save-restriction
+                             (article-goto-body)
+                             (narrow-to-region (point-min) (point))
+                             (gnus-treat-article 'head))))))
+    (add-hook 'mime-display-text/plain-hook
+             (function (lambda ()
+                         (let ((parent (mime-entity-parent entity)))
+                           (when (and parent
+                                      (and (eq (mime-entity-media-type
+                                                parent)
+                                               'message)
+                                           (eq (mime-entity-media-subtype
+                                                parent)
+                                               'rfc822)))
+                             (save-excursion
+                               (save-restriction
+                                 (gnus-treat-article nil 1 1))))))))
     (set (make-local-variable 'default-mime-charset) charset)
     (mime-display-message handles
                          gnus-article-buffer nil
                          gnus-article-mode-map 'gnus-article-mode)
     (make-local-variable 'mime-button-mother-dispatcher)
     (setq mime-button-mother-dispatcher
-         (function gnus-article-push-button))))
+         (function gnus-article-push-button))
+    (save-excursion
+      (save-restriction
+       (gnus-treat-article nil 1 1)))))
 
 (defun gnus-mime-display-part-with-Gnus (ihandles handles)
   (let ((gnus-displaying-mime t))