[RFC PATCH 4/4] emacs: add notmuch hello refresh hook to place point in a widget

Jani Nikula jani at nikula.org
Tue Apr 17 02:38:57 PDT 2012


On Tue, 17 Apr 2012 13:16:10 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> Jani Nikula <jani at nikula.org> writes:
> 
> > Add support for putting point to a widget after refresh through a
> > hook. This approximates the old behaviour.
> 
> I may be wrong, but this looks to me like a hack that cannot work well.
> See my first reply in the thread for ideas on how to better implement
> this functionality.

This isn't very much unlike how the current code finds a widget before
refreshing. The difference is that this is based on a saved and restored
point, which indeed does have it's inaccuracies.

Jani.

> 
> Regards,
>   Dmitry
> 
> > ---
> >  emacs/notmuch-hello.el |    8 +++++++-
> >  1 files changed, 7 insertions(+), 1 deletions(-)
> >
> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> > index 13da146..07e64d4 100644
> > --- a/emacs/notmuch-hello.el
> > +++ b/emacs/notmuch-hello.el
> > @@ -148,7 +148,8 @@ International Bureau of Weights and Measures."
> >  (defcustom notmuch-hello-refresh-hook nil
> >    "Functions called after updating a `notmuch-hello' buffer."
> >    :type 'hook
> > -  :options '(notmuch-hello-refresh-status-message)
> > +  :options '(notmuch-hello-refresh-status-message
> > +	     notmuch-hello-refresh-point-to-widget)
> >    :group 'notmuch-hello
> >    :group 'notmuch-hooks)
> >  
> > @@ -752,6 +753,11 @@ Used internally by `notmuch-hello-refresh-status-message'.")
> >  		       (notmuch-hello-nice-number (- diff-count))))))
> >        (setq notmuch-hello-refresh-count new-count))))
> >  
> > +(defun notmuch-hello-refresh-point-to-widget (no-display)
> > +  "Hook to place point to widget after notmuch-hello refresh."
> > +  (widget-backward 1)
> > +  (widget-forward 1))
> > +
> >  ;;;###autoload
> >  (defun notmuch-hello (&optional no-display)
> >    "Run notmuch and display saved searches, known tags, etc."
> > -- 
> > 1.7.1
> >
> > _______________________________________________
> > notmuch mailing list
> > notmuch at notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list