aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Mark Walters <markwalters1009@gmail.com>2013-05-04 14:01:14 +0100
committerGravatar David Bremner <bremner@debian.org>2013-05-20 15:01:48 -0300
commitb681aa8235a16630e282626d3938862a6c2f7fd0 (patch)
treea331858fa69aa569ac508553fd991b9af8e36a2c /emacs
parente63aa66de8d4de43ea9c3b660b951a44dc50bdeb (diff)
emacs:show: separate out handling of application/octet-stream
Currently mime parts are basically handled based on their mime-type with the exception of application/octet-stream parts. Deal with these parts at the top level (notmuch-show-insert-bodypart). This is needed later in the series as we need to put in a part button for each part (which means knowing its mime type) while deferring the actual insertion of the part.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 423dd58e..652e5dc3 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -797,9 +797,9 @@ message at DEPTH in the current thread."
(defun notmuch-show-insert-part-text/x-vcalendar (msg part content-type nth depth declared-type)
(notmuch-show-insert-part-text/calendar msg part content-type nth depth declared-type))
-(defun notmuch-show-insert-part-application/octet-stream (msg part content-type nth depth declared-type)
+(defun notmuch-show-get-mime-type-of-application/octet-stream (part)
;; If we can deduce a MIME type from the filename of the attachment,
- ;; do so and pass it on to the handler for that type.
+ ;; we return that.
(if (plist-get part :filename)
(let ((extension (file-name-extension (plist-get part :filename)))
mime-type)
@@ -809,7 +809,7 @@ message at DEPTH in the current thread."
(setq mime-type (mailcap-extension-to-mime extension))
(if (and mime-type
(not (string-equal mime-type "application/octet-stream")))
- (notmuch-show-insert-bodypart-internal msg part mime-type nth depth content-type)
+ mime-type
nil))
nil))))
@@ -886,11 +886,14 @@ message at DEPTH in the current thread."
"Insert the body part PART at depth DEPTH in the current thread.
If HIDE is non-nil then initially hide this part."
- (let ((content-type (downcase (plist-get part :content-type)))
- (nth (plist-get part :id))
- (beg (point)))
-
- (notmuch-show-insert-bodypart-internal msg part content-type nth depth content-type)
+ (let* ((content-type (downcase (plist-get part :content-type)))
+ (mime-type (or (and (string= content-type "application/octet-stream")
+ (notmuch-show-get-mime-type-of-application/octet-stream part))
+ content-type))
+ (nth (plist-get part :id))
+ (beg (point)))
+
+ (notmuch-show-insert-bodypart-internal msg part mime-type nth depth content-type)
;; Some of the body part handlers leave point somewhere up in the
;; part, so we make sure that we're down at the end.
(goto-char (point-max))