Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 83 / 01e79069ed0cf5ae7a5f8242a183b637554746
1 Return-Path: <wking@tremily.us>\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 82EB7431FAE\r
6         for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 10:31:43 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: 0\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
13         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
14         autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id CPkyIqB19YhS for <notmuch@notmuchmail.org>;\r
18         Sat,  5 Apr 2014 10:31:37 -0700 (PDT)\r
19 Received: from qmta15.westchester.pa.mail.comcast.net\r
20         (qmta15.westchester.pa.mail.comcast.net [76.96.59.228])\r
21         by olra.theworths.org (Postfix) with ESMTP id 268F9431FC0\r
22         for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 10:31:28 -0700 (PDT)\r
23 Received: from omta10.westchester.pa.mail.comcast.net ([76.96.62.28])\r
24         by qmta15.westchester.pa.mail.comcast.net with comcast\r
25         id mFuc1n0020cZkys5FHXT2B; Sat, 05 Apr 2014 17:31:27 +0000\r
26 Received: from odin.tremily.us ([24.18.63.50])\r
27         by omta10.westchester.pa.mail.comcast.net with comcast\r
28         id mHXS1n00N152l3L3WHXTZw; Sat, 05 Apr 2014 17:31:27 +0000\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
30         by odin.tremily.us (Postfix) with ESMTPS id 67EFB1103C1B;\r
31         Sat,  5 Apr 2014 10:31:26 -0700 (PDT)\r
32 Received: (nullmailer pid 16921 invoked by uid 1000);\r
33         Sat, 05 Apr 2014 17:31:15 -0000\r
34 From: "W. Trevor King" <wking@tremily.us>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH 5/7] doc: Allow rst2man.py as an alternative to rst2man\r
37 Date: Sat,  5 Apr 2014 10:31:09 -0700\r
38 Message-Id:\r
39  <adce76bb9a0ca728d856da4ecaf6b282e22e7440.1396718720.git.wking@tremily.us>\r
40 X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
41 In-Reply-To: <cover.1396718720.git.wking@tremily.us>\r
42 References: <cover.1396718720.git.wking@tremily.us>\r
43 In-Reply-To: <cover.1396718720.git.wking@tremily.us>\r
44 References: <cover.1396718720.git.wking@tremily.us>\r
45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
46         s=q20140121; t=1396719087;\r
47         bh=pA1t9ChZWMir5BXJfljawrzzmFw6nHncXINLUCSvNgQ=;\r
48         h=Received:Received:Received:Received:From:To:Subject:Date:\r
49         Message-Id;\r
50         b=hTcNmrNp6jktDN9LsPcPm93PaD87H2X+YtHXkCXDIo6uIy1JsHFhZvteKKzX20e4y\r
51         5I6z2K/xaBsCteQQIRwmLemXXMSsfdRKh8BjlUISNZAuy3opSVhXSck0AtNwRicRB5\r
52         3eLtbqeYmBIgrps6gDOkyvQ9d7316a3SC4HfnNf9B7Prw+2o2jUdbZ2yTPJ0UriXEK\r
53         yFWWs6oIjYB6TQo5/p3gKrE05Fs0pi0U+E6uJcI1L1/V83KXBu5Y9b/AmnW214twel\r
54         wiA3AEY48tY3Lu3mzaDuGbkLjfAa7qR9hQ8zz0pCc0nlWYMdAcF3lJwzA+Hocu6bgO\r
55         Zwhnl2T5CkLfg==\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Sat, 05 Apr 2014 17:31:43 -0000\r
69 \r
70 Gentoo's dev-python/docutils-0.10 installs Docutils scripts with a\r
71 *.py extension, so I have /usr/bin/rst2man.py and no rst2man script.\r
72 This patch supports users with both types of systems by checking for\r
73 rst2man, falling back on rst2man.py, and giving up only if neither is\r
74 found.  Users can also set the new RST2MAN path variable explicitly\r
75 when they call Make:\r
76 \r
77   make RST2MAN=/my/custom/rst_to_man_converter build-man\r
78 \r
79 I use POSIX's 'command -v' [1] to find the path to rst2man or\r
80 rst2man.py, and save that as RST2MAN in Makefile.config.  We can use a\r
81 non-empty RST2MAN to check for the availability of an rst2man program,\r
82 so there's no need for a separate HAVE_RST2MAN.  Then pass the\r
83 configured RST2MAN path through to prerst2man.py to use in its system\r
84 call.\r
85 \r
86 [1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html\r
87 ---\r
88  configure          | 12 +++++++-----\r
89  doc/Makefile.local |  6 +++---\r
90  doc/prerst2man.py  |  9 +++++----\r
91  3 files changed, 15 insertions(+), 12 deletions(-)\r
92 \r
93 diff --git a/configure b/configure\r
94 index 1d430b9..81c286b 100755\r
95 --- a/configure\r
96 +++ b/configure\r
97 @@ -400,7 +400,6 @@ printf "Checking if sphinx is available and supports nroff output... "\r
98  if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev/null 2>&1 ; then\r
99      printf "Yes.\n"\r
100      have_sphinx=1\r
101 -    have_rst2man=0\r
102  else\r
103      printf "No (falling back to rst2man).\n"\r
104      have_sphinx=0\r
105 @@ -408,10 +407,12 @@ else\r
106      printf "Checking if rst2man is available... "\r
107      if rst2man -V > /dev/null 2>&1; then\r
108         printf "Yes.\n"\r
109 -       have_rst2man=1\r
110 +       RST2MAN=$(command -v rst2man)\r
111 +    elif rst2man.py -V > /dev/null 2>&1; then\r
112 +       printf "Yes.\n"\r
113 +       RST2MAN=$(command -v rst2man.py)\r
114      else\r
115         printf "No (so will not install man pages).\n"\r
116 -       have_rst2man=0\r
117      fi\r
118  fi\r
119  \r
120 @@ -788,8 +789,9 @@ HAVE_EMACS = ${have_emacs}\r
121  # Whether there's a sphinx-build binary available for building documentation\r
122  HAVE_SPHINX=${have_sphinx}\r
123  \r
124 -# Whether there's a rst2man binary available for building documentation\r
125 -HAVE_RST2MAN=${have_rst2man}\r
126 +# The path to the rst2man program for building documentation.  Set to\r
127 +# an empty string if no such program is available.\r
128 +RST2MAN=${RST2MAN}\r
129  \r
130  # The directory to which desktop files should be installed\r
131  desktop_dir = \$(prefix)/share/applications\r
132 diff --git a/doc/Makefile.local b/doc/Makefile.local\r
133 index 0980c71..e08fc99 100644\r
134 --- a/doc/Makefile.local\r
135 +++ b/doc/Makefile.local\r
136 @@ -42,8 +42,8 @@ ifeq ($(HAVE_SPHINX),1)\r
137             mkdir -p $(DOCBUILDDIR)/man/man$${section}; \\r
138             mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \\r
139         done\r
140 -else ifeq ($(HAVE_RST2MAN),1)\r
141 -       $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man\r
142 +else ifdef RST2MAN\r
143 +       $(prerst2man) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man\r
144  else\r
145         @echo "Fatal: build dependency fail."\r
146         @false\r
147 @@ -51,7 +51,7 @@ endif\r
148  \r
149  # Do not try to build or install man pages if a man page converter is\r
150  # not available.\r
151 -ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)\r
152 +ifeq ($(HAVE_SPHINX)$(RST2MAN),0)\r
153  build-man:\r
154  install-man:\r
155         @echo "No sphinx or rst2man, will not install man pages."\r
156 diff --git a/doc/prerst2man.py b/doc/prerst2man.py\r
157 index 437dea9..81ce817 100644\r
158 --- a/doc/prerst2man.py\r
159 +++ b/doc/prerst2man.py\r
160 @@ -4,8 +4,9 @@ from os.path import dirname, isdir\r
161  from os import makedirs, system\r
162  import re\r
163  \r
164 -sourcedir = argv[1]\r
165 -outdir = argv[2]\r
166 +rst2man = argv[1]\r
167 +sourcedir = argv[2]\r
168 +outdir = argv[3]\r
169  \r
170  if not isdir(outdir):\r
171      makedirs(outdir, 0o755)\r
172 @@ -59,5 +60,5 @@ for page in man_pages:\r
173      outfile.write("".join(lines))\r
174      outfile.close()\r
175  \r
176 -    system('set -x; rst2man {0} {1}/{2}.{3}'\r
177 -           .format(filename, outdir, page[0], page[4]))\r
178 +    system('set -x; {0} {1} {2}/{3}.{4}'\r
179 +           .format(rst2man, filename, outdir, page[0], page[4]))\r
180 -- \r
181 1.9.1.353.gc66d89d\r
182 \r