--- /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 462AE431FBF\r
+ for <notmuch@notmuchmail.org>; Sun, 9 Mar 2014 05:57:31 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.001\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.001 tagged_above=-999 required=5\r
+ tests=[WEIRD_QUOTING=0.001] 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 OJ7DrwVg5KEe for <notmuch@notmuchmail.org>;\r
+ Sun, 9 Mar 2014 05:57:18 -0700 (PDT)\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 5F3CC431FBD\r
+ for <notmuch@notmuchmail.org>; Sun, 9 Mar 2014 05:57:18 -0700 (PDT)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1WMdI3-0003qE-VW; Sun, 09 Mar 2014 09:57:15 -0300\r
+Received: (nullmailer pid 8481 invoked by uid 1000); Sun, 09 Mar 2014\r
+ 12:57:08 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v3 1/4] doc: convert sphinx based docs\r
+Date: Sun, 9 Mar 2014 09:56:57 -0300\r
+Message-Id: <1394369820-8319-2-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.8.5.3\r
+In-Reply-To: <1394369820-8319-1-git-send-email-david@tethera.net>\r
+References: <1394369820-8319-1-git-send-email-david@tethera.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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: Sun, 09 Mar 2014 12:57:31 -0000\r
+\r
+This is the output from sphinx-quickstart, massaged a bit, along with\r
+our existing man pages converted to rst.\r
+\r
+A skeleton notmuch-emacs manual is also included. It is not suitable\r
+for end user use yet.\r
+---\r
+ INSTALL | 18 ++-\r
+ Makefile | 2 +-\r
+ debian/control | 1 +\r
+ doc/.gitignore | 2 +\r
+ doc/INSTALL | 24 ++++\r
+ doc/Makefile | 5 +\r
+ doc/Makefile.local | 27 +++++\r
+ doc/conf.py | 166 +++++++++++++++++++++++++++\r
+ doc/index.rst | 30 +++++\r
+ doc/man1/notmuch-compact.rst | 52 +++++++++\r
+ doc/man1/notmuch-config.rst | 123 ++++++++++++++++++++\r
+ doc/man1/notmuch-count.rst | 60 ++++++++++\r
+ doc/man1/notmuch-dump.rst | 72 ++++++++++++\r
+ doc/man1/notmuch-insert.rst | 58 ++++++++++\r
+ doc/man1/notmuch-new.rst | 52 +++++++++\r
+ doc/man1/notmuch-reply.rst | 112 ++++++++++++++++++\r
+ doc/man1/notmuch-restore.rst | 59 ++++++++++\r
+ doc/man1/notmuch-search.rst | 146 ++++++++++++++++++++++++\r
+ doc/man1/notmuch-show.rst | 179 +++++++++++++++++++++++++++++\r
+ doc/man1/notmuch-tag.rst | 107 +++++++++++++++++\r
+ doc/man1/notmuch.rst | 143 +++++++++++++++++++++++\r
+ doc/man5/notmuch-hooks.rst | 44 +++++++\r
+ doc/man7/notmuch-search-terms.rst | 234 ++++++++++++++++++++++++++++++++++++++\r
+ doc/notmuch-emacs.rst | 192 +++++++++++++++++++++++++++++++\r
+ 24 files changed, 1905 insertions(+), 3 deletions(-)\r
+ create mode 100644 doc/.gitignore\r
+ create mode 100644 doc/INSTALL\r
+ create mode 100644 doc/Makefile\r
+ create mode 100644 doc/Makefile.local\r
+ create mode 100644 doc/conf.py\r
+ create mode 100644 doc/index.rst\r
+ create mode 100644 doc/man1/notmuch-compact.rst\r
+ create mode 100644 doc/man1/notmuch-config.rst\r
+ create mode 100644 doc/man1/notmuch-count.rst\r
+ create mode 100644 doc/man1/notmuch-dump.rst\r
+ create mode 100644 doc/man1/notmuch-insert.rst\r
+ create mode 100644 doc/man1/notmuch-new.rst\r
+ create mode 100644 doc/man1/notmuch-reply.rst\r
+ create mode 100644 doc/man1/notmuch-restore.rst\r
+ create mode 100644 doc/man1/notmuch-search.rst\r
+ create mode 100644 doc/man1/notmuch-show.rst\r
+ create mode 100644 doc/man1/notmuch-tag.rst\r
+ create mode 100644 doc/man1/notmuch.rst\r
+ create mode 100644 doc/man5/notmuch-hooks.rst\r
+ create mode 100644 doc/man7/notmuch-search-terms.rst\r
+ create mode 100644 doc/notmuch-emacs.rst\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/Makefile b/Makefile\r
+index 0428160..39f0e62 100644\r
+--- a/Makefile\r
++++ b/Makefile\r
+@@ -5,7 +5,7 @@ all:\r
+ # List all subdirectories here. Each contains its own Makefile.local.\r
+ # Use of '=', without '+=', seems to be required for out-of-tree\r
+ # builds to work.\r
+-subdirs = compat completion emacs lib man parse-time-string performance-test util test\r
++subdirs = compat completion doc emacs lib man parse-time-string performance-test util test\r
+ \r
+ # We make all targets depend on the Makefiles themselves.\r
+ global_deps = Makefile Makefile.config Makefile.local \\r
+diff --git a/debian/control b/debian/control\r
+index c5475c4..8d8e938 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 b/doc/Makefile\r
+new file mode 100644\r
+index 0000000..fa25832\r
+--- /dev/null\r
++++ b/doc/Makefile\r
+@@ -0,0 +1,5 @@\r
++all:\r
++ $(MAKE) -C .. all\r
++\r
++.DEFAULT:\r
++ $(MAKE) -C .. $@\r
+diff --git a/doc/Makefile.local b/doc/Makefile.local\r
+new file mode 100644\r
+index 0000000..ec23012\r
+--- /dev/null\r
++++ b/doc/Makefile.local\r
+@@ -0,0 +1,27 @@\r
++# -*- makefile -*-\r
++\r
++dir := doc\r
++\r
++# You can set these variables from the command line.\r
++SPHINXOPTS := -q -c $(dir)\r
++SPHINXBUILD = sphinx-build\r
++DOCBUILDDIR := $(dir)/_build\r
++\r
++# Internal variables.\r
++ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)\r
++\r
++.PHONY: sphinx-html sphinx-man sphinx-texinfo sphinx-info\r
++\r
++sphinx-html:\r
++ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html\r
++\r
++sphinx-man:\r
++ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man\r
++\r
++sphinx-texinfo:\r
++ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo\r
++\r
++sphinx-info: sphinx-texinfo\r
++ make -C $(DOCBUILDDIR)/texinfo info\r
++\r
++CLEAN := $(CLEAN) $(DOCBUILDDIR)\r
+diff --git a/doc/conf.py b/doc/conf.py\r
+new file mode 100644\r
+index 0000000..6c2806d\r
+--- /dev/null\r
++++ b/doc/conf.py\r
+@@ -0,0 +1,166 @@\r
++\r
++# -*- coding: utf-8 -*-\r
++\r
++import sys\r
++import os\r
++\r
++# The suffix of source filenames.\r
++source_suffix = '.rst'\r
++\r
++# The master toctree document.\r
++master_doc = 'index'\r
++\r
++# General information about the project.\r
++project = u'notmuch'\r
++copyright = u'2014, Carl Worth and many others'\r
++\r
++# The short X.Y version.\r
++version = '0.17'\r
++# The full version, including alpha/beta/rc tags.\r
++release = '0.17'\r
++\r
++# List of patterns, relative to source directory, that match files and\r
++# directories to ignore when looking for source files.\r
++exclude_patterns = ['_build', 'notmuch-emacs.rst']\r
++\r
++# The name of the Pygments (syntax highlighting) style to use.\r
++pygments_style = 'sphinx'\r
++\r
++# -- Options for HTML output ----------------------------------------------\r
++\r
++# The theme to use for HTML and HTML Help pages. See the documentation for\r
++# a list of builtin themes.\r
++html_theme = 'default'\r
++\r
++\r
++# Add any paths that contain custom static files (such as style sheets) here,\r
++# relative to this directory. They are copied after the builtin static files,\r
++# so a file named "default.css" will overwrite the builtin "default.css".\r
++html_static_path = ['_static']\r
++\r
++# Output file base name for HTML help builder.\r
++htmlhelp_basename = 'notmuchdoc'\r
++\r
++# -- Options for manual page output ---------------------------------------\r
++\r
++# One entry per manual page. List of tuples\r
++# (source start file, name, description, authors, manual section).\r
++\r
++man_pages = [\r
++\r
++('man1/notmuch','notmuch',\r
++ u'thread-based email index, search, and tagging',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-compact','notmuch-compact',\r
++ u'compact the notmuch database',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-config','notmuch-config',\r
++ u'access notmuch configuration file',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-count','notmuch-count',\r
++ u'count messages matching the given search terms',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-dump','notmuch-dump',\r
++ u'creates a plain-text dump of the tags of each message',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man5/notmuch-hooks','notmuch-hooks',\r
++ u'hooks for notmuch',\r
++ [u'Carl Worth and many others'], 5),\r
++\r
++('man1/notmuch-insert','notmuch-insert',\r
++ u'add a message to the maildir and notmuch database',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-new','notmuch-new',\r
++ u'incorporate new mail into the notmuch database',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-reply','notmuch-reply',\r
++ u'constructs a reply template for a set of messages',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-restore','notmuch-restore',\r
++ u'restores the tags from the given file (see notmuch dump)',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-search','notmuch-search',\r
++ u'search for messages matching the given search terms',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man7/notmuch-search-terms','notmuch-search-terms',\r
++ u'syntax for notmuch queries',\r
++ [u'Carl Worth and many others'], 7),\r
++\r
++('man1/notmuch-show','notmuch-show',\r
++ u'show messages matching the given search terms',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++('man1/notmuch-tag','notmuch-tag',\r
++ u'add/remove tags for all messages matching the search terms',\r
++ [u'Carl Worth and many others'], 1),\r
++\r
++\r
++]\r
++# If true, show URL addresses after external links.\r
++#man_show_urls = False\r
++\r
++# -- Options for Texinfo output -------------------------------------------\r
++\r
++# Grouping the document tree into Texinfo files. List of tuples\r
++# (source start file, target name, title, author,\r
++# dir menu entry, description, category)\r
++# If true, do not generate a @detailmenu in the "Top" node's menu.\r
++texinfo_no_detailmenu = True\r
++\r
++texinfo_documents = [\r
++ ('notmuch-emacs', 'notmuch-emacs', u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-emacs',\r
++ 'emacs based front-end for notmuch', 'Miscellaneous'),\r
++('man1/notmuch','notmuch',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch',\r
++ 'thread-based email index, search, and tagging','Miscellaneous'),\r
++('man1/notmuch-compact','notmuch-compact',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-compact',\r
++ 'compact the notmuch database','Miscellaneous'),\r
++('man1/notmuch-config','notmuch-config',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-config',\r
++ 'access notmuch configuration file','Miscellaneous'),\r
++('man1/notmuch-count','notmuch-count',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-count',\r
++ 'count messages matching the given search terms','Miscellaneous'),\r
++('man1/notmuch-dump','notmuch-dump',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-dump',\r
++ 'creates a plain-text dump of the tags of each message','Miscellaneous'),\r
++('man5/notmuch-hooks','notmuch-hooks',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-hooks',\r
++ 'hooks for notmuch','Miscellaneous'),\r
++('man1/notmuch-insert','notmuch-insert',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-insert',\r
++ 'add a message to the maildir and notmuch database','Miscellaneous'),\r
++('man1/notmuch-new','notmuch-new',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-new',\r
++ 'incorporate new mail into the notmuch database','Miscellaneous'),\r
++('man1/notmuch-reply','notmuch-reply',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-reply',\r
++ 'constructs a reply template for a set of messages','Miscellaneous'),\r
++('man1/notmuch-restore','notmuch-restore',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-restore',\r
++ 'restores the tags from the given file (see notmuch dump)','Miscellaneous'),\r
++('man1/notmuch-search','notmuch-search',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-search',\r
++ 'search for messages matching the given search terms','Miscellaneous'),\r
++('man7/notmuch-search-terms','notmuch-search-terms',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-search-terms',\r
++ 'syntax for notmuch queries','Miscellaneous'),\r
++('man1/notmuch-show','notmuch-show',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-show',\r
++ 'show messages matching the given search terms','Miscellaneous'),\r
++('man1/notmuch-tag','notmuch-tag',u'notmuch Documentation',\r
++ u'Carl Worth and many others', 'notmuch-tag',\r
++ 'add/remove tags for all messages matching the search terms','Miscellaneous'),\r
++]\r
+diff --git a/doc/index.rst b/doc/index.rst\r
+new file mode 100644\r
+index 0000000..b33aa9f\r
+--- /dev/null\r
++++ b/doc/index.rst\r
+@@ -0,0 +1,30 @@\r
++\r
++Welcome to notmuch's documentation!\r
++===================================\r
++\r
++Contents:\r
++\r
++.. toctree::\r
++ :titlesonly:\r
++\r
++ man1/notmuch\r
++ man1/notmuch-compact\r
++ man1/notmuch-config\r
++ man1/notmuch-count\r
++ man1/notmuch-dump\r
++ man5/notmuch-hooks\r
++ man1/notmuch-insert\r
++ man1/notmuch-new\r
++ man1/notmuch-reply\r
++ man1/notmuch-restore\r
++ man1/notmuch-search\r
++ man7/notmuch-search-terms\r
++ man1/notmuch-show\r
++ man1/notmuch-tag\r
++\r
++Indices and tables\r
++==================\r
++\r
++* :ref:`genindex`\r
++* :ref:`modindex`\r
++* :ref:`search`\r
+diff --git a/doc/man1/notmuch-compact.rst b/doc/man1/notmuch-compact.rst\r
+new file mode 100644\r
+index 0000000..e0109dc\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-compact.rst\r
+@@ -0,0 +1,52 @@\r
++===============\r
++notmuch-compact\r
++===============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **compact** [--quiet] [--backup=<*directory*>]\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++The **compact** command can be used to compact the notmuch database.\r
++This can both reduce the space required by the database and improve\r
++lookup performance.\r
++\r
++The compacted database is built in a temporary directory and is later\r
++moved into the place of the origin database. The original uncompacted\r
++database is discarded, unless the ``--backup=``\ <directory> option is\r
++used.\r
++\r
++Note that the database write lock will be held during the compaction\r
++process (which may be quite long) to protect data integrity.\r
++\r
++Supported options for **compact** include\r
++\r
++ ``--backup=``\ <directory>\r
++ Save the current database to the given directory before\r
++ replacing it with the compacted database. The backup directory\r
++ must not exist and it must reside on the same mounted filesystem\r
++ as the current database.\r
++\r
++ ``--quiet``\r
++ Do not report database compaction progress to stdout.\r
++\r
++ENVIRONMENT\r
++===========\r
++\r
++The following environment variables can be used to control the behavior\r
++of notmuch.\r
++\r
++**NOTMUCH\_CONFIG**\r
++ Specifies the location of the notmuch configuration file. Notmuch\r
++ will use ${HOME}/.notmuch-config if this variable is not set.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-count(1)**, **notmuch-dump(1)**,\r
++**notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,\r
++**notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst\r
+new file mode 100644\r
+index 0000000..3c9a568\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-config.rst\r
+@@ -0,0 +1,123 @@\r
++==============\r
++notmuch-config\r
++==============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **config** **get** <*section*>.<*item*>\r
++\r
++**notmuch** **config** **set** <*section*>.<*item*> [*value* ...]\r
++\r
++**notmuch** **config** **list**\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++The **config** command can be used to get or set settings in the notmuch\r
++configuration file.\r
++\r
++ **get**\r
++ The value of the specified configuration item is printed to\r
++ stdout. If the item has multiple values (it is a list), each\r
++ value is separated by a newline character.\r
++\r
++ **set**\r
++ The specified configuration item is set to the given value. To\r
++ specify a multiple-value item (a list), provide each value as a\r
++ separate command-line argument.\r
++\r
++ If no values are provided, the specified configuration item will\r
++ be removed from the configuration file.\r
++\r
++ **list**\r
++ Every configuration item is printed to stdout, each on a\r
++ separate line of the form:\r
++\r
++ *section*.\ *item*\ =\ *value*\r
++\r
++ No additional whitespace surrounds the dot or equals sign\r
++ characters. In a multiple-value item (a list), the values are\r
++ separated by semicolon characters.\r
++\r
++The available configuration items are described below.\r
++\r
++ **database.path**\r
++ The top-level directory where your mail currently exists and to\r
++ where mail will be delivered in the future. Files should be\r
++ individual email messages. Notmuch will store its database\r
++ within a sub-directory of the path configured here named\r
++ ``.notmuch``.\r
++\r
++ **user.name**\r
++ Your full name.\r
++\r
++ **user.primary\_email**\r
++ Your primary email address.\r
++\r
++ **user.other\_email**\r
++ A list of other email addresses at which you receive email.\r
++\r
++ **new.tags**\r
++ A list of tags that will be added to all messages incorporated\r
++ by **notmuch new**.\r
++\r
++ **new.ignore**\r
++ A list of file and directory names, without path, that will not\r
++ be searched for messages by **notmuch new**. All the files and\r
++ directories matching any of the names specified here will be\r
++ ignored, regardless of the location in the mail store directory\r
++ hierarchy.\r
++\r
++ **search.exclude\_tags**\r
++ A list of tags that will be excluded from search results by\r
++ default. Using an excluded tag in a query will override that\r
++ exclusion.\r
++\r
++ **maildir.synchronize\_flags**\r
++ If true, then the following maildir flags (in message filenames)\r
++ will be synchronized with the corresponding notmuch tags:\r
++\r
++ +--------+-----------------------------------------------+\r
++ | Flag | Tag |\r
++ +========+===============================================+\r
++ | D | draft |\r
++ +--------+-----------------------------------------------+\r
++ | F | flagged |\r
++ +--------+-----------------------------------------------+\r
++ | P | passed |\r
++ +--------+-----------------------------------------------+\r
++ | R | replied |\r
++ +--------+-----------------------------------------------+\r
++ | S | unread (added when 'S' flag is not present) |\r
++ +--------+-----------------------------------------------+\r
++\r
++ The **notmuch new** command will notice flag changes in\r
++ filenames and update tags, while the **notmuch tag** and\r
++ **notmuch restore** commands will notice tag changes and update\r
++ flags in filenames.\r
++\r
++ If there have been any changes in the maildir (new messages\r
++ added, old ones removed or renamed, maildir flags changed,\r
++ etc.), it is advisable to run **notmuch new** before **notmuch\r
++ tag** or **notmuch restore** commands to ensure the tag changes\r
++ are properly synchronized to the maildir flags, as the commands\r
++ expect the database and maildir to be in sync.\r
++\r
++ENVIRONMENT\r
++===========\r
++\r
++The following environment variables can be used to control the behavior\r
++of notmuch.\r
++\r
++**NOTMUCH\_CONFIG**\r
++ Specifies the location of the notmuch configuration file. Notmuch\r
++ will use ${HOME}/.notmuch-config if this variable is not set.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-count(1)**, **notmuch-dump(1)**,\r
++**notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,\r
++**notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-count.rst b/doc/man1/notmuch-count.rst\r
+new file mode 100644\r
+index 0000000..ca78c18\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-count.rst\r
+@@ -0,0 +1,60 @@\r
++=============\r
++notmuch-count\r
++=============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **count** [*option* ...] <*search-term*> ...\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Count messages matching the search terms.\r
++\r
++The number of matching messages (or threads) is output to stdout.\r
++\r
++With no search terms, a count of all messages (or threads) in the\r
++database will be displayed.\r
++\r
++See **notmuch-search-terms(7)** for details of the supported syntax for\r
++<search-terms>.\r
++\r
++Supported options for **count** include\r
++\r
++ ``--output=(messages|threads|files)``\r
++\r
++ **messages**\r
++ Output the number of matching messages. This is the default.\r
++\r
++ **threads**\r
++ Output the number of matching threads.\r
++\r
++ **files**\r
++ Output the number of files associated with matching\r
++ messages. This may be bigger than the number of matching\r
++ messages due to duplicates (i.e. multiple files having the\r
++ same message-id).\r
++\r
++ ``--exclude=(true|false)``\r
++ Specify whether to omit messages matching search.tag\_exclude\r
++ from the count (the default) or not.\r
++\r
++ ``--batch``\r
++ Read queries from a file (stdin by default), one per line, and\r
++ output the number of matching messages (or threads) to stdout,\r
++ one per line. On an empty input line the count of all messages\r
++ (or threads) in the database will be output. This option is not\r
++ compatible with specifying search terms on the command line.\r
++\r
++ ``--input=``\ <filename>\r
++ Read input from given file, instead of from stdin. Implies\r
++ ``--batch``.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-dump(1)**,\r
++**notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,\r
++**notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-dump.rst b/doc/man1/notmuch-dump.rst\r
+new file mode 100644\r
+index 0000000..17d1da5\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-dump.rst\r
+@@ -0,0 +1,72 @@\r
++============\r
++notmuch-dump\r
++============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **dump** [--format=(batch-tag|sup)] [--] [--output=<*file*>] [--] [<*search-term*> ...]\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Dump tags for messages matching the given search terms.\r
++\r
++Output is to the given filename, if any, or to stdout.\r
++\r
++These tags are the only data in the notmuch database that can't be\r
++recreated from the messages themselves. The output of notmuch dump is\r
++therefore the only critical thing to backup (and much more friendly to\r
++incremental backup than the native database files.)\r
++\r
++``--format=(sup|batch-tag)``\r
++ Notmuch restore supports two plain text dump formats, both with one\r
++ message-id per line, followed by a list of tags.\r
++\r
++ **batch-tag**\r
++ The default **batch-tag** dump format is intended to more robust\r
++ against malformed message-ids and tags containing whitespace or\r
++ non-\ **ascii(7)** characters. Each line has the form\r
++\r
++ +<*encoded-tag*\ > +<*encoded-tag*\ > ... --\r
++ id:<*quoted-message-id*\ >\r
++\r
++ Tags are hex-encoded by replacing every byte not matching the\r
++ regex **[A-Za-z0-9@=.,\_+-]** with **%nn** where nn is the two\r
++ digit hex encoding. The message ID is a valid Xapian query,\r
++ quoted using Xapian boolean term quoting rules: if the ID\r
++ contains whitespace or a close paren or starts with a double\r
++ quote, it must be enclosed in double quotes and double quotes\r
++ inside the ID must be doubled. The astute reader will notice\r
++ this is a special case of the batch input format for\r
++ **notmuch-tag(1)**; note that the single message-id query is\r
++ mandatory for **notmuch-restore(1)**.\r
++\r
++ **sup**\r
++ The **sup** dump file format is specifically chosen to be\r
++ compatible with the format of files produced by sup-dump. So if\r
++ you've previously been using sup for mail, then the **notmuch\r
++ restore** command provides you a way to import all of your tags\r
++ (or labels as sup calls them). Each line has the following form\r
++\r
++ <*message-id*\ > **(** <*tag*\ > ... **)**\r
++\r
++ with zero or more tags are separated by spaces. Note that\r
++ (malformed) message-ids may contain arbitrary non-null\r
++ characters. Note also that tags with spaces will not be\r
++ correctly restored with this format.\r
++\r
++ With no search terms, a dump of all messages in the database will be\r
++ generated. A "--" argument instructs notmuch that the remaining\r
++ arguments are search terms.\r
++\r
++ See **notmuch-search-terms(7)** for details of the supported syntax\r
++ for <search-terms>.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,\r
++**notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-insert.rst b/doc/man1/notmuch-insert.rst\r
+new file mode 100644\r
+index 0000000..2be1a7b\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-insert.rst\r
+@@ -0,0 +1,58 @@\r
++==============\r
++notmuch-insert\r
++==============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **insert** [option ...] [+<*tag*>|-<*tag*> ...]\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++**notmuch insert** reads a message from standard input and delivers it\r
++into the maildir directory given by configuration option\r
++**database.path**, then incorporates the message into the notmuch\r
++database. It is an alternative to using a separate tool to deliver the\r
++message then running **notmuch new** afterwards.\r
++\r
++The new message will be tagged with the tags specified by the\r
++**new.tags** configuration option, then by operations specified on the\r
++command-line: tags prefixed by '+' are added while those prefixed by '-'\r
++are removed.\r
++\r
++If the new message is a duplicate of an existing message in the database\r
++(it has same Message-ID), it will be added to the maildir folder and\r
++notmuch database, but the tags will not be changed.\r
++\r
++Option arguments must appear before any tag operation arguments.\r
++Supported options for **insert** include\r
++\r
++ ``--folder=<``\ folder\ **>**\r
++ Deliver the message to the specified folder, relative to the\r
++ top-level directory given by the value of **database.path**. The\r
++ default is to deliver to the top-level directory.\r
++\r
++ ``--create-folder``\r
++ Try to create the folder named by the ``--folder`` option, if it\r
++ does not exist. Otherwise the folder must already exist for mail\r
++ delivery to succeed.\r
++\r
++EXIT STATUS\r
++===========\r
++\r
++This command returns exit status 0 if the message was successfully added\r
++to the mail directory, even if the message could not be indexed and\r
++added to the notmuch database. In the latter case, a warning will be\r
++printed to standard error but the message file will be left on disk.\r
++\r
++If the message could not be written to disk then a non-zero exit status\r
++is returned.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-reply(1)**,\r
++**notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-new.rst b/doc/man1/notmuch-new.rst\r
+new file mode 100644\r
+index 0000000..d11fcee\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-new.rst\r
+@@ -0,0 +1,52 @@\r
++===========\r
++notmuch-new\r
++===========\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **new** [--no-hooks]\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Find and import any new messages to the database.\r
++\r
++The **new** command scans all sub-directories of the database,\r
++performing full-text indexing on new messages that are found. Each new\r
++message will automatically be tagged with both the **inbox** and\r
++**unread** tags.\r
++\r
++You should run **notmuch new** once after first running **notmuch\r
++setup** to create the initial database. The first run may take a long\r
++time if you have a significant amount of mail (several hundred thousand\r
++messages or more). Subsequently, you should run **notmuch new** whenever\r
++new mail is delivered and you wish to incorporate it into the database.\r
++These subsequent runs will be much quicker than the initial run.\r
++\r
++Invoking ``notmuch`` with no command argument will run **new** if\r
++**notmuch setup** has previously been completed, but **notmuch new** has\r
++not previously been run.\r
++\r
++**notmuch new** updates tags according to maildir flag changes if the\r
++**maildir.synchronize\_flags** configuration option is enabled. See\r
++**notmuch-config(1)** for details.\r
++\r
++The **new** command supports hooks. See **notmuch-hooks(5)** for more\r
++details on hooks.\r
++\r
++Supported options for **new** include\r
++\r
++ ``--no-hooks``\r
++ Prevents hooks from being run.\r
++\r
++ ``--quiet``\r
++ Do not print progress or results.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
++**notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-reply.rst b/doc/man1/notmuch-reply.rst\r
+new file mode 100644\r
+index 0000000..cfbd4ea\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-reply.rst\r
+@@ -0,0 +1,112 @@\r
++=============\r
++notmuch-reply\r
++=============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **reply** [option ...] <*search-term*> ...\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Constructs a reply template for a set of messages.\r
++\r
++To make replying to email easier, **notmuch reply** takes an existing\r
++set of messages and constructs a suitable mail template. The Reply-to:\r
++header (if any, otherwise From:) is used for the To: address. Unless\r
++``--reply-to=sender`` is specified, values from the To: and Cc: headers\r
++are copied, but not including any of the current user's email addresses\r
++(as configured in primary\_mail or other\_email in the .notmuch-config\r
++file) in the recipient list.\r
++\r
++It also builds a suitable new subject, including Re: at the front (if\r
++not already present), and adding the message IDs of the messages being\r
++replied to to the References list and setting the In-Reply-To: field\r
++correctly.\r
++\r
++Finally, the original contents of the emails are quoted by prefixing\r
++each line with '> ' and included in the body.\r
++\r
++The resulting message template is output to stdout.\r
++\r
++Supported options for **reply** include\r
++\r
++ ``--format=``\ (**default**\ \|\ **json**\ \|\ **sexp**\ \|\ **headers-only**)\r
++\r
++ **default**\r
++ Includes subject and quoted message body as an RFC 2822\r
++ message.\r
++\r
++ **json**\r
++ Produces JSON output containing headers for a reply message\r
++ and the contents of the original message. This output can be\r
++ used by a client to create a reply message intelligently.\r
++\r
++ **sexp**\r
++ Produces S-Expression output containing headers for a reply\r
++ message and the contents of the original message. This\r
++ output can be used by a client to create a reply message\r
++ intelligently.\r
++\r
++ **headers-only**\r
++ Only produces In-Reply-To, References, To, Cc, and Bcc\r
++ headers.\r
++\r
++ ``--format-version=N``\r
++ Use the specified structured output format version. This is\r
++ intended for programs that invoke **notmuch(1)** internally. If\r
++ omitted, the latest supported version will be used.\r
++\r
++ ``--reply-to=``\ (**all**\ \|\ **sender**)\r
++\r
++ **all** (default)\r
++ Replies to all addresses.\r
++\r
++ **sender**\r
++ Replies only to the sender. If replying to user's own\r
++ message (Reply-to: or From: header is one of the user's\r
++ configured email addresses), try To:, Cc:, and Bcc: headers\r
++ in this order, and copy values from the first that contains\r
++ something other than only the user's addresses.\r
++\r
++ ``--decrypt``\r
++ Decrypt any MIME encrypted parts found in the selected content\r
++ (ie. "multipart/encrypted" parts). Status of the decryption will\r
++ be reported (currently only supported with --format=json and\r
++ --format=sexp) and on successful decryption the\r
++ multipart/encrypted part will be replaced by the decrypted\r
++ content.\r
++\r
++ Decryption expects a functioning **gpg-agent(1)** to provide any\r
++ needed credentials. Without one, the decryption will fail.\r
++\r
++See **notmuch-search-terms(7)** for details of the supported syntax for\r
++<search-terms>.\r
++\r
++Note: It is most common to use **notmuch reply** with a search string\r
++matching a single message, (such as id:<message-id>), but it can be\r
++useful to reply to several messages at once. For example, when a series\r
++of patches are sent in a single thread, replying to the entire thread\r
++allows for the reply to comment on issues found in multiple patches. The\r
++default format supports replying to multiple messages at once, but the\r
++JSON and S-Expression formats do not.\r
++\r
++EXIT STATUS\r
++===========\r
++\r
++This command supports the following special exit status codes\r
++\r
++``20``\r
++ The requested format version is too old.\r
++\r
++``21``\r
++ The requested format version is too new.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
++**notmuch-new(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-restore.rst b/doc/man1/notmuch-restore.rst\r
+new file mode 100644\r
+index 0000000..d6cf19a\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-restore.rst\r
+@@ -0,0 +1,59 @@\r
++===============\r
++notmuch-restore\r
++===============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **restore** [--accumulate] [--format=(auto|batch-tag|sup)] [--input=<*filename*>]\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Restores the tags from the given file (see **notmuch dump**).\r
++\r
++The input is read from the given filename, if any, or from stdin.\r
++\r
++Supported options for **restore** include\r
++\r
++ ``--accumulate``\r
++ The union of the existing and new tags is applied, instead of\r
++ replacing each message's tags as they are read in from the dump\r
++ file.\r
++\r
++ ``--format=(sup|batch-tag|auto)``\r
++ Notmuch restore supports two plain text dump formats, with each\r
++ line specifying a message-id and a set of tags. For details of\r
++ the actual formats, see **notmuch-dump(1)**.\r
++\r
++ **sup**\r
++ The **sup** dump file format is specifically chosen to be\r
++ compatible with the format of files produced by sup-dump. So\r
++ if you've previously been using sup for mail, then the\r
++ **notmuch restore** command provides you a way to import all\r
++ of your tags (or labels as sup calls them).\r
++\r
++ **batch-tag**\r
++ The **batch-tag** dump format is intended to more robust\r
++ against malformed message-ids and tags containing whitespace\r
++ or non-\ **ascii(7)** characters. See **notmuch-dump(1)**\r
++ for details on this format.\r
++\r
++ **notmuch restore** updates the maildir flags according to\r
++ tag changes if the **maildir.synchronize\_flags**\r
++ configuration option is enabled. See **notmuch-config(1)**\r
++ for details.\r
++\r
++ **auto**\r
++ This option (the default) tries to guess the format from the\r
++ input. For correctly formed input in either supported\r
++ format, this heuristic, based the fact that batch-tag format\r
++ contains no parentheses, should be accurate.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
++**notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-search.rst b/doc/man1/notmuch-search.rst\r
+new file mode 100644\r
+index 0000000..7ac6c68\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-search.rst\r
+@@ -0,0 +1,146 @@\r
++==============\r
++notmuch-search\r
++==============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **search** [*option* ...] <*search-term*> ...\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Search for messages matching the given search terms, and display as\r
++results the threads containing the matched messages.\r
++\r
++The output consists of one line per thread, giving a thread ID, the date\r
++of the newest (or oldest, depending on the sort option) matched message\r
++in the thread, the number of matched messages and total messages in the\r
++thread, the names of all participants in the thread, and the subject of\r
++the newest (or oldest) message.\r
++\r
++See **notmuch-search-terms(7)** for details of the supported syntax for\r
++<search-terms>.\r
++\r
++Supported options for **search** include\r
++\r
++ ``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**)\r
++ Presents the results in either JSON, S-Expressions, newline\r
++ character separated plain-text (default), or null character\r
++ separated plain-text (compatible with **xargs(1)** -0 option\r
++ where available).\r
++\r
++ ``--format-version=N``\r
++ Use the specified structured output format version. This is\r
++ intended for programs that invoke **notmuch(1)** internally. If\r
++ omitted, the latest supported version will be used.\r
++\r
++ ``--output=(summary|threads|messages|files|tags)``\r
++\r
++ **summary**\r
++ Output a summary of each thread with any message matching\r
++ the search terms. The summary includes the thread ID, date,\r
++ the number of messages in the thread (both the number\r
++ matched and the total number), the authors of the thread and\r
++ the subject.\r
++\r
++ **threads**\r
++ Output the thread IDs of all threads with any message\r
++ matching the search terms, either one per line\r
++ (--format=text), separated by null characters\r
++ (--format=text0), as a JSON array (--format=json), or an\r
++ S-Expression list (--format=sexp).\r
++\r
++ **messages**\r
++ Output the message IDs of all messages matching the search\r
++ terms, either one per line (--format=text), separated by\r
++ null characters (--format=text0), as a JSON array\r
++ (--format=json), or as an S-Expression list (--format=sexp).\r
++\r
++ **files**\r
++ Output the filenames of all messages matching the search\r
++ terms, either one per line (--format=text), separated by\r
++ null characters (--format=text0), as a JSON array\r
++ (--format=json), or as an S-Expression list (--format=sexp).\r
++\r
++ Note that each message may have multiple filenames\r
++ associated with it. All of them are included in the output,\r
++ unless limited with the --duplicate=N option.\r
++\r
++ **tags**\r
++ Output all tags that appear on any message matching the\r
++ search terms, either one per line (--format=text), separated\r
++ by null characters (--format=text0), as a JSON array\r
++ (--format=json), or as an S-Expression list (--format=sexp).\r
++\r
++ ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)\r
++ This option can be used to present results in either\r
++ chronological order (**oldest-first**) or reverse chronological\r
++ order (**newest-first**).\r
++\r
++ Note: The thread order will be distinct between these two\r
++ options (beyond being simply reversed). When sorting by\r
++ **oldest-first** the threads will be sorted by the oldest\r
++ message in each thread, but when sorting by **newest-first** the\r
++ threads will be sorted by the newest message in each thread.\r
++\r
++ By default, results will be displayed in reverse chronological\r
++ order, (that is, the newest results will be displayed first).\r
++\r
++ ``--offset=[-]N``\r
++ Skip displaying the first N results. With the leading '-', start\r
++ at the Nth result from the end.\r
++\r
++ ``--limit=N``\r
++ Limit the number of displayed results to N.\r
++\r
++ ``--exclude=(true|false|all|flag)``\r
++ A message is called "excluded" if it matches at least one tag in\r
++ search.tag\_exclude that does not appear explicitly in the\r
++ search terms. This option specifies whether to omit excluded\r
++ messages in the search process.\r
++\r
++ The default value, **true**, prevents excluded messages from\r
++ matching the search terms.\r
++\r
++ **all** additionally prevents excluded messages from appearing\r
++ in displayed results, in effect behaving as though the excluded\r
++ messages do not exist.\r
++\r
++ **false** allows excluded messages to match search terms and\r
++ appear in displayed results. Excluded messages are still marked\r
++ in the relevant outputs.\r
++\r
++ **flag** only has an effect when ``--output=summary``. The\r
++ output is almost identical to **false**, but the "match count"\r
++ is the number of matching non-excluded messages in the thread,\r
++ rather than the number of matching messages.\r
++\r
++ ``--duplicate=N``\r
++ Effective with ``--output=files``, output the Nth filename\r
++ associated with each message matching the query (N is 1-based).\r
++ If N is greater than the number of files associated with the\r
++ message, don't print anything.\r
++\r
++ Note that this option is orthogonal with the **folder:** search\r
++ prefix. The prefix matches messages based on filenames. This\r
++ option filters filenames of the matching messages.\r
++\r
++EXIT STATUS\r
++===========\r
++\r
++This command supports the following special exit status codes\r
++\r
++``20``\r
++ The requested format version is too old.\r
++\r
++``21``\r
++ The requested format version is too new.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
++**notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-show.rst b/doc/man1/notmuch-show.rst\r
+new file mode 100644\r
+index 0000000..bad868b\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-show.rst\r
+@@ -0,0 +1,179 @@\r
++============\r
++notmuch-show\r
++============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **show** [*option* ...] <*search-term*> ...\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Shows all messages matching the search terms.\r
++\r
++See **notmuch-search-terms(7)** for details of the supported syntax for\r
++<search-terms>.\r
++\r
++The messages will be grouped and sorted based on the threading (all\r
++replies to a particular message will appear immediately after that\r
++message in date order). The output is not indented by default, but depth\r
++tags are printed so that proper indentation can be performed by a\r
++post-processor (such as the emacs interface to notmuch).\r
++\r
++Supported options for **show** include\r
++\r
++ ``--entire-thread=(true|false)``\r
++ If true, **notmuch show** outputs all messages in the thread of\r
++ any message matching the search terms; if false, it outputs only\r
++ the matching messages. For ``--format=json`` and\r
++ ``--format=sexp`` this defaults to true. For other formats, this\r
++ defaults to false.\r
++\r
++ ``--format=(text|json|sexp|mbox|raw)``\r
++\r
++ **text** (default for messages)\r
++ The default plain-text format has all text-content MIME\r
++ parts decoded. Various components in the output,\r
++ (**message**, **header**, **body**, **attachment**, and MIME\r
++ **part**), will be delimited by easily-parsed markers. Each\r
++ marker consists of a Control-L character (ASCII decimal 12),\r
++ the name of the marker, and then either an opening or\r
++ closing brace, ('{' or '}'), to either open or close the\r
++ component. For a multipart MIME message, these parts will be\r
++ nested.\r
++\r
++ **json**\r
++ The output is formatted with Javascript Object Notation\r
++ (JSON). This format is more robust than the text format for\r
++ automated processing. The nested structure of multipart MIME\r
++ messages is reflected in nested JSON output. By default JSON\r
++ output includes all messages in a matching thread; that is,\r
++ by default,\r
++\r
++ ``--format=json`` sets ``--entire-thread`` The caller can\r
++ disable this behaviour by setting ``--entire-thread=false``\r
++\r
++ **sexp**\r
++ The output is formatted as an S-Expression (sexp). This\r
++ format is more robust than the text format for automated\r
++ processing. The nested structure of multipart MIME messages\r
++ is reflected in nested S-Expression output. By default,\r
++ S-Expression output includes all messages in a matching\r
++ thread; that is, by default,\r
++\r
++ ``--format=sexp`` sets ``--entire-thread`` The caller can\r
++ disable this behaviour by setting ``--entire-thread=false``\r
++\r
++ **mbox**\r
++ All matching messages are output in the traditional, Unix\r
++ mbox format with each message being prefixed by a line\r
++ beginning with "From " and a blank line separating each\r
++ message. Lines in the message content beginning with "From "\r
++ (preceded by zero or more '>' characters) have an additional\r
++ '>' character added. This reversible escaping is termed\r
++ "mboxrd" format and described in detail here:\r
++\r
++ http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html\r
++\r
++ **raw** (default for a single part, see --part)\r
++ For a message or an attached message part, the original, raw\r
++ content of the email message is output. Consumers of this\r
++ format should expect to implement MIME decoding and similar\r
++ functions.\r
++\r
++ For a single part (--part) the raw part content is output\r
++ after performing any necessary MIME decoding. Note that\r
++ messages with a simple body still have two parts: part 0 is\r
++ the whole message and part 1 is the body.\r
++\r
++ For a multipart part, the part headers and body (including\r
++ all child parts) is output.\r
++\r
++ The raw format must only be used with search terms matching\r
++ single message.\r
++\r
++ ``--format-version=N``\r
++ Use the specified structured output format version. This is\r
++ intended for programs that invoke **notmuch(1)** internally. If\r
++ omitted, the latest supported version will be used.\r
++\r
++ ``--part=N``\r
++ Output the single decoded MIME part N of a single message. The\r
++ search terms must match only a single message. Message parts are\r
++ numbered in a depth-first walk of the message MIME structure,\r
++ and are identified in the 'json', 'sexp' or 'text' output\r
++ formats.\r
++\r
++ ``--verify``\r
++ Compute and report the validity of any MIME cryptographic\r
++ signatures found in the selected content (ie. "multipart/signed"\r
++ parts). Status of the signature will be reported (currently only\r
++ supported with --format=json and --format=sexp), and the\r
++ multipart/signed part will be replaced by the signed data.\r
++\r
++ ``--decrypt``\r
++ Decrypt any MIME encrypted parts found in the selected content\r
++ (ie. "multipart/encrypted" parts). Status of the decryption will\r
++ be reported (currently only supported with --format=json and\r
++ --format=sexp) and on successful decryption the\r
++ multipart/encrypted part will be replaced by the decrypted\r
++ content.\r
++\r
++ Decryption expects a functioning **gpg-agent(1)** to provide any\r
++ needed credentials. Without one, the decryption will fail.\r
++\r
++ Implies --verify.\r
++\r
++ ``--exclude=(true|false)``\r
++ Specify whether to omit threads only matching\r
++ search.tag\_exclude from the search results (the default) or\r
++ not. In either case the excluded message will be marked with the\r
++ exclude flag (except when output=mbox when there is nowhere to\r
++ put the flag).\r
++\r
++ If --entire-thread is specified then complete threads are\r
++ returned regardless (with the excluded flag being set when\r
++ appropriate) but threads that only match in an excluded message\r
++ are not returned when ``--exclude=true.``\r
++\r
++ The default is ``--exclude=true.``\r
++\r
++ ``--body=(true|false)``\r
++ If true (the default) **notmuch show** includes the bodies of\r
++ the messages in the output; if false, bodies are omitted.\r
++ ``--body=false`` is only implemented for the json and sexp\r
++ formats and it is incompatible with ``--part > 0.``\r
++\r
++ This is useful if the caller only needs the headers as body-less\r
++ output is much faster and substantially smaller.\r
++\r
++ ``--include-html``\r
++ Include "text/html" parts as part of the output (currently only\r
++ supported with --format=json and --format=sexp). By default,\r
++ unless ``--part=N`` is used to select a specific part or\r
++ ``--include-html`` is used to include all "text/html" parts, no\r
++ part with content type "text/html" is included in the output.\r
++\r
++A common use of **notmuch show** is to display a single thread of email\r
++messages. For this, use a search term of "thread:<thread-id>" as can be\r
++seen in the first column of output from the **notmuch search** command.\r
++\r
++EXIT STATUS\r
++===========\r
++\r
++This command supports the following special exit status codes\r
++\r
++``20``\r
++ The requested format version is too old.\r
++\r
++``21``\r
++ The requested format version is too new.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
++**notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,\r
++**notmuch-search(1)**, **notmuch-search-terms(7)**, **notmuch-tag(1)**\r
+diff --git a/doc/man1/notmuch-tag.rst b/doc/man1/notmuch-tag.rst\r
+new file mode 100644\r
+index 0000000..2e7e1d3\r
+--- /dev/null\r
++++ b/doc/man1/notmuch-tag.rst\r
+@@ -0,0 +1,107 @@\r
++===========\r
++notmuch-tag\r
++===========\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **tag** [options ...] +<*tag*>|-<*tag*> [--] <*search-term*> ...\r
++\r
++**notmuch** **tag** **--batch** [--input=<*filename*>]\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Add/remove tags for all messages matching the search terms.\r
++\r
++See **notmuch-search-terms(7)** for details of the supported syntax for\r
++<*search-term*\ >.\r
++\r
++Tags prefixed by '+' are added while those prefixed by '-' are removed.\r
++For each message, tag changes are applied in the order they appear on\r
++the command line.\r
++\r
++The beginning of the search terms is recognized by the first argument\r
++that begins with neither '+' nor '-'. Support for an initial search term\r
++beginning with '+' or '-' is provided by allowing the user to specify a\r
++"--" argument to separate the tags from the search terms.\r
++\r
++**notmuch tag** updates the maildir flags according to tag changes if\r
++the **maildir.synchronize\_flags** configuration option is enabled. See\r
++**notmuch-config(1)** for details.\r
++\r
++Supported options for **tag** include\r
++\r
++ ``--remove-all``\r
++ Remove all tags from each message matching the search terms\r
++ before applying the tag changes appearing on the command line.\r
++ This means setting the tags of each message to the tags to be\r
++ added. If there are no tags to be added, the messages will have\r
++ no tags.\r
++\r
++ ``--batch``\r
++ Read batch tagging operations from a file (stdin by default).\r
++ This is more efficient than repeated **notmuch tag**\r
++ invocations. See `TAG FILE FORMAT <#tag_file_format>`__ below\r
++ for the input format. This option is not compatible with\r
++ specifying tagging on the command line.\r
++\r
++ ``--input=``\ <filename>\r
++ Read input from given file, instead of from stdin. Implies\r
++ ``--batch``.\r
++\r
++TAG FILE FORMAT\r
++===============\r
++\r
++The input must consist of lines of the format:\r
++\r
+++<*tag*\ >\|-<*tag*\ > [...] [--] <*query*\ >\r
++\r
++Each line is interpreted similarly to **notmuch tag** command line\r
++arguments. The delimiter is one or more spaces ' '. Any characters in\r
++<*tag*\ > **may** be hex-encoded with %NN where NN is the hexadecimal\r
++value of the character. To hex-encode a character with a multi-byte\r
++UTF-8 encoding, hex-encode each byte. Any spaces in <tag> **must** be\r
++hex-encoded as %20. Any characters that are not part of <*tag*\ > **must\r
++not** be hex-encoded.\r
++\r
++In the future tag:"tag with spaces" style quoting may be supported for\r
++<*tag*\ > as well; for this reason all double quote characters in\r
++<*tag*\ > **should** be hex-encoded.\r
++\r
++The <*query*\ > should be quoted using Xapian boolean term quoting\r
++rules: if a term contains whitespace or a close paren or starts with a\r
++double quote, it must be enclosed in double quotes (not including any\r
++prefix) and double quotes inside the term must be doubled (see below for\r
++examples).\r
++\r
++Leading and trailing space ' ' is ignored. Empty lines and lines\r
++beginning with '#' are ignored.\r
++\r
++EXAMPLE\r
++-------\r
++\r
++The following shows a valid input to batch tagging. Note that only the\r
++isolated '\*' acts as a wildcard. Also note the two different quotings\r
++of the tag **space in tags**\r
++\r
++::\r
++\r
++ +winner *\r
++ +foo::bar%25 -- (One and Two) or (One and tag:winner)\r
++ +found::it -- tag:foo::bar%\r
++ # ignore this line and the next\r
++\r
++ +space%20in%20tags -- Two\r
++ # add tag '(tags)', among other stunts.\r
++ +crazy{ +(tags) +&are +#possible\ -- tag:"space in tags"\r
++ +match*crazy -- tag:crazy{\r
++ +some_tag -- id:"this is ""nauty)"""\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
++**notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,\r
++**notmuch-search(1)**, **notmuch-search-terms(7)**, **notmuch-show(1)**,\r
+diff --git a/doc/man1/notmuch.rst b/doc/man1/notmuch.rst\r
+new file mode 100644\r
+index 0000000..9710294\r
+--- /dev/null\r
++++ b/doc/man1/notmuch.rst\r
+@@ -0,0 +1,143 @@\r
++=======\r
++notmuch\r
++=======\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** [option ...] **command** [arg ...]\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Notmuch is a command-line based program for indexing, searching,\r
++reading, and tagging large collections of email messages.\r
++\r
++This page describes how to get started using notmuch from the command\r
++line, and gives a brief overview of the commands available. For more\r
++information on e.g. **notmuch show** consult the **notmuch-show(1)** man\r
++page, also accessible via **notmuch help show**\r
++\r
++The quickest way to get started with Notmuch is to simply invoke the\r
++``notmuch`` command with no arguments, which will interactively guide\r
++you through the process of indexing your mail.\r
++\r
++NOTE\r
++====\r
++\r
++While the command-line program ``notmuch`` provides powerful\r
++functionality, it does not provide the most convenient interface for\r
++that functionality. More sophisticated interfaces are expected to be\r
++built on top of either the command-line interface, or more likely, on\r
++top of the notmuch library interface. See http://notmuchmail.org for\r
++more about alternate interfaces to notmuch. The emacs-based interface to\r
++notmuch (available under **emacs/** in the Notmuch source distribution)\r
++is probably the most widely used at this time.\r
++\r
++OPTIONS\r
++=======\r
++\r
++Supported global options for ``notmuch`` include\r
++\r
++ ``--help``\r
++ Print a synopsis of available commands and exit.\r
++\r
++ ``--version``\r
++ Print the installed version of notmuch, and exit.\r
++\r
++ ``--config=FILE``\r
++ Specify the configuration file to use. This overrides any\r
++ configuration file specified by ${NOTMUCH\_CONFIG}.\r
++\r
++COMMANDS\r
++========\r
++\r
++SETUP\r
++-----\r
++\r
++The **notmuch setup** command is used to configure Notmuch for first\r
++use, (or to reconfigure it later).\r
++\r
++The setup command will prompt for your full name, your primary email\r
++address, any alternate email addresses you use, and the directory\r
++containing your email archives. Your answers will be written to a\r
++configuration file in ${NOTMUCH\_CONFIG} (if set) or\r
++${HOME}/.notmuch-config . This configuration file will be created with\r
++descriptive comments, making it easy to edit by hand later to change the\r
++configuration. Or you can run **notmuch setup** again to change the\r
++configuration.\r
++\r
++The mail directory you specify can contain any number of sub-directories\r
++and should primarily contain only files with individual email messages\r
++(eg. maildir or mh archives are perfect). If there are other, non-email\r
++files (such as indexes maintained by other email programs) then notmuch\r
++will do its best to detect those and ignore them.\r
++\r
++Mail storage that uses mbox format, (where one mbox file contains many\r
++messages), will not work with notmuch. If that's how your mail is\r
++currently stored, it is recommended you first convert it to maildir\r
++format with a utility such as mb2md before running **notmuch setup .**\r
++\r
++Invoking ``notmuch`` with no command argument will run **setup** if the\r
++setup command has not previously been completed.\r
++\r
++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
++supported syntax.\r
++\r
++The **search**, **show** and **count** commands are used to query the\r
++email database.\r
++\r
++The **reply** command is useful for preparing a template for an email\r
++reply.\r
++\r
++The **tag** command is the only command available for manipulating\r
++database contents.\r
++\r
++The **dump** and **restore** commands can be used to create a textual\r
++dump of email tags for backup purposes, and to restore from that dump.\r
++\r
++The **config** command can be used to get or set settings in the notmuch\r
++configuration file.\r
++\r
++ENVIRONMENT\r
++===========\r
++\r
++The following environment variables can be used to control the behavior\r
++of notmuch.\r
++\r
++**NOTMUCH\_CONFIG**\r
++ Specifies the location of the notmuch configuration file. Notmuch\r
++ will use ${HOME}/.notmuch-config if this variable is not set.\r
++\r
++**NOTMUCH\_TALLOC\_REPORT**\r
++ Location to write a talloc memory usage report. See\r
++ **talloc\_enable\_leak\_report\_full** in **talloc(3)** for more\r
++ information.\r
++\r
++**NOTMUCH\_DEBUG\_QUERY**\r
++ If set to a non-empty value, the notmuch library will print (to\r
++ stderr) Xapian queries it constructs.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch-config(1)**, **notmuch-count(1)**, **notmuch-dump(1)**,\r
++**notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,\r
++**notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
++\r
++The notmuch website: **http://notmuchmail.org**\r
++\r
++CONTACT\r
++=======\r
++\r
++Feel free to send questions, comments, or kudos to the notmuch mailing\r
++list <notmuch@notmuchmail.org> . Subscription is not required before\r
++posting, but is available from the notmuchmail.org website.\r
++\r
++Real-time interaction with the Notmuch community is available via IRC\r
++(server: irc.freenode.net, channel: #notmuch).\r
+diff --git a/doc/man5/notmuch-hooks.rst b/doc/man5/notmuch-hooks.rst\r
+new file mode 100644\r
+index 0000000..493abf2\r
+--- /dev/null\r
++++ b/doc/man5/notmuch-hooks.rst\r
+@@ -0,0 +1,44 @@\r
++=============\r
++notmuch-hooks\r
++=============\r
++\r
++SYNOPSIS\r
++========\r
++\r
++ $DATABASEDIR/.notmuch/hooks/*\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Hooks are scripts (or arbitrary executables or symlinks to such) that\r
++notmuch invokes before and after certain actions. These scripts reside\r
++in the .notmuch/hooks directory within the database directory and must\r
++have executable permissions.\r
++\r
++The currently available hooks are described below.\r
++\r
++ **pre-new**\r
++ This hook is invoked by the **new** command before scanning or\r
++ importing new messages into the database. If this hook exits\r
++ with a non-zero status, notmuch will abort further processing of\r
++ the **new** command.\r
++\r
++ Typically this hook is used for fetching or delivering new mail\r
++ to be imported into the database.\r
++\r
++ **post-new**\r
++ This hook is invoked by the **new** command after new messages\r
++ have been imported into the database and initial tags have been\r
++ applied. The hook will not be run if there have been any errors\r
++ during the scan or import.\r
++\r
++ Typically this hook is used to perform additional query-based\r
++ tagging on the imported messages.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-insert(1)**, **notmuch-new(1)**,\r
++**notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
++**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst\r
+new file mode 100644\r
+index 0000000..20bc6f1\r
+--- /dev/null\r
++++ b/doc/man7/notmuch-search-terms.rst\r
+@@ -0,0 +1,234 @@\r
++====================\r
++notmuch-search-terms\r
++====================\r
++\r
++SYNOPSIS\r
++========\r
++\r
++**notmuch** **count** [option ...] <*search-term*> ...\r
++\r
++**notmuch** **dump** [--format=(batch-tag|sup)] [--] [--output=<*file*>] [--] [<*search-term*> ...]\r
++\r
++**notmuch** **search** [option ...] <*search-term*> ...\r
++\r
++**notmuch** **show** [option ...] <*search-term*> ...\r
++\r
++**notmuch** **tag** +<*tag*> ... -<*tag*> [--] <*search-term*> ...\r
++\r
++DESCRIPTION\r
++===========\r
++\r
++Several notmuch commands accept a common syntax for search terms.\r
++\r
++The search terms can consist of free-form text (and quoted phrases)\r
++which will match all messages that contain all of the given\r
++terms/phrases in the body, the subject, or any of the sender or\r
++recipient headers.\r
++\r
++As a special case, a search string consisting of exactly a single\r
++asterisk ("\*") will match all messages.\r
++\r
++In addition to free text, the following prefixes can be used to force\r
++terms to match against specific portions of an email, (where <brackets>\r
++indicate user-supplied values):\r
++\r
++- from:<name-or-address>\r
++\r
++- to:<name-or-address>\r
++\r
++- subject:<word-or-quoted-phrase>\r
++\r
++- attachment:<word>\r
++\r
++- tag:<tag> (or is:<tag>)\r
++\r
++- id:<message-id>\r
++\r
++- thread:<thread-id>\r
++\r
++- folder:<directory-path>\r
++\r
++- date:<since>..<until>\r
++\r
++The **from:** prefix is used to match the name or address of the sender\r
++of an email message.\r
++\r
++The **to:** prefix is used to match the names or addresses of any\r
++recipient of an email message, (whether To, Cc, or Bcc).\r
++\r
++Any term prefixed with **subject:** will match only text from the\r
++subject of an email. Searching for a phrase in the subject is supported\r
++by including quotation marks around the phrase, immediately following\r
++**subject:**.\r
++\r
++The **attachment:** prefix can be used to search for specific filenames\r
++(or extensions) of attachments to email messages.\r
++\r
++For **tag:** and **is:** valid tag values include **inbox** and\r
++**unread** by default for new messages added by **notmuch new** as well\r
++as any other tag values added manually with **notmuch tag**.\r
++\r
++For **id:**, message ID values are the literal contents of the\r
++Message-ID: header of email messages, but without the '<', '>'\r
++delimiters.\r
++\r
++The **thread:** prefix can be used with the thread ID values that are\r
++generated internally by notmuch (and do not appear in email messages).\r
++These thread ID values can be seen in the first column of output from\r
++**notmuch search**\r
++\r
++The **folder:** prefix can be used to search for email message files\r
++that are contained within particular directories within the mail store.\r
++If the same email message has multiple message files associated with it,\r
++it's sufficient for a match that at least one of the files is contained\r
++within a matching directory. Only the directory components below the\r
++top-level mail database path are available to be searched.\r
++\r
++The **date:** prefix can be used to restrict the results to only\r
++messages within a particular time range (based on the Date: header) with\r
++a range syntax of:\r
++\r
++date:<since>..<until>\r
++\r
++See **DATE AND TIME SEARCH** below for details on the range expression,\r
++and supported syntax for <since> and <until> date and time expressions.\r
++\r
++The time range can also be specified using timestamps with a syntax of:\r
++\r
++<initial-timestamp>..<final-timestamp>\r
++\r
++Each timestamp is a number representing the number of seconds since\r
++1970-01-01 00:00:00 UTC.\r
++\r
++In addition to individual terms, multiple terms can be combined with\r
++Boolean operators ( **and**, **or**, **not** , etc.). Each term in the\r
++query will be implicitly connected by a logical AND if no explicit\r
++operator is provided, (except that terms with a common prefix will be\r
++implicitly combined with OR until we get Xapian defect #402 fixed).\r
++\r
++Parentheses can also be used to control the combination of the Boolean\r
++operators, but will have to be protected from interpretation by the\r
++shell, (such as by putting quotation marks around any parenthesized\r
++expression).\r
++\r
++DATE AND TIME SEARCH\r
++====================\r
++\r
++notmuch understands a variety of standard and natural ways of expressing\r
++dates and times, both in absolute terms ("2012-10-24") and in relative\r
++terms ("yesterday"). Any number of relative terms can be combined ("1\r
++hour 25 minutes") and an absolute date/time can be combined with\r
++relative terms to further adjust it. A non-exhaustive description of the\r
++syntax supported for absolute and relative terms is given below.\r
++\r
++The range expression\r
++--------------------\r
++\r
++date:<since>..<until>\r
++\r
++The above expression restricts the results to only messages from <since>\r
++to <until>, based on the Date: header.\r
++\r
++<since> and <until> can describe imprecise times, such as "yesterday".\r
++In this case, <since> is taken as the earliest time it could describe\r
++(the beginning of yesterday) and <until> is taken as the latest time it\r
++could describe (the end of yesterday). Similarly, date:january..february\r
++matches from the beginning of January to the end of February.\r
++\r
++Currently, we do not support spaces in range expressions. You can\r
++replace the spaces with '\_', or (in most cases) '-', or (in some cases)\r
++leave the spaces out altogether. Examples in this man page use spaces\r
++for clarity.\r
++\r
++Open-ended ranges are supported (since Xapian 1.2.1), i.e. it's possible\r
++to specify date:..<until> or date:<since>.. to not limit the start or\r
++end time, respectively. Pre-1.2.1 Xapian does not report an error on\r
++open ended ranges, but it does not work as expected either.\r
++\r
++Entering date:expr without ".." (for example date:yesterday) won't work,\r
++as it's not interpreted as a range expression at all. You can achieve\r
++the expected result by duplicating the expr both sides of ".." (for\r
++example date:yesterday..yesterday).\r
++\r
++Relative date and time\r
++----------------------\r
++\r
++[N\|number]\r
++(years\|months\|weeks\|days\|hours\|hrs\|minutes\|mins\|seconds\|secs)\r
++[...]\r
++\r
++All refer to past, can be repeated and will be accumulated.\r
++\r
++Units can be abbreviated to any length, with the otherwise ambiguous\r
++single m being m for minutes and M for months.\r
++\r
++Number can also be written out one, two, ..., ten, dozen, hundred.\r
++Additionally, the unit may be preceded by "last" or "this" (e.g., "last\r
++week" or "this month").\r
++\r
++When combined with absolute date and time, the relative date and time\r
++specification will be relative from the specified absolute date and\r
++time.\r
++\r
++Examples: 5M2d, two weeks\r
++\r
++Supported absolute time formats\r
++-------------------------------\r
++\r
++- H[H]:MM[:SS] [(am\|a.m.\|pm\|p.m.)]\r
++\r
++- H[H] (am\|a.m.\|pm\|p.m.)\r
++\r
++- HHMMSS\r
++\r
++- now\r
++\r
++- noon\r
++\r
++- midnight\r
++\r
++- Examples: 17:05, 5pm\r
++\r
++Supported absolute date formats\r
++-------------------------------\r
++\r
++- YYYY-MM[-DD]\r
++\r
++- DD-MM[-[YY]YY]\r
++\r
++- MM-YYYY\r
++\r
++- M[M]/D[D][/[YY]YY]\r
++\r
++- M[M]/YYYY\r
++\r
++- D[D].M[M][.[YY]YY]\r
++\r
++- D[D][(st\|nd\|rd\|th)] Mon[thname] [YYYY]\r
++\r
++- Mon[thname] D[D][(st\|nd\|rd\|th)] [YYYY]\r
++\r
++- Wee[kday]\r
++\r
++Month names can be abbreviated at three or more characters.\r
++\r
++Weekday names can be abbreviated at three or more characters.\r
++\r
++Examples: 2012-07-31, 31-07-2012, 7/31/2012, August 3\r
++\r
++Time zones\r
++----------\r
++\r
++- (+\|-)HH:MM\r
++\r
++- (+\|-)HH[MM]\r
++\r
++Some time zone codes, e.g. UTC, EET.\r
++\r
++SEE ALSO\r
++========\r
++\r
++**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
++**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
++**notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,\r
++**notmuch-search(1)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst\r
+new file mode 100644\r
+index 0000000..28301b3\r
+--- /dev/null\r
++++ b/doc/notmuch-emacs.rst\r
+@@ -0,0 +1,192 @@\r
++=============\r
++notmuch-emacs\r
++=============\r
++\r
++About this Manual\r
++=================\r
++\r
++This manual covers only the emacs interface to notmuch. For information\r
++on the command line interface, see See section “Description” in Notmuch\r
++Manual Pager. To save typing, we will sometimes use *notmuch* in this\r
++manual to refer to the Emacs interface to notmuch. If the distinction\r
++should every be important, we’ll refer to the Emacs inteface as\r
++*notmuch-emacs*.\r
++\r
++Notmuch-emacs is highly customizable via the the Emacs customization\r
++framework (or just by setting the appropriate variables). We try to\r
++point out relevant variables in this manual, but in order to avoid\r
++duplication of information, but you can usually find the most detailed\r
++description in the varables docstring.\r
++\r
++notmuch-hello\r
++=============\r
++\r
++.. index::\r
++ single: notmuch-hello\r
++ single: notmuch\r
++\r
++``notmuch-hello`` is the main entry point for notmuch. You can start it\r
++with ``M-x notmuch`` or ``M-x notmuch-hello``. The startup screen looks\r
++something like the following. There are some hints at the bottom of the\r
++screen. There are three main parts to the notmuch-hello screen,\r
++discussed below. The **bold** text indicates buttons you can click with\r
++a mouse or by positioning the cursor and pressing ``<return>``\r
++\r
++| Welcome to **notmuch** You have 52 messages.\r
++|\r
++| Saved searches: **[edit]**\r
++|\r
++| 52 **inbox** 52 **unread**\r
++|\r
++| Search: ____________________________________\r
++|\r
++| All tags: **[show]**\r
++|\r
++| Type a search query and hit RET to view matching threads.\r
++| Edit saved searches with the ``edit`` button.\r
++| Hit RET or click on a saved search or tag name to view matching threads.\r
++| ``=`` to refresh this screen. ``s`` to search messages. ``q`` to quit.\r
++| **Customize** this page.\r
++\r
++You can change the overall appearence of the notmuch-hello screen by\r
++customizing the variable :index:`notmuch-hello-sections`.\r
++\r
++\r
++\r
++notmuch-hello key bindings\r
++--------------------------\r
++\r
++``<tab>``\r
++ Move to the next widget (button or text entry field)\r
++\r
++``<backtab>``\r
++ Move to the previous widget.\r
++\r
++``<return>``\r
++ Activate the current widget.\r
++\r
++``=``\r
++ Refresh the buffer; mainly update the counts of messages for various\r
++ saved searches.\r
++\r
++``G``\r
++ Import mail, See :ref:`importing`\r
++\r
++``m``\r
++ Compose a message\r
++\r
++``s``\r
++ Search the notmuch database using :ref:`notmuch-search`\r
++\r
++``v``\r
++ Print notmuch version\r
++\r
++``q``\r
++ Quit\r
++\r
++.. _saved-searches:\r
++\r
++Saved Searches\r
++--------------\r
++\r
++Notmuch replaces the static assignment of messages with the more dynamic\r
++notion of searching. Notmuch-hello presents the user with a customizable\r
++set of saved searchs. The initial defaults are ``tag:inbox`` and\r
++``tag:unread``, but you can customize the following variables\r
++\r
++:index:`notmuch-saved-searches`\r
++ A list of cons pairs, the first being the name to display, the\r
++ second being a query string for notmuch. See section “Description”\r
++ in Notmuch Query Syntax.\r
++\r
++:index:`notmuch-saved-searches-sort-function`\r
++ This variable controls how saved searches should be sorted. A value\r
++ of ``nil`` displays the saved searches in the order they are stored\r
++ in ‘notmuch-saved-searches’.\r
++\r
++:index:`notmuch-column-control`\r
++ Controls the number of columns for displaying saved-searches/tags\r
++\r
++Search Box\r
++----------\r
++\r
++The search box lets the user enter an notmuch query. See section\r
++“Description” in Notmuch Query Syntax, for more info on notmuch query\r
++syntax. A history of recent searches is also displayed by default. The\r
++latter is controlled by the variable :index:`notmuch-hello-recent-searches-max`.\r
++\r
++Known Tags\r
++----------\r
++\r
++One special kind of saved search provided by default is for each\r
++individual tag defined in the database. This can be controlled via the\r
++following variables.\r
++\r
++:index:`notmuch-hello-tag-list-make-query`\r
++ Control how to construct a search (“virtual folder”) from a given\r
++ tag.\r
++\r
++:index:`notmuch-hello-hide-tags`\r
++ Which tags not to display at all.\r
++\r
++:index:`notmuch-column-control`\r
++ Controls the number of columns for displaying saved-searches/tags\r
++\r
++.. _notmuch-search:\r
++\r
++notmuch-search\r
++==============\r
++\r
++``notmuch-search-mode`` is used to display the results from executing\r
++a query via ``notmuch-search``. The syntax for these queries is the\r
++the same as :ref:`saved-searches`. For details of this syntax see\r
++info:notmuch-search-terms\r
++\r
++By default the output approximates that of the command line See section\r
++“Description” in notmuch search command.\r
++\r
++The main purpose of the ``notmuch-search-mode`` buffer is to act as a\r
++menu of results that the user can explore further by pressing\r
++``<return>`` on the appropriate line.\r
++\r
++``n,C-n,<down>``\r
++ Move to next line\r
++\r
++``p,C-p,<up>``\r
++ Move to previous line\r
++\r
++``<return>``\r
++ Open thread on current line in :ref:`notmuch-show` mode\r
++\r
++``?``\r
++ Display full set of key bindings\r
++\r
++The presentation of results can be controlled by the following\r
++variables.\r
++\r
++:index:`notmuch-search-result-format`\r
++ Control how each thread of messages is presented in the\r
++ ``notmuch-show-mode`` buffer\r
++\r
++:index:`notmuch-search-oldest-first`\r
++ Display the oldest threads at the top of the buffer\r
++\r
++.. _notmuch-show:\r
++\r
++notmuch-show\r
++============\r
++\r
++notmuch-tree\r
++============\r
++\r
++Configuration\r
++=============\r
++\r
++.. _importing:\r
++\r
++Importing Mail\r
++--------------\r
++\r
++:index:`notmuch-poll`\r
++\r
++:index:`notmuch-poll-script`\r
+-- \r
+1.8.5.3\r
+\r