[PATCH v2] emacs: add function to toggle display of all multipart/alternative parts

Mark Walters markwalters1009 at gmail.com
Sun Jun 24 11:56:09 PDT 2012


On Tue, 19 Jun 2012, Jani Nikula <jani at nikula.org> wrote:
> 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.

Hi 

This patch looks good to me with one small concern: I set the
variable notmuch-show-all-multipart/alternative-parts in my an emacs file
loaded from my .emacs file rather than through customize using 
(setq notmuch-show-all-multipart/alternative-parts nil)

This no longer works because of the buffer local property (ie I see all
parts): I need to use 
(setq-default notmuch-show-all-multipart/alternative-parts nil)

This "change" might be worth flagging up in the news file.

I do not think the existence of my semi-patch
id:"87pq8vokmp.fsf at qmul.ac.uk" should hold up this patch. My patch is
only a draft and I definitely do not know enough lisp to be able to
write a correct version (with correct quoting of message-ids etc).

Best wishes

Mark



> ---
>  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
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list