RE: [Spam-verdenking][english 100%] Re: another bug fix release: 0.15.2, in progress.
[notmuch-archives.git] / 49 / 6bf74eb5a107501346b2f19cb537698f798e1d
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 C09C7429E25\r
6         for <notmuch@notmuchmail.org>; Sun, 11 Dec 2011 14:19:46 -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 D1MIyiVtQLgl for <notmuch@notmuchmail.org>;\r
16         Sun, 11 Dec 2011 14:19:45 -0800 (PST)\r
17 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
18  [74.125.83.53])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  9F7E1431FB6    for <notmuch@notmuchmail.org>; Sun, 11 Dec 2011 14:19:45 -0800\r
21  (PST)\r
22 Received: by eekd41 with SMTP id d41so998987eek.26\r
23         for <notmuch@notmuchmail.org>; Sun, 11 Dec 2011 14:19:43 -0800 (PST)\r
24 Received: by 10.14.15.16 with SMTP id e16mr2121756eee.72.1323641981025;\r
25         Sun, 11 Dec 2011 14:19:41 -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 z43sm54605546eef.7.2011.12.11.14.19.38\r
29         (version=SSLv3 cipher=OTHER); Sun, 11 Dec 2011 14:19:39 -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] emacs: support "notmuch new" as a notmuch-poll-script\r
33 In-Reply-To: <87wra26a5u.fsf@gmail.com>\r
34 References: <1323640100-18326-1-git-send-email-jani@nikula.org>\r
35         <87wra26a5u.fsf@gmail.com>\r
36 User-Agent: Notmuch/0.10.2+102~ga1ca0d4 (http://notmuchmail.org) Emacs/23.3.1\r
37         (i686-pc-linux-gnu)\r
38 Date: Mon, 12 Dec 2011 00:19:36 +0200\r
39 Message-ID: <878vmi4upz.fsf@nikula.org>\r
40 MIME-Version: 1.0\r
41 Content-Type: text/plain; charset=us-ascii\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Sun, 11 Dec 2011 22:19:46 -0000\r
55 \r
56 \r
57 Hi Dmitry -\r
58 \r
59 On Mon, 12 Dec 2011 02:00:45 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
60 > On Sun, 11 Dec 2011 23:48:20 +0200, Jani Nikula <jani@nikula.org> wrote:\r
61 > > Let notmuch-poll-script be a function as well as a string. Make default\r
62 > > value nil instead of an empty string, but allow "" for backwards\r
63 > > compatibility. Add a notmuch poll function to call "notmuch new" using the\r
64 > > configured notmuch-command.\r
65 > > \r
66 > > This allows taking better advantage of the "notmuch new" hooks from emacs\r
67 > > without intermediate scripts.\r
68 > > \r
69\r
70 > I was just thinking about working on this myself :)\r
71 \r
72 :)\r
73 \r
74 > I think a better solution would be to allow running a command with\r
75 > arguments.  Creating a elisp function just to run a command with some\r
76 > parameters feels wrong.  This way we would have to add another function\r
77 > each time we want to add another argument.\r
78 \r
79 One thing to take into account is running "notmuch new" using\r
80 notmuch-command, and make that happen with one click in custom.\r
81 \r
82 > Function support for notmuch-poll-script seems like a useful feature on\r
83 > it's own.\r
84 \r
85 I just did this quickly to scratch my own itches, so to speak. My elisp\r
86 is not that great, so I really wouldn't mind if you wanted to continue\r
87 from here and make it your own. It'll be a while before I have the time\r
88 to (figure out how to) do this properly anyway. But up to you, really.\r
89 \r
90 BR,\r
91 Jani.\r
92 \r
93 \r
94\r
95 > Regards,\r
96 >   Dmitry\r
97\r
98 > > Signed-off-by: Jani Nikula <jani@nikula.org>\r
99 > > ---\r
100 > >  emacs/notmuch.el |   44 ++++++++++++++++++++++++++++++++------------\r
101 > >  1 files changed, 32 insertions(+), 12 deletions(-)\r
102 > > \r
103 > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
104 > > index 8936149..6c7e800 100644\r
105 > > --- a/emacs/notmuch.el\r
106 > > +++ b/emacs/notmuch.el\r
107 > > @@ -965,28 +965,48 @@ same relative position within the new buffer."\r
108 > >      (notmuch-search query oldest-first target-thread target-line continuation)\r
109 > >      (goto-char (point-min))))\r
110 > >  \r
111 > > -(defcustom notmuch-poll-script ""\r
112 > > -  "An external script to incorporate new mail into the notmuch database.\r
113 > > +(defcustom notmuch-poll-script nil\r
114 > > +  "A script or a function to incorporate new mail into the notmuch database.\r
115 > >  \r
116 > > -If this variable is non empty, then it should name a script to be\r
117 > > -invoked by `notmuch-search-poll-and-refresh-view' and\r
118 > > -`notmuch-hello-poll-and-update' (each have a default keybinding\r
119 > > -of 'G'). The script could do any of the following depending on\r
120 > > +This variable can be set to a function or the name of an external\r
121 > > +script to be invoked by `notmuch-search-poll-and-refresh-view'\r
122 > > +and `notmuch-hello-poll-and-update' (each have a default\r
123 > > +keybinding of 'G'). Set to nil to do nothing.\r
124 > > +\r
125 > > +The function or script could do any of the following depending on\r
126 > >  the user's needs:\r
127 > >  \r
128 > >  1. Invoke a program to transfer mail to the local mail store\r
129 > >  2. Invoke \"notmuch new\" to incorporate the new mail\r
130 > > -3. Invoke one or more \"notmuch tag\" commands to classify the mail"\r
131 > > -  :type 'string\r
132 > > +3. Invoke one or more \"notmuch tag\" commands to classify the mail\r
133 > > +\r
134 > > +You can also choose to use \"notmuch new\" through the provided\r
135 > > +`notmuch-poll-script-notmuch-new' function, and have the\r
136 > > +\"notmuch new\" hooks perform the actions above."\r
137 > > +  :type '(choice (const :tag "Not set" nil)\r
138 > > +            (const :tag "Notmuch new" notmuch-poll-script-notmuch-new)\r
139 > > +            (function :tag "Custom function"\r
140 > > +                      :value notmuch-poll-script-notmuch-new)\r
141 > > +            (string :tag "Custom script"))\r
142 > >    :group 'notmuch)\r
143 > >  \r
144 > > +(defun notmuch-poll-script-notmuch-new ()\r
145 > > +  "Run \"notmuch new\"."\r
146 > > +  (call-process notmuch-command nil nil nil "new"))\r
147 > > +\r
148 > >  (defun notmuch-poll ()\r
149 > > -  "Run external script to import mail.\r
150 > > +  "Run external script or call a function to import mail.\r
151 > >  \r
152 > > -Invokes `notmuch-poll-script' if it is not set to an empty string."\r
153 > > +Invokes `notmuch-poll-script', which can be a function or the\r
154 > > +name of an external script. Does nothing if `notmuch-poll-script'\r
155 > > +is nil or an empty string."\r
156 > >    (interactive)\r
157 > > -  (if (not (string= notmuch-poll-script ""))\r
158 > > -      (call-process notmuch-poll-script nil nil)))\r
159 > > +  (cond\r
160 > > +   ((stringp notmuch-poll-script)\r
161 > > +    (if (not (string= notmuch-poll-script "")) ;; for backwards compatibility\r
162 > > +   (call-process notmuch-poll-script nil nil)))\r
163 > > +   ((functionp notmuch-poll-script)\r
164 > > +    (funcall notmuch-poll-script))))\r
165 > >  \r
166 > >  (defun notmuch-search-poll-and-refresh-view ()\r
167 > >    "Invoke `notmuch-poll' to import mail, then refresh the current view."\r
168 > > -- \r
169 > > 1.7.5.4\r
170 > > \r
171 > > _______________________________________________\r
172 > > notmuch mailing list\r
173 > > notmuch@notmuchmail.org\r
174 > > http://notmuchmail.org/mailman/listinfo/notmuch\r