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

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Sun Dec 11 16:39:03 PST 2011


On Sun, 11 Dec 2011 19:31:03 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> Quoth Jani Nikula on Dec 12 at  1:10 am:
> >    On Dec 12, 2011 12:56 AM, "Austin Clements" <[1]amdragon at mit.edu> wrote:
> >    >
> >    > Quoth Dmitry Kurochkin on Dec 12 at  2:00 am:
> >    > > Hi Jani.
> >    > >
> >    > > On Sun, 11 Dec 2011 23:48:20 +0200, Jani Nikula <[2]jani at nikula.org>
> >    wrote:
> >    > > > Let notmuch-poll-script be a function as well as a string. Make
> >    default
> >    > > > value nil instead of an empty string, but allow "" for backwards
> >    > > > compatibility. Add a notmuch poll function to call "notmuch new"
> >    using the
> >    > > > configured notmuch-command.
> >    > > >
> >    > > > This allows taking better advantage of the "notmuch new" hooks from
> >    emacs
> >    > > > without intermediate scripts.
> >    > > >
> >    > >
> >    > > I was just thinking about working on this myself :)
> >    > >
> >    > > I think a better solution would be to allow running a command with
> >    > > arguments.  Creating a elisp function just to run a command with some
> >    > > parameters feels wrong.  This way we would have to add another
> >    function
> >    > > each time we want to add another argument.
> >    >
> >    > This seems a little awkward to me, too, though perhaps it's the best
> >    > way.  Other approaches to consider include accepting a list for
> >    > notmuch-poll-script (e.g., ("notmuch" "new")) or leaving it as a
> >    > string but treating it as a shell command so "notmuch new" would Just
> >    > Work.  Personally, I think the latter is the most intuitive, but it
> >    > would be worth looking at how other customizable external commands are
> >    > done in Emacs.
> >    >
> >    > A function seems powerful, but also like overkill.  Can you give a use
> >    > case for a function that wouldn't be more easily solved by one of the
> >    > above approaches?
> > 
> >    The only reason I had for using a function was running notmuch using
> >    notmuch-command. Any ideas how to do that with the Just Works approach?
> 
> Oh, I see.  I'd missed that.
> 
> 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.

Fine with me.  AFAIK no one has asked for using custom functions for
notmuch-poll-script, so adding a sane default may be the simplest and
the best option.

Regards,
  Dmitry


More information about the notmuch mailing list