Re: [PATCH v2] emacs: support "notmuch new" as a notmuch-poll-script
authorAustin Clements <amdragon@MIT.EDU>
Mon, 12 Dec 2011 20:24:49 +0000 (15:24 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:46 +0000 (09:40 -0800)
72/e8f1d9f42cb176a07f96ae6bc76ea11bef8e8b [new file with mode: 0644]

diff --git a/72/e8f1d9f42cb176a07f96ae6bc76ea11bef8e8b b/72/e8f1d9f42cb176a07f96ae6bc76ea11bef8e8b
new file mode 100644 (file)
index 0000000..9136d01
--- /dev/null
@@ -0,0 +1,161 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E7627429E26\r
+       for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 12:23:19 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id iIzN9QfD-aXr for <notmuch@notmuchmail.org>;\r
+       Mon, 12 Dec 2011 12:23:19 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
+       [18.9.25.13])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3BABA429E25\r
+       for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 12:23:19 -0800 (PST)\r
+X-AuditID: 1209190d-b7f576d0000008c4-82-4ee662b6ea6f\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 91.C2.02244.6B266EE4; Mon, 12 Dec 2011 15:23:18 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id pBCKNHHJ013006; \r
+       Mon, 12 Dec 2011 15:23:18 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pBCKNFjg011240\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 12 Dec 2011 15:23:16 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1RaCQb-00062o-Ra; Mon, 12 Dec 2011 15:24:49 -0500\r
+Date: Mon, 12 Dec 2011 15:24:49 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Jani Nikula <jani@nikula.org>\r
+Subject: Re: [PATCH v2] emacs: support "notmuch new" as a notmuch-poll-script\r
+Message-ID: <20111212202449.GS2760@mit.edu>\r
+References: <1323640100-18326-1-git-send-email-jani@nikula.org>\r
+       <1323719848-27958-1-git-send-email-jani@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1323719848-27958-1-git-send-email-jani@nikula.org>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IRYrdT192W9MzPoHG2kkXTdGeL6zdnMjsw\r
+       edy6/5rd49mqW8wBTFFcNimpOZllqUX6dglcGafPNTEXTJGpmHm6l7GB8YhYFyMHh4SAicS/\r
+       qUJdjJxAppjEhXvr2boYuTiEBPYxSjw+O48ZwtnAKHHo8BRmkCohgZNMEjOXm0EkljBKbOlr\r
+       A0uwCKhK3J3wnAnEZhPQkNi2fzkjiC0ioCix+eR+MJtZQFri2+9msBphAV+JRw9ms4DYvALa\r
+       EtO/fWCCWFAqsejmPGaIuKDEyZlPWCB6tSRu/HvJBHI1yJzl/zhAwpwCDhJLpq8BaxUVUJGY\r
+       cnIb2wRGoVlIumch6Z6F0L2AkXkVo2xKbpVubmJmTnFqsm5xcmJeXmqRrpFebmaJXmpK6SZG\r
+       UEhzSvLuYHx3UOkQowAHoxIPb6LvUz8h1sSy4srcQ4ySHExKorz3op75CfEl5adUZiQWZ8QX\r
+       leakFh9ilOBgVhLhjXUDyvGmJFZWpRblw6SkOViUxHlrdj30ExJITyxJzU5NLUgtgsnKcHAo\r
+       SfDWJgI1ChalpqdWpGXmlCCkmTg4QYbzAA23TgIZXlyQmFucmQ6RP8WoKCXOewqkWQAkkVGa\r
+       B9cLSzmvGMWBXhHmLQep4gGmK7juV0CDmYAGx6U8ARlckoiQkmpgrPG90PLGnyHTuYXzBNvx\r
+       fZGSgRYXrk5Ralmc3vDatDTTyY17U/ZJifomXbHOwj/Xjr3RKfc23FFpO8W5OPyo2amZS1xu\r
+       2m+P/1fjsFSyzTJ/zfM2qzs++wuWCrVbtKx9mbiiICpkQa7rN5fMz2H71i6anDr3/HOGs4pN\r
+       51Qcme37Kl1D955RYinOSDTUYi4qTgQAnxK1MxQDAAA=\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 12 Dec 2011 20:23:20 -0000\r
+\r
+Looks good to me.\r
+\r
+One documentation nitpick below.\r
+\r
+Quoth Jani Nikula on Dec 12 at  9:57 pm:\r
+> Support nil value for notmuch-poll-script to run "notmuch new" instead of\r
+> an external script, and make this the new default. "notmuch new" is run\r
+> using the configured notmuch-command.\r
+> \r
+> This allows taking better advantage of the "notmuch new" hooks from emacs\r
+> without intermediate scripts.\r
+> \r
+> Signed-off-by: Jani Nikula <jani@nikula.org>\r
+> ---\r
+>  emacs/notmuch.el |   34 ++++++++++++++++++++++++----------\r
+>  1 files changed, 24 insertions(+), 10 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index 8936149..5a8ab9d 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -965,28 +965,42 @@ same relative position within the new buffer."\r
+>      (notmuch-search query oldest-first target-thread target-line continuation)\r
+>      (goto-char (point-min))))\r
+>  \r
+> -(defcustom notmuch-poll-script ""\r
+> +(defcustom notmuch-poll-script nil\r
+>    "An external script to incorporate new mail into the notmuch database.\r
+>  \r
+> -If this variable is non empty, then it should name a script to be\r
+> -invoked by `notmuch-search-poll-and-refresh-view' and\r
+> +This variable controls the action invoked by\r
+> +`notmuch-search-poll-and-refresh-view' and\r
+>  `notmuch-hello-poll-and-update' (each have a default keybinding\r
+> -of 'G'). The script could do any of the following depending on\r
+> +of 'G') to incorporate new mail into the notmuch database.\r
+> +\r
+> +If this variable is non empty, then it should name an external\r
+> +script to be run. If set to an empty string, no action is\r
+> +invoked. Finally, if set to nil (the default), \"notmuch new\" is\r
+> +run using the command specified by `notmuch-command'.\r
+\r
+The default should probably be given first.  Also, "non empty" is a\r
+bit confusing, since nothing has been said about it being a string at\r
+that point.  So, perhaps something like\r
+\r
+If set to nil (the default), new mail is processed by invoking\r
+\"notmuch new\".  Otherwise, this should be set to a string that gives\r
+the name of an external script that processes new mail.  If set to the\r
+empty string, no command will be run.\r
+\r
+> +\r
+> +The external script could do any of the following depending on\r
+>  the user's needs:\r
+>  \r
+>  1. Invoke a program to transfer mail to the local mail store\r
+>  2. Invoke \"notmuch new\" to incorporate the new mail\r
+> -3. Invoke one or more \"notmuch tag\" commands to classify the mail"\r
+> -  :type 'string\r
+> +3. Invoke one or more \"notmuch tag\" commands to classify the mail\r
+> +\r
+> +Note that the same can be achieved through \"notmuch new\" hooks."\r
+> +  :type '(choice (const :tag "Notmuch new" nil)\r
+> +             (const :tag "Disabled" "")\r
+> +             (string :tag "Custom script"))\r
+>    :group 'notmuch)\r
+>  \r
+>  (defun notmuch-poll ()\r
+> -  "Run external script to import mail.\r
+> +  "Run \"notmuch new\" or an external script to import mail.\r
+>  \r
+> -Invokes `notmuch-poll-script' if it is not set to an empty string."\r
+> +Invokes `notmuch-poll-script', \"notmuch new\", or does nothing\r
+> +depending on the value of `notmuch-poll-script'."\r
+>    (interactive)\r
+> -  (if (not (string= notmuch-poll-script ""))\r
+> -      (call-process notmuch-poll-script nil nil)))\r
+> +  (if (stringp notmuch-poll-script)\r
+> +      (if (not (string= notmuch-poll-script ""))\r
+> +      (call-process notmuch-poll-script nil nil))\r
+> +    (call-process notmuch-command nil nil nil "new")))\r
+>  \r
+>  (defun notmuch-search-poll-and-refresh-view ()\r
+>    "Invoke `notmuch-poll' to import mail, then refresh the current view."\r