From: Austin Clements Date: Tue, 3 Sep 2013 21:45:21 +0000 (+2000) Subject: [PATCH v2 5/9] emacs: Move `notmuch-poll' to notmuch-lib X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c88cc1253d1a977d6e0c06c9b7d2a8d2c11e19e4;p=notmuch-archives.git [PATCH v2 5/9] emacs: Move `notmuch-poll' to notmuch-lib --- diff --git a/27/bc3c674da216b408cbd0b253132008bc9bdee2 b/27/bc3c674da216b408cbd0b253132008bc9bdee2 new file mode 100644 index 000000000..12a3be539 --- /dev/null +++ b/27/bc3c674da216b408cbd0b253132008bc9bdee2 @@ -0,0 +1,185 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1AD43429E39 + for ; Tue, 3 Sep 2013 14:45:48 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id HnbrR7EOqqMo for ; + Tue, 3 Sep 2013 14:45:40 -0700 (PDT) +Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu + [18.7.68.35]) + by olra.theworths.org (Postfix) with ESMTP id 4B4BC431FDA + for ; Tue, 3 Sep 2013 14:45:33 -0700 (PDT) +X-AuditID: 12074423-b7f168e00000095a-8d-5226587b6c3c +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP + id 52.0E.02394.B7856225; Tue, 3 Sep 2013 17:45:31 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r83LjUdR023523; + Tue, 3 Sep 2013 17:45:30 -0400 +Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r83LjRHv026855 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Tue, 3 Sep 2013 17:45:28 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1VGyPe-0004xz-UJ; Tue, 03 Sep 2013 17:45:26 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 5/9] emacs: Move `notmuch-poll' to notmuch-lib +Date: Tue, 3 Sep 2013 17:45:21 -0400 +Message-Id: <1378244725-18846-6-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1378244725-18846-1-git-send-email-amdragon@mit.edu> +References: <1378244725-18846-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsUixCmqrVsdoRZksOaytUXTdGeL1XN5LK7f + nMnswOyxc9Zddo9b91+zezxbdYs5gDmKyyYlNSezLLVI3y6BK+PipPdMBfsUK3b+t25g3Crd + xcjJISFgIrHpficzhC0mceHeerYuRi4OIYF9jBJNq46zgCSEBDYwSsz/aQWROMwk0fR5MSuE + M5dR4tezT2BVbAIaEtv2L2cEsUUEpCV23p3NCmIzC0RLHLk8gw3EFhZwlHj9Zjk7iM0ioCrx + e8Y0sBpeAQeJY73zmSDOUJTofjYBrJ4TqL53wSJ2iCscJJpWXmafwMi/gJFhFaNsSm6Vbm5i + Zk5xarJucXJiXl5qka6ZXm5miV5qSukmRlBgsbso72D8c1DpEKMAB6MSDy/DI9UgIdbEsuLK + 3EOMkhxMSqK8R0LVgoT4kvJTKjMSizPii0pzUosPMUpwMCuJ8Cb4AOV4UxIrq1KL8mFS0hws + SuK8z56eDRQSSE8sSc1OTS1ILYLJynBwKEnwlocDNQoWpaanVqRl5pQgpJk4OEGG8wANXwNS + w1tckJhbnJkOkT/FqCglzpsOkhAASWSU5sH1wiL/FaM40CvCvD0gVTzApAHX/QpoMBPQ4LTP + qiCDSxIRUlINjPuybjY9f+zH6rHX3jHIcs3Dl96dZgk39cQkiwQnZMjPuzFj956yrL23D/XM + 3BdZpPHai4Fzfs+pZYumz/M7uND6wrf1jDse3dK7GPR2wlfbx9xz5lfU3lu15C+veFHr9pM+ + HebXCtVqGf1mMT7Znrot2UDwknhElNP5lXt1le/nLjWbZ5Z+xlqJpTgj0VCLuag4EQAWfYHA + 1wIAAA== +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 03 Sep 2013 21:45:48 -0000 + +--- + emacs/notmuch-lib.el | 38 ++++++++++++++++++++++++++++++++++++++ + emacs/notmuch.el | 38 -------------------------------------- + 2 files changed, 38 insertions(+), 38 deletions(-) + +diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +index 4796f17..9754e16 100644 +--- a/emacs/notmuch-lib.el ++++ b/emacs/notmuch-lib.el +@@ -76,6 +76,33 @@ search." + :type 'boolean + :group 'notmuch-search) + ++(defcustom notmuch-poll-script nil ++ "An external script to incorporate new mail into the notmuch database. ++ ++This variable controls the action invoked by ++`notmuch-search-poll-and-refresh-view' and ++`notmuch-hello-poll-and-update' (each have a default keybinding ++of 'G') to incorporate new mail into the notmuch database. ++ ++If set to nil (the default), new mail is processed by invoking ++\"notmuch new\". Otherwise, this should be set to a string that ++gives the name of an external script that processes new mail. If ++set to the empty string, no command will be run. ++ ++The external script could do any of the following depending on ++the user's needs: ++ ++1. Invoke a program to transfer mail to the local mail store ++2. Invoke \"notmuch new\" to incorporate the new mail ++3. Invoke one or more \"notmuch tag\" commands to classify the mail ++ ++Note that the recommended way of achieving the same is using ++\"notmuch new\" hooks." ++ :type '(choice (const :tag "notmuch new" nil) ++ (const :tag "Disabled" "") ++ (string :tag "Custom script")) ++ :group 'notmuch-external) ++ + ;; + + (defvar notmuch-search-history nil +@@ -161,6 +188,17 @@ Otherwise the output will be returned" + "Return the user.other_email value (as a list) from the notmuch configuration." + (split-string (notmuch-config-get "user.other_email") "\n")) + ++(defun notmuch-poll () ++ "Run \"notmuch new\" or an external script to import mail. ++ ++Invokes `notmuch-poll-script', \"notmuch new\", or does nothing ++depending on the value of `notmuch-poll-script'." ++ (interactive) ++ (if (stringp notmuch-poll-script) ++ (unless (string= notmuch-poll-script "") ++ (call-process notmuch-poll-script nil nil)) ++ (call-process notmuch-command nil nil nil "new"))) ++ + (defun notmuch-kill-this-buffer () + "Kill the current buffer." + (interactive) +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 00cf271..82cece8 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -959,44 +959,6 @@ same relative position within the new buffer." + (notmuch-search query oldest-first target-thread target-line) + (goto-char (point-min)))) + +-(defcustom notmuch-poll-script nil +- "An external script to incorporate new mail into the notmuch database. +- +-This variable controls the action invoked by +-`notmuch-search-poll-and-refresh-view' and +-`notmuch-hello-poll-and-update' (each have a default keybinding +-of 'G') to incorporate new mail into the notmuch database. +- +-If set to nil (the default), new mail is processed by invoking +-\"notmuch new\". Otherwise, this should be set to a string that +-gives the name of an external script that processes new mail. If +-set to the empty string, no command will be run. +- +-The external script could do any of the following depending on +-the user's needs: +- +-1. Invoke a program to transfer mail to the local mail store +-2. Invoke \"notmuch new\" to incorporate the new mail +-3. Invoke one or more \"notmuch tag\" commands to classify the mail +- +-Note that the recommended way of achieving the same is using +-\"notmuch new\" hooks." +- :type '(choice (const :tag "notmuch new" nil) +- (const :tag "Disabled" "") +- (string :tag "Custom script")) +- :group 'notmuch-external) +- +-(defun notmuch-poll () +- "Run \"notmuch new\" or an external script to import mail. +- +-Invokes `notmuch-poll-script', \"notmuch new\", or does nothing +-depending on the value of `notmuch-poll-script'." +- (interactive) +- (if (stringp notmuch-poll-script) +- (unless (string= notmuch-poll-script "") +- (call-process notmuch-poll-script nil nil)) +- (call-process notmuch-command nil nil nil "new"))) +- + (defun notmuch-search-poll-and-refresh-view () + "Invoke `notmuch-poll' to import mail, then refresh the current view." + (interactive) +-- +1.7.10.4 +