[PATCH] Emacs: Add variable to toggle message indentation in a thread

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Mon Jul 11 01:53:04 PDT 2011


Hi Felix.

On Mon, 11 Jul 2011 10:42:04 +0200, Felix Geller <fgeller at gmail.com> wrote:
> Hi,
> 
> I added a variable to toggle message indentation in Emacs.
> 
> Please let me know what you think.
> 

I like the change.  Though I do not think I would use it without
chronological sorting.

Comments on the code below.

Regards,
  Dmitry

> 
> Cheers,
> Felix
> 
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index a433dec..8101c27 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -90,6 +90,11 @@ any given message."
>    :group 'notmuch
>    :type 'boolean)
>  
> +(defcustom notmuch-show-indent-messages-in-thread nil
> +  "Should the messages in a thread be indented according to their respective depth in the thread?"

This line is too long and should be split.

> +  :group 'notmuch
> +  :type 'boolean)
> +
>  (defcustom notmuch-show-indent-multipart nil
>    "Should the sub-parts of a multipart/* part be indented?"
>    ;; dme: Not sure which is a good default.
> @@ -237,7 +242,9 @@ unchanged ADDRESS if parsing fails."
>    "Insert a notmuch style headerline based on HEADERS for a
>  message at DEPTH in the current thread."
>    (let ((start (point)))
> -    (insert (notmuch-show-spaces-n depth)
> +    (insert (if notmuch-show-indent-messages-in-thread
> +		(notmuch-show-spaces-n depth)
> +	      "")

(if notmuch-show-indent-messages-in-thread
    (insert (notmuch-show-spaces-n depth)))

Is cleaner and avoids useless empty string insert.

>  	    (notmuch-show-clean-address (plist-get headers :From))
>  	    " ("
>  	    date
> @@ -733,7 +740,8 @@ current buffer, if possible."
>      (setq content-end (point-marker))
>  
>      ;; Indent according to the depth in the thread.
> -    (indent-rigidly content-start content-end depth)
> +    (when notmuch-show-indent-messages-in-thread
> +      (indent-rigidly content-start content-end depth))

Not a big deal, but I would prefer `if' instead of `when' here.

Regards,
  Dmitry

>  
>      (setq message-end (point-max-marker))
>  
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list