1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 1FD36429E26
\r
6 for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 11:57:38 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id E4z0jRyeWHgm for <notmuch@notmuchmail.org>;
\r
16 Mon, 12 Dec 2011 11:57:37 -0800 (PST)
\r
17 Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com
\r
18 [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 3AA42429E25
\r
21 for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 11:57:37 -0800 (PST)
\r
22 Received: by eaan11 with SMTP id n11so1355527eaa.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 11:57:34 -0800 (PST)
\r
24 Received: by 10.14.9.218 with SMTP id 66mr3065592eet.80.1323719854303;
\r
25 Mon, 12 Dec 2011 11:57:34 -0800 (PST)
\r
26 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.
\r
28 by mx.google.com with ESMTPS id z43sm66963092eef.7.2011.12.12.11.57.31
\r
29 (version=SSLv3 cipher=OTHER); Mon, 12 Dec 2011 11:57:32 -0800 (PST)
\r
30 From: Jani Nikula <jani@nikula.org>
\r
31 To: notmuch@notmuchmail.org
\r
32 Subject: [PATCH v2] emacs: support "notmuch new" as a notmuch-poll-script
\r
33 Date: Mon, 12 Dec 2011 21:57:28 +0200
\r
34 Message-Id: <1323719848-27958-1-git-send-email-jani@nikula.org>
\r
35 X-Mailer: git-send-email 1.7.5.4
\r
36 In-Reply-To: <1323640100-18326-1-git-send-email-jani@nikula.org>
\r
37 References: <1323640100-18326-1-git-send-email-jani@nikula.org>
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Mon, 12 Dec 2011 19:57:38 -0000
\r
52 Support nil value for notmuch-poll-script to run "notmuch new" instead of
\r
53 an external script, and make this the new default. "notmuch new" is run
\r
54 using the configured notmuch-command.
\r
56 This allows taking better advantage of the "notmuch new" hooks from emacs
\r
57 without intermediate scripts.
\r
59 Signed-off-by: Jani Nikula <jani@nikula.org>
\r
61 emacs/notmuch.el | 34 ++++++++++++++++++++++++----------
\r
62 1 files changed, 24 insertions(+), 10 deletions(-)
\r
64 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
65 index 8936149..5a8ab9d 100644
\r
66 --- a/emacs/notmuch.el
\r
67 +++ b/emacs/notmuch.el
\r
68 @@ -965,28 +965,42 @@ same relative position within the new buffer."
\r
69 (notmuch-search query oldest-first target-thread target-line continuation)
\r
70 (goto-char (point-min))))
\r
72 -(defcustom notmuch-poll-script ""
\r
73 +(defcustom notmuch-poll-script nil
\r
74 "An external script to incorporate new mail into the notmuch database.
\r
76 -If this variable is non empty, then it should name a script to be
\r
77 -invoked by `notmuch-search-poll-and-refresh-view' and
\r
78 +This variable controls the action invoked by
\r
79 +`notmuch-search-poll-and-refresh-view' and
\r
80 `notmuch-hello-poll-and-update' (each have a default keybinding
\r
81 -of 'G'). The script could do any of the following depending on
\r
82 +of 'G') to incorporate new mail into the notmuch database.
\r
84 +If this variable is non empty, then it should name an external
\r
85 +script to be run. If set to an empty string, no action is
\r
86 +invoked. Finally, if set to nil (the default), \"notmuch new\" is
\r
87 +run using the command specified by `notmuch-command'.
\r
89 +The external script could do any of the following depending on
\r
92 1. Invoke a program to transfer mail to the local mail store
\r
93 2. Invoke \"notmuch new\" to incorporate the new mail
\r
94 -3. Invoke one or more \"notmuch tag\" commands to classify the mail"
\r
96 +3. Invoke one or more \"notmuch tag\" commands to classify the mail
\r
98 +Note that the same can be achieved through \"notmuch new\" hooks."
\r
99 + :type '(choice (const :tag "Notmuch new" nil)
\r
100 + (const :tag "Disabled" "")
\r
101 + (string :tag "Custom script"))
\r
104 (defun notmuch-poll ()
\r
105 - "Run external script to import mail.
\r
106 + "Run \"notmuch new\" or an external script to import mail.
\r
108 -Invokes `notmuch-poll-script' if it is not set to an empty string."
\r
109 +Invokes `notmuch-poll-script', \"notmuch new\", or does nothing
\r
110 +depending on the value of `notmuch-poll-script'."
\r
112 - (if (not (string= notmuch-poll-script ""))
\r
113 - (call-process notmuch-poll-script nil nil)))
\r
114 + (if (stringp notmuch-poll-script)
\r
115 + (if (not (string= notmuch-poll-script ""))
\r
116 + (call-process notmuch-poll-script nil nil))
\r
117 + (call-process notmuch-command nil nil nil "new")))
\r
119 (defun notmuch-search-poll-and-refresh-view ()
\r
120 "Invoke `notmuch-poll' to import mail, then refresh the current view."
\r