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

Tomi Ollila tomi.ollila at iki.fi
Mon Dec 12 02:15:44 PST 2011


On Sun, 11 Dec 2011 19:31:03 -0500, Austin Clements <amdragon at 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.

users who want other functionality can reimplement notmuch-poll function
after notmuch has been loaded (and manage things themselves when internal
implementation changes ;().


Tomi


More information about the notmuch mailing list