Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 86 / 0a0c0347ecb0dfa87c833cec9bfd39325b6c7b
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 735CB429E26\r
6         for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 12:50:10 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 axwEsHzm9G35 for <notmuch@notmuchmail.org>;\r
16         Mon, 12 Dec 2011 12:50:09 -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 A7703429E25\r
21         for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 12:50:09 -0800 (PST)\r
22 Received: by eaan11 with SMTP id n11so1378400eaa.26\r
23         for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 12:50:08 -0800 (PST)\r
24 Received: by 10.14.9.193 with SMTP id 41mr3076021eet.73.1323723008294;\r
25         Mon, 12 Dec 2011 12:50:08 -0800 (PST)\r
26 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.\r
27         [80.220.92.23])\r
28         by mx.google.com with ESMTPS id q28sm79736292eea.6.2011.12.12.12.50.06\r
29         (version=SSLv3 cipher=OTHER); Mon, 12 Dec 2011 12:50:07 -0800 (PST)\r
30 From: Jani Nikula <jani@nikula.org>\r
31 To: notmuch@notmuchmail.org\r
32 Subject: [PATCH v3] emacs: support "notmuch new" as a notmuch-poll-script\r
33 Date: Mon, 12 Dec 2011 22:50:04 +0200\r
34 Message-Id: <1323723004-32605-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
40 Precedence: list\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 20:50:10 -0000\r
51 \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
55 \r
56 This allows taking better advantage of the "notmuch new" hooks from emacs\r
57 without intermediate scripts.\r
58 \r
59 Signed-off-by: Jani Nikula <jani@nikula.org>\r
60 \r
61 ---\r
62 \r
63 v3: only documentation changes suggested by Austin and Dmitry.\r
64 ---\r
65  emacs/notmuch.el |   35 +++++++++++++++++++++++++----------\r
66  1 files changed, 25 insertions(+), 10 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
69 index 8936149..675a110 100644\r
70 --- a/emacs/notmuch.el\r
71 +++ b/emacs/notmuch.el\r
72 @@ -965,28 +965,43 @@ same relative position within the new buffer."\r
73      (notmuch-search query oldest-first target-thread target-line continuation)\r
74      (goto-char (point-min))))\r
75  \r
76 -(defcustom notmuch-poll-script ""\r
77 +(defcustom notmuch-poll-script nil\r
78    "An external script to incorporate new mail into the notmuch database.\r
79  \r
80 -If this variable is non empty, then it should name a script to be\r
81 -invoked by `notmuch-search-poll-and-refresh-view' and\r
82 +This variable controls the action invoked by\r
83 +`notmuch-search-poll-and-refresh-view' and\r
84  `notmuch-hello-poll-and-update' (each have a default keybinding\r
85 -of 'G'). The script could do any of the following depending on\r
86 +of 'G') to incorporate new mail into the notmuch database.\r
87 +\r
88 +If set to nil (the default), new mail is processed by invoking\r
89 +\"notmuch new\". Otherwise, this should be set to a string that\r
90 +gives the name of an external script that processes new mail. If\r
91 +set to the empty string, no command will be run.\r
92 +\r
93 +The external script could do any of the following depending on\r
94  the user's needs:\r
95  \r
96  1. Invoke a program to transfer mail to the local mail store\r
97  2. Invoke \"notmuch new\" to incorporate the new mail\r
98 -3. Invoke one or more \"notmuch tag\" commands to classify the mail"\r
99 -  :type 'string\r
100 +3. Invoke one or more \"notmuch tag\" commands to classify the mail\r
101 +\r
102 +Note that the recommended way of achieving the same is using\r
103 +\"notmuch new\" hooks."\r
104 +  :type '(choice (const :tag "notmuch new" nil)\r
105 +                (const :tag "Disabled" "")\r
106 +                (string :tag "Custom script"))\r
107    :group 'notmuch)\r
108  \r
109  (defun notmuch-poll ()\r
110 -  "Run external script to import mail.\r
111 +  "Run \"notmuch new\" or an external script to import mail.\r
112  \r
113 -Invokes `notmuch-poll-script' if it is not set to an empty string."\r
114 +Invokes `notmuch-poll-script', \"notmuch new\", or does nothing\r
115 +depending on the value of `notmuch-poll-script'."\r
116    (interactive)\r
117 -  (if (not (string= notmuch-poll-script ""))\r
118 -      (call-process notmuch-poll-script nil nil)))\r
119 +  (if (stringp notmuch-poll-script)\r
120 +      (if (not (string= notmuch-poll-script ""))\r
121 +         (call-process notmuch-poll-script nil nil))\r
122 +    (call-process notmuch-command nil nil nil "new")))\r
123  \r
124  (defun notmuch-search-poll-and-refresh-view ()\r
125    "Invoke `notmuch-poll' to import mail, then refresh the current view."\r
126 -- \r
127 1.7.5.4\r
128 \r