* mime-view.el (mime-view-insert-fontified-text-content): Don't use
[elisp/semi.git] / mime-play.el
index 7341183..a476a05 100644 (file)
@@ -45,6 +45,9 @@ If t, it means current directory."
 (defvar mime-play-find-every-situations t
   "*Find every available situations if non-nil.")
 
+(defvar mime-play-messages-coding-system nil
+  "Coding system to be used for external MIME playback method.")
+
 
 ;;; @ content decoder
 ;;;
@@ -87,21 +90,19 @@ specified, play as it.  Default MODE is \"play\"."
                                mime-acting-situation-example-list
                                'method ignored-method
                                mime-play-find-every-situations))
-       method)
+       method menu)
     (setq mime-acting-situation-example-list (cdr ret)
          ret (car ret))
     (cond ((cdr ret)
-          (setq ret (mime-popup-menu-select
-                     (cons 
-                      "Methods"
-                      (mapcar
-                       (lambda (situation)
-                         (vector
-                          (format "%s"
-                                  (cdr (assq 'method situation)))
-                          situation t))
-                       ret))))
-          (setq ret (mime-sort-situation ret))
+          (while ret
+            (or (vassoc (setq method
+                              (format "%s"
+                                      (cdr (assq 'method (pop ret)))))
+                        menu)
+                (push (vector method situation t) menu)))
+          (setq ret (mime-sort-situation
+                     (mime-menu-select "Play entity with: "
+                                       (cons "Methods" menu))))
           (add-to-list 'mime-acting-situation-example-list (cons ret 0)))
          (t
           (setq ret (car ret))))
@@ -143,8 +144,10 @@ specified, play as it.  Default MODE is \"play\"."
                  (mime-format-mailcap-command
                   method
                   (cons (cons 'filename name) situation))))
-            (start-process command mime-echo-buffer-name
-                           shell-file-name shell-command-switch command))))
+            (binary-to-text-funcall
+             mime-play-messages-coding-system
+             #'start-process command mime-echo-buffer-name
+             shell-file-name shell-command-switch command))))
       (set-alist 'mime-mailcap-method-filename-alist process name)
       (set-process-sentinel process 'mime-mailcap-method-sentinel))))
 
@@ -345,7 +348,7 @@ It is registered to variable `mime-preview-quitting-method-alist'."
          (save-window-excursion
            (set-buffer full-buf)
            (erase-buffer)
-           (binary-insert-file-contents file)
+           (binary-insert-encoded-file file)
            (setq major-mode 'mime-show-message-mode)
            (mime-view-buffer (current-buffer) nil mother)
            (setq pbuf (current-buffer))
@@ -390,11 +393,12 @@ It is registered to variable `mime-preview-quitting-method-alist'."
                    (setq file (concat root-dir "/" (int-to-string i)))
                    (or (file-exists-p file)
                        (throw 'tag nil))
-                   (binary-insert-file-contents file)
+                   (binary-insert-encoded-file file)
                    (goto-char (point-max))
                    (setq i (1+ i))))
-               (binary-write-region (point-min)(point-max)
-                                    (expand-file-name "FULL" root-dir))
+               (binary-write-decoded-region
+                (point-min)(point-max)
+                (expand-file-name "FULL" root-dir))
                (let ((i 1))
                  (while (<= i total)
                    (let ((file (format "%s/%d" root-dir i)))