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 12:15:44 +0200

To: Austin Clements, Jani Nikula

Cc: notmuch@notmuchmail.org

From: Tomi Ollila


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.

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


Tomi

Thread: