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

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Mon Jul 11 02:55:24 PDT 2011


On Mon, 11 Jul 2011 11:24:57 +0200, Felix Geller <fgeller at gmail.com> wrote:
> Hi Dmitry,
> 
> thank you for the comments. I included an updated patch that also
> includes Daniel's comment regarding the default value. 
> 

Another thing that would be nice to have is a test for this feature.

Regards,
  Dmitry

> I didn't change the "when" though--not because of personal reasons
> ;)--but because it is used for determining indentation of multi-parts.
> 
> 
> Cheers,
> Felix
> 
> 
> 
> On Mon, 11 Jul 2011 12:53:04 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> > 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
> 
> 
> commit f90fafdc0545a825ea4b69db5e51c2e866a4ff5e
> Author: Felix Geller <fgeller at gmail.com>
> Date:   Mon Jul 11 10:39:00 2011 +0200
> 
>     Added a variable to toggle message indentation for thread view in emacs.
>      - includes adjustments according to comments from ML
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index a433dec..1834066 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 t
> +  "Should messages be indented according to their depth in a thread?"
> +  :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,8 +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)
> -	    (notmuch-show-clean-address (plist-get headers :From))
> +    (when notmuch-show-indent-messages-in-thread
> +      (insert (notmuch-show-spaces-n depth)))
> +    (insert (notmuch-show-clean-address (plist-get headers :From))
>  	    " ("
>  	    date
>  	    ") ("
> @@ -733,7 +739,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))
>  
>      (setq message-end (point-max-marker))
>  


More information about the notmuch mailing list