Add function notmuch-show-toggle-multipart-alternative to toggle the value of notmuch-show-all-multipart/alternative-parts variable in the buffer, and redisplay the thread with either all or preferred alternative parts expanded. A small wrinkle is that in order to make the variable survive notmuch-show-refresh-view (which is required for expanding/collapsing the parts, but ends up calling kill-all-local-variables through notmuch-show-mode) it is necessary to give it the permanent-local property. --- emacs/notmuch-show.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 36cad93..4d3f03f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -98,6 +98,18 @@ any given message." "Should all parts of multipart/alternative parts be shown?" :type 'boolean :group 'notmuch-show) +(make-variable-buffer-local 'notmuch-show-all-multipart/alternative-parts) +(put 'notmuch-show-all-multipart/alternative-parts 'permanent-local t) + +(defun notmuch-show-toggle-multipart-alternative () + "Toggle the display of all multipart/alternative parts." + (interactive) + (setq notmuch-show-all-multipart/alternative-parts + (not notmuch-show-all-multipart/alternative-parts)) + (message (if notmuch-show-all-multipart/alternative-parts + "Showing all multipart/alternative parts." + "Showing preferred multipart/alternative part.")) + (notmuch-show-refresh-view)) (defcustom notmuch-show-indent-messages-width 1 "Width of message indentation in threads. -- 1.7.9.5