--- /dev/null
+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 2F405431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 29 Aug 2013 09:26:48 -0700 (PDT)\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 1cjdAex7nr5P for <notmuch@notmuchmail.org>;\r
+ Thu, 29 Aug 2013 09:26:43 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
+ [18.9.25.12])\r
+ by olra.theworths.org (Postfix) with ESMTP id B772C431E64\r
+ for <notmuch@notmuchmail.org>; Thu, 29 Aug 2013 09:26:15 -0700 (PDT)\r
+X-AuditID: 1209190c-b7fac8e000006335-6e-521f762768d1\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 1C.CE.25397.7267F125; Thu, 29 Aug 2013 12:26:15 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r7TGQ3dj025414; \r
+ Thu, 29 Aug 2013 12:26:04 -0400\r
+Received: from drake.dyndns.org\r
+ (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+ [216.15.114.40]) (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7TGQ1aM014997\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Thu, 29 Aug 2013 12:26:02 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VF52n-0007Wt-2K; Thu, 29 Aug 2013 12:26:01 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 5/9] emacs: Move `notmuch-poll' to notmuch-lib\r
+Date: Thu, 29 Aug 2013 12:25:53 -0400\r
+Message-Id: <1377793557-28878-6-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1377793557-28878-1-git-send-email-amdragon@mit.edu>\r
+References: <1377793557-28878-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixG6noqteJh9kcLKN3+L6zZnMDowez1bd\r
+ Yg5gjOKySUnNySxLLdK3S+DKuDjpPVPBPsWKnf+tGxi3SncxcnJICJhIrNy4ghHCFpO4cG89\r
+ WxcjF4eQwD5GicdfLzFCOBsZJVb8X8QGUiUkcIdJ4sGOCojEXEaJyeeeg7WzCWhIbNu/HMwW\r
+ EZCW2Hl3NmsXIwcHs4CaxJ8uFZCwsICdxOpZy5lAbBYBVYn5D9+A2bwCDhLN67tYIa5QlOh+\r
+ NgFsF6eAo0T/3bcsEHsdJP5cfMo+gZF/ASPDKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl1DvdzM\r
+ Er3UlNJNjKCQ4ZTk2cH45qDSIUYBDkYlHt6OQPkgIdbEsuLK3EOMkhxMSqK8gSVAIb6k/JTK\r
+ jMTijPii0pzU4kOMEhzMSiK8bzmBcrwpiZVVqUX5MClpDhYlcd6nT88GCgmkJ5akZqemFqQW\r
+ wWRlODiUJHjjS4EaBYtS01Mr0jJzShDSTBycIMN5gIaXg9TwFhck5hZnpkPkTzEqSonz5oEk\r
+ BEASGaV5cL2wmH7FKA70ijCvJEgVDzAdwHW/AhrMBDR4Qr4cyOCSRISUVANj2VUmi40fD9dd\r
+ NOYPqCuIuf7uxu+TMbnnfgY9vWk0m2ebfMe5q/v8O7n6Xu81Z/r2aFKO4Nmd7UaNDTO97Z+W\r
+ 7t3tynbvgdTn+bNnCwSdfa8/Zfknjd+L1Z5+XLzxVcdsr9qX/Mbn95XIyoak3GeJnl7qWZ0j\r
+ vHaj40bbvW8PeamE+9+wKk23VGIpzkg01GIuKk4EAOBycoLEAgAA\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: Thu, 29 Aug 2013 16:26:48 -0000\r
+\r
+---\r
+ emacs/notmuch-lib.el | 38 ++++++++++++++++++++++++++++++++++++++\r
+ emacs/notmuch.el | 38 --------------------------------------\r
+ 2 files changed, 38 insertions(+), 38 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 4796f17..9754e16 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -76,6 +76,33 @@ search."\r
+ :type 'boolean\r
+ :group 'notmuch-search)\r
+ \r
++(defcustom notmuch-poll-script nil\r
++ "An external script to incorporate new mail into the notmuch database.\r
++\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') to incorporate new mail into the notmuch database.\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\r
++gives the name of an external script that processes new mail. If\r
++set to the empty string, no command will be run.\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
++\r
++Note that the recommended way of achieving the same is using\r
++\"notmuch new\" hooks."\r
++ :type '(choice (const :tag "notmuch new" nil)\r
++ (const :tag "Disabled" "")\r
++ (string :tag "Custom script"))\r
++ :group 'notmuch-external)\r
++\r
+ ;;\r
+ \r
+ (defvar notmuch-search-history nil\r
+@@ -161,6 +188,17 @@ Otherwise the output will be returned"\r
+ "Return the user.other_email value (as a list) from the notmuch configuration."\r
+ (split-string (notmuch-config-get "user.other_email") "\n"))\r
+ \r
++(defun notmuch-poll ()\r
++ "Run \"notmuch new\" or an external script to import mail.\r
++\r
++Invokes `notmuch-poll-script', \"notmuch new\", or does nothing\r
++depending on the value of `notmuch-poll-script'."\r
++ (interactive)\r
++ (if (stringp notmuch-poll-script)\r
++ (unless (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-kill-this-buffer ()\r
+ "Kill the current buffer."\r
+ (interactive)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 00cf271..82cece8 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -959,44 +959,6 @@ same relative position within the new buffer."\r
+ (notmuch-search query oldest-first target-thread target-line)\r
+ (goto-char (point-min))))\r
+ \r
+-(defcustom notmuch-poll-script nil\r
+- "An external script to incorporate new mail into the notmuch database.\r
+-\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') to incorporate new mail into the notmuch database.\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\r
+-gives the name of an external script that processes new mail. If\r
+-set to the empty string, no command will be run.\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
+-\r
+-Note that the recommended way of achieving the same is using\r
+-\"notmuch new\" hooks."\r
+- :type '(choice (const :tag "notmuch new" nil)\r
+- (const :tag "Disabled" "")\r
+- (string :tag "Custom script"))\r
+- :group 'notmuch-external)\r
+-\r
+-(defun notmuch-poll ()\r
+- "Run \"notmuch new\" or an external script to import mail.\r
+-\r
+-Invokes `notmuch-poll-script', \"notmuch new\", or does nothing\r
+-depending on the value of `notmuch-poll-script'."\r
+- (interactive)\r
+- (if (stringp notmuch-poll-script)\r
+- (unless (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
+ (interactive)\r
+-- \r
+1.7.10.4\r
+\r