Re: [PATCH] NEWS: initial NEWS for 0.22.1
[notmuch-archives.git] / d4 / f65416ce94ae8f946e4f18a2b56856e3b541eb
1 Return-Path: <bremner@tesseract.cs.unb.ca>\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 D99A5431FC0\r
6         for <notmuch@notmuchmail.org>; Sat,  3 Jan 2015 04:59:03 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 ntckZBX7tsXi for <notmuch@notmuchmail.org>;\r
16         Sat,  3 Jan 2015 04:59:01 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 2F9FC431FDB\r
21         for <notmuch@notmuchmail.org>; Sat,  3 Jan 2015 04:59:01 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1Y7OIG-0006EZ-6l; Sat, 03 Jan 2015 08:59:00 -0400\r
25 Received: (nullmailer pid 29794 invoked by uid 1000); Sat, 03 Jan 2015\r
26         12:58:54 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH 2/2] completion: generate notmuch-completion.zsh using\r
30         doc/conf.py\r
31 Date: Sat,  3 Jan 2015 13:58:20 +0100\r
32 Message-Id: <1420289900-29717-2-git-send-email-david@tethera.net>\r
33 X-Mailer: git-send-email 2.1.3\r
34 In-Reply-To: <1420289900-29717-1-git-send-email-david@tethera.net>\r
35 References: <1420289900-29717-1-git-send-email-david@tethera.net>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain; charset=UTF-8\r
38 Content-Transfer-Encoding: 8bit\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sat, 03 Jan 2015 12:59:04 -0000\r
52 \r
53 I noticed that the (out of date) list of subcommands was simply\r
54 repeating the summary lines from the manpage. Since those summary\r
55 lines are already kept in machine readable form in doc/conf.py,\r
56 it's easy to compute that part of the completion file.\r
57 ---\r
58  completion/Makefile.local         |  12 ++++-\r
59  completion/gen-zsh-completion.py  | 108 ++++++++++++++++++++++++++++++++++++++\r
60  completion/notmuch-completion.zsh |  96 ---------------------------------\r
61  3 files changed, 119 insertions(+), 97 deletions(-)\r
62  create mode 100644 completion/gen-zsh-completion.py\r
63  delete mode 100644 completion/notmuch-completion.zsh\r
64 \r
65 diff --git a/completion/Makefile.local b/completion/Makefile.local\r
66 index dfc1271..616afa4 100644\r
67 --- a/completion/Makefile.local\r
68 +++ b/completion/Makefile.local\r
69 @@ -6,7 +6,15 @@ dir := completion\r
70  # directly in any shell commands. Instead we save its value in other,\r
71  # private variables that we can use in the commands.\r
72  bash_script := $(srcdir)/$(dir)/notmuch-completion.bash\r
73 -zsh_script := $(srcdir)/$(dir)/notmuch-completion.zsh\r
74 +gen_zsh_script := $(srcdir)/$(dir)/gen-zsh-completion.py\r
75 +conf_file := $(srcdir)/$(dir)/../doc/conf.py\r
76 +\r
77 +$(dir)/notmuch-completion.zsh: $(dir)/gen-zsh-completion.py\r
78 +       $(PYTHON) $(gen_zsh_script)  $(conf_file) > $@\r
79 +\r
80 +ifeq ($(WITH_ZSH),1)\r
81 +all: $(dir)/notmuch-completion.zsh\r
82 +endif\r
83  \r
84  install: install-$(dir)\r
85  \r
86 @@ -20,3 +28,5 @@ ifeq ($(WITH_ZSH),1)\r
87         mkdir -p "$(DESTDIR)$(zsh_completion_dir)"\r
88         install -m0644 $(zsh_script) "$(DESTDIR)$(zsh_completion_dir)/_notmuch"\r
89  endif\r
90 +\r
91 +CLEAN += $(dir)/notmuch-completion.zsh\r
92 diff --git a/completion/gen-zsh-completion.py b/completion/gen-zsh-completion.py\r
93 new file mode 100644\r
94 index 0000000..26cd13e\r
95 --- /dev/null\r
96 +++ b/completion/gen-zsh-completion.py\r
97 @@ -0,0 +1,108 @@\r
98 +# Copyright 2014 David Bremner <david@tethera.net>\r
99 +#\r
100 +# This program is free software: you can redistribute it and/or modify\r
101 +# it under the terms of the GNU General Public License as published by\r
102 +# the Free Software Foundation, either version 3 of the License, or\r
103 +# (at your option) any later version.\r
104 +#\r
105 +# This program is distributed in the hope that it will be useful,\r
106 +# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
107 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
108 +# GNU General Public License for more details.\r
109 +#\r
110 +# You should have received a copy of the GNU General Public License\r
111 +# along with this program.  If not, see http://www.gnu.org/licenses/ .\r
112 +#\r
113 +# This script is based on notmuch-completion.zsh, by\r
114 +#               Ingmar Vanhassel <ingmar@exherbo.org>\r
115 +\r
116 +from sys import argv\r
117 +\r
118 +conffile = argv[1]\r
119 +\r
120 +with open(conffile) as cf:\r
121 +    exec(cf.read())\r
122 +\r
123 +print(r'''#compdef notmuch\r
124 +\r
125 +# This file was generated from gen-zsh-completion.py in the notmuch source.\r
126 +# You should probably not edit it directly\r
127 +_notmuch_commands()\r
128 +{\r
129 +  local -a notmuch_commands\r
130 +  notmuch_commands=(\r
131 +    'help:display documentation for a subcommand'\r
132 +    'setup:interactively configure notmuch'\r
133 +''')\r
134 +\r
135 +for command in man_pages:\r
136 +    parts=command[1].split('-')\r
137 +    if len(parts) == 1 or command[4] != 1:\r
138 +        continue\r
139 +    print ('    \'{0:s}:{1:s}\''.format(parts[1],command[2]))\r
140 +\r
141 +print (\r
142 +r'''  )\r
143 +\r
144 +  _describe -t command 'command' notmuch_commands\r
145 +}\r
146 +\r
147 +_notmuch_dump()\r
148 +{\r
149 +  _files\r
150 +}\r
151 +\r
152 +_notmuch_help_topics()\r
153 +{\r
154 +  local -a notmuch_help_topics\r
155 +  notmuch_help_topics=(\r
156 +    'search-terms:show common search-terms syntax'\r
157 +  )\r
158 +  _describe -t notmuch-help-topics 'topic' notmuch_help_topics\r
159 +}\r
160 +\r
161 +_notmuch_help()\r
162 +{\r
163 +  _alternative \\r
164 +    _notmuch_commands \\r
165 +    _notmuch_help_topics\r
166 +}\r
167 +\r
168 +_notmuch_restore()\r
169 +{\r
170 +  _files\r
171 +}\r
172 +\r
173 +_notmuch_search()\r
174 +{\r
175 +  _arguments -s : \\r
176 +    '--max-threads=[display only the first x threads from the search results]:number of threads to show: ' \\r
177 +    '--first=[omit the first x threads from the search results]:number of threads to omit: ' \\r
178 +    '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \\r
179 +    '--output=[select what to output]:output:((summary threads messages files tags))'\r
180 +}\r
181 +\r
182 +_notmuch_address()\r
183 +{\r
184 +  _arguments -s : \\r
185 +    '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \\r
186 +    '--output=[select what to output]:output:((sender recipients count))'\r
187 +}\r
188 +\r
189 +_notmuch()\r
190 +{\r
191 +  if (( CURRENT > 2 )) ; then\r
192 +    local cmd=${words[2]}\r
193 +    curcontext="${curcontext%:*:*}:notmuch-$cmd"\r
194 +    (( CURRENT-- ))\r
195 +    shift words\r
196 +    _call_function ret _notmuch_$cmd\r
197 +    return ret\r
198 +  else\r
199 +    _notmuch_commands\r
200 +  fi\r
201 +}\r
202 +\r
203 +_notmuch "$@"\r
204 +\r
205 +''')\r
206 diff --git a/completion/notmuch-completion.zsh b/completion/notmuch-completion.zsh\r
207 deleted file mode 100644\r
208 index 46b33d1..0000000\r
209 --- a/completion/notmuch-completion.zsh\r
210 +++ /dev/null\r
211 @@ -1,96 +0,0 @@\r
212 -#compdef notmuch\r
213 -\r
214 -# ZSH completion for `notmuch`\r
215 -# Copyright © 2009 Ingmar Vanhassel <ingmar@exherbo.org>\r
216 -#\r
217 -# This program is free software: you can redistribute it and/or modify\r
218 -# it under the terms of the GNU General Public License as published by\r
219 -# the Free Software Foundation, either version 3 of the License, or\r
220 -# (at your option) any later version.\r
221 -#\r
222 -# This program is distributed in the hope that it will be useful,\r
223 -# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
224 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
225 -# GNU General Public License for more details.\r
226 -#\r
227 -# You should have received a copy of the GNU General Public License\r
228 -# along with this program.  If not, see http://www.gnu.org/licenses/ .\r
229 -\r
230 -_notmuch_commands()\r
231 -{\r
232 -  local -a notmuch_commands\r
233 -  notmuch_commands=(\r
234 -    'setup:interactively set up notmuch for first use'\r
235 -    'new:find and import any new message to the database'\r
236 -    'search:search for messages matching the search terms, display matching threads as results'\r
237 -    'address:get addresses from messages matching the given search terms'\r
238 -    'reply:constructs a reply template for a set of messages'\r
239 -    'show:show all messages matching the search terms'\r
240 -    'tag:add or remove tags for all messages matching the search terms'\r
241 -    'dump:creates a plain-text dump of the tags of each message'\r
242 -    'restore:restores the tags from the given file'\r
243 -    'help:show details on a command'\r
244 -  )\r
245 -\r
246 -  _describe -t command 'command' notmuch_commands\r
247 -}\r
248 -\r
249 -_notmuch_dump()\r
250 -{\r
251 -  _files\r
252 -}\r
253 -\r
254 -_notmuch_help_topics()\r
255 -{\r
256 -  local -a notmuch_help_topics\r
257 -  notmuch_help_topics=(\r
258 -    'search-terms:show common search-terms syntax'\r
259 -  )\r
260 -  _describe -t notmuch-help-topics 'topic' notmuch_help_topics\r
261 -}\r
262 -\r
263 -_notmuch_help()\r
264 -{\r
265 -  _alternative \\r
266 -    _notmuch_commands \\r
267 -    _notmuch_help_topics\r
268 -}\r
269 -\r
270 -_notmuch_restore()\r
271 -{\r
272 -  _files\r
273 -}\r
274 -\r
275 -_notmuch_search()\r
276 -{\r
277 -  _arguments -s : \\r
278 -    '--max-threads=[display only the first x threads from the search results]:number of threads to show: ' \\r
279 -    '--first=[omit the first x threads from the search results]:number of threads to omit: ' \\r
280 -    '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \\r
281 -    '--output=[select what to output]:output:((summary threads messages files tags))'\r
282 -}\r
283 -\r
284 -_notmuch_address()\r
285 -{\r
286 -  _arguments -s : \\r
287 -    '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \\r
288 -    '--output=[select what to output]:output:((sender recipients count))'\r
289 -}\r
290 -\r
291 -_notmuch()\r
292 -{\r
293 -  if (( CURRENT > 2 )) ; then\r
294 -    local cmd=${words[2]}\r
295 -    curcontext="${curcontext%:*:*}:notmuch-$cmd"\r
296 -    (( CURRENT-- ))\r
297 -    shift words\r
298 -    _call_function ret _notmuch_$cmd\r
299 -    return ret\r
300 -  else\r
301 -    _notmuch_commands\r
302 -  fi\r
303 -}\r
304 -\r
305 -_notmuch "$@"\r
306 -\r
307 -# vim: set sw=2 sts=2 ts=2 et ft=zsh :\r
308 -- \r
309 2.1.3\r
310 \r