Add automatic application/octet-stream type guessing
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 16 Feb 2012 05:42:00 +0000 (06:42 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 16 Feb 2012 05:42:00 +0000 (06:42 +0100)
* mm-decode.el (mm-dissect-singlepart): Guess what the type of
application/octet-stream parts really is.

lisp/ChangeLog
lisp/mm-decode.el

index 43b4a38..742beea 100644 (file)
@@ -1,5 +1,8 @@
 2012-02-16  Lars Ingebrigtsen  <larsi@gnus.org>
 
+       * mm-decode.el (mm-dissect-singlepart): Guess what the type of
+       application/octet-stream parts really is.
+
        * gnus-sum.el (gnus-propagate-marks): Remove.
 
 2012-02-15  Lars Ingebrigtsen  <larsi@gnus.org>
index 03bcaa1..5f5d06d 100644 (file)
@@ -659,6 +659,15 @@ Postpone undisplaying of viewers for types in
            (if (equal "text/plain" (car ctl))
                (assoc 'format ctl)
              t))
+    ;; Guess what the type of application/octet-stream parts should
+    ;; really be.
+    (let ((filename (cdr (assq 'filename (cdr cdl)))))
+      (when (and (equal (car ctl) "application/octet-stream")
+                filename
+                (string-match "\\.\\([^.]+\\)$" filename))
+       (let ((new-type (mailcap-extension-to-mime (match-string 1 filename))))
+         (when new-type
+           (setcar ctl new-type)))))
     (let ((handle
           (mm-make-handle
            (mm-copy-to-buffer) ctl cte nil cdl description nil id))