Re: [PATCH v3] emacs: support "notmuch new" as a notmuch-poll-script
[notmuch-archives.git] / 93 / f6857b236451684c65a8a2892a88e5cbcb994e
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 900A3429E26\r
6         for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 13:13:18 -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 O+y21-efFEsP for <notmuch@notmuchmail.org>;\r
16         Mon, 12 Dec 2011 13:13:17 -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 9EA08429E25\r
21         for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 13:13:17 -0800 (PST)\r
22 Received: by eaan11 with SMTP id n11so1388396eaa.26\r
23         for <notmuch@notmuchmail.org>; Mon, 12 Dec 2011 13:13:16 -0800 (PST)\r
24 Received: by 10.14.8.16 with SMTP id 16mr3100961eeq.246.1323724396206;\r
25         Mon, 12 Dec 2011 13:13:16 -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 a60sm79973450eeb.4.2011.12.12.13.13.13\r
29         (version=SSLv3 cipher=OTHER); Mon, 12 Dec 2011 13:13:15 -0800 (PST)\r
30 From: Jani Nikula <jani@nikula.org>\r
31 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>, notmuch@notmuchmail.org\r
32 Subject: Re: [PATCH v3] emacs: support "notmuch new" as a notmuch-poll-script\r
33 In-Reply-To: <87liqhbjgu.fsf@gmail.com>\r
34 References: <1323640100-18326-1-git-send-email-jani@nikula.org>\r
35         <1323723004-32605-1-git-send-email-jani@nikula.org>\r
36         <87liqhbjgu.fsf@gmail.com>\r
37 User-Agent: Notmuch/0.10.2+104~gbfbf8b6 (http://notmuchmail.org) Emacs/23.3.1\r
38         (i686-pc-linux-gnu)\r
39 Date: Mon, 12 Dec 2011 23:13:11 +0200\r
40 Message-ID: <87r509wl20.fsf@nikula.org>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Mon, 12 Dec 2011 21:13:18 -0000\r
56 \r
57 On Tue, 13 Dec 2011 00:53:05 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
58 > On Mon, 12 Dec 2011 22:50:04 +0200, Jani Nikula <jani@nikula.org> wrote:\r
59 > > Support nil value for notmuch-poll-script to run "notmuch new" instead of\r
60 > > an external script, and make this the new default. "notmuch new" is run\r
61 > > using the configured notmuch-command.\r
62 > > \r
63 > > This allows taking better advantage of the "notmuch new" hooks from emacs\r
64 > > without intermediate scripts.\r
65 > > \r
66 > > Signed-off-by: Jani Nikula <jani@nikula.org>\r
67 > > \r
68 > > ---\r
69 > > \r
70 > > v3: only documentation changes suggested by Austin and Dmitry.\r
71 > > ---\r
72 > >  emacs/notmuch.el |   35 +++++++++++++++++++++++++----------\r
73 > >  1 files changed, 25 insertions(+), 10 deletions(-)\r
74 > > \r
75 > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
76 > > index 8936149..675a110 100644\r
77 > > --- a/emacs/notmuch.el\r
78 > > +++ b/emacs/notmuch.el\r
79 > > @@ -965,28 +965,43 @@ same relative position within the new buffer."\r
80 > >      (notmuch-search query oldest-first target-thread target-line continuation)\r
81 > >      (goto-char (point-min))))\r
82 > >  \r
83 > > -(defcustom notmuch-poll-script ""\r
84 > > +(defcustom notmuch-poll-script nil\r
85 > >    "An external script to incorporate new mail into the notmuch database.\r
86 > >  \r
87 > > -If this variable is non empty, then it should name a script to be\r
88 > > -invoked by `notmuch-search-poll-and-refresh-view' and\r
89 > > +This variable controls the action invoked by\r
90 > > +`notmuch-search-poll-and-refresh-view' and\r
91 > >  `notmuch-hello-poll-and-update' (each have a default keybinding\r
92 > > -of 'G'). The script could do any of the following depending on\r
93 > > +of 'G') to incorporate new mail into the notmuch database.\r
94 > > +\r
95 > > +If set to nil (the default), new mail is processed by invoking\r
96 > > +\"notmuch new\". Otherwise, this should be set to a string that\r
97 > > +gives the name of an external script that processes new mail. If\r
98 > > +set to the empty string, no command will be run.\r
99\r
100 > I think this should be "an empty string".  But I may be mistaking.\r
101 \r
102 Shameless copy paste from a native speaker, who am I to argue? :)\r
103 Austin?\r
104 \r
105 Jani.\r
106 \r
107 \r
108\r
109 > Regards,\r
110 >   Dmitry\r
111\r
112 > > +\r
113 > > +The external script could do any of the following depending on\r
114 > >  the user's needs:\r
115 > >  \r
116 > >  1. Invoke a program to transfer mail to the local mail store\r
117 > >  2. Invoke \"notmuch new\" to incorporate the new mail\r
118 > > -3. Invoke one or more \"notmuch tag\" commands to classify the mail"\r
119 > > -  :type 'string\r
120 > > +3. Invoke one or more \"notmuch tag\" commands to classify the mail\r
121 > > +\r
122 > > +Note that the recommended way of achieving the same is using\r
123 > > +\"notmuch new\" hooks."\r
124 > > +  :type '(choice (const :tag "notmuch new" nil)\r
125 > > +            (const :tag "Disabled" "")\r
126 > > +            (string :tag "Custom script"))\r
127 > >    :group 'notmuch)\r
128 > >  \r
129 > >  (defun notmuch-poll ()\r
130 > > -  "Run external script to import mail.\r
131 > > +  "Run \"notmuch new\" or an external script to import mail.\r
132 > >  \r
133 > > -Invokes `notmuch-poll-script' if it is not set to an empty string."\r
134 > > +Invokes `notmuch-poll-script', \"notmuch new\", or does nothing\r
135 > > +depending on the value of `notmuch-poll-script'."\r
136 > >    (interactive)\r
137 > > -  (if (not (string= notmuch-poll-script ""))\r
138 > > -      (call-process notmuch-poll-script nil nil)))\r
139 > > +  (if (stringp notmuch-poll-script)\r
140 > > +      (if (not (string= notmuch-poll-script ""))\r
141 > > +     (call-process notmuch-poll-script nil nil))\r
142 > > +    (call-process notmuch-command nil nil nil "new")))\r
143 > >  \r
144 > >  (defun notmuch-search-poll-and-refresh-view ()\r
145 > >    "Invoke `notmuch-poll' to import mail, then refresh the current view."\r
146 > > -- \r
147 > > 1.7.5.4\r
148 > > \r
149 > > _______________________________________________\r
150 > > notmuch mailing list\r
151 > > notmuch@notmuchmail.org\r
152 > > http://notmuchmail.org/mailman/listinfo/notmuch\r