[RFC] Content-Description when naming MIME parts in Emacs mode

2014-02-02 Thread W. Trevor King
On the rss2email list, Victor Orlikowski pointed out [1] that a number of MUAs don't use the Subject header of attached message/rfc822 parts to label multipart/digest subparts [2]. Instead, notmuch and several other MUAs use the filename parameter [3] as a content hint [4]. Using the filename

[PATCH 0/2]

2014-02-03 Thread W. Trevor King
, and I'll restrict future submissions to notmuch@. W. Trevor King (2): notmuch-show: Add content-description output pair emacs: Prefer Content-Description over filename for part buttons NEWS | 9 +++ emacs/notmuch-show.el

[PATCH 02/17] nmbug-status: Use email.utils instead of rfc822

2014-02-03 Thread W. Trevor King
rfc822 has been deprecated since Python 2.3, and it's gone in Python 3 [1]. [1]: http://docs.python.org/2/library/rfc822.html --- devel/nmbug/nmbug-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH 03/17] nmbug-status: Decode Popen output using the user's locale

2014-02-03 Thread W. Trevor King
Avoid: $ ./nmbug-status --list-views Traceback (most recent call last): File ./nmbug-status, line 47, in module 'cat-file', 'blob', sha1+':status-config.json'], TypeError: can't concat bytes to str by explicitly converting the byte-stream read from Popen into a Unicode string.

[PATCH 04/17] nmbug-status: Factor config-loading out into read_config

2014-02-03 Thread W. Trevor King
By isolating this peripheral handling, we make the core logic of nmbug-status easier to read. --- devel/nmbug/nmbug-status | 45 + 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-03 Thread W. Trevor King
with asthetic sensibilities is free to pick nicer colors in the final patch. I'm too partial to the EFF permutation symmetry to be able to pick other colors myself ;). W. Trevor King (17): nmbug-status: Convert to Python-3-compatible print functions nmbug-status: Use email.utils instead

[PATCH 05/17] nmbug-status: Add metavars for --config and --get-query

2014-02-03 Thread W. Trevor King
Now the suggested usage (listed by 'nmbug-status --help') is: usage: nmbug-status [-h] [--text] [--config PATH] [--list-views] [--get-query VIEW] instead of the less obvious: usage: nmbug-status [-h] [--text] [--config CONFIG] [--list-views]

[PATCH 11/17] nmbug-status: Normalize table HTML indentation

2014-02-03 Thread W. Trevor King
I don't think I've ever seen '/tdtd{value}\n' before :p. The new formatting avoids mixing tag levels and content across lines. --- devel/nmbug/nmbug-status | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH 12/17] nmbug-status: Convert from XHTML 1.0 to HTML 5

2014-02-03 Thread W. Trevor King
HTML 5 for the win :). I also de-namespaced the language; the HTML 5 spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I stripped it. This shouldn't break anything at tethera, which already serves the status as text/html: $ wget -S http://nmbug.tethera.net/status/

[PATCH 14/17] nmbug-status: Anchor with h3 ids instead of a names

2014-02-03 Thread W. Trevor King
HTML 5 allows id attributes on all HTML elements [1], but restricts names to particular cases [2]. Attaching the id attribute to the h3 element allows us to drop the anchor a element altogether. [1]: http://www.w3.org/TR/html5/dom.html#the-id-attribute [2]:

[PATCH 07/17] nmbug-status: Don't require write access

2014-02-03 Thread W. Trevor King
The database in only used for notmuch.Query, so there's no need for write access. This allows nmbug-status to run while the database is being updated, without raising: A Xapian exception occurred opening database: Unable to get write lock on …: already locked Traceback (most recent call

[PATCH 17/17] nmbug-status: Color threads in HTML output

2014-02-03 Thread W. Trevor King
Add tbody sections so we don't have to color every row. Multiple tbody sections are allowed [1]. Use CSS 3's nth-child to handle even/odd coloring (skipping the spacer rows) [2], which is supported on the major browsers [3]. border-spacing is from CCS 2.1 [4,5]. I'm using it to avoid

[PATCH 01/17] nmbug-status: Convert to Python-3-compatible print functions

2014-02-03 Thread W. Trevor King
We shouldn't require folks to install Python 2 to run nmbug-status. --- devel/nmbug/nmbug-status | 44 +++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index 934c895..b1feee9 100755 ---

[PATCH 09/17] nmbug-status: Add a Python-3-compatible urllib.parse.quote import

2014-02-03 Thread W. Trevor King
Python 2's urllib.quote [1] has moved to urllib.parse.quote in Python 3 [2]. [1]: http://docs.python.org/2/library/urllib.html#urllib.quote [2]: http://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote --- devel/nmbug/nmbug-status | 9 ++--- 1 file changed, 6 insertions(+), 3

[PATCH 15/17] nmbug-status: Quote the title when using it as an id

2014-02-03 Thread W. Trevor King
Also allow manual id overrides from the JSON config. Quoting avoids errors like: Bad value '#Possible bugs' for attribute href on element a: Whitespace in fragment component. Use %20 in place of spaces. from http://validator.w3.org. --- devel/nmbug/nmbug-status | 6 -- 1 file

[PATCH 16/17] nmbug-status: Use code and p markup where appropriate

2014-02-03 Thread W. Trevor King
* Wrap free text in p tags. * Convert blockquote to pcode for query strings. * Wrap message-id-term (id:...) in code. The code tags get nicer default markup (smaller monospace font) for notmuch query terms [1]. The p tags don't have much effect without attached CSS, but bare text (phrasing

[PATCH 13/17] nmbug-status: Encode output using the user's locale

2014-02-03 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-)

[PATCH 06/17] nmbug-status: Consolidate functions and main code

2014-02-03 Thread W. Trevor King
The definitions of Thread, output_with_separator, and print_view were between the main argparse and view-printing code. Group them together with our existing read_config at the top of the module, which makes for easier reading in the main section. I also: * Made 'headers' a print_view argument

[PATCH 10/17] nmbug-status: Add Page and HtmlPage for modular rendering

2014-02-03 Thread W. Trevor King
I was having trouble understanding the logic of the longish print_view function, so I refactored the output generation into modular bits. The basic text rendering is handled by Page, which has enough hooks that HtmlPage can borrow the logic and slot-in HTML generators. By modularizing the logic

Re: [PATCH 2/2] emacs: Prefer Content-Description over filename for part buttons

2014-02-03 Thread W. Trevor King
On Mon, Feb 03, 2014 at 08:15:35PM +, Mark Walters wrote: I think we should only display/use the content-description if it exists and is non-empty. Sounds good to me. I'll queue this and a test for v2. My only other comment on the series is that you should update devel/schemata in the

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-03 Thread W. Trevor King
On Mon, Feb 03, 2014 at 11:10:23PM +0200, Tomi Ollila wrote: data['message-id-term'] = 'id:{}'.format(value) ValueError: zero length field name in format Oops, Python 2.6 still needs explicit indexes ('{0}', not '{}'). It's an easy fix, so I'll queue it for v2. You're still going to need

Re: [PATCH 2/2] emacs: Prefer Content-Description over filename for part buttons

2014-02-03 Thread W. Trevor King
On Mon, Feb 03, 2014 at 12:34:18PM -0800, W. Trevor King wrote: On Mon, Feb 03, 2014 at 08:15:35PM +, Mark Walters wrote: I think we should only display/use the content-description if it exists and is non-empty. Sounds good to me. I'll queue this and a test for v2. Rather than

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-04 Thread W. Trevor King
On Tue, Feb 04, 2014 at 09:07:45AM -0400, David Bremner wrote: Tomi Ollila writes: anyway, if this doesn't resolve out and there is no resistance to require python 2.7 (that means from David) I can hack around this to get this reviewed. Currently the production copy of nmbug-status is

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-04 Thread W. Trevor King
On Tue, Feb 04, 2014 at 12:30:30PM +0200, Tomi Ollila wrote: On Tue, Feb 04 2014, W. Trevor King wrote: On Mon, Feb 03, 2014 at 11:10:23PM +0200, Tomi Ollila wrote: File devel/nmbug/nmbug-status, line 197, in _write_threads ).format(**message_display_data)) File /usr/lib64

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-04 Thread W. Trevor King
On Tue, Feb 04, 2014 at 07:50:32AM -0800, W. Trevor King wrote: That's two votes for Python 2.6 and none for later versions, so I'll just try a bit harder for 2.6 compatibility ;). As a v2 preview, and to help with further review, I've posted my current v1+ version of this branch at: git

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-04 Thread W. Trevor King
On Tue, Feb 04, 2014 at 12:30:30PM +0200, Tomi Ollila wrote: On Tue, Feb 04 2014, W. Trevor King wrote: On Mon, Feb 03, 2014 at 11:10:23PM +0200, Tomi Ollila wrote: File devel/nmbug/nmbug-status, line 197, in _write_threads ).format(**message_display_data)) File /usr/lib64

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-04 Thread W. Trevor King
On Tue, Feb 04, 2014 at 08:40:18PM +0200, Tomi Ollila wrote: On Tue, Feb 04 2014, W. Trevor King wrote: from __future__ import unicode_literals import codecs import locale import sys print(locale.getpreferredencoding()) # same as yours UTF-8 print

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-05 Thread W. Trevor King
On Wed, Feb 05, 2014 at 05:00:45PM +0200, Tomi Ollila wrote: After I fixed the wrapper the program works fine on python 2.6.6. :) now every other thread is background-colored (girly) pink (fef?) and every other light blue (eff). for me the light blue is not visible (there are no body

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-05 Thread W. Trevor King
On Wed, Feb 05, 2014 at 05:24:56PM +0200, Tomi Ollila wrote: Forgot to mention that the , , etc. characters could also be encoded in this patch series (to lt;, gt;, amp; etc.) Good point. I'll xml.sax.saxutils.escape the message-id, from, and subject at the end of

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-06 Thread W. Trevor King
On Thu, Feb 06, 2014 at 12:54:56AM +0200, Tomi Ollila wrote: On Wed, Feb 05 2014, W. Trevor King wrote: On Wed, Feb 05, 2014 at 05:00:45PM +0200, Tomi Ollila wrote: #DFF for the light-blue works better for me. I'm fine with that. As I said in my cover letter, I'm happy to have

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-07 Thread W. Trevor King
On Wed, Feb 05, 2014 at 07:31:27AM -0800, W. Trevor King wrote: On Wed, Feb 05, 2014 at 05:24:56PM +0200, Tomi Ollila wrote: Forgot to mention that the , , etc. characters could also be encoded in this patch series (to lt;, gt;, amp; etc.) Good point. I'll xml.sax.saxutils.escape

Re: [PATCH 2/2] emacs: Prefer Content-Description over filename for part buttons

2014-02-08 Thread W. Trevor King
On Sat, Feb 08, 2014 at 08:55:02AM -0400, David Bremner wrote: W. Trevor King wk...@tremily.us writes: Rather than patching this in Emacs, maybe we should collapse the “not set” and “set to empty string” cases in notmuch-show.c? I can't think of any reasons why someone would want

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-08 Thread W. Trevor King
On Sat, Feb 08, 2014 at 09:54:28AM -0400, David Bremner wrote: W. Trevor King writes: I'll remove this once the series lands, but I've currently got a preview up at http://tremily.us/status.html yeah, the colour scheme is not my favourite. For the sake of being semi-constructive, I attach

Re: [PATCH 2/2] emacs: Prefer Content-Description over filename for part buttons

2014-02-08 Thread W. Trevor King
On Mon, Feb 03, 2014 at 12:34:18PM -0800, W. Trevor King wrote: On Mon, Feb 03, 2014 at 08:15:35PM +, Mark Walters wrote: My only other comment on the series is that you should update devel/schemata in the first patch to reflect this addition. Ah, I didn't realize that file existed :p

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-08 Thread W. Trevor King
On Sat, Feb 08, 2014 at 08:29:41PM +0200, Tomi Ollila wrote: On Sat, Feb 08 2014, W. Trevor King wrote: On Sat, Feb 08, 2014 at 09:54:28AM -0400, David Bremner wrote: W. Trevor King writes: I'll remove this once the series lands, but I've currently got a preview up at http://tremily.us

Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

2014-02-08 Thread W. Trevor King
On Sat, Feb 08, 2014 at 09:37:43PM +0200, Tomi Ollila wrote: On Sat, Feb 08 2014, W. Trevor King wrote: On Sat, Feb 08, 2014 at 08:29:41PM +0200, Tomi Ollila wrote: On Sat, Feb 08 2014, W. Trevor King wrote: On Sat, Feb 08, 2014 at 09:54:28AM -0400, David Bremner wrote: More importantly

[PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-02-08 Thread W. Trevor King
From: W. Trevor King wk...@tremily.us With two branches getting fetched (master and config), the branch referenced by FETCH_HEAD is ambiguous. For example, I have: $ cat FETCH_HEAD 41d7bfa7184cc93c9dac139d1674e9530799e3b0 \ not-for-merge branch 'config' of http://nmbug.tethera.net/git

Re: [PATCH 15/17] nmbug-status: Quote the title when using it as an id

2014-02-08 Thread W. Trevor King
On Mon, Feb 03, 2014 at 02:59:33AM -0800, W. Trevor King wrote: +if 'id' not in view: +view['id'] = quote(view['title']) Stuff like href=#Maybe%20Ready%20%28Core%20and%20Emacs%29 wasn't working for me on Firefox 24.2.0, so I've tweaked this commit to slug titles

Re: [PATCH v4] build: write VERSION file containing $(VERSION) string

2014-02-08 Thread W. Trevor King
On Thu, Feb 06, 2014 at 12:58:33AM +0200, Tomi Ollila wrote: -VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/) +# Also write VERSION file in case its contents differ from $(VERSION) +VERSION:=$(shell\ + gv=`git describe --match '[0-9.]*'|sed -e s/_/~/ -e

[PATCH v2 06/20] nmbug-status: Consolidate functions and main code

2014-02-10 Thread W. Trevor King
The definitions of Thread, output_with_separator, and print_view were between the main argparse and view-printing code. Group them together with our existing read_config at the top of the module, which makes for easier reading in the main section. I also: * Made 'headers' a print_view argument

[PATCH v2 00/20] nmbug-status: Python-3-compatibility and general refactoring

2014-02-10 Thread W. Trevor King
/gmane.mail.notmuch.general/17151 [5]: id=20140208221925.gd17...@odin.tremily.us http://article.gmane.org/gmane.mail.notmuch.general/17153 [6]: id=20140208231804.ge17...@odin.tremily.us http://article.gmane.org/gmane.mail.notmuch.general/17155 W. Trevor King (20): nmbug-status: Convert

[PATCH v2 07/20] nmbug-status: Don't require write access

2014-02-10 Thread W. Trevor King
The database in only used for notmuch.Query, so there's no need for write access. This allows nmbug-status to run while the database is being updated, without raising: A Xapian exception occurred opening database: Unable to get write lock on …: already locked Traceback (most recent call

[PATCH v2 11/20] nmbug-status: Add an OrderedDict stub for Python 2.6

2014-02-10 Thread W. Trevor King
Tomi Ollila and David Bremner (and presumably others) are running Python 2.6 on their nmbug-status boxes, so it makes sense to keep support for that version. This commit adds a really minimal OrderedDict stub (e.g. it doesn't handle key removal), but it gets the job done for Page._get_threads.

[PATCH v2 01/20] nmbug-status: Convert to Python-3-compatible print functions

2014-02-10 Thread W. Trevor King
We shouldn't require folks to install Python 2 to run nmbug-status. --- devel/nmbug/nmbug-status | 44 +++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index 934c895..b1feee9 100755 ---

[PATCH v2 15/20] nmbug-status: Anchor with h3 ids instead of a names

2014-02-10 Thread W. Trevor King
HTML 5 allows id attributes on all HTML elements [1], but restricts names to particular cases [2]. Attaching the id attribute to the h3 element allows us to drop the anchor a element altogether. [1]: http://www.w3.org/TR/html5/dom.html#the-id-attribute [2]:

[PATCH v2 04/20] nmbug-status: Factor config-loading out into read_config

2014-02-10 Thread W. Trevor King
By isolating this peripheral handling, we make the core logic of nmbug-status easier to read. --- devel/nmbug/nmbug-status | 45 + 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 12/20] nmbug-status: Normalize table HTML indentation

2014-02-10 Thread W. Trevor King
I don't think I've ever seen '/tdtd{value}\n' before :p. The new formatting avoids mixing tag levels and content across lines. --- devel/nmbug/nmbug-status | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-10 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-)

[PATCH v2 02/20] nmbug-status: Use email.utils instead of rfc822

2014-02-10 Thread W. Trevor King
rfc822 has been deprecated since Python 2.3, and it's gone in Python 3 [1]. [1]: http://docs.python.org/2/library/rfc822.html --- devel/nmbug/nmbug-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 05/20] nmbug-status: Add metavars for --config and --get-query

2014-02-10 Thread W. Trevor King
Now the suggested usage (listed by 'nmbug-status --help') is: usage: nmbug-status [-h] [--text] [--config PATH] [--list-views] [--get-query VIEW] instead of the less obvious: usage: nmbug-status [-h] [--text] [--config CONFIG] [--list-views]

[PATCH v2 09/20] nmbug-status: Add a Python-3-compatible urllib.parse.quote import

2014-02-10 Thread W. Trevor King
Python 2's urllib.quote [1] has moved to urllib.parse.quote in Python 3 [2]. [1]: http://docs.python.org/2/library/urllib.html#urllib.quote [2]: http://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote --- devel/nmbug/nmbug-status | 9 ++--- 1 file changed, 6 insertions(+), 3

[PATCH v2 18/20] nmbug-status: Color threads in HTML output

2014-02-10 Thread W. Trevor King
Add tbody sections so we don't have to color every row. Multiple tbody sections are allowed [1]. Use CSS 3's nth-child to handle even/odd coloring (skipping the spacer rows) [2], which is supported on the major browsers [3]. border-spacing is from CCS 2.1 [4,5]. I'm using it to avoid

[PATCH v2 13/20] nmbug-status: Convert from XHTML 1.0 to HTML 5

2014-02-10 Thread W. Trevor King
HTML 5 for the win :). I also de-namespaced the language; the HTML 5 spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I stripped it. This shouldn't break anything at tethera, which already serves the status as text/html: $ wget -S http://nmbug.tethera.net/status/

[PATCH v2 03/20] nmbug-status: Decode Popen output using the user's locale

2014-02-10 Thread W. Trevor King
Avoid: $ ./nmbug-status --list-views Traceback (most recent call last): File ./nmbug-status, line 47, in module 'cat-file', 'blob', sha1+':status-config.json'], TypeError: can't concat bytes to str by explicitly converting the byte-stream read from Popen into a Unicode string.

[PATCH v2 08/20] nmbug-status: Consolidate HTML header printing

2014-02-10 Thread W. Trevor King
Make this all one big string, using '...{date}...'.format(date=...) to inject the date [1]. This syntax was added in Python 2.6, and is preferred to %-formatting in Python 3 [1]. [1]: http://docs.python.org/2/library/stdtypes.html#str.format --- devel/nmbug/nmbug-status | 13 ++--- 1

[PATCH v2 10/20] nmbug-status: Add Page and HtmlPage for modular rendering

2014-02-10 Thread W. Trevor King
I was having trouble understanding the logic of the longish print_view function, so I refactored the output generation into modular bits. The basic text rendering is handled by Page, which has enough hooks that HtmlPage can borrow the logic and slot-in HTML generators. By modularizing the logic

[PATCH v2 17/20] nmbug-status: Use code and p markup where appropriate

2014-02-10 Thread W. Trevor King
* Wrap free text in p tags. * Convert blockquote to pcode for query strings. * Wrap message-id-term (id:...) in code. The code tags get nicer default markup (smaller monospace font) for notmuch query terms [1]. The p tags don't have much effect without attached CSS, but bare text (phrasing

[PATCH v2 19/20] nmbug-status: Escape , , and in HTML display data

2014-02-10 Thread W. Trevor King
'message-id' and 'from' now have sensitive characters escaped using xml.sax.saxutils.escape [1]. The 'subject' data was already being converted to a link into Gmane; I've escape()d that too, so it doesn't need to be handled ain the same block as 'message-id' and 'from'. This prevents broken HTML

[PATCH v2 20/20] nmbug-status: Add inter-message padding

2014-02-10 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

[PATCH v2 16/20] nmbug-status: Slug the title when using it as an id

2014-02-10 Thread W. Trevor King
Also allow manual id overrides from the JSON config. Sluggin avoids errors like: Bad value '#Possible bugs' for attribute href on element a: Whitespace in fragment component. Use %20 in place of spaces. from http://validator.w3.org. I tried just quoting the titles (e.g.

Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-11 Thread W. Trevor King
On Tue, Feb 11, 2014 at 04:14:45PM +0200, Tomi Ollila wrote: On Tue, Feb 11 2014, David Bremner wrote: W. Trevor King writes: Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal

Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-11 Thread W. Trevor King
On Tue, Feb 11, 2014 at 06:02:09PM -0400, David Bremner wrote: W. Trevor King writes: If a user has set LANG=C, I expect that's what we should use for output (in which case dying with an encoding error is the right thing to do). Perhaps for an interactive tool, intended mainly to be run

Re: [PATCH v2 13/20] nmbug-status: Convert from XHTML 1.0 to HTML 5

2014-02-12 Thread W. Trevor King
On Wed, Feb 12, 2014 at 07:35:19PM -0400, David Bremner wrote: W. Trevor King writes: HTML 5 for the win :). I also de-namespaced the language; the HTML 5 spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I stripped it. I pushed the first 13 patches in the series

Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-12 Thread W. Trevor King
On Wed, Feb 12, 2014 at 10:13:50PM -0400, David Bremner wrote: W. Trevor King writes: I don't understand why your choice of LANG should depend on the interactive-ness of an invocation. It's not the choice of LANG, but rather the acceptability of crashing with an unhandled exception. I'd

[PATCH v3 0/8] nmbug-status: Python-3-compatibility and general refactoring

2014-02-13 Thread W. Trevor King
@zancas.localnet http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17200 [4]: id:m2sirpu46i@guru.guru-group.fi http://article.gmane.org/gmane.mail.notmuch.general/17191 [5]: id:m2vbwj79lu@guru.guru-group.fi http://article.gmane.org/gmane.mail.notmuch.general/17209 W. Trevor

[PATCH v3 1/8] nmbug-status: Anchor with h3 ids instead of a names

2014-02-13 Thread W. Trevor King
HTML 5 allows id attributes on all HTML elements [1], but restricts names to particular cases [2]. Attaching the id attribute to the h3 element allows us to drop the anchor a element altogether. [1]: http://www.w3.org/TR/html5/dom.html#the-id-attribute [2]:

[PATCH v3 8/8] nmbug-status: Hardcode UTF-8 instead of using the user's locale

2014-02-13 Thread W. Trevor King
David [1] and Tomi [2] both feel that the user's choice of LANG is not explicit enough to have such a strong effect on nmbug-status. For example, cron jobs usually default to LANG=C, and that is going to give you ASCII output: $ LANG=C python -c 'import locale;

[PATCH v3 2/8] nmbug-status: Slug the title when using it as an id

2014-02-13 Thread W. Trevor King
Also allow manual id overrides from the JSON config. Sluggin avoids errors like: Bad value '#Possible bugs' for attribute href on element a: Whitespace in fragment component. Use %20 in place of spaces. from http://validator.w3.org. I tried just quoting the titles (e.g.

[PATCH v3 3/8] nmbug-status: Use code and p markup where appropriate

2014-02-13 Thread W. Trevor King
* Wrap free text in p tags. * Convert blockquote to pcode for query strings. * Wrap message-id-term (id:...) in code. The code tags get nicer default markup (smaller monospace font) for notmuch query terms [1]. The p tags don't have much effect without attached CSS, but bare text (phrasing

[PATCH v3 4/8] nmbug-status: Color threads in HTML output

2014-02-13 Thread W. Trevor King
Add tbody sections so we don't have to color every row. Multiple tbody sections are allowed [1]. Use CSS 3's nth-child to handle even/odd coloring (skipping the spacer rows) [2], which is supported on the major browsers [3]. border-spacing is from CCS 2.1 [4,5]. I'm using it to avoid

[PATCH v3 5/8] nmbug-status: Escape , , and in HTML display data

2014-02-13 Thread W. Trevor King
'message-id' and 'from' now have sensitive characters escaped using xml.sax.saxutils.escape [1]. The 'subject' data was already being converted to a link into Gmane; I've escape()d that too, so it doesn't need to be handled ain the same block as 'message-id' and 'from'. This prevents broken HTML

[PATCH v3 6/8] nmbug-status: Add inter-message padding

2014-02-13 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

[PATCH v3 7/8] nmbug-status: Encode output using the user's locale

2014-02-13 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

Re: [PATCH v3 7/8] nmbug-status: Encode output using the user's locale

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 08:47:22AM -0800, W. Trevor King wrote: '''.format(date=datetime.datetime.utcnow().date(), + encoding=_ENCODING), inter_message_padding='0.25em', border_radius='0.5em'), Oops, that should be: encoding=_ENCODING, not: encoding

Re: [PATCH v3 4/8] nmbug-status: Color threads in HTML output

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 09:58:43PM -0400, David Bremner wrote: W. Trevor King writes: + meta http-equiv=Content-Type content=text/html; charset=utf-8 / + meta http-equiv=Content-Type content=text/html; charset={encoding} / looks like a bad rebase there. Oops. Fixed in my branch

Re: [PATCH v3 6/8] nmbug-status: Add inter-message padding

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 10:13:42PM -0400, David Bremner wrote: I tested patches 1-6, but my fix for patch 4 broke patch 7. So maybe it's best if you regenerate the series. The concept of the last two patches seems OK. Sure. Sorry I botched v3 :/. Do you want to nibble off patches one

[PATCH v4 4/4] nmbug-status: Hardcode UTF-8 instead of using the user's locale

2014-02-14 Thread W. Trevor King
David [1] and Tomi [2] both feel that the user's choice of LANG is not explicit enough to have such a strong effect on nmbug-status. For example, cron jobs usually default to LANG=C, and that is going to give you ASCII output: $ LANG=C python -c 'import locale;

[PATCH v4 0/4] nmbug-status: Python-3-compatibility and general refactoring

2014-02-14 Thread W. Trevor King
.fsf@zancas.localnet http://article.gmane.org/gmane.mail.notmuch.general/17239 W. Trevor King (4): nmbug-status: Color threads in HTML output nmbug-status: Add inter-message padding nmbug-status: Encode output using the user's locale nmbug-status: Hardcode UTF-8 instead of using

[PATCH v4 1/4] nmbug-status: Color threads in HTML output

2014-02-14 Thread W. Trevor King
Add tbody sections so we don't have to color every row. Multiple tbody sections are allowed [1]. Use CSS 3's nth-child to handle even/odd coloring (skipping the spacer rows) [2], which is supported on the major browsers [3]. border-spacing is from CCS 2.1 [4,5]. I'm using it to avoid

[PATCH v4 3/4] nmbug-status: Encode output using the user's locale

2014-02-14 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff

[PATCH v4 2/4] nmbug-status: Add inter-message padding

2014-02-14 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

Re: [PATCH 1/1] nmbug-status: replace __values__() with values() in OrderedDict stub

2014-02-18 Thread W. Trevor King
On Tue, Feb 18, 2014 at 08:34:52PM +0200, Tomi Ollila wrote: -def __values__(self): +def values(self): Looks good to me. I'm not sure why I used __values__ in the first place; probably just in the __ zone after __init__ and __setitem__. Cheers, Trevor -- This email may be

Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-08 Thread W. Trevor King
On Sat, Mar 08, 2014 at 08:43:26AM -0400, David Bremner wrote: W. Trevor King writes: +sub do_clone { + my $repository = shift; + system ('git', 'clone', '--bare', $repository, $NMBGIT) == 0 +or die 'git clone' exited with nonzero value\n; + my $branch = git ('symbolic-ref

Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-08 Thread W. Trevor King
On Sat, Mar 08, 2014 at 08:26:33AM -0800, W. Trevor King wrote: That's going to create ~/.nmbug/.git though, if we want to preserve the current bare-style ~/.nmbug/ layout, we'd need something like: $ TEMPDIR=$(mktemp -d) $ git clone --no-checkout --separate-git-dir=~/.nmbug \ http

[PATCH v2] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-09 Thread W. Trevor King
With two branches getting fetched (master and config), the branch referenced by FETCH_HEAD is ambiguous. For example, I have: $ cat FETCH_HEAD 41d7bfa7184cc93c9dac139d1674e9530799e3b0 \ not-for-merge branch 'config' of http://nmbug.tethera.net/git/nmbug-tags

Re: [PATCH 0/2] nmbug-status: make title/blurb configurable

2014-03-13 Thread W. Trevor King
On Thu, Mar 13, 2014 at 01:04:03PM +0100, Jani Nikula wrote: This lets me use nmbug-status for publishing search views in html outside of the nmbug context. I'm sure especially 2/2 can be done better. If someone wants to use their mad python skillz to improve this, it would be great. ;) Both

Re: [PATCH v4 0/4] nmbug-status: Python-3-compatibility and general refactoring

2014-04-05 Thread W. Trevor King
On Sun, Feb 16, 2014 at 07:46:29PM -0400, David Bremner wrote: pushed the last 4. It looks like there's still a nmbug-status branch on git://notmuchmail.org/git/notmuch. It's an ancestor of debian/0.17-4, and nmbug-status development seems to have calmed back down, so that branch can probably

[PATCH 0/7] doc: Python 3 compat, rst2man.py support, etc.

2014-04-05 Thread W. Trevor King
haven't checked the logic though, and I'm not running 3.2 locally anymore, so it's not a big priority for me. Cheers, Trevor [1]: https://docs.python.org/3/whatsnew/3.3.html#pep-414-explicit-unicode-literals [2]: from __future__ import unicode_literals W. Trevor King (7): doc/mkdocdeps.py

[PATCH 1/7] doc/mkdocdeps.py: Convert execfile to import

2014-04-05 Thread W. Trevor King
excefile is gone in Python 3 [1]. Instead of exec-ing the configuration, it's easier to insert the source directory in Python's path [2], and just import the configuration. With this change, mkdocdeps.py is compatible with both Python 2 and 3. [1]:

[PATCH 4/7] doc/prerst2man.py: Fix 'os.system' - 'system' typo

2014-04-05 Thread W. Trevor King
Avoid: $ make HAVE_SPHINX=0 HAVE_RST2MAN=1 build-man python ./doc/prerst2man.py ./doc doc/_build/man Traceback (most recent call last): File ./doc/prerst2man.py, line 65, in module os.system('set -x; rst2man {0} {1}/{2}.{3}' NameError: name 'os' is not defined make: ***

[PATCH 2/7] doc/mkdocdeps.py: Use with statement for the output file

2014-04-05 Thread W. Trevor King
Before this patch, the open was unnecessarily early and relied on the process cleanup to close. Neither one of these was a real problem, but PEP 343's context managers (which landed in Python 2.5) make proper cleanup very easy. [1]: http://legacy.python.org/dev/peps/pep-0343/ ---

[PATCH 7/7] doc/INSTALL: Remove rst2man reference and other updates

2014-04-05 Thread W. Trevor King
The rst2man target was removed in 9d9a700 (doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN, 2014-03-13), but a reference in the install docs slipped through. While I was removing that reference, I also: * Converted doc/INSTALL to reStructuredText, so I can link to Sphinx

[PATCH 6/7] doc/prerst2man.py: Convert execfile to import

2014-04-05 Thread W. Trevor King
excefile is gone in Python 3 [1]. Instead of exec-ing the configuration, it's easier to insert the source directory in Python's path [2], and just import the configuration. With this change, prerst2man.py is compatible with both Python 2 and 3. [1]:

[PATCH 3/7] doc/prerst2man.py: Use Python-3-compatible octal notation

2014-04-05 Thread W. Trevor King
Python 3 only supports the 0oXXX notation for octal literals [1,2], which have also been supported in 2.x since 2.6 [2]. [1]: https://docs.python.org/3.0/whatsnew/3.0.html#integers [2]: http://legacy.python.org/dev/peps/pep-3127/ --- doc/prerst2man.py | 4 ++-- 1 file changed, 2 insertions(+), 2

Re: [PATCH 7/7] doc/INSTALL: Remove rst2man reference and other updates

2014-04-05 Thread W. Trevor King
On Sat, Apr 05, 2014 at 05:35:49PM -0300, David Bremner wrote: W. Trevor King writes: -- You can build build and install man pages with 'make install-man' + make build-{man|info|html|pdf} most of those those targets now start with sphinx- Ah, looks like that happended

[PATCH] NEWS: Document the recent 'nmbug clone' and @{upstream} changes

2014-04-08 Thread W. Trevor King
The changes just landed with c200167 (nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}, 2014-03-09). The preferred markup language for NEWS seems to be Markdown, which is parsed by devel/news2wiki.pl into Markdown chunks for rendering by ikiwiki [1]. [1]: http://notmuchmail.org/news/

Re: [PATCH] NEWS: Document the recent 'nmbug clone' and @{upstream} changes

2014-04-09 Thread W. Trevor King
On Wed, Apr 09, 2014 at 08:22:26AM -0300, David Bremner wrote: W. Trevor King writes: The changes just landed with c200167 (nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}, 2014-03-09). The preferred markup language for NEWS seems to be Markdown, which is parsed by devel

Re: [PATCH] NEWS: Document the recent 'nmbug clone' and @{upstream} changes

2014-04-09 Thread W. Trevor King
On Wed, Apr 09, 2014 at 10:01:25PM -0300, David Bremner wrote: W. Trevor King writes: We need non-bare repositories to have remote-tracking branches (distinct from local branches) [3], and we need remote-tracking branches to have working @{upstream}. OK, I see what you mean

Re: [PATCH] nmbug: mark repository as bare on clone

2014-04-15 Thread W. Trevor King
On Sat, Apr 12, 2014 at 01:30:32PM -0300, David Bremner wrote: As far as I can figure out, if a git repository is non-bare, then it should either have core.worktree set, or the parent directory should be the worktree. If this works in your testing, then +1 from me ;). However, the default is

Re: Thanks for the nmbug-status program

2014-04-22 Thread W. Trevor King
On Tue, Apr 22, 2014 at 02:12:30PM -0700, Carl Worth wrote: The script is quite general, (only a tiny portion was tied directly to nmbug), so I renamed it notmuch-to-html, and hosted it here after a tiny bit of generalization and a couple of minor user-interface changes:

  1   2   3   4   5   >