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

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

Date: Fri, 16 Dec 2011 22:36:59 +0400

To: Thomas Jost, notmuch@notmuchmail.org

Cc:

From: Dmitry Kurochkin


On Tue, 13 Dec 2011 21:49:00 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> On Tue, 13 Dec 2011 18:32:12 +0100, Thomas Jost <schnouki@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@notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch

Thread: