*** empty log message ***
[gnus] / lisp / mm-decode.el
index c3c288c..e52b99b 100644 (file)
     ("text/x-vcard"
      mm-inline-text
      (lambda (handle)
-       (locate-library "vcard")))
+       (or (featurep 'vcard)
+          (locate-library "vcard"))))
     ("message/delivery-status" mm-inline-text identity)
     ("message/rfc822" mm-inline-message identity)
     ("text/.*" mm-inline-text identity)
@@ -329,9 +330,9 @@ external if displayed external."
          (insert-buffer-substring cur)
          (message "Viewing with %s" method)
          (let ((mm (current-buffer))
-               (non-viewer (assoc "non-viewer"
-                                  (mailcap-mime-info
-                                   (mm-handle-media-type handle) t))))
+               (non-viewer (assq 'non-viewer
+                                 (mailcap-mime-info
+                                  (mm-handle-media-type handle) t))))
            (unwind-protect
                (if method
                    (funcall method)
@@ -348,6 +349,7 @@ external if displayed external."
                         (mm-handle-media-type handle) t))
             (needsterm (or (assoc "needsterm" mime-info)
                            (assoc "needsterminal" mime-info)))
+            (copiousoutput (assoc "copiousoutput" mime-info))
             process file buffer)
        ;; We create a private sub-directory where we store our files.
        (make-directory dir)
@@ -356,22 +358,35 @@ external if displayed external."
            (setq file (expand-file-name (file-name-nondirectory filename)
                                         dir))
          (setq file (make-temp-name (expand-file-name "mm." dir))))
-       (write-region (point-min) (point-max) file nil 'nomesg)
+       (let ((coding-system-for-write mm-binary-coding-system))
+         (write-region (point-min) (point-max) file nil 'nomesg))
        (message "Viewing with %s" method)
        (unwind-protect
            (setq process
-                 (if needsterm
-                     (start-process "*display*" nil
-                                    "xterm"
-                                    "-e" shell-file-name "-c"
-                                    (mm-mailcap-command
-                                     method file (mm-handle-type handle)))
-                   (start-process "*display*"
-                                  (setq buffer (generate-new-buffer "*mm*"))
-                                  shell-file-name
-                                  "-c"
-                                  (mm-mailcap-command
-                                   method file (mm-handle-type handle)))))
+                 (cond (needsterm
+                        (start-process "*display*" nil
+                                       "xterm"
+                                       "-e" shell-file-name 
+                                       shell-command-switch
+                                       (mm-mailcap-command
+                                        method file (mm-handle-type handle))))
+                       (copiousoutput
+                        (start-process "*display*"
+                                       (setq buffer 
+                                             (generate-new-buffer "*mm*"))
+                                       shell-file-name
+                                       shell-command-switch
+                                       (mm-mailcap-command
+                                        method file (mm-handle-type handle)))
+                        (switch-to-buffer buffer))
+                       (t
+                        (start-process "*display*"
+                                       (setq buffer
+                                             (generate-new-buffer "*mm*"))
+                                       shell-file-name
+                                       shell-command-switch
+                                       (mm-mailcap-command
+                                        method file (mm-handle-type handle))))))
          (mm-handle-set-undisplayer handle (cons file buffer)))
        (message "Displaying %s..." (format method file))))))
 
@@ -603,10 +618,7 @@ external if displayed external."
          ;; ange-ftp, which is reasonable to use here.
          (inhibit-file-name-operation 'write-region)
          (inhibit-file-name-handlers
-          (if (equal (mm-handle-media-type handle)
-                     "application/octet-stream")
-              (cons 'jka-compr-handler inhibit-file-name-handlers)
-            inhibit-file-name-handlers)))
+          (cons 'jka-compr-handler inhibit-file-name-handlers)))
       (write-region (point-min) (point-max) file))))
 
 (defun mm-pipe-part (handle)