From: Jani Nikula <jani@nikula.org>
Date: Tue, 27 Dec 2011 16:04:38 +0000 (+0200)
Subject: emacs: add inline patch fake parts through a special handler
X-Git-Tag: debian/0.12_rc1-1~262
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=d5d39a92f1d2c38f2813bb9aa2fbffa2a450b549;p=obsolete%2Fnotmuch-old

emacs: add inline patch fake parts through a special handler

Add wash generated inline patch fake parts through a special
"inline-patch-fake-part" handler to distinguish them from real MIME
parts. The fake parts are described as "inline patch (as text/x-diff)".

Signed-off-by: Jani Nikula <jani@nikula.org>
---

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index eee4da98..6ef3f90f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -585,6 +585,10 @@ current buffer, if possible."
 		nil))
 	  nil))))
 
+;; Handler for wash generated inline patch fake parts.
+(defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type)
+  (notmuch-show-insert-part-*/* msg part "text/x-diff" nth depth "inline patch"))
+
 (defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type)
   ;; This handler _must_ succeed - it is the handler of last resort.
   (notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename))
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 1f420b25..e9f2dbad 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -313,7 +313,7 @@ for error."
 	      (setq patch-end (match-beginning 0)))
 	  (save-restriction
 	    (narrow-to-region patch-start patch-end)
-	    (setq part (plist-put part :content-type "text/x-diff"))
+	    (setq part (plist-put part :content-type "inline-patch-fake-part"))
 	    (setq part (plist-put part :content (buffer-string)))
 	    (setq part (plist-put part :id -1))
 	    (setq part (plist-put part :filename "inline patch"))