[PATCH v4 1/2] emacs: User-defined sections in notmuch-hello

Michal Sojka sojkam1 at fel.cvut.cz
Fri Jul 8 22:35:46 PDT 2011


On Fri, 08 Jul 2011, Daniel Schoepe wrote:
Non-text part: multipart/signed
> On Sat, 09 Jul 2011 01:00:03 +0200, Michal Sojka <sojkam1 at fel.cvut.cz> wrote:
> > Yes, this is definitely a good idea. My last comment to the patch is
> > that I do not like the use of plists in customization interface. It is
> > especially weird in the case of boolean options like hide-if-empty,
> > because they actually have three states: disabled, off and on. And this
> > make not a lot of sense.
> > 
> > I think that the customization interface is much better arranged when it
> > is modified like in the patch below (it is against v3).
> > 
> > [..]
> > -  :type
> > -  (let ((opts
> > -        '((:title (string :tag "Title for this section"))
> > -          (:make-query (string :tag "Filter for each tag"))
> > -          (:make-count (string :tag "Different query to generate counts"))
> > -          (:hide-tags (repeat :tag "Tags that will be hidden" string))
> > -          (:initially-hidden (boolean :tag "Hide this on startup?"))
> > -          (:hide-empty-tags (boolean :tag "Hide tags with no matching messages"))
> > -          (:hide-if-empty (boolean :tag "Hide if empty")))))
> > -    `(list (const :tag "" notmuch-hello-insert-tags-section)
> > -          (plist :inline t :options ,opts))))
> > +  :type '(list (const :tag "" notmuch-hello-insert-tags-section)
> > +              (string :tag "Title for this section")
> > +              (string :tag "Filter for each tag")
> > +              (string :tag "Different filter to generate counts")
> > +              (repeat :tag "Tags that will be hidden" string)
> > +              (boolean :tag "Hide this on startup?")
> > +              (boolean :tag "Hide tags with no matching messages")
> > +              (boolean :tag "Hide if empty")))
> >  
> 
> > -(defun notmuch-hello-insert-tags-section (&rest options)
> > +(defun notmuch-hello-insert-tags-section (title &optional filter filter-count hide-tags initially-hidden
> > +                                               hide-empty-searches hide-if-empty)
> 
> This would make customization via elisp somewhat more cumbersome though,
> because then one has to specify all preceding optional arguments to set
> an option near the end of the argument list. Also, it gets harder to
> decipher which value belongs to which option.

Not necessarily. In fact, notmuch-hello-insert-tags-section is only a
thin wrapper of notmuch-hello-insert-searches. In elisp you can always
use directly those plist-based "low-level" functions.

-Michal


More information about the notmuch mailing list