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

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

Date: Sun, 11 Dec 2011 17:58:22 -0500

To: Jani Nikula, Dmitry Kurochkin

Cc: notmuch@notmuchmail.org

From: Austin Clements


Quoth Dmitry Kurochkin on Dec 12 at  2:00 am:
> Hi Jani.
> 
> On Sun, 11 Dec 2011 23:48:20 +0200, Jani Nikula <jani@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?

Thread: