[PATCH 1/5] nmbug-status: Avoid hard-coded filename in error message

2016-01-01 Thread W. Trevor King
We already have a 'filename' variable with the name, so stay DRY and
use that variable here.

Also fix a missing-whitespace error from bed8b674 (nmbug-status:
Clarify errors for illegible configs, 2014-05-10), wrapping on the
sentence to match similar error-generation earlier in this function.
---
 devel/nmbug/nmbug-status | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index b36b6ad..22e3b5b 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -109,9 +109,9 @@ def read_config(path=None, encoding=None):
 status = p.wait()
 if status != 0:
 raise ConfigError(
-("Missing status-config.json in branch '{branch}' of"
- '{nmbgit}.  Add the file or explicitly set --config.'
-).format(branch=branch, nmbgit=nmbhome))
+("Missing {filename} in branch '{branch}' of {nmbgit}.  "
+ 'Add the file or explicitly set --config.'
+).format(filename=filename, branch=branch, nmbgit=nmbhome))
 
 config_json = config_bytes.decode(encoding)
 try:
-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 4/5] notmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man pages

2016-01-01 Thread W. Trevor King
To describe the script and config file format, so folks don't have to
dig through NEWS or the script's source to get that information.

The Makefile and conf.py are excerpted from the main doc/ directory
with minor simplifications and adjustments.  The devel/nmbug/ scripts
are largely independent of notmuch, and separating the docs here
allows packagers to easily build the docs and install the scripts in a
separate package, without complicating notmuch's core build/install
process.
---
 devel/nmbug/doc/.gitignore |   2 +
 devel/nmbug/doc/Makefile   |  38 
 devel/nmbug/doc/conf.py|  67 +
 devel/nmbug/doc/index.rst  |  17 
 devel/nmbug/doc/man1/notmuch-report.1.rst  |  54 +++
 devel/nmbug/doc/man5/notmuch-report.json.5.rst | 129 +
 devel/nmbug/notmuch-report |  19 ++--
 7 files changed, 318 insertions(+), 8 deletions(-)
 create mode 100644 devel/nmbug/doc/.gitignore
 create mode 100644 devel/nmbug/doc/Makefile
 create mode 100644 devel/nmbug/doc/conf.py
 create mode 100644 devel/nmbug/doc/index.rst
 create mode 100644 devel/nmbug/doc/man1/notmuch-report.1.rst
 create mode 100644 devel/nmbug/doc/man5/notmuch-report.json.5.rst

diff --git a/devel/nmbug/doc/.gitignore b/devel/nmbug/doc/.gitignore
new file mode 100644
index 000..4930881
--- /dev/null
+++ b/devel/nmbug/doc/.gitignore
@@ -0,0 +1,2 @@
+*.pyc
+_build
diff --git a/devel/nmbug/doc/Makefile b/devel/nmbug/doc/Makefile
new file mode 100644
index 000..7ea3ae7
--- /dev/null
+++ b/devel/nmbug/doc/Makefile
@@ -0,0 +1,38 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS=
+SPHINXBUILD   = sphinx-build
+DOCBUILDDIR   := _build
+
+SRCDIR ?= .
+ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(SRCDIR)
+
+MAN_RST_FILES := $(shell find $(SRCDIR)/man* -name '*.rst')
+MAN_ROFF_FILES := $(patsubst 
$(SRCDIR)/man%.rst,$(DOCBUILDDIR)/man/man%,$(MAN_RST_FILES))
+MAN_GZIP_FILES := $(addsuffix .gz,$(MAN_ROFF_FILES))
+
+.PHONY: build-man
+build-man: $(MAN_GZIP_FILES)
+
+%.gz: %
+   rm -f $@ && gzip --stdout $^ > $@
+
+$(MAN_ROFF_FILES): $(DOCBUILDDIR)/.roff.stamp
+
+# By using $(DOCBUILDDIR)/.roff.stamp instead of $(MAN_ROFF_FILES), we
+# convey to make that a single invocation of this recipe builds all
+# of the roff files.  This prevents parallel make from starting an
+# instance of this recipe for each roff file.
+$(DOCBUILDDIR)/.roff.stamp $(MAN_ROFF_FILES): $(MAN_RST_FILES)
+   mkdir -p $(DOCBUILDDIR)
+   touch $(DOCBUILDDIR)/.roff.stamp
+   $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
+   for section in 1 5; do \
+   mkdir -p $(DOCBUILDDIR)/man/man$${section}; \
+   mv $(DOCBUILDDIR)/man/*.$${section} 
$(DOCBUILDDIR)/man/man$${section}; \
+   done
+
+clean:
+   rm -rf $(DOCBUILDDIR) $(SRCDIR)/conf.pyc
diff --git a/devel/nmbug/doc/conf.py b/devel/nmbug/doc/conf.py
new file mode 100644
index 000..29379d0
--- /dev/null
+++ b/devel/nmbug/doc/conf.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+import os.path
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'notmuch'
+authors = 'Carl Worth and many others'
+copyright = '2009-2015, {0}'.format(authors)
+
+location = os.path.dirname(__file__)
+
+dirname = location
+while True:
+version_file = os.path.join(dirname, 'version')
+if os.path.exists(version_file):
+with open(version_file,'r') as f:
+version = f.read().strip()
+break
+if dirname == '/':
+raise ValueError(
+'no version file found in this directory or its ancestors')
+dirname = os.path.dirname(dirname)
+
+# The full version, including alpha/beta/rc tags.
+release = version
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# -- Options for manual page output ---
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+
+man_pages = [
+('man1/notmuch-report.1', 'notmuch-report',
+ 'generate reports from notmuch queries', [authors], 1),
+('man5/notmuch-report.json.5', 'notmuch-report.json',
+ 'configure notmuch-report', [authors], 5),
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+# -- Options for Texinfo output ---
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+texinfo_no_detailmenu = True
+

[PATCH 2/5] notmuch-report: Rename from nmbug-status

2016-01-01 Thread W. Trevor King
This script generates reports based on notmuch queries, and doesn't
really have anything to do with nmbug, except for sharing the NMBGIT
environment variable.
---
 devel/nmbug/nmbug-status   | 419 -
 devel/nmbug/notmuch-report | 419 +
 2 files changed, 419 insertions(+), 419 deletions(-)
 delete mode 100755 devel/nmbug/nmbug-status
 create mode 100755 devel/nmbug/notmuch-report

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
deleted file mode 100755
index 22e3b5b..000
--- a/devel/nmbug/nmbug-status
+++ /dev/null
@@ -1,419 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2011-2012 David Bremner 
-#
-# dependencies
-#   - python 2.6 for json
-#   - argparse; either python 2.7, or install separately
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
-
-"""Generate HTML for one or more notmuch searches.
-
-Messages matching each search are grouped by thread.  Each message
-that contains both a subject and message-id will have the displayed
-subject link to the Gmane view of the message.
-"""
-
-from __future__ import print_function
-from __future__ import unicode_literals
-
-import codecs
-import collections
-import datetime
-import email.utils
-try:  # Python 3
-from urllib.parse import quote
-except ImportError:  # Python 2
-from urllib import quote
-import json
-import argparse
-import os
-import re
-import sys
-import subprocess
-import xml.sax.saxutils
-
-
-_ENCODING = 'UTF-8'
-_PAGES = {}
-
-
-if not hasattr(collections, 'OrderedDict'):  # Python 2.6 or earlier
-class _OrderedDict (dict):
-"Just enough of a stub to get through Page._get_threads"
-def __init__(self, *args, **kwargs):
-super(_OrderedDict, self).__init__(*args, **kwargs)
-self._keys = []  # record key order
-
-def __setitem__(self, key, value):
-super(_OrderedDict, self).__setitem__(key, value)
-self._keys.append(key)
-
-def values(self):
-for key in self._keys:
-yield self[key]
-
-
-collections.OrderedDict = _OrderedDict
-
-
-class ConfigError (Exception):
-"""Errors with config file usage
-"""
-pass
-
-
-def read_config(path=None, encoding=None):
-"Read config from json file"
-if not encoding:
-encoding = _ENCODING
-if path:
-try:
-with open(path, 'rb') as f:
-config_bytes = f.read()
-except IOError as e:
-raise ConfigError('Could not read config from {}'.format(path))
-else:
-nmbhome = os.getenv('NMBGIT', os.path.expanduser('~/.nmbug'))
-branch = 'config'
-filename = 'status-config.json'
-
-# read only the first line from the pipe
-sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
-stdout=subprocess.PIPE).stdout.readline()
-sha1 = sha1_bytes.decode(encoding).rstrip()
-if not sha1:
-raise ConfigError(
-("No local branch '{branch}' in {nmbgit}.  "
- 'Checkout a local {branch} branch or explicitly set --config.'
-).format(branch=branch, nmbgit=nmbhome))
-
-p = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'cat-file', 'blob',
- '{}:{}'.format(sha1, filename)],
-stdout=subprocess.PIPE)
-config_bytes, err = p.communicate()
-status = p.wait()
-if status != 0:
-raise ConfigError(
-("Missing {filename} in branch '{branch}' of {nmbgit}.  "
- 'Add the file or explicitly set --config.'
-).format(filename=filename, branch=branch, nmbgit=nmbhome))
-
-config_json = config_bytes.decode(encoding)
-try:
-return json.loads(config_json)
-except ValueError as e:
-if not path:
-path = "{} in branch '{}' of {}".format(
-filename, branch, nmbhome)
-raise ConfigError(
-'Could not parse JSON from the config file {}:\n{}'.format(
-path, e))
-
-
-class Thread (list):
-def __init__(self):
-self.running_data = {}
-
-
-class Page (object):
-def __init__(self, header=None, footer=None):
-self.header = header
- 

[PATCH v2 3/4] nmbug-status: Wrap query phrases in parentheses when and-ing together

2016-01-01 Thread W. Trevor King
For example:

  "query": ["tag:a", "tag:b or tag:c"]

is now converted to:

  ( tag:a ) and ( tag:b or tag:c )

instead of the old:

  tag:a and tag:b or tag:c

This helps us avoid confusion due to Xapian's higher-precedence AND
[1], where the old query would be interpreted as:

  ( tag:a and tag:b ) or tag:c

[1]: http://xapian.org/docs/queryparser.html
---
 NEWS | 3 +++
 devel/nmbug/nmbug-status | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 9f2e860..403a046 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ Notmuch 0.22 (UNRELEASED)
 nmbug-status
 
 
+`nmbug-status` now wraps query phrases in parentheses when and-ing
+them together, to avoid confusion about clause grouping.
+
 `nmbug-status` now supports `meta.message-url` to override the Gmane
 template.  For example, you can use:
 
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index d72f1db..7d3a76e 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -167,7 +167,8 @@ class Page (object):
 view['title'], sort_key))
 if 'query-string' not in view:
 query = view['query']
-view['query-string'] = ' and '.join(query)
+view['query-string'] = ' and '.join(
+'( {} )'.format(q) for q in query)
 q = notmuch.Query(database, view['query-string'])
 q.set_sort(sort)
 threads = self._get_threads(messages=q.search_messages())
@@ -411,7 +412,7 @@ if args.list_views:
 elif args.get_query != None:
 for view in config['views']:
 if args.get_query == view['title']:
-print(' and '.join(view['query']))
+print(' and '.join('( {} )'.format(q) for q in view['query']))
 sys.exit(0)
 else:
 # only import notmuch if needed
-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 5/5] NEWS: Document the notmuch-report branch

2016-01-01 Thread W. Trevor King
---
 NEWS | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/NEWS b/NEWS
index 6681699..3535614 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,29 @@
+Notmuch 0.22 (UNRELEASED)
+=
+
+Documentation
+-
+
+New `notmuch-report(1)` and `notmuch-report.json(5)` man pages
+describe `notmuch-report` and its JSON configuration file.  You can
+build these files by running `make` in the `devel/nmbug/doc`
+directory.
+
+notmuch-report
+--
+
+Renamed from `nmbug-status`.  This script generates reports based on
+notmuch queries, and doesn't really have anything to do with nmbug,
+except for sharing the `NMBGIT` environment variable.  The new name
+focuses on the script's action, instead of its historical association
+with the nmbug workflow.  This should make it more discoverable for
+users looking for generic notmuch reporting tools.
+
+The default configuration file name (extracted from the `config`
+branch of `NBMGIT` has changed from `status-config.json` to
+`notmuch-report.json` so it is more obviously associated with the
+report-generating script.
+
 Notmuch 0.21 (2015-10-29)
 =
 
-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 2/4] nmbug-status: Add meta.message-url config setting

2016-01-01 Thread W. Trevor King
So you can link to archives other than Gmane.  For example, I'm doing
this in [1].

[1]: https://github.com/wking/nmbug-oci
---
 NEWS | 20 
 devel/nmbug/nmbug-status | 13 ++---
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 0a7a0e0..9f2e860 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,23 @@
+Notmuch 0.22 (UNRELEASED)
+=
+
+nmbug-status
+
+
+`nmbug-status` now supports `meta.message-url` to override the Gmane
+template.  For example, you can use:
+
+{
+  "meta": {
+"message-url": 
"https://groups.google.com/a/opencontainers.org/forum/#!search/messageid$3A%22{message-id}%22;
+ ...
+  },
+  ...
+}
+
+To link to messages in the [opencontainers.org Google
+Groups](https://groups.google.com/a/opencontainers.org/forum/#!overview).
+
 Notmuch 0.21 (2015-10-29)
 =
 
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index b36b6ad..d72f1db 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -19,11 +19,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see http://www.gnu.org/licenses/ .
 
-"""Generate HTML for one or more notmuch searches.
+"""Generate text and/or HTML for one or more notmuch searches.
 
 Messages matching each search are grouped by thread.  Each message
 that contains both a subject and message-id will have the displayed
-subject link to the Gmane view of the message.
+subject link to an archive view of the message (defaulting to Gmane).
 """
 
 from __future__ import print_function
@@ -232,6 +232,10 @@ class Page (object):
 class HtmlPage (Page):
 _slug_regexp = re.compile('\W+')
 
+def __init__(self, message_url_template, **kwargs):
+self.message_url_template = message_url_template
+super(HtmlPage, self).__init__(**kwargs)
+
 def _write_header(self, views, stream):
 super(HtmlPage, self)._write_header(views=views, stream=stream)
 stream.write('\n')
@@ -292,8 +296,9 @@ class HtmlPage (Page):
 'message-id': quote(display_data['message-id']),
 'subject': xml.sax.saxutils.escape(display_data['subject']),
 }
+d['url'] = self.message_url_template.format(**d)
 display_data['subject'] = (
-'http://mid.gmane.org/{message-id};>{subject}'
+'{subject}'
 ).format(**d)
 for key in ['message-id', 'from']:
 if key in display_data:
@@ -395,6 +400,8 @@ _PAGES['text'] = Page()
 _PAGES['html'] = HtmlPage(
 header=header_template.format(**context),
 footer=footer_template.format(**context),
+message_url_template=config['meta'].get(
+'message-url', 'http://mid.gmane.org/{message-id}'),
 )
 
 if args.list_views:
-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 4/4] status-config.json: Remove parens from query entry

2016-01-01 Thread W. Trevor King
These are now added by nmbug-status.
---
 devel/nmbug/status-config.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/status-config.json b/devel/nmbug/status-config.json
index b926946..48b6f19 100644
--- a/devel/nmbug/status-config.json
+++ b/devel/nmbug/status-config.json
@@ -62,7 +62,7 @@
"not tag:notmuch::obsolete",
"not tag:notmuch::stale",
"not tag:notmuch::wontfix",
-   "(tag:notmuch::moreinfo or tag:notmuch::needs-review)"
+   "tag:notmuch::moreinfo or tag:notmuch::needs-review"
],
"title": "Review"
}
-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/5] notmuch-report.json: Rename from status-config.json

2016-01-01 Thread W. Trevor King
status-config.json wasn't obviously associated with the old
nmubg-status, now notmuch-report.  The new name is
${CONFIGURED_SCRIPT}.json, so the association should be clear.
---
 devel/nmbug/notmuch-report  |  2 +-
 devel/nmbug/notmuch-report.json | 70 +
 devel/nmbug/status-config.json  | 70 -
 3 files changed, 71 insertions(+), 71 deletions(-)
 create mode 100644 devel/nmbug/notmuch-report.json
 delete mode 100644 devel/nmbug/status-config.json

diff --git a/devel/nmbug/notmuch-report b/devel/nmbug/notmuch-report
index 22e3b5b..5425e06 100755
--- a/devel/nmbug/notmuch-report
+++ b/devel/nmbug/notmuch-report
@@ -88,7 +88,7 @@ def read_config(path=None, encoding=None):
 else:
 nmbhome = os.getenv('NMBGIT', os.path.expanduser('~/.nmbug'))
 branch = 'config'
-filename = 'status-config.json'
+filename = 'notmuch-report.json'
 
 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
diff --git a/devel/nmbug/notmuch-report.json b/devel/nmbug/notmuch-report.json
new file mode 100644
index 000..b926946
--- /dev/null
+++ b/devel/nmbug/notmuch-report.json
@@ -0,0 +1,70 @@
+{
+"meta": {
+"title": "Notmuch Patches",
+"blurb": "For more information see http://notmuchmail.org/nmbug\;>nmbug"
+},
+
+"views": [
+   {
+   "comment": "Unresolved bugs (or just need tag updating).",
+   "query": [
+   "tag:notmuch::bug",
+   "not tag:notmuch::fixed",
+   "not tag:notmuch::wontfix"
+   ],
+   "title": "Bugs"
+   },
+   {
+   "comment": "These patches are under consideration for pushing.",
+   "query": [
+   "tag:notmuch::patch and not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete and not tag:notmuch::wip",
+   "not tag:notmuch::stale and not tag:notmuch::contrib",
+   "not tag:notmuch::moreinfo",
+   "not tag:notmuch::python",
+   "not tag:notmuch::vim",
+   "not tag:notmuch::wontfix",
+   "not tag:notmuch::needs-review"
+   ],
+   "title": "Maybe Ready (Core and Emacs)"
+   },
+   {
+   "comment": "These python related patches might be ready to push, or 
they might just need updated tags.",
+   "query": [
+   "tag:notmuch::patch and not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete and not tag:notmuch::wip",
+   "not tag:notmuch::stale and not tag:notmuch::contrib",
+   "not tag:notmuch::moreinfo",
+   "not tag:notmuch::wontfix",
+   " tag:notmuch::python",
+   "not tag:notmuch::needs-review"
+   ],
+   "title": "Maybe Ready (Python)"
+   },
+   {
+   "comment": "These vim related patches might be ready to push, or 
they might just need updated tags.",
+   "query": [
+   "tag:notmuch::patch and not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete and not tag:notmuch::wip",
+   "not tag:notmuch::stale and not tag:notmuch::contrib",
+   "not tag:notmuch::moreinfo",
+   "not tag:notmuch::wontfix",
+   "tag:notmuch::vim",
+   "not tag:notmuch::needs-review"
+   ],
+   "title": "Maybe Ready (vim)"
+   },
+   {
+   "comment": "These patches are under review, or waiting for 
feedback.",
+   "query": [
+   "tag:notmuch::patch",
+   "not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete",
+   "not tag:notmuch::stale",
+   "not tag:notmuch::wontfix",
+   "(tag:notmuch::moreinfo or tag:notmuch::needs-review)"
+   ],
+   "title": "Review"
+   }
+]
+}
diff --git a/devel/nmbug/status-config.json b/devel/nmbug/status-config.json
deleted file mode 100644
index b926946..000
--- a/devel/nmbug/status-config.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-"meta": {
-"title": "Notmuch Patches",
-"blurb": "For more information see http://notmuchmail.org/nmbug\;>nmbug"
-},
-
-"views": [
-   {
-   "comment": "Unresolved bugs (or just need tag updating).",
-   "query": [
-   "tag:notmuch::bug",
-   "not tag:notmuch::fixed",
-   "not tag:notmuch::wontfix"
-   ],
-   "title": "Bugs"
-   },
-   {
-   "comment": "These patches are under consideration for pushing.",
-   "query": [
-   "tag:notmuch::patch and not tag:notmuch::pushed",
-   "not tag:notmuch::obsolete and not tag:notmuch::wip",
-   "not tag:notmuch::stale and not tag:notmuch::contrib",
-   "not tag:notmuch::moreinfo",
-   "not tag:notmuch::python",

[PATCH 0/5] notmuch-report: Rename from nmbug-status and add man pages

2016-01-01 Thread W. Trevor King
Spun off from discussion here [1].  I've just shifted nmbug-status in
this series, and left nmbug alone for now.  If/when this series lands,
it will be easy to handle a nmbug rename in a subsequent series.

Note that while I think the renames from nmbug-status to
notmuch-report and status-config.json to notmuch-report.json are
useful changes, they will break backwards compatibility for existing
users.  I'm not sure how many existing users there are, and I expect
the NEWS entry will clue them in.  But if folks want a temporary
fallback to status-config.json in the absence of notmuch-report.json,
I can add that in a v2.

Cheers,
Trevor

[1]: id:m2twmxbl1i@guru.guru-group.fi
 http://thread.gmane.org/gmane.mail.notmuch.general/21535/focus=21539

W. Trevor King (5):
  nmbug-status: Avoid hard-coded filename in error message
  notmuch-report: Rename from nmbug-status
  notmuch-report.json: Rename from status-config.json
  notmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man
pages
  NEWS: Document the notmuch-report branch

 NEWS   |  26 ++
 devel/nmbug/doc/.gitignore |   2 +
 devel/nmbug/doc/Makefile   |  38 +++
 devel/nmbug/doc/conf.py|  67 
 devel/nmbug/doc/index.rst  |  17 +
 devel/nmbug/doc/man1/notmuch-report.1.rst  |  54 
 devel/nmbug/doc/man5/notmuch-report.json.5.rst | 129 
 devel/nmbug/nmbug-status   | 419 
 devel/nmbug/notmuch-report | 422 +
 devel/nmbug/notmuch-report.json|  70 
 devel/nmbug/status-config.json |  70 
 11 files changed, 825 insertions(+), 489 deletions(-)
 create mode 100644 devel/nmbug/doc/.gitignore
 create mode 100644 devel/nmbug/doc/Makefile
 create mode 100644 devel/nmbug/doc/conf.py
 create mode 100644 devel/nmbug/doc/index.rst
 create mode 100644 devel/nmbug/doc/man1/notmuch-report.1.rst
 create mode 100644 devel/nmbug/doc/man5/notmuch-report.json.5.rst
 delete mode 100755 devel/nmbug/nmbug-status
 create mode 100755 devel/nmbug/notmuch-report
 create mode 100644 devel/nmbug/notmuch-report.json
 delete mode 100644 devel/nmbug/status-config.json

-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 0/4] nmbug-status: meta.message-url and query parens

2016-01-01 Thread W. Trevor King
Changes since v1 [1]:

* [4/5, v2 3/4] Added parentheses handling for ‘nmbug-status
  --get-query VIEW’ too [2].
* [3/5] Dropped the man page, and will file a separate series that
  adds man pages to the script directory [3].

Cheers,
Trevor

[1]: id:cover.1451502495.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/21523
 http://thread.gmane.org/gmane.mail.notmuch.general/21535
[2]: id:20151231164719.ga20...@odin.tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/21523/focus=21534

W. Trevor King (4):
  NEWS: Remove trailing comma from an old nmbug-status config
  nmbug-status: Add meta.message-url config setting
  nmbug-status: Wrap query phrases in parentheses when and-ing together
  status-config.json: Remove parens from query entry

 NEWS   | 25 -
 devel/nmbug/nmbug-status   | 18 +-
 devel/nmbug/status-config.json |  2 +-
 3 files changed, 38 insertions(+), 7 deletions(-)

-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 1/4] NEWS: Remove trailing comma from an old nmbug-status config

2016-01-01 Thread W. Trevor King
That closing brace is the end of the config JSON; there won't be
anything coming after it.
---
 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 6681699..0a7a0e0 100644
--- a/NEWS
+++ b/NEWS
@@ -409,7 +409,7 @@ from the config file.  Use something like:
  ...
   },
   ...
-},
+}
 
 Python Bindings
 ---
-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] cli/insert: do not lose the SMTP envelope

2016-01-01 Thread J Farkas
From: Janos Farkas 
Subject: [PATCH] cli/insert: do not lose the SMTP envelope

Make sure we store the envelope sender/recipient if provided by
qmail-command(8) in $RPLINE and $DTLINE.
---

I just realised that the messages delivered directly into maildir don't have
the usual envelope addresses that qmail provides.  This is a piece of
information that's important to (at least my) troubleshooting, so I created a
patch that seems to work well, applies cleanly to master (and 0.21), and
provided a NEWS entry should it be necessary.

 NEWS |  9 +
 notmuch-insert.c | 28 
 2 files changed, 37 insertions(+)

diff --git a/NEWS b/NEWS
index 6681699..13d45c8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+
+
+`notmuch insert` records the envelope addresses if available
+
+  If the caller provides this information as qmail-command(8) does in
+  the RPLINE and DTLINE environment variables, then notmuch insert will
+  record it in the maildir file.
+
+
 Notmuch 0.21 (2015-10-29)
 =
 
diff --git a/notmuch-insert.c b/notmuch-insert.c
index 5205c17..ecc0fa0 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -284,6 +284,26 @@ copy_fd (int fdout, int fdin)
 }
 
 /*
+ * Write zero (and LF) terminated string to the output fd.  It's expected to
+ * come from getenv(), so it's not checked for correctness.  NULL or empty
+ * string is ignored, successfully.
+ * Return TRUE on success, FALSE on errors.
+ */
+static notmuch_bool_t
+write_header (int fdout, const char *hdr)
+{
+ssize_t written,to_write;
+
+if (hdr && (to_write = strlen (hdr))) {
+written = write (fdout, hdr, to_write);
+   if (written != to_write)
+   return FALSE;
+}
+
+return TRUE;
+}
+
+/*
  * Write fdin to a new temp file in maildir/tmp, return full path to
  * the file, or NULL on errors.
  */
@@ -297,6 +317,14 @@ maildir_write_tmp (const void *ctx, int fdin, const char 
*maildir)
 if (fdout < 0)
return NULL;
 
+/* maildir(5) suggests the message should start with a Return-Path
+ * and Delivered-To lines.  qmail-local(8) supplies these.
+ */
+if (! write_header(fdout, getenv("RPLINE")))
+   goto FAIL;
+if (! write_header(fdout, getenv("DTLINE")))
+   goto FAIL;
+
 if (! copy_fd (fdout, fdin))
goto FAIL;
 
-- 
2.6.3

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2016-01-01 Thread Tomi Ollila
On Thu, Dec 31 2015, David Bremner  wrote:

> Jani Nikula  writes:
>
>> On Wed, 30 Dec 2015, "W. Trevor King"  wrote:
>>> To describe the config file format, so folks don't have to dig through
>>> NEWS or the nmbug-status source to get that information.
>>
>> Overall I approve of the series (though I did not do a thorough
>> review).
>>
>> I am wondering about the man page though. I find it slightly confusing
>> there would be a man page named after the tool describing just the
>> config, but not the tool itself.
>
> For me it's a bit odd to have a man page for a tool we don't install by
> default. Is it maybe time to "promote" nmbug-status to the notmuch-
> namespace and install it by default? That would have to be somehow tied
> to installing the python bindings; or else the script could just print a
> helpful error message if the bindings are not found.
>
> This would also allow addressing Tomi's comment about testing, by adding
> a couple of tests to the test suite.

What we could simply have at the time being:

  devel/nmbug/nmbug
  devel/nmbug/nmbug.rst (or .1)
  devel/nmbug/nmbug-status
  devel/nmbug/nmbug-status.rst (or .1)
  devel/nmbug/nmbug-status-config
  devel/nmbug/nmbug-status-config.rst (or .5)

(and if .rst:s, a Makefile to build the namual pages)

The responsibility to install the tools could be
outside of notmuch for now...

Tomi

>
> d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/2] nmbug-status: h1 title and unbalanced fixups to default templates

2016-01-01 Thread Tomi Ollila
On Thu, Dec 31 2015, "W. Trevor King"  wrote:

> On Thu, Dec 31, 2015 at 03:46:50PM +0200, Tomi Ollila wrote:
>> This series LGTM. (html) tidy complains about imo irrelevant things
>> -- or I just did not know how to use it correctly -- as `| tidy
>> -eq`.
>
> That doesn't complain about anything with the current tidy 5.1.25 [1]
> with output built by this branch (although I ran it on output for a
> non-notmuch tag-set).

yes, I have old tidy (20091203), and the complaints were about
utf8-characters (being invalid) in output and summary attribute missing in
tables; i.e. nothing about the well-formity of the syntax...

Tomi

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2016-01-01 Thread David Bremner
Tomi Ollila  writes:

>
> What we could simply have at the time being:
>
>   devel/nmbug/nmbug
>   devel/nmbug/nmbug.rst (or .1)
>   devel/nmbug/nmbug-status
>   devel/nmbug/nmbug-status.rst (or .1)
>   devel/nmbug/nmbug-status-config
>   devel/nmbug/nmbug-status-config.rst (or .5)
>
> (and if .rst:s, a Makefile to build the namual pages)
>
> The responsibility to install the tools could be
> outside of notmuch for now...

This simpler option is also fine with me, and would be faster to review
and apply.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2016-01-01 Thread David Bremner
"W. Trevor King"  writes:

> So separate --without-… configure flags for each script, which will
> also control the associated man pages and handle runtime-dependency
> warnings/errors?

Or just have e.g. the nmbug-status install depend on the hypothetical
--without-python flag.  

>
> Looking over our current configure, I see we have a --without-ruby,
> but no --without-python.  I may file a separate patch adding that, so
> folks with Python installed can still opt-out of notmuch's Python
> bindings.

That seems sensible in any case. Although we'd have to double check that
the build itself doesn't depend on python.  It might make sense to
distinguish between the python bindings (needed for nmbug-status) and
python itself, needed for the test-suite (at least) and nmbug.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] emacs: Improve notmuch-message-mode initialization

2016-01-01 Thread David Bremner
Michal Sojka  writes:

> This commit fixes these problems by replacing a call to message-mail
> with notmuch-specific code that is (hopefully) equivalent to
> message-mail functionality before introduction of
> notmuch-message-mode.

pushed to master

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/2] nmbug-status: h1 title and unbalanced fixups to default templates

2016-01-01 Thread Tomi Ollila
On Fri, Jan 01 2016, "W. Trevor King"  wrote:

> On Fri, Jan 01, 2016 at 01:30:57PM +0200, Tomi Ollila wrote:
>> yes, I have old tidy (20091203), and the complaints were about
>> utf8-characters (being invalid) in output and 
>
> UTF-8 should be valid, because we declare the charset in:
>
>   
>
> If you feel like the UTF-8 complaints are valid, can you post more
> details about them?

IMO UTF-8 complaints are INvalid ! i.e. everything ok there.

Tomi

>> … summary attribute missing in tables…
>
> This attribute seems like it's obsolete [1].

I believe that :D

i.e. everything looks ok to me.

Tomi

>
> Cheers,
> Trevor
>
> [1]: http://www.w3.org/TR/html5/obsolete.html#attr-table-summary
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2016-01-01 Thread W. Trevor King
On Fri, Jan 01, 2016 at 01:23:37PM +0200, Tomi Ollila wrote:
> What we could simply have at the time being:
> 
>   devel/nmbug/nmbug
>   devel/nmbug/nmbug.rst (or .1)
>   devel/nmbug/nmbug-status
>   devel/nmbug/nmbug-status.rst (or .1)
>   devel/nmbug/nmbug-status-config
>   devel/nmbug/nmbug-status-config.rst (or .5)
> 
> (and if .rst:s, a Makefile to build the namual pages)

This is closer to my “separate project” idea [1], and works for me as
far as this series goes.  By not providing install tooling, we also
avoid David's concern about strongly linking the independent tools
[2].  I'll push something like it in a v2.

Once we land that, I may file a subsequent series renaming the scripts
and configs to something more general.  But we can hash that out in
that series' thread.

Cheers,
Trevor

[1]: http://thread.gmane.org/gmane.mail.notmuch.general/21535/focus=21536
 id:20151231202815.gl3...@odin.tremily.us
[2]: http://thread.gmane.org/gmane.mail.notmuch.general/21535/focus=21537
 id:87d1tm46ax.fsf@zancas.localnet

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch