[PATCH 1/2] emacs: support defining a list of alternative parts to show

Subject: [PATCH 1/2] emacs: support defining a list of alternative parts to show

Date: Wed, 8 Feb 2012 16:55:15 +0000

To: notmuch@notmuchmail.org


From: Jani Nikula

Make notmuch-show-all-multipart/alternative-parts accept a list of
multipart/alternative types to show in addition to the preferred
types. This allows the user to force display some alternative part
types while normally showing just the preferred ones.

Signed-off-by: Jani Nikula <jani@nikula.org>
 emacs/notmuch-show.el |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index faa9f9b..1340380 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -97,7 +97,9 @@ any given message."
 ;; Mostly useful for debugging.
 (defcustom notmuch-show-all-multipart/alternative-parts t
   "Should all parts of multipart/alternative parts be shown?"
-  :type 'boolean
+  :type '(choice (const :tag "Show all" t)
+		 (const :tag "Show preferred" nil)
+		 (repeat :tag "Show preferred and custom" string))
   :group 'notmuch-show)
 (defcustom notmuch-show-indent-messages-width 1
@@ -513,7 +515,9 @@ current buffer, if possible."
     ;; should be chosen if there are more than one that match?
     (mapc (lambda (inner-part)
 	    (let ((inner-type (plist-get inner-part :content-type)))
-	      (if (or notmuch-show-all-multipart/alternative-parts
+	      (if (or (equal notmuch-show-all-multipart/alternative-parts t)
+		      (member inner-type
+			      notmuch-show-all-multipart/alternative-parts)
 		      (string= chosen-type inner-type))
 		  (notmuch-show-insert-bodypart msg inner-part depth)
 		(notmuch-show-insert-part-header (plist-get inner-part :id) inner-type inner-type nil " (not shown)"))))