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

2014-02-13 Thread David Bremner
"W. Trevor King"  writes:

> 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* two-row message blocks.

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.

d


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

2014-02-13 Thread David Bremner
"W. Trevor King"  writes:

> +  
> +  

looks like a bad rebase there.

d


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
through three (and maybe five, which applies cleanly on top of three)
first, or should I include them in v4?

Cheers,
Trevor

-- 
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
http://notmuchmail.org/mailman/listinfo/notmuch


[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
through three (and maybe five, which applies cleanly on top of three)
first, or should I include them in v4?

Cheers,
Trevor

-- 
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
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140213/9b724cb6/attachment.pgp>


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

2014-02-13 Thread Tomi Ollila
On Thu, Feb 13 2014, "W. Trevor King"  wrote:

> The only changes since v2 [1] are related to our discussion of
> locale-based encodings vs. hardcoded UTF-8 [2,3,and descendants].
> This iteration addresses those concerns by rebasing the controversial
> commit (nmbug-status: Encode output using the user's locale) to the
> end of the series.  In order to address Tomi's hardcoded config
> encoding request [4,5] now that fd29d3f (nmbug-status: Decode Popen
> output using the user's locale, 2014-02-10) has landed in master, I
> think we should keep the output locale patch (7/8 in v3) and add an
> additional patch to hardcode _ENCODING (8/8 in v3).  The commit
> message for 8/8 was tricky, but I think the current wording expresses
> both the motivation for the hardcoded UTF-8, my acceptance of a
> hardcoded UTF-8, and my personal preference for respecting LANG ;).
> Suggestions for alternative wordings are welcome, especially since I
> try to explain both David and Tomi's perspectives :p.

Good stuff -- I did not have chance to test these yet...

> Cheers,
> Trevor

Tomi

>
> [1]: id:"cover.1392056624.git.wking at tremily.us"
>  http://thread.gmane.org/gmane.mail.notmuch.general/17167
> [2]: id:"87eh396e6e.fsf at zancas.localnet"
>  http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17190
> [3]: id:"87a9dv52h4.fsf at zancas.localnet"
>  http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17200
> [4]: id:"m2sirpu46i.fsf at guru.guru-group.fi"
>  http://article.gmane.org/gmane.mail.notmuch.general/17191
> [5]: id:"m2vbwj79lu.fsf at guru.guru-group.fi"
>  http://article.gmane.org/gmane.mail.notmuch.general/17209
>
> W. Trevor King (8):
>   nmbug-status: Anchor with h3 ids instead of a names
>   nmbug-status: Slug the title when using it as an id
>   nmbug-status: Use  and  markup where appropriate
>   nmbug-status: Color threads in HTML output
>   nmbug-status: Escape &, <, and > in HTML display data
>   nmbug-status: Add inter-message padding
>   nmbug-status: Encode output using the user's locale
>   nmbug-status: Hardcode UTF-8 instead of using the user's locale
>
>  devel/nmbug/nmbug-status | 96 
> ++--
>  1 file changed, 76 insertions(+), 20 deletions(-)
>
> -- 
> 1.8.5.2.8.g0f6c0d1


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

2014-02-13 Thread David Bremner
"W. Trevor King"  writes:

> 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* two-row message blocks.

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.

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


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:
> > +  
> > +   > />
> 
> looks like a bad rebase there.

Oops.  Fixed in my branch and queued for v4.

Thanks,
Trevor

-- 
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
http://notmuchmail.org/mailman/listinfo/notmuch


[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:
> > +  
> > +   > />
> 
> looks like a bad rebase there.

Oops.  Fixed in my branch and queued for v4.

Thanks,
Trevor

-- 
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
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140213/7f4a6519/attachment.pgp>


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

2014-02-13 Thread David Bremner
"W. Trevor King"  writes:

> +  
> +  

looks like a bad rebase there.

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


[PATCH] ruby bindings message: docstring typo

2014-02-13 Thread David Bremner
Gaute Hope  writes:

Any objections Felipe? 
>
> diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c
> index eed4b31..4ff6097 100644
> --- a/bindings/ruby/message.c
> +++ b/bindings/ruby/message.c
> @@ -111,7 +111,7 @@ notmuch_rb_message_get_filename (VALUE self)
>  }
>  
>  /*
> - * call-seq: MESSAGE.filanames => FILENAMES
> + * call-seq: MESSAGE.filenames => FILENAMES
>   *

d


Re: [PATCH] ruby bindings message: docstring typo

2014-02-13 Thread David Bremner
Gaute Hope  writes:

Any objections Felipe? 
>
> diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c
> index eed4b31..4ff6097 100644
> --- a/bindings/ruby/message.c
> +++ b/bindings/ruby/message.c
> @@ -111,7 +111,7 @@ notmuch_rb_message_get_filename (VALUE self)
>  }
>  
>  /*
> - * call-seq: MESSAGE.filanames => FILENAMES
> + * call-seq: MESSAGE.filenames => FILENAMES
>   *

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


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=_ENCODING),

I can resubmit v4 or send a fixup patch, but feel free to squash this
in locally.  My revised branch is still available at:

  git://tremily.us/notmuch.git nmbug-status-python3

if you'd rather just pull the fixup directly (they end with commit
f994568).

Cheers,
Trevor

-- 
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
http://notmuchmail.org/mailman/listinfo/notmuch


[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=_ENCODING),

I can resubmit v4 or send a fixup patch, but feel free to squash this
in locally.  My revised branch is still available at:

  git://tremily.us/notmuch.git nmbug-status-python3

if you'd rather just pull the fixup directly (they end with commit
f994568).

Cheers,
Trevor

-- 
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
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140213/a24e6f1c/attachment.pgp>


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

2014-02-13 Thread Tomi Ollila
On Thu, Feb 13 2014, "W. Trevor King"  wrote:

> 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 to master.
>
> :).  If the output encoding patch (nmbug-status: Encode output using
> the user's locale) is the sticking point for the remainder of the
> series, I'm happy to rebase it to the end of the series and let it
> cook on the list until someone needs it.  UTF-8 works for me
> personally.

No-one will need ?ny alternatives... ;D

Personally hardcoding UTF-8 works for me.

Next option hardcoding UTF-8 for config read (I would not want LANG=C
borke my 'F??b?r' in title ;) and use os.isatty(1) to determine
whether hardcod UTF-8 for output could be possibly tolerable to me.

> Cheers,
> Trevor

Tomi


[PATCH 1/1] emacs: always write emacs/.eldeps when the target is remade

2014-02-13 Thread Tomi Ollila
On Thu, Feb 13 2014, Austin Clements  wrote:

> Quoth Tomi Ollila on Jan 25 at 12:21 pm:
>> So that the target is newer than its prerequisites.
>> ---
>>  emacs/Makefile.local | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
>> index 42bfbd9..d5d402e 100644
>> --- a/emacs/Makefile.local
>> +++ b/emacs/Makefile.local
>> @@ -32,8 +32,7 @@ emacs_bytecode = $(emacs_sources:.el=.elc)
>>  ifeq ($(HAVE_EMACS),1)
>>  $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
>>  $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
>> --f batch-make-deps $(emacs_sources) > $@.tmp && \
>> -(cmp -s $@.tmp $@ || mv $@.tmp $@)
>> +-f batch-make-deps $(emacs_sources) > $@.tmp && mv $@.tmp $@
>>  -include $(dir)/.eldeps
>>  endif
>>  CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp
>
> Is this just so the rule doesn't get run again on the next make
> invocation (unless, of course, a dependent changed)?

Basically yes. I did multiple builds in rapid succession when developing
something and this thing confused me quite a lot in the beginning...

> Interestingly, if any of the dependents have changed, but in ways that
> don't affect .eldeps, this change will make the build more expensive
> because it will trigger a make restart after .eldeps is updated.

I wondered what was the reason for the recipe you've chosen here, has
it something to do with inodes or something ;) (and were going to ask
an alternative to touch (or even : > $@) the target...

... but now I understand. E.g. change in notmuch-lib.el will cause *all* 
.el files to be re-bytecompiled after this change. 

An alternative to this patch would be adding a message to the rule
which informs user to touch .eldeps to avoid re-doing .eldeps if
that irritates one :D

something like:

(cmp -s $@.tmp $@ && \
 echo "touch $@ to avoid redoing this target" || mv $@.tmp $@)

Thanks, 

Tomi


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

2014-02-13 Thread Tomi Ollila
On Thu, Feb 13 2014, "W. Trevor King"  wrote:

> The only changes since v2 [1] are related to our discussion of
> locale-based encodings vs. hardcoded UTF-8 [2,3,and descendants].
> This iteration addresses those concerns by rebasing the controversial
> commit (nmbug-status: Encode output using the user's locale) to the
> end of the series.  In order to address Tomi's hardcoded config
> encoding request [4,5] now that fd29d3f (nmbug-status: Decode Popen
> output using the user's locale, 2014-02-10) has landed in master, I
> think we should keep the output locale patch (7/8 in v3) and add an
> additional patch to hardcode _ENCODING (8/8 in v3).  The commit
> message for 8/8 was tricky, but I think the current wording expresses
> both the motivation for the hardcoded UTF-8, my acceptance of a
> hardcoded UTF-8, and my personal preference for respecting LANG ;).
> Suggestions for alternative wordings are welcome, especially since I
> try to explain both David and Tomi's perspectives :p.

Good stuff -- I did not have chance to test these yet...

> Cheers,
> Trevor

Tomi

>
> [1]: id:"cover.1392056624.git.wk...@tremily.us"
>  http://thread.gmane.org/gmane.mail.notmuch.general/17167
> [2]: id:"87eh396e6e.fsf@zancas.localnet"
>  http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17190
> [3]: id:"87a9dv52h4.fsf@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 King (8):
>   nmbug-status: Anchor with h3 ids instead of a names
>   nmbug-status: Slug the title when using it as an id
>   nmbug-status: Use  and  markup where appropriate
>   nmbug-status: Color threads in HTML output
>   nmbug-status: Escape &, <, and > in HTML display data
>   nmbug-status: Add inter-message padding
>   nmbug-status: Encode output using the user's locale
>   nmbug-status: Hardcode UTF-8 instead of using the user's locale
>
>  devel/nmbug/nmbug-status | 96 
> ++--
>  1 file changed, 76 insertions(+), 20 deletions(-)
>
> -- 
> 1.8.5.2.8.g0f6c0d1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] new: Detect dirent.d_type support at configure time

2014-02-13 Thread Tomi Ollila
On Thu, Feb 13 2014, Austin Clements  wrote:

> Support for dirent.d_type is OS-specific.  Previously, we used
> _DIRENT_HAVE_D_TYPE to detect support for this, but this is apparently
> a glic-ism (FreeBSD, for example, supports d_type, but does not define
> this).  Since there's no cross-platform way to detect support for
> dirent.d_type, detect it using a test compile at configure time.
> ---
> This is a trivial rebase of
> id:1385262952-29240-1-git-send-email-amdragon at mit.edu, which I
> apparently never got around to sending.  Tomi and Jani checked off v1
> of this patch, so I'm marking it ready.

Looks good. Applies cleanly. Tests pass.

Tomi



[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* two-row message blocks.

   <--- new padding
  thread-1, message-1, row-1  (class="message-first")
  thread-1, message-1, row-2  (class="message-last")
   <--- new padding
spacer tbody with a blank row
   <--- new padding
  thread-2, message-1, row-1  (class="message-first")
  thread-2, message-1, row-2  (class="message-last")
   <--- new padding
   <--- new padding
  thread-2, message-2, row-1  (class="message-first")
  thread-2, message-2, row-2  (class="message-last")
   <--- new padding
---
 devel/nmbug/nmbug-status | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 57eec6c..9ad7d35 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -208,11 +208,11 @@ class HtmlPage (Page):
 stream.write('  \n')
 for message_display_data in thread:
 stream.write((
-'\n'
+'\n'
 '  {date}\n'
 '  {message-id-term}\n'
 '\n'
-'\n'
+'\n'
 '  {from}\n'
 '  {subject}\n'
 '\n'
@@ -256,6 +256,12 @@ _PAGES['html'] = HtmlPage(
 table {{
   border-spacing: 0;
 }}
+tr.message-first td {{
+  padding-top: {inter_message_padding};
+}}
+tr.message-last td {{
+  padding-bottom: {inter_message_padding};
+}}
 td {{
   padding-left: {border_radius};
   padding-right: {border_radius};
@@ -288,6 +294,7 @@ For more infomation see http://notmuchmail.org/nmbug";>nmbug
 
 Views
 '''.format(date=datetime.datetime.utcnow().date(),
+   inter_message_padding='0.25em',
border_radius='0.5em'),
 footer='\n\n',
 )
-- 
1.8.5.2.8.g0f6c0d1

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


[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 --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 9ad7d35..8cc097a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -90,7 +90,7 @@ class Page (object):
 byte_stream = sys.stdout.buffer
 except AttributeError:  # Python 2
 byte_stream = sys.stdout
-stream = codecs.getwriter(encoding='UTF-8')(stream=byte_stream)
+stream = codecs.getwriter(encoding=_ENCODING)(stream=byte_stream)
 self._write_header(views=views, stream=stream)
 for view in views:
 self._write_view(database=database, view=view, stream=stream)
@@ -249,7 +249,6 @@ _PAGES['html'] = HtmlPage(
 header='''
 
 
-  
   
   Notmuch Patches
   

[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 by if subjects etc. contain characters that
would otherwise be interpreted as HTML markup.

[1]: http://docs.python.org/3/library/xml.sax.utils.html#xml.sax.saxutils.escape
---
 devel/nmbug/nmbug-status | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 92552a4..57eec6c 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -24,6 +24,7 @@ import os
 import re
 import sys
 import subprocess
+import xml.sax.saxutils
 
 
 _ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding()
@@ -229,11 +230,14 @@ class HtmlPage (Page):
 if 'subject' in display_data and 'message-id' in display_data:
 d = {
 'message-id': quote(display_data['message-id']),
-'subject': display_data['subject'],
+'subject': xml.sax.saxutils.escape(display_data['subject']),
 }
 display_data['subject'] = (
 'http://mid.gmane.org/{message-id}";>{subject}'
 ).format(**d)
+for key in ['message-id', 'from']:
+if key in display_data:
+display_data[key] = xml.sax.saxutils.escape(display_data[key])
 return (running_data, display_data)
 
 def _slug(self, string):
-- 
1.8.5.2.8.g0f6c0d1

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


[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
whitespace between td cells.

border-radius is from CCS 3 [6,7].  I'm using it to make the colored
sections a bit less harsh.  I tried adding rounded borders to the
tbody itself doesn't work, but I couldn't get that to work without
setting the tbody's display to 'block'.  That rounded the corners, but
collapsed the cell spacing (e.g. columns were no longer aligned).
This commit's by-corner-td approach is not particularly elegant, but
it works.  The td padding entries just ensure that the cell body is
suitably far from the edges that it doesn't fall outside of the
rounded corners.

The doubled-braces are escapes from Python's str.format.

[1]: http://www.w3.org/TR/html5/tabular-data.html#the-table-element
[2]: http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
[3]: 
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#Browser_compatibility
[4]: http://www.w3.org/TR/CSS2/tables.html#propdef-border-spacing
[5]: 
https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing#Browser_compatibility
[6]: http://www.w3.org/TR/css3-background/#the-border-radius
[7]: 
https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius#Browser_compatibility
---
 devel/nmbug/nmbug-status | 56 +---
 1 file changed, 44 insertions(+), 12 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 6a156af..92552a4 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -204,19 +204,22 @@ class HtmlPage (Page):
 return
 stream.write('\n')
 for thread in threads:
+stream.write('  \n')
 for message_display_data in thread:
 stream.write((
-'\n'
-'  {date}\n'
-'  {message-id-term}\n'
-'\n'
-'\n'
-'  {from}\n'
-'  {subject}\n'
-'\n'
+'\n'
+'  {date}\n'
+'  {message-id-term}\n'
+'\n'
+'\n'
+'  {from}\n'
+'  {subject}\n'
+'\n'
 ).format(**message_display_data))
+stream.write('  \n')
 if thread != threads[-1]:
-stream.write('\n')
+stream.write(
+'  \n')
 stream.write('\n')
 
 def _message_display_data(self, *args, **kwargs):
@@ -242,8 +245,36 @@ _PAGES['html'] = HtmlPage(
 header='''
 
 
-
-Notmuch Patches
+  
+  
+  Notmuch Patches
+  
+table {{
+  border-spacing: 0;
+}}
+td {{
+  padding-left: {border_radius};
+  padding-right: {border_radius};
+}}
+tr:first-child td:first-child {{
+  border-top-left-radius: {border_radius};
+}}
+tr:first-child td:last-child {{
+  border-top-right-radius: {border_radius};
+}}
+tr:last-child td:first-child {{
+  border-bottom-left-radius: {border_radius};
+}}
+tr:last-child td:last-child {{
+  border-bottom-right-radius: {border_radius};
+}}
+tbody:nth-child(4n+1) tr td {{
+  background-color: #ffd96e;
+}}
+tbody:nth-child(4n+3) tr td {{
+  background-color: #bce;
+}}
+  
 
 
 Notmuch Patches
@@ -252,7 +283,8 @@ Generated: {date}
 For more infomation see http://notmuchmail.org/nmbug";>nmbug
 
 Views
-'''.format(date=datetime.datetime.utcnow().date()),
+'''.format(date=datetime.datetime.utcnow().date(),
+   border_radius='0.5em'),
 footer='\n\n',
 )
 
-- 
1.8.5.2.8.g0f6c0d1

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


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

2014-02-13 Thread W. Trevor King
* Wrap free text in  tags.
* Convert  to  for query strings.
* Wrap message-id-term (id:"...") in .

The  tags get nicer default markup (smaller monospace font) for
notmuch query terms [1].  The  tags don't have much effect without
attached CSS, but bare text (phrasing content [2]) in  (which
expects flow content [3,4]) feels wrong.

[1]: http://www.w3.org/TR/html5/text-level-semantics.html#the-code-element
[2]: http://www.w3.org/TR/html5/dom.html#phrasing-content-1
[3]: http://www.w3.org/TR/html5/dom.html#flow-content-1
[4]: http://www.w3.org/TR/html5/sections.html#the-body-element
---
 devel/nmbug/nmbug-status | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 9fde20e..6a156af 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -183,14 +183,18 @@ class HtmlPage (Page):
 
 def _write_view_header(self, view, stream):
 stream.write('{title}\n'.format(**view))
+stream.write('\n')
 if 'comment' in view:
 stream.write(view['comment'])
 stream.write('\n')
 for line in [
 'The view is generated from the following query:',
-'',
+'',
+'',
+'  ',
 view['query-string'],
-'',
+'  ',
+'',
 ]:
 stream.write(line)
 stream.write('\n')
@@ -204,7 +208,7 @@ class HtmlPage (Page):
 stream.write((
 '\n'
 '  {date}\n'
-'  {message-id-term}\n'
+'  {message-id-term}\n'
 '\n'
 '\n'
 '  {from}\n'
@@ -243,8 +247,10 @@ _PAGES['html'] = HtmlPage(
 
 
 Notmuch Patches
+
 Generated: {date}
 For more infomation see http://notmuchmail.org/nmbug";>nmbug
+
 Views
 '''.format(date=datetime.datetime.utcnow().date()),
 footer='\n\n',
-- 
1.8.5.2.8.g0f6c0d1

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


[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. 'Possible%20bugs'), but that
didn't work (at least with Firefox 24.2.0).  Slugging avoids any
ambiguity over when the quotes are expanded in the client.  The specs
are unclear about quoting, saying only [1]:

  Value: Any string, with the following restrictions:

must be at least one character long
must not contain any space characters

[1]: http://dev.w3.org/html5/markup/global-attributes.html#common.attrs.id
---
 devel/nmbug/nmbug-status | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 40e6896..9fde20e 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -21,6 +21,7 @@ except ImportError:  # Python 2
 import json
 import argparse
 import os
+import re
 import sys
 import subprocess
 
@@ -168,16 +169,20 @@ class Page (object):
 
 
 class HtmlPage (Page):
+_slug_regexp = re.compile('\W+')
+
 def _write_header(self, views, stream):
 super(HtmlPage, self)._write_header(views=views, stream=stream)
 stream.write('\n')
 for view in views:
+if 'id' not in view:
+view['id'] = self._slug(view['title'])
 stream.write(
-'{title}\n'.format(**view))
+'{title}\n'.format(**view))
 stream.write('\n')
 
 def _write_view_header(self, view, stream):
-stream.write('{title}\n'.format(**view))
+stream.write('{title}\n'.format(**view))
 if 'comment' in view:
 stream.write(view['comment'])
 stream.write('\n')
@@ -224,6 +229,9 @@ class HtmlPage (Page):
 ).format(**d)
 return (running_data, display_data)
 
+def _slug(self, string):
+return self._slug_regexp.sub('-', string)
+
 
 _PAGES['text'] = Page()
 _PAGES['html'] = HtmlPage(
-- 
1.8.5.2.8.g0f6c0d1

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


[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; print(locale.getpreferredencoding())'
  ANSI_X3.4-1968

Trying to print Unicode author names (and other strings) in that
encoding would crash nmbug-status with a UnicodeEncodeError.  To avoid
that, this patch hardcodes UTF-8, which can handle generic Unicode,
and is the preferred encoding (regardless of LANG settings) for
everyone who has chimed in on the list so far.  I'd prefer trusting
LANG, but in the absence of any users that prefer non-UTF-8 encodings
I'm fine with this approach.

While we could achieve the same effect on the output content by
dropping the previous patch (nmbug-status: Encode output using the
user's locale), Tomi also wanted UTF-8 hardcoded as the config-file
encoding [2].  Keeping the output encoding patch and then adding this
to hardcode both the config-file and output encodings at once seems
the easiest route, now that fd29d3f (nmbug-status: Decode Popen output
using the user's locale, 2014-02-10) has landed in master.

[1]: id="877g8z4v4x.fsf@zancas.localnet"
 http://article.gmane.org/gmane.mail.notmuch.general/17202
[2]: id="m2vbwj79lu@guru.guru-group.fi"
 http://article.gmane.org/gmane.mail.notmuch.general/17209
---
 devel/nmbug/nmbug-status | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 8cc097a..beb2af5 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -13,7 +13,6 @@ import codecs
 import collections
 import datetime
 import email.utils
-import locale
 try:  # Python 3
 from urllib.parse import quote
 except ImportError:  # Python 2
@@ -27,7 +26,7 @@ import subprocess
 import xml.sax.saxutils
 
 
-_ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding()
+_ENCODING = 'UTF-8'
 _PAGES = {}
 
 
-- 
1.8.5.2.8.g0f6c0d1

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


[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]: http://www.w3.org/TR/html5/index.html#attributes-1
---
 devel/nmbug/nmbug-status | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 873a46a..40e6896 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -177,7 +177,7 @@ class HtmlPage (Page):
 stream.write('\n')
 
 def _write_view_header(self, view, stream):
-stream.write('{title}\n'.format(**view))
+stream.write('{title}\n'.format(**view))
 if 'comment' in view:
 stream.write(view['comment'])
 stream.write('\n')
-- 
1.8.5.2.8.g0f6c0d1

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


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

2014-02-13 Thread W. Trevor King
The only changes since v2 [1] are related to our discussion of
locale-based encodings vs. hardcoded UTF-8 [2,3,and descendants].
This iteration addresses those concerns by rebasing the controversial
commit (nmbug-status: Encode output using the user's locale) to the
end of the series.  In order to address Tomi's hardcoded config
encoding request [4,5] now that fd29d3f (nmbug-status: Decode Popen
output using the user's locale, 2014-02-10) has landed in master, I
think we should keep the output locale patch (7/8 in v3) and add an
additional patch to hardcode _ENCODING (8/8 in v3).  The commit
message for 8/8 was tricky, but I think the current wording expresses
both the motivation for the hardcoded UTF-8, my acceptance of a
hardcoded UTF-8, and my personal preference for respecting LANG ;).
Suggestions for alternative wordings are welcome, especially since I
try to explain both David and Tomi's perspectives :p.

Cheers,
Trevor

[1]: id:"cover.1392056624.git.wk...@tremily.us"
 http://thread.gmane.org/gmane.mail.notmuch.general/17167
[2]: id:"87eh396e6e.fsf@zancas.localnet"
 http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17190
[3]: id:"87a9dv52h4.fsf@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 King (8):
  nmbug-status: Anchor with h3 ids instead of a names
  nmbug-status: Slug the title when using it as an id
  nmbug-status: Use  and  markup where appropriate
  nmbug-status: Color threads in HTML output
  nmbug-status: Escape &, <, and > in HTML display data
  nmbug-status: Add inter-message padding
  nmbug-status: Encode output using the user's locale
  nmbug-status: Hardcode UTF-8 instead of using the user's locale

 devel/nmbug/nmbug-status | 96 ++--
 1 file changed, 76 insertions(+), 20 deletions(-)

-- 
1.8.5.2.8.g0f6c0d1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[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; print(locale.getpreferredencoding())'
  ANSI_X3.4-1968

Trying to print Unicode author names (and other strings) in that
encoding would crash nmbug-status with a UnicodeEncodeError.  To avoid
that, this patch hardcodes UTF-8, which can handle generic Unicode,
and is the preferred encoding (regardless of LANG settings) for
everyone who has chimed in on the list so far.  I'd prefer trusting
LANG, but in the absence of any users that prefer non-UTF-8 encodings
I'm fine with this approach.

While we could achieve the same effect on the output content by
dropping the previous patch (nmbug-status: Encode output using the
user's locale), Tomi also wanted UTF-8 hardcoded as the config-file
encoding [2].  Keeping the output encoding patch and then adding this
to hardcode both the config-file and output encodings at once seems
the easiest route, now that fd29d3f (nmbug-status: Decode Popen output
using the user's locale, 2014-02-10) has landed in master.

[1]: id="877g8z4v4x.fsf at zancas.localnet"
 http://article.gmane.org/gmane.mail.notmuch.general/17202
[2]: id="m2vbwj79lu.fsf at guru.guru-group.fi"
 http://article.gmane.org/gmane.mail.notmuch.general/17209
---
 devel/nmbug/nmbug-status | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 8cc097a..beb2af5 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -13,7 +13,6 @@ import codecs
 import collections
 import datetime
 import email.utils
-import locale
 try:  # Python 3
 from urllib.parse import quote
 except ImportError:  # Python 2
@@ -27,7 +26,7 @@ import subprocess
 import xml.sax.saxutils


-_ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding()
+_ENCODING = 'UTF-8'
 _PAGES = {}


-- 
1.8.5.2.8.g0f6c0d1



[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 --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 9ad7d35..8cc097a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -90,7 +90,7 @@ class Page (object):
 byte_stream = sys.stdout.buffer
 except AttributeError:  # Python 2
 byte_stream = sys.stdout
-stream = codecs.getwriter(encoding='UTF-8')(stream=byte_stream)
+stream = codecs.getwriter(encoding=_ENCODING)(stream=byte_stream)
 self._write_header(views=views, stream=stream)
 for view in views:
 self._write_view(database=database, view=view, stream=stream)
@@ -249,7 +249,6 @@ _PAGES['html'] = HtmlPage(
 header='''
 
 
-  
   
   Notmuch Patches
   

[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* two-row message blocks.

   <--- new padding
  thread-1, message-1, row-1  (class="message-first")
  thread-1, message-1, row-2  (class="message-last")
   <--- new padding
spacer tbody with a blank row
   <--- new padding
  thread-2, message-1, row-1  (class="message-first")
  thread-2, message-1, row-2  (class="message-last")
   <--- new padding
   <--- new padding
  thread-2, message-2, row-1  (class="message-first")
  thread-2, message-2, row-2  (class="message-last")
   <--- new padding
---
 devel/nmbug/nmbug-status | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 57eec6c..9ad7d35 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -208,11 +208,11 @@ class HtmlPage (Page):
 stream.write('  \n')
 for message_display_data in thread:
 stream.write((
-'\n'
+'\n'
 '  {date}\n'
 '  {message-id-term}\n'
 '\n'
-'\n'
+'\n'
 '  {from}\n'
 '  {subject}\n'
 '\n'
@@ -256,6 +256,12 @@ _PAGES['html'] = HtmlPage(
 table {{
   border-spacing: 0;
 }}
+tr.message-first td {{
+  padding-top: {inter_message_padding};
+}}
+tr.message-last td {{
+  padding-bottom: {inter_message_padding};
+}}
 td {{
   padding-left: {border_radius};
   padding-right: {border_radius};
@@ -288,6 +294,7 @@ For more infomation see http://notmuchmail.org/nmbug";>nmbug
 
 Views
 '''.format(date=datetime.datetime.utcnow().date(),
+   inter_message_padding='0.25em',
border_radius='0.5em'),
 footer='\n\n',
 )
-- 
1.8.5.2.8.g0f6c0d1



[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 by if subjects etc. contain characters that
would otherwise be interpreted as HTML markup.

[1]: http://docs.python.org/3/library/xml.sax.utils.html#xml.sax.saxutils.escape
---
 devel/nmbug/nmbug-status | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 92552a4..57eec6c 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -24,6 +24,7 @@ import os
 import re
 import sys
 import subprocess
+import xml.sax.saxutils


 _ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding()
@@ -229,11 +230,14 @@ class HtmlPage (Page):
 if 'subject' in display_data and 'message-id' in display_data:
 d = {
 'message-id': quote(display_data['message-id']),
-'subject': display_data['subject'],
+'subject': xml.sax.saxutils.escape(display_data['subject']),
 }
 display_data['subject'] = (
 'http://mid.gmane.org/{message-id}";>{subject}'
 ).format(**d)
+for key in ['message-id', 'from']:
+if key in display_data:
+display_data[key] = xml.sax.saxutils.escape(display_data[key])
 return (running_data, display_data)

 def _slug(self, string):
-- 
1.8.5.2.8.g0f6c0d1



[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
whitespace between td cells.

border-radius is from CCS 3 [6,7].  I'm using it to make the colored
sections a bit less harsh.  I tried adding rounded borders to the
tbody itself doesn't work, but I couldn't get that to work without
setting the tbody's display to 'block'.  That rounded the corners, but
collapsed the cell spacing (e.g. columns were no longer aligned).
This commit's by-corner-td approach is not particularly elegant, but
it works.  The td padding entries just ensure that the cell body is
suitably far from the edges that it doesn't fall outside of the
rounded corners.

The doubled-braces are escapes from Python's str.format.

[1]: http://www.w3.org/TR/html5/tabular-data.html#the-table-element
[2]: http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
[3]: 
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#Browser_compatibility
[4]: http://www.w3.org/TR/CSS2/tables.html#propdef-border-spacing
[5]: 
https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing#Browser_compatibility
[6]: http://www.w3.org/TR/css3-background/#the-border-radius
[7]: 
https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius#Browser_compatibility
---
 devel/nmbug/nmbug-status | 56 +---
 1 file changed, 44 insertions(+), 12 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 6a156af..92552a4 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -204,19 +204,22 @@ class HtmlPage (Page):
 return
 stream.write('\n')
 for thread in threads:
+stream.write('  \n')
 for message_display_data in thread:
 stream.write((
-'\n'
-'  {date}\n'
-'  {message-id-term}\n'
-'\n'
-'\n'
-'  {from}\n'
-'  {subject}\n'
-'\n'
+'\n'
+'  {date}\n'
+'  {message-id-term}\n'
+'\n'
+'\n'
+'  {from}\n'
+'  {subject}\n'
+'\n'
 ).format(**message_display_data))
+stream.write('  \n')
 if thread != threads[-1]:
-stream.write('\n')
+stream.write(
+'  \n')
 stream.write('\n')

 def _message_display_data(self, *args, **kwargs):
@@ -242,8 +245,36 @@ _PAGES['html'] = HtmlPage(
 header='''
 
 
-
-Notmuch Patches
+  
+  
+  Notmuch Patches
+  
+table {{
+  border-spacing: 0;
+}}
+td {{
+  padding-left: {border_radius};
+  padding-right: {border_radius};
+}}
+tr:first-child td:first-child {{
+  border-top-left-radius: {border_radius};
+}}
+tr:first-child td:last-child {{
+  border-top-right-radius: {border_radius};
+}}
+tr:last-child td:first-child {{
+  border-bottom-left-radius: {border_radius};
+}}
+tr:last-child td:last-child {{
+  border-bottom-right-radius: {border_radius};
+}}
+tbody:nth-child(4n+1) tr td {{
+  background-color: #ffd96e;
+}}
+tbody:nth-child(4n+3) tr td {{
+  background-color: #bce;
+}}
+  
 
 
 Notmuch Patches
@@ -252,7 +283,8 @@ Generated: {date}
 For more infomation see http://notmuchmail.org/nmbug";>nmbug
 
 Views
-'''.format(date=datetime.datetime.utcnow().date()),
+'''.format(date=datetime.datetime.utcnow().date(),
+   border_radius='0.5em'),
 footer='\n\n',
 )

-- 
1.8.5.2.8.g0f6c0d1



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

2014-02-13 Thread W. Trevor King
* Wrap free text in  tags.
* Convert  to  for query strings.
* Wrap message-id-term (id:"...") in .

The  tags get nicer default markup (smaller monospace font) for
notmuch query terms [1].  The  tags don't have much effect without
attached CSS, but bare text (phrasing content [2]) in  (which
expects flow content [3,4]) feels wrong.

[1]: http://www.w3.org/TR/html5/text-level-semantics.html#the-code-element
[2]: http://www.w3.org/TR/html5/dom.html#phrasing-content-1
[3]: http://www.w3.org/TR/html5/dom.html#flow-content-1
[4]: http://www.w3.org/TR/html5/sections.html#the-body-element
---
 devel/nmbug/nmbug-status | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 9fde20e..6a156af 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -183,14 +183,18 @@ class HtmlPage (Page):

 def _write_view_header(self, view, stream):
 stream.write('{title}\n'.format(**view))
+stream.write('\n')
 if 'comment' in view:
 stream.write(view['comment'])
 stream.write('\n')
 for line in [
 'The view is generated from the following query:',
-'',
+'',
+'',
+'  ',
 view['query-string'],
-'',
+'  ',
+'',
 ]:
 stream.write(line)
 stream.write('\n')
@@ -204,7 +208,7 @@ class HtmlPage (Page):
 stream.write((
 '\n'
 '  {date}\n'
-'  {message-id-term}\n'
+'  {message-id-term}\n'
 '\n'
 '\n'
 '  {from}\n'
@@ -243,8 +247,10 @@ _PAGES['html'] = HtmlPage(
 
 
 Notmuch Patches
+
 Generated: {date}
 For more infomation see http://notmuchmail.org/nmbug";>nmbug
+
 Views
 '''.format(date=datetime.datetime.utcnow().date()),
 footer='\n\n',
-- 
1.8.5.2.8.g0f6c0d1



[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. 'Possible%20bugs'), but that
didn't work (at least with Firefox 24.2.0).  Slugging avoids any
ambiguity over when the quotes are expanded in the client.  The specs
are unclear about quoting, saying only [1]:

  Value: Any string, with the following restrictions:

must be at least one character long
must not contain any space characters

[1]: http://dev.w3.org/html5/markup/global-attributes.html#common.attrs.id
---
 devel/nmbug/nmbug-status | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 40e6896..9fde20e 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -21,6 +21,7 @@ except ImportError:  # Python 2
 import json
 import argparse
 import os
+import re
 import sys
 import subprocess

@@ -168,16 +169,20 @@ class Page (object):


 class HtmlPage (Page):
+_slug_regexp = re.compile('\W+')
+
 def _write_header(self, views, stream):
 super(HtmlPage, self)._write_header(views=views, stream=stream)
 stream.write('\n')
 for view in views:
+if 'id' not in view:
+view['id'] = self._slug(view['title'])
 stream.write(
-'{title}\n'.format(**view))
+'{title}\n'.format(**view))
 stream.write('\n')

 def _write_view_header(self, view, stream):
-stream.write('{title}\n'.format(**view))
+stream.write('{title}\n'.format(**view))
 if 'comment' in view:
 stream.write(view['comment'])
 stream.write('\n')
@@ -224,6 +229,9 @@ class HtmlPage (Page):
 ).format(**d)
 return (running_data, display_data)

+def _slug(self, string):
+return self._slug_regexp.sub('-', string)
+

 _PAGES['text'] = Page()
 _PAGES['html'] = HtmlPage(
-- 
1.8.5.2.8.g0f6c0d1



[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]: http://www.w3.org/TR/html5/index.html#attributes-1
---
 devel/nmbug/nmbug-status | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 873a46a..40e6896 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -177,7 +177,7 @@ class HtmlPage (Page):
 stream.write('\n')

 def _write_view_header(self, view, stream):
-stream.write('{title}\n'.format(**view))
+stream.write('{title}\n'.format(**view))
 if 'comment' in view:
 stream.write(view['comment'])
 stream.write('\n')
-- 
1.8.5.2.8.g0f6c0d1



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

2014-02-13 Thread W. Trevor King
The only changes since v2 [1] are related to our discussion of
locale-based encodings vs. hardcoded UTF-8 [2,3,and descendants].
This iteration addresses those concerns by rebasing the controversial
commit (nmbug-status: Encode output using the user's locale) to the
end of the series.  In order to address Tomi's hardcoded config
encoding request [4,5] now that fd29d3f (nmbug-status: Decode Popen
output using the user's locale, 2014-02-10) has landed in master, I
think we should keep the output locale patch (7/8 in v3) and add an
additional patch to hardcode _ENCODING (8/8 in v3).  The commit
message for 8/8 was tricky, but I think the current wording expresses
both the motivation for the hardcoded UTF-8, my acceptance of a
hardcoded UTF-8, and my personal preference for respecting LANG ;).
Suggestions for alternative wordings are welcome, especially since I
try to explain both David and Tomi's perspectives :p.

Cheers,
Trevor

[1]: id:"cover.1392056624.git.wking at tremily.us"
 http://thread.gmane.org/gmane.mail.notmuch.general/17167
[2]: id:"87eh396e6e.fsf at zancas.localnet"
 http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17190
[3]: id:"87a9dv52h4.fsf at zancas.localnet"
 http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17200
[4]: id:"m2sirpu46i.fsf at guru.guru-group.fi"
 http://article.gmane.org/gmane.mail.notmuch.general/17191
[5]: id:"m2vbwj79lu.fsf at guru.guru-group.fi"
 http://article.gmane.org/gmane.mail.notmuch.general/17209

W. Trevor King (8):
  nmbug-status: Anchor with h3 ids instead of a names
  nmbug-status: Slug the title when using it as an id
  nmbug-status: Use  and  markup where appropriate
  nmbug-status: Color threads in HTML output
  nmbug-status: Escape &, <, and > in HTML display data
  nmbug-status: Add inter-message padding
  nmbug-status: Encode output using the user's locale
  nmbug-status: Hardcode UTF-8 instead of using the user's locale

 devel/nmbug/nmbug-status | 96 ++--
 1 file changed, 76 insertions(+), 20 deletions(-)

-- 
1.8.5.2.8.g0f6c0d1


doc: notmuch_result_move_to_next -> notmuch_tags_move_to_next

2014-02-13 Thread David Bremner
Gaute Hope  writes:

> Greetings,
>
> another small typo in the docs. Patch attached.
>
> Cheers, Gaute
>

pushed, thanks. 

For future reference: 

- patches via git send-email are much less work to deal with

- We usually want at least one more line in the commit message beyond
  the "subject"





[PATCH] emacs: update alist for mail-archive.com API change

2014-02-13 Thread David Bremner
Jed Brown  writes:

> -("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=";)
> +("Mail Archive, The" . "http://mid.mail-archive.com/";)

the change looks reasonable, but it breaks one of the tests.

Please update the corresponding test at the same time.

d


[PATCH] emacs: update alist for mail-archive.com API change

2014-02-13 Thread Jed Brown
Searching by Message-Id no longer works via the old mail-archive.com
API, though I have contacted them in hopes that they restore it to
prevent dead links.  Anyway, the new API is cleaner.

Acked-by: Austin Clements 
---
Fixed the test.  Thanks, David.

 emacs/notmuch-show.el | 2 +-
 test/T310-emacs.sh| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1ac80ca..88752f1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -171,7 +171,7 @@ each attachment handler is logged in buffers with names 
beginning
 (defcustom notmuch-show-stash-mlarchive-link-alist
   '(("Gmane" . "http://mid.gmane.org/";)
 ("MARC" . "http://marc.info/?i=";)
-("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=";)
+("Mail Archive, The" . "http://mid.mail-archive.com/";)
 ("LKML" . "http://lkml.kernel.org/r/";)
 ;; FIXME: can these services be searched by `Message-Id' ?
 ;; ("MarkMail" . "http://markmail.org/";)
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 7dc9a8e..00ae96a 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -727,7 +727,7 @@ inbox,stashtest
 ${gen_msg_filename}
 http://mid.gmane.org/bought
 http://marc.info/?i=bought
-http://mail-archive.com/search?l=mid&q=bought
+http://mid.mail-archive.com/bought
 EOF
 test_expect_equal_file OUTPUT EXPECTED

-- 
1.8.5.4



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

2014-02-13 Thread David Bremner
"W. Trevor King"  writes:

>
> Folks on Microsoft OSes might prefer UTF-16 [1], which is a valid
> preference.
>

I see your wikipedia reference and raise you

  http://www.utf8everywhere.org/

;).

>  Should I rebase this to the end of the remaining series and resubmit?
> Then this patch can cook on the list until we find a user that doesn't
> like UTF-8 ;).
>

Sure.



[PATCH] emacs: update alist for mail-archive.com API change

2014-02-13 Thread Jed Brown
Searching by Message-Id no longer works via the old mail-archive.com
API, though I have contacted them in hopes that they restore it to
prevent dead links.  Anyway, the new API is cleaner.

Acked-by: Austin Clements 
---
Fixed the test.  Thanks, David.

 emacs/notmuch-show.el | 2 +-
 test/T310-emacs.sh| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1ac80ca..88752f1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -171,7 +171,7 @@ each attachment handler is logged in buffers with names 
beginning
 (defcustom notmuch-show-stash-mlarchive-link-alist
   '(("Gmane" . "http://mid.gmane.org/";)
 ("MARC" . "http://marc.info/?i=";)
-("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=";)
+("Mail Archive, The" . "http://mid.mail-archive.com/";)
 ("LKML" . "http://lkml.kernel.org/r/";)
 ;; FIXME: can these services be searched by `Message-Id' ?
 ;; ("MarkMail" . "http://markmail.org/";)
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 7dc9a8e..00ae96a 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -727,7 +727,7 @@ inbox,stashtest
 ${gen_msg_filename}
 http://mid.gmane.org/bought
 http://marc.info/?i=bought
-http://mail-archive.com/search?l=mid&q=bought
+http://mid.mail-archive.com/bought
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-- 
1.8.5.4

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


Re: doc: notmuch_result_move_to_next -> notmuch_tags_move_to_next

2014-02-13 Thread David Bremner
Gaute Hope  writes:

> Greetings,
>
> another small typo in the docs. Patch attached.
>
> Cheers, Gaute
>

pushed, thanks. 

For future reference: 

- patches via git send-email are much less work to deal with

- We usually want at least one more line in the commit message beyond
  the "subject"



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


Re: [PATCH] emacs: update alist for mail-archive.com API change

2014-02-13 Thread David Bremner
Jed Brown  writes:

> -("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=";)
> +("Mail Archive, The" . "http://mid.mail-archive.com/";)

the change looks reasonable, but it breaks one of the tests.

Please update the corresponding test at the same time.

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


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

2014-02-13 Thread David Bremner
"W. Trevor King"  writes:

>
> Folks on Microsoft OSes might prefer UTF-16 [1], which is a valid
> preference.
>

I see your wikipedia reference and raise you

  http://www.utf8everywhere.org/

;).

>  Should I rebase this to the end of the remaining series and resubmit?
> Then this patch can cook on the list until we find a user that doesn't
> like UTF-8 ;).
>

Sure.

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


[PATCH 1/1] emacs: always write emacs/.eldeps when the target is remade

2014-02-13 Thread Austin Clements
Quoth Tomi Ollila on Feb 13 at  9:26 am:
> On Thu, Feb 13 2014, Austin Clements  wrote:
> 
> > Quoth Tomi Ollila on Jan 25 at 12:21 pm:
> >> So that the target is newer than its prerequisites.
> >> ---
> >>  emacs/Makefile.local | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >> 
> >> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> >> index 42bfbd9..d5d402e 100644
> >> --- a/emacs/Makefile.local
> >> +++ b/emacs/Makefile.local
> >> @@ -32,8 +32,7 @@ emacs_bytecode = $(emacs_sources:.el=.elc)
> >>  ifeq ($(HAVE_EMACS),1)
> >>  $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
> >>$(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
> >> -  -f batch-make-deps $(emacs_sources) > $@.tmp && \
> >> -  (cmp -s $@.tmp $@ || mv $@.tmp $@)
> >> +  -f batch-make-deps $(emacs_sources) > $@.tmp && mv $@.tmp $@
> >>  -include $(dir)/.eldeps
> >>  endif
> >>  CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp
> >
> > Is this just so the rule doesn't get run again on the next make
> > invocation (unless, of course, a dependent changed)?
> 
> Basically yes. I did multiple builds in rapid succession when developing
> something and this thing confused me quite a lot in the beginning...
> 
> > Interestingly, if any of the dependents have changed, but in ways that
> > don't affect .eldeps, this change will make the build more expensive
> > because it will trigger a make restart after .eldeps is updated.
> 
> I wondered what was the reason for the recipe you've chosen here, has
> it something to do with inodes or something ;) (and were going to ask
> an alternative to touch (or even : > $@) the target...
> 
> ... but now I understand. E.g. change in notmuch-lib.el will cause *all* 
> .el files to be re-bytecompiled after this change. 

This is unrelated to the cmp in the recipe.  A change in
notmuch-lib.el *must* cause almost all .el files to be recompiled
because they almost all require it and may use macros from it.  If you
touch, e.g., notmuch-hello.el, you'll see that very little is rebuilt
(with or without this patch).

> An alternative to this patch would be adding a message to the rule
> which informs user to touch .eldeps to avoid re-doing .eldeps if
> that irritates one :D
> 
> something like:
> 
> (cmp -s $@.tmp $@ && \
>  echo "touch $@ to avoid redoing this target" || mv $@.tmp $@)

I think this patch is good as it is; I was just pointing out that the
change also has a performance drawback in some situations.  (Knowing
make, there's probably *some* way to get the best of both worlds and
it's probably really ugly.)

> Thanks, 
> 
> Tomi


[PATCH] emacs: update alist for mail-archive.com API change

2014-02-13 Thread Austin Clements
On Wed, 12 Feb 2014, Jed Brown  wrote:
> Searching by Message-Id no longer works via the old mail-archive.com
> API, though I have contacted them in hopes that they restore it to
> prevent dead links.  Anyway, the new API is cleaner.
> ---
>  emacs/notmuch-show.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 1ac80ca..88752f1 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -171,7 +171,7 @@ each attachment handler is logged in buffers with names 
> beginning
>  (defcustom notmuch-show-stash-mlarchive-link-alist
>'(("Gmane" . "http://mid.gmane.org/";)
>  ("MARC" . "http://marc.info/?i=";)
> -("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=";)
> +("Mail Archive, The" . "http://mid.mail-archive.com/";)
>  ("LKML" . "http://lkml.kernel.org/r/";)
>  ;; FIXME: can these services be searched by `Message-Id' ?
>  ;; ("MarkMail" . "http://markmail.org/";)
> -- 
> 1.8.5.4

LGTM.

Curiously, if you go to just http://mid.mail-archive.com/, it redirects
to http://www.mail-archive.com/search?l=mid&q=message-id%3A%5C, which
suggests to me that they did not intend to break the old URLs.  But I
agree that the new API is nicer (and produces shorter URLs).


[PATCH 1/1] emacs: always write emacs/.eldeps when the target is remade

2014-02-13 Thread Austin Clements
Quoth Tomi Ollila on Jan 25 at 12:21 pm:
> So that the target is newer than its prerequisites.
> ---
>  emacs/Makefile.local | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index 42bfbd9..d5d402e 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -32,8 +32,7 @@ emacs_bytecode = $(emacs_sources:.el=.elc)
>  ifeq ($(HAVE_EMACS),1)
>  $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
>   $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
> - -f batch-make-deps $(emacs_sources) > $@.tmp && \
> - (cmp -s $@.tmp $@ || mv $@.tmp $@)
> + -f batch-make-deps $(emacs_sources) > $@.tmp && mv $@.tmp $@
>  -include $(dir)/.eldeps
>  endif
>  CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp

Is this just so the rule doesn't get run again on the next make
invocation (unless, of course, a dependent changed)?

Interestingly, if any of the dependents have changed, but in ways that
don't affect .eldeps, this change will make the build more expensive
because it will trigger a make restart after .eldeps is updated.


[PATCH v2] new: Detect dirent.d_type support at configure time

2014-02-13 Thread Austin Clements
Support for dirent.d_type is OS-specific.  Previously, we used
_DIRENT_HAVE_D_TYPE to detect support for this, but this is apparently
a glic-ism (FreeBSD, for example, supports d_type, but does not define
this).  Since there's no cross-platform way to detect support for
dirent.d_type, detect it using a test compile at configure time.
---
This is a trivial rebase of
id:1385262952-29240-1-git-send-email-amdragon at mit.edu, which I
apparently never got around to sending.  Tomi and Jani checked off v1
of this patch, so I'm marking it ready.

 compat/have_d_type.c | 10 ++
 configure| 16 
 notmuch-new.c|  2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 compat/have_d_type.c

diff --git a/compat/have_d_type.c b/compat/have_d_type.c
new file mode 100644
index 000..9ca6c6e
--- /dev/null
+++ b/compat/have_d_type.c
@@ -0,0 +1,10 @@
+#include 
+
+int main()
+{
+struct dirent ent;
+
+(void) ent.d_type;
+
+return 0;
+}
diff --git a/configure b/configure
index 66aaedb..2eaed4a 100755
--- a/configure
+++ b/configure
@@ -578,6 +578,17 @@ else
 fi
 rm -f compat/have_timegm

+printf "Checking for dirent.d_type... "
+if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1
+then
+printf "Yes.\n"
+have_d_type="1"
+else
+printf "No (will use stat instead).\n"
+have_d_type="0"
+fi
+rm -f compat/have_d_type
+
 printf "Checking for standard version of getpwuid_r... "
 if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > 
/dev/null 2>&1
 then
@@ -769,6 +780,9 @@ HAVE_STRCASESTR = ${have_strcasestr}
 # build its own version)
 HAVE_STRSEP = ${have_strsep}

+# Whether struct dirent has d_type (if not, then notmuch will use stat)
+HAVE_D_TYPE = ${have_d_type}
+
 # Whether the Xapian version in use supports compaction
 HAVE_XAPIAN_COMPACT = ${have_xapian_compact}

@@ -829,6 +843,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
\$(GMIME_CFLAGS)  \\
   \$(VALGRIND_CFLAGS)   \\
   -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\
   -DHAVE_STRSEP=\$(HAVE_STRSEP) \\
+  -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\
   -DSTD_GETPWUID=\$(STD_GETPWUID)   \\
   -DSTD_ASCTIME=\$(STD_ASCTIME) \\
   -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\
@@ -839,6 +854,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
\$(GMIME_CFLAGS)\\
 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)   \\
 -DHAVE_STRSEP=\$(HAVE_STRSEP)   \\
+-DHAVE_D_TYPE=\$(HAVE_D_TYPE)   \\
 -DSTD_GETPWUID=\$(STD_GETPWUID) \\
 -DSTD_ASCTIME=\$(STD_ASCTIME)   \\
 -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)   \\
diff --git a/notmuch-new.c b/notmuch-new.c
index cd74489..8529fdd 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -173,7 +173,7 @@ dirent_type (const char *path, const struct dirent *entry)
 char *abspath;
 int err, saved_errno;

-#ifdef _DIRENT_HAVE_D_TYPE
+#if HAVE_D_TYPE
 /* Mapping from d_type to stat mode_t.  We omit DT_LNK so that
  * we'll fall through to stat and get the real file type. */
 static const mode_t modes[] = {
-- 
1.8.4.rc3