comment
[bpt/emacs.git] / lisp / gnus / mm-decode.el
index 97fa35b..d9537d6 100644 (file)
@@ -30,7 +30,8 @@
 (eval-when-compile (require 'cl))
 
 (eval-and-compile
-  (autoload 'mm-inline-partial "mm-partial"))
+  (autoload 'mm-inline-partial "mm-partial")
+  (autoload 'mm-insert-inline "mm-view"))
 
 (defgroup mime-display ()
   "Display of MIME in mail and news articles."
@@ -219,6 +220,15 @@ to:
 ;; "message/rfc822".
 (defvar mm-dissect-default-type "text/plain")
 
+(defvar mm-viewer-completion-map
+  (let ((map (make-sparse-keymap 'mm-viewer-completion-map)))
+    (set-keymap-parent map minibuffer-local-completion-map)
+    map)
+  "Keymap for input viewer with completion.")
+
+;; Should we bind other key to minibuffer-complete-word?
+(define-key mm-viewer-completion-map " " 'self-insert-command) 
+
 ;;; The functions.
 
 (defun mm-dissect-buffer (&optional no-strict-mime)
@@ -362,14 +372,13 @@ external if displayed external."
          (let ((cur (current-buffer)))
            (if (eq method 'mailcap-save-binary-file)
                (progn
-                 (set-buffer (generate-new-buffer "*mm*"))
+                 (set-buffer (generate-new-buffer " *mm*"))
                  (setq method nil))
              (mm-insert-part handle)
              (let ((win (get-buffer-window cur t)))
                (when win
                  (select-window win)))
-             (switch-to-buffer (generate-new-buffer "*mm*")))
-           (buffer-disable-undo)
+             (switch-to-buffer (generate-new-buffer " *mm*")))
            (mm-set-buffer-file-coding-system mm-binary-coding-system)
            (insert-buffer-substring cur)
            (goto-char (point-min))
@@ -710,7 +719,9 @@ external if displayed external."
         (methods
          (mapcar (lambda (i) (list (cdr (assoc 'viewer i))))
                  (mailcap-mime-info type 'all)))
-        (method (completing-read "Viewer: " methods)))
+        (method (let ((minibuffer-local-completion-map
+                       mm-viewer-completion-map))
+                  (completing-read "Viewer: " methods))))
     (when (string= method "")
       (error "No method given"))
     (if (string-match "^[^% \t]+$" method) 
@@ -828,8 +839,7 @@ external if displayed external."
 
 (defun mm-valid-and-fit-image-p (format handle)
   "Say whether FORMAT can be displayed natively and HANDLE fits the window."
-  (and window-system
-       (mm-valid-image-format-p format)
+  (and (mm-valid-image-format-p format)
        (mm-image-fit-p handle)))
 
 (provide 'mm-decode)