[PATCH v3 4/4] emacs: add notmuch-hello-hook

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Fri Dec 16 10:36:59 PST 2011


On Tue, 13 Dec 2011 21:49:00 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> On Tue, 13 Dec 2011 18:32:12 +0100, Thomas Jost <schnouki at schnouki.net> wrote:
> > This hook is called every time the notmuch-hello buffer is updated.
> > ---
> >  emacs/notmuch-hello.el |    9 ++++++++-
> >  1 files changed, 8 insertions(+), 1 deletions(-)
> > 
> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> > index 0fe9c1d..112b40b 100644
> > --- a/emacs/notmuch-hello.el
> > +++ b/emacs/notmuch-hello.el
> > @@ -131,6 +131,11 @@ So:
> >  	  (integer :tag "Number of characters")
> >  	  (float :tag "Fraction of window")))
> >  
> > +(defcustom notmuch-hello-hook nil
> > +  "Functions called after populating a `notmuch-hello' buffer."
> > +  :type 'hook
> > +  :group 'notmuch)
> > +
> >  (defcustom notmuch-thousands-separator ","
> >    "The string used as a thousands separator.
> >  
> > @@ -579,7 +584,9 @@ Complete list of currently available key bindings:
> >  	  (widget-forward 1)))
> >  
> >        (unless (widget-at)
> > -	(notmuch-hello-goto-search)))))
> > +	(notmuch-hello-goto-search))
> > +
> > +      (run-hooks 'notmuch-hello-hook))))
> >  
> 
> I spent some time finding out why run-hooks are not on the top level.
> Turns out it is inside two let statements.  Can we move to the top level
> of `notmuch-hello' to make it clear that it is always run (i.e. there
> are no ifs or whens)?
> 

In addition to the above comment: I think we should rename
notmuch-hello-hook to notmuch-hello-refresh-hook.  That would make it
clear that the hook runs on each notmuch-hello buffer update.  And would
avoid confusion with notmuch-hello-mode-hook if we add it later.

Regards,
  Dmitry

> BTW this would replace one of the oldest custom patches which I have in
> my master branch :)
> 
> Regards,
>   Dmitry
> 
> >  (defun notmuch-folder ()
> >    "Deprecated function for invoking notmuch---calling `notmuch' is preferred now."
> > -- 
> > 1.7.8
> > 
> > _______________________________________________
> > notmuch mailing list
> > notmuch at notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list