unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: add function to toggle display of all multipart/alternative parts
@ 2012-06-15 15:55 Jani Nikula
  2012-06-18 21:26 ` Jameson Graef Rollins
  2012-06-19 20:14 ` [PATCH v2] " Jani Nikula
  0 siblings, 2 replies; 23+ messages in thread
From: Jani Nikula @ 2012-06-15 15:55 UTC (permalink / raw)
  To: notmuch

Add function notmuch-show-toggle-multipart-alternative to make
notmuch-show-all-multipart/alternative-parts buffer local, toggle its
value 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 |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 36cad93..9c177d9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -99,6 +99,17 @@ any given message."
   :type 'boolean
   :group 'notmuch-show)
 
+(defun notmuch-show-toggle-multipart-alternative ()
+  "Toggle `notmuch-show-all-multipart/alternative-parts' in the buffer."
+  (interactive)
+  (unless (local-variable-p 'notmuch-show-all-multipart/alternative-parts)
+    (make-local-variable 'notmuch-show-all-multipart/alternative-parts)
+    ;; Make it permanently local to survive notmuch-show-refresh-view.
+    (put 'notmuch-show-all-multipart/alternative-parts 'permanent-local t))
+  (setq notmuch-show-all-multipart/alternative-parts
+	(not notmuch-show-all-multipart/alternative-parts))
+  (notmuch-show-refresh-view))
+
 (defcustom notmuch-show-indent-messages-width 1
   "Width of message indentation in threads.
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2012-10-20  2:31 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-15 15:55 [PATCH] emacs: add function to toggle display of all multipart/alternative parts Jani Nikula
2012-06-18 21:26 ` Jameson Graef Rollins
2012-06-19  6:56   ` Mark Walters
2012-08-09 20:52     ` Jameson Graef Rollins
2012-08-10  7:10       ` [PATCH v2] " Mark Walters
2012-08-10 14:53         ` Jani Nikula
2012-08-10 16:18           ` Jameson Graef Rollins
2012-08-10 16:39             ` Jani Nikula
2012-08-10 16:58               ` Mark Walters
2012-08-10 17:49                 ` Jameson Graef Rollins
2012-08-12 17:39         ` [PATCH 1/2] test: add emacs show mode test for toggling display of multipart/alternative Jameson Graef Rollins
2012-08-12 17:39           ` [PATCH 2/2] test: move all emacs show tests to emacs-show test script Jameson Graef Rollins
2012-08-31 19:44             ` David Bremner
2012-10-20  2:31           ` [PATCH 1/2] test: add emacs show mode test for toggling display of multipart/alternative Ethan Glasser-Camp
2012-10-09 22:21         ` [PATCH v2] emacs: add function to toggle display of all multipart/alternative parts Jeremy Nickurak
2012-10-19 16:36         ` Ethan Glasser-Camp
2012-06-19  6:57   ` [PATCH] " Jani Nikula
2012-06-19 20:14 ` [PATCH v2] " Jani Nikula
2012-06-19 20:25   ` Jani Nikula
2012-06-22 22:34   ` David Bremner
2012-06-24  7:10     ` Jani Nikula
2012-06-24 18:56   ` Mark Walters
2012-10-19 16:14     ` [PATCH] Add NEWS item for multipart/alternative toggle Ethan Glasser-Camp

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).