*** empty log message ***
[gnus] / lisp / mm-decode.el
index f208252..06d6e29 100644 (file)
@@ -67,6 +67,8 @@
          (eq (device-type) 'x)))
     ("image/xpm" mm-inline-image
      (and window-system (featurep 'xpm)))
+    ("image/x-pixmap" mm-inline-image
+     (and window-system (featurep 'xpm)))
     ("image/bmp" mm-inline-image
      (and window-system (featurep 'bmp)))
     ("text/plain" mm-inline-text t)
@@ -91,6 +93,9 @@
   '("text/plain" "text/enriched" "text/richtext" "text/html" 
     "image/.*" "message/delivery-status" "multipart/.*"))
 
+(defvar mm-user-automatic-external-display nil
+  "List of MIME type regexps that will be displayed externally automatically.")
+
 (defvar mm-alternative-precedence
   '("image/jpeg" "image/gif" "text/html" "text/enriched"
     "text/richtext" "text/plain")
 (defvar mm-tmp-directory "/tmp/"
   "Where mm will store its temporary files.")
 
+(defvar mm-all-images-fit nil
+  "If non-nil, then all images fit in the buffer.")
+
 ;;; Internal variables.
 
 (defvar mm-dissection-list nil)
@@ -399,6 +407,16 @@ external if displayed external."
              methods nil)))
     result))
 
+(defun mm-automatic-external-display-p (type)
+  "Return the user-defined method for TYPE."
+  (let ((methods mm-user-automatic-external-display)
+       method result)
+    (while (setq method (pop methods))
+      (when (string-match method type)
+       (setq result t
+             methods nil)))
+    result))
+
 (defun add-mime-display-method (type method)
   "Make parts of TYPE be displayed with METHOD.
 This overrides entries in the mailcap file."
@@ -527,6 +545,12 @@ This overrides entries in the mailcap file."
   "Return an image instance based on HANDLE."
   (let ((type (cadr (split-string (car (mm-handle-type handle)) "/")))
        spec)
+    ;; Allow some common translations.
+    (setq type
+         (cond
+          ((equal type "x-pixmap")
+           "xpm")
+          (t type)))
     (or (mm-handle-cache handle)
        (mm-with-unibyte-buffer
          (insert-buffer-substring (mm-handle-buffer handle))
@@ -541,8 +565,9 @@ This overrides entries in the mailcap file."
 (defun mm-image-fit-p (handle)
   "Say whether the image in HANDLE will fit the current window."
   (let ((image (mm-get-image handle)))
-    (and (< (glyph-width image) (window-pixel-width))
-        (< (glyph-height image) (window-pixel-height)))))
+    (or mm-all-images-fit
+       (and (< (glyph-width image) (window-pixel-width))
+            (< (glyph-height image) (window-pixel-height))))))
 
 (provide 'mm-decode)