Re: [PATCH] emacs: support "notmuch new" as a notmuch-poll-script

Subject: Re: [PATCH] emacs: support "notmuch new" as a notmuch-poll-script

Date: Mon, 12 Dec 2011 10:42:21 -0500

To: Dmitry Kurochkin

Cc: Tomi Ollila, notmuch@notmuchmail.org

From: Austin Clements


Quoth Dmitry Kurochkin on Dec 12 at  2:21 pm:
> On Mon, 12 Dec 2011 12:15:44 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > On Sun, 11 Dec 2011 19:31:03 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> > > 
> > > So here's another idea, prefaced with a rant.
> > > 
> > > It's bothered me for a long time that notmuch-emacs didn't just know
> > > by default how to check for new mail.  What MUA doesn't know how to
> > > check for new mail?  Why does a new user of notmuch have to tell it
> > > how to check for new mail?  Of course, this *had* to be configured
> > > before because everyone had their own way of checking for new mail.
> > > Hooks eliminate this unnecessary flexibility and make "notmuch new"
> > > the one true way to check for new mail---as it ought to be---and in
> > > turn make the notmuch-poll-script variable obsolete.
> > > 
> > > So, what about changing the default "" setting of notmuch-poll-script
> > > from meaning "do nothing and be useless" to meaning "run notmuch new
> > > (using notmuch-command)"?  It will then automatically do the right
> > > thing for new users, while still being backward-compatible and
> > > allowing an escape hatch for bizarre situations.
> > 
> > +1
> > 
> > So, it could work like this:
> > 
> > (defun notmuch-poll ()
> >   "FIX DOCSTRING"
> >   (interactive)
> >   (if (stringp notmuch notmuch-poll-script)
> >       (if (string= notmuch-poll-script "")
> >         (call-process notmuch-command nil nil nil "new")
> >         (call-process notmuch-poll-script))))
> > 
> > I.e. in case notmuch-poll-script == nil, (or not string)
> > do nothing. In case notmuch-poll-script == "" execute notmuch new
> > and if notmuch-poll-script is string with content execute that.
> > 
> 
> I think the following scheme would be slightly better and more
> consistent:
> 
> * nil - run "notmuch new", the new default
> * "" - do nothing
> * "script" - run script
> 
> Regards,
>   Dmitry

I like it!

Thread: