--- /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 1AD43429E39\r
+ for <notmuch@notmuchmail.org>; Tue, 3 Sep 2013 14:45: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 HnbrR7EOqqMo for <notmuch@notmuchmail.org>;\r
+ Tue, 3 Sep 2013 14:45:40 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
+ [18.7.68.35])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4B4BC431FDA\r
+ for <notmuch@notmuchmail.org>; Tue, 3 Sep 2013 14:45:33 -0700 (PDT)\r
+X-AuditID: 12074423-b7f168e00000095a-8d-5226587b6c3c\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 52.0E.02394.B7856225; Tue, 3 Sep 2013 17:45:31 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r83LjUdR023523; \r
+ Tue, 3 Sep 2013 17:45:30 -0400\r
+Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182])\r
+ (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 r83LjRHv026855\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Tue, 3 Sep 2013 17:45:28 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VGyPe-0004xz-UJ; Tue, 03 Sep 2013 17:45:26 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 5/9] emacs: Move `notmuch-poll' to notmuch-lib\r
+Date: Tue, 3 Sep 2013 17:45:21 -0400\r
+Message-Id: <1378244725-18846-6-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1378244725-18846-1-git-send-email-amdragon@mit.edu>\r
+References: <1378244725-18846-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsUixCmqrVsdoRZksOaytUXTdGeL1XN5LK7f\r
+ nMnswOyxc9Zddo9b91+zezxbdYs5gDmKyyYlNSezLLVI3y6BK+PipPdMBfsUK3b+t25g3Crd\r
+ xcjJISFgIrHpficzhC0mceHeerYuRi4OIYF9jBJNq46zgCSEBDYwSsz/aQWROMwk0fR5MSuE\r
+ M5dR4tezT2BVbAIaEtv2L2cEsUUEpCV23p3NCmIzC0RLHLk8gw3EFhZwlHj9Zjk7iM0ioCrx\r
+ e8Y0sBpeAQeJY73zmSDOUJTofjYBrJ4TqL53wSJ2iCscJJpWXmafwMi/gJFhFaNsSm6Vbm5i\r
+ Zk5xarJucXJiXl5qka6ZXm5miV5qSukmRlBgsbso72D8c1DpEKMAB6MSDy/DI9UgIdbEsuLK\r
+ 3EOMkhxMSqK8R0LVgoT4kvJTKjMSizPii0pzUosPMUpwMCuJ8Cb4AOV4UxIrq1KL8mFS0hws\r
+ SuK8z56eDRQSSE8sSc1OTS1ILYLJynBwKEnwlocDNQoWpaanVqRl5pQgpJk4OEGG8wANXwNS\r
+ w1tckJhbnJkOkT/FqCglzpsOkhAASWSU5sH1wiL/FaM40CvCvD0gVTzApAHX/QpoMBPQ4LTP\r
+ qiCDSxIRUlINjPuybjY9f+zH6rHX3jHIcs3Dl96dZgk39cQkiwQnZMjPuzFj956yrL23D/XM\r
+ 3BdZpPHai4Fzfs+pZYumz/M7uND6wrf1jDse3dK7GPR2wlfbx9xz5lfU3lu15C+veFHr9pM+\r
+ HebXCtVqGf1mMT7Znrot2UDwknhElNP5lXt1le/nLjWbZ5Z+xlqJpTgj0VCLuag4EQAWfYHA\r
+ 1wIAAA==\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: Tue, 03 Sep 2013 21:45: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