<p><br>
On Jul 8, 2012 9:57 AM, "Mark Walters" <<a href="mailto:markwalters1009@gmail.com">markwalters1009@gmail.com</a>> wrote:<br>
><br>
> On Fri, 15 Jun 2012, Jani Nikula <<a href="mailto:jani@nikula.org">jani@nikula.org</a>> wrote:<br>
> > Add a notmuch hello refresh hook to display a message about change in<br>
> > message count in the database since the notmuch-hello buffer was last<br>
> > refreshed manually (no-display is nil).<br>
> ><br>
> > Signed-off-by: Jani Nikula <<a href="mailto:jani@nikula.org">jani@nikula.org</a>><br>
><br>
> Hi<br>
><br>
> I just have a couple of comments/queries. First, since it breaks<br>
> existing hooks I think it needs a NEWS item.</p>
<p>Sure.</p>
<p>> Secondly, I, personally, would much prefer the hook with the slight<br>
> tweak that it counts inbox messages rather than all messages. Is that<br>
> an option that could be put in the defcustom?</p>
<p>I suppose the query could be customizable. That's simple enough; for anything non-trivial people can write their own hooks.</p>
<p>BR,<br>
Jani.</p>
<p>><br>
> Best wishes<br>
><br>
> Mark<br>
><br>
> > ---<br>
> > emacs/notmuch-hello.el | 27 +++++++++++++++++++++++++++<br>
> > 1 file changed, 27 insertions(+)<br>
> ><br>
> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el<br>
> > index bc43178..bcca044 100644<br>
> > --- a/emacs/notmuch-hello.el<br>
> > +++ b/emacs/notmuch-hello.el<br>
> > @@ -148,6 +148,7 @@ International Bureau of Weights and Measures."<br>
> > (defcustom notmuch-hello-refresh-hook nil<br>
> > "Functions called after updating a `notmuch-hello' buffer."<br>
> > :type 'hook<br>
> > + :options '(notmuch-hello-refresh-status-message)<br>
> > :group 'notmuch-hello<br>
> > :group 'notmuch-hooks)<br>
> ><br>
> > @@ -749,6 +750,32 @@ following:<br>
> > (let ((fill-column (- (window-width) notmuch-hello-indent)))<br>
> > (center-region start (point)))))<br>
> ><br>
> > +(defvar notmuch-hello-refresh-count 0<br>
> > + "Number of messages in the database when `notmuch-hello' was last run.<br>
> > +<br>
> > +Used internally by `notmuch-hello-refresh-status-message'.")<br>
> > +<br>
> > +(defun notmuch-hello-refresh-status-message (no-display)<br>
> > + "Hook to display a status message when refreshing notmuch-hello buffer.<br>
> > +<br>
> > +Display a status message about the difference in message count in<br>
> > +the database since the last call."<br>
> > + (unless no-display<br>
> > + (let* ((new-count<br>
> > + (string-to-number (car (process-lines notmuch-command "count"))))<br>
> > + (diff-count (- new-count notmuch-hello-refresh-count)))<br>
> > + (cond<br>
> > + ((= notmuch-hello-refresh-count 0)<br>
> > + (message "You have %s messages."<br>
> > + (notmuch-hello-nice-number new-count)))<br>
> > + ((> diff-count 0)<br>
> > + (message "You have %s more messages since last refresh."<br>
> > + (notmuch-hello-nice-number diff-count)))<br>
> > + ((< diff-count 0)<br>
> > + (message "You have %s fewer messages since last refresh."<br>
> > + (notmuch-hello-nice-number (- diff-count)))))<br>
> > + (setq notmuch-hello-refresh-count new-count))))<br>
> > +<br>
> > ;;;###autoload<br>
> > (defun notmuch-hello (&optional no-display)<br>
> > "Run notmuch and display saved searches, known tags, etc."<br>
> > --<br>
> > 1.7.9.5<br>
> ><br>
> > _______________________________________________<br>
> > notmuch mailing list<br>
> > <a href="mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.org</a><br>
> > <a href="http://notmuchmail.org/mailman/listinfo/notmuch">http://notmuchmail.org/mailman/listinfo/notmuch</a><br>
</p>