--- /dev/null
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 12CE8431FBF\r
+ for <notmuch@notmuchmail.org>; Thu, 6 Mar 2014 05:21:11 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id M7ngo465HM1d for <notmuch@notmuchmail.org>;\r
+ Thu, 6 Mar 2014 05:21:03 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 32BDB431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 6 Mar 2014 05:21:03 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>) id 1WLYEO-0000vI-T8\r
+ for notmuch@notmuchmail.org; Thu, 06 Mar 2014 09:21:00 -0400\r
+Received: (nullmailer pid 2390 invoked by uid 1000); Thu, 06 Mar 2014\r
+ 13:20:57 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: Sphinx man pages, round n+2\r
+Date: Thu, 6 Mar 2014 09:20:44 -0400\r
+Message-Id: <1394112048-2151-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.8.5.3\r
+In-Reply-To: <m2d2i0jz2h.fsf@guru.guru-group.fi>\r
+References: <m2d2i0jz2h.fsf@guru.guru-group.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 06 Mar 2014 13:21:11 -0000\r
+\r
+This is the second non-RFC version of these patches, based on Tomi's comments, \r
+and also adding documentation (for the doc build process) and dependencies.\r
+\r
+Interdiff follows:\r
+\r
+diff --git a/INSTALL b/INSTALL\r
+index fce9352..690b0ef 100644\r
+--- a/INSTALL\r
++++ b/INSTALL\r
+@@ -60,16 +60,30 @@ Talloc which are each described below:\r
+ \r
+ Talloc is available from http://talloc.samba.org/\r
+ \r
++Building Documentation\r
++----------------------\r
++\r
++By default the documentation for notmuch is built using sphinx.\r
++\r
++Sphinx is available from www.sphinx-doc.org.\r
++\r
++If you prefer, you can build the man pages using rst2man, from the\r
++python docutils package. See doc/INSTALL for details.\r
++\r
++\r
++Installing Dependencies from Packages\r
++-------------------------------------\r
++\r
+ On a modern, package-based operating system you can install all of the\r
+ dependencies with a simple simple command line. For example:\r
+ \r
+ For Debian and similar:\r
+ \r
+- sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev\r
++ sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev python-sphinx\r
+ \r
+ For Fedora and similar:\r
+ \r
+- sudo yum install xapian-core-devel gmime-devel libtalloc-devel\r
++ sudo yum install xapian-core-devel gmime-devel libtalloc-devel python-sphinx\r
+ \r
+ On other systems, a similar command can be used, but the details of\r
+ the package names may be different.\r
+diff --git a/debian/control b/debian/control\r
+index 475b787..caf8a5d 100644\r
+--- a/debian/control\r
++++ b/debian/control\r
+@@ -15,6 +15,7 @@ Build-Depends:\r
+ libz-dev,\r
+ python-all (>= 2.6.6-3~),\r
+ python3-all (>= 3.1.2-7~),\r
++ python-sphinx (>= 1.0),\r
+ ruby, ruby-dev (>>1:1.9.3~),\r
+ emacs23-nox | emacs23 (>=23~) | emacs23-lucid (>=23~) |\r
+ emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~),\r
+diff --git a/doc/.gitignore b/doc/.gitignore\r
+new file mode 100644\r
+index 0000000..a60fb31\r
+--- /dev/null\r
++++ b/doc/.gitignore\r
+@@ -0,0 +1,2 @@\r
++docdeps.mk\r
++_build\r
+diff --git a/doc/INSTALL b/doc/INSTALL\r
+new file mode 100644\r
+index 0000000..e37c2b9\r
+--- /dev/null\r
++++ b/doc/INSTALL\r
+@@ -0,0 +1,24 @@\r
++This file contains some more detailed information about building and\r
++installing the documentation.\r
++\r
++Building with sphinx.\r
++---------------------\r
++\r
++- You need sphinx at least version 1.0.\r
++\r
++- You can build build and install man pages with 'make install-man'\r
++\r
++- You can build man, info, html, and pdf versions of the docs\r
++ (currently only the man pages) with\r
++\r
++ 'make install-{man|info|html|pdf}'\r
++\r
++Building the man pages\r
++----------------------\r
++\r
++- You can build the man pages with rst2man (from python-docutils) with\r
++ 'make rst2man'.\r
++\r
++- Currently there is no support to automagically install the resulting\r
++ nroff files, but it should work to modify the target install-man\r
++ in doc/Makefile.local.\r
+diff --git a/doc/Makefile.local b/doc/Makefile.local\r
+index 19861a7..fd64f70 100644\r
+--- a/doc/Makefile.local\r
++++ b/doc/Makefile.local\r
+@@ -19,7 +19,7 @@ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)\r
+ .PHONY: install-man\r
+ \r
+ %.gz: %\r
+- gzip -k -f $^\r
++ rm -f $@ && gzip --stdout $^ > $@\r
+ \r
+ sphinx-html:\r
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html\r
+@@ -37,7 +37,7 @@ sphinx-info: sphinx-texinfo\r
+ rst2man:\r
+ $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man\r
+ \r
+-include $(dir)/docdeps.mk\r
++-include $(dir)/docdeps.mk\r
+ \r
+ MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})\r
+ \r
+diff --git a/doc/man1/notmuch.rst b/doc/man1/notmuch.rst\r
+index 343927f..9710294 100644\r
+--- a/doc/man1/notmuch.rst\r
++++ b/doc/man1/notmuch.rst\r
+@@ -85,7 +85,7 @@ OTHER COMMANDS\r
+ --------------\r
+ \r
+ Several of the notmuch commands accept search terms with a common\r
+-syntax. See *notmuch-search-terms*\ (7) for more details on the\r
++syntax. See **notmuch-search-terms**\ (7) for more details on the\r
+ supported syntax.\r
+ \r
+ The **search**, **show** and **count** commands are used to query the\r