]> git.notmuchmail.org Git - notmuch/log
notmuch
10 years agotest: NOTMUCH_SKIP_TESTS accepts test names with or without Tddd- prefix
Tomi Ollila [Tue, 4 Mar 2014 20:38:21 +0000 (22:38 +0200)]
test: NOTMUCH_SKIP_TESTS accepts test names with or without Tddd- prefix

The test names assigned to NOTMUCH_SKIP_TESTS variable can now be given
with or without the Tddd- prefix for tester convenience:

The test name without Tddd -prefix stays constant even when test filenames
are renumbered.

The test name with Tddd -prefix is printed out when tests run.

10 years agotest: don't use $(dir) in recipes.
David Bremner [Sat, 8 Mar 2014 14:00:39 +0000 (10:00 -0400)]
test: don't use $(dir) in recipes.

According the semantics of make, the expansion of $(dir) in recipes
uses dynamic scope, i.e. the value at the time the recipe is run. This
means if test/Makefile.local is not the last sub-makefile included,
all heck breaks loose.

10 years agodebian: add dependency on bash-completion
David Bremner [Thu, 6 Mar 2014 12:52:02 +0000 (08:52 -0400)]
debian: add dependency on bash-completion

At some point we decided to only install bash completion for notmuch
if the bash-completion file was present. Add the corresponding debian
build dependency.

10 years agotest: Print the number of the test along with its name
Austin Clements [Tue, 4 Mar 2014 06:40:08 +0000 (01:40 -0500)]
test: Print the number of the test along with its name

Previously, we stripped the "Tnnn-" part from the test name when
printing its description at the beginning of each test.  However, this
makes it difficult to find the source script for a test (e.g., when a
test fails).  Put this prefix back.

10 years agocli: add missing \n in error message
Jani Nikula [Tue, 4 Mar 2014 16:51:54 +0000 (18:51 +0200)]
cli: add missing \n in error message

The error messages returned by illegal_tag() don't contain newlines.

10 years agotest: add tests for invalid new.tags
Jani Nikula [Sun, 23 Feb 2014 16:55:23 +0000 (18:55 +0200)]
test: add tests for invalid new.tags

Similar tests for both notmuch new and insert.

10 years agocli: make sure notmuch new and insert don't add invalid tags
Jani Nikula [Sun, 23 Feb 2014 16:55:22 +0000 (18:55 +0200)]
cli: make sure notmuch new and insert don't add invalid tags

Check new.tags configuration values before doing anything, and bail
out on invalid values.

10 years agocli: export function for illegal tag checking
Jani Nikula [Sun, 23 Feb 2014 16:55:21 +0000 (18:55 +0200)]
cli: export function for illegal tag checking

This lets us check for forbidden tags consistently across the cli. No
functional changes.

10 years agoemacs: use the originating buffer's working directory for pipe
Jani Nikula [Sat, 1 Mar 2014 13:17:50 +0000 (15:17 +0200)]
emacs: use the originating buffer's working directory for pipe

Currently notmuch-show-pipe-message runs the command in the working
directory of the *notmuch-pipe* buffer if it exists, and the current
buffer's working directory (which is inherited to the new
*notmuch-pipe* buffer) otherwise. This is all very surprising to the
user, and it's difficult to know or change where the command will be
run.

Always use the current show buffer's working directory for piping. The
user can check that with M-x pwd and change it with M-x cd. This is
consistent with notmuch-show-pipe-part.

10 years agoemacs: Simplify and fix `notmuch-mua-prompt-for-sender'
Austin Clements [Thu, 27 Feb 2014 18:10:54 +0000 (13:10 -0500)]
emacs: Simplify and fix `notmuch-mua-prompt-for-sender'

`notmuch-mua-prompt-for-sender' is over-engineered and often wrong.
It attempts to detect when all identities have the same name and
specialize the prompt to just the email address part.  However, to do
this it uses `mail-extract-address-components', which is meant for
displaying email addresses, not general-purpose parsing, and hence
performs many canonicalizations that can interfere with this use.  For
example, configuring notmuch-identities to ("Austin
<austin@example.com>"), will cause `notmuch-mua-prompt-for-sender' to
lose the name part entirely and return " <austin@example.com>".

This patch rewrites `notmuch-mua-prompt-for-sender' to simply prompt
for a full identity when notmuch-identities is configured, or to
prompt for a sender address when it isn't.

The original code also did several strange things, like using `eval'
and specifying that this function was interactive.  As a side-effect,
this patch fixes these problems.  And it adds a docstring.

10 years agoNEWS: note closing of id:87ty19pi85.fsf@zancas.localnet
David Bremner [Mon, 3 Mar 2014 12:48:33 +0000 (08:48 -0400)]
NEWS: note closing of id:87ty19pi85.fsf@zancas.localnet

Also close the original debian bug.

10 years agodebian: note closing of debian bug 739556
David Bremner [Mon, 3 Mar 2014 12:36:37 +0000 (08:36 -0400)]
debian: note closing of debian bug 739556

This one doesn't seem NEWS-worthy.

10 years agoNEWS: note closing of bug id:87wqhcxb5j.fsf@maritornes.cs.unb.ca
David Bremner [Mon, 3 Mar 2014 12:25:04 +0000 (08:25 -0400)]
NEWS: note closing of bug id:87wqhcxb5j.fsf@maritornes.cs.unb.ca

This is also/originally Debian bug 737496, so close that too.

10 years agoMerge tag 'debian/0.17-5'
David Bremner [Mon, 3 Mar 2014 12:10:51 +0000 (08:10 -0400)]
Merge tag 'debian/0.17-5'

uploaded to unstable

10 years agodebian: fix typo in postinst (Debian bug 740325), clean up empty directory debian/0.17-5
David Bremner [Sun, 2 Mar 2014 11:36:34 +0000 (07:36 -0400)]
debian: fix typo in postinst (Debian bug 740325), clean up empty directory

Try to remove the directory /0755 ; if that fails assume it has
something in it to preserve.

10 years agotest: Simplify CLEAN list construction
Austin Clements [Tue, 25 Feb 2014 19:18:59 +0000 (14:18 -0500)]
test: Simplify CLEAN list construction

Construct as much of the CLEAN list from TEST_BINARIES as possible,
rather than duplicating this information by hand.

10 years agocli: command line option parser cleanup
Jani Nikula [Mon, 24 Feb 2014 21:36:58 +0000 (23:36 +0200)]
cli: command line option parser cleanup

Reduce the indentation for clarity. No functional changes.

10 years agoemacs: remove newlines from input to notmuch count --batch
David Bremner [Sat, 8 Feb 2014 14:25:17 +0000 (10:25 -0400)]
emacs: remove newlines from input to notmuch count --batch

Since a newline starts a new query in batch mode, this causes
mysterious crashes in the emacs interface if saved searches contain
newlines.  See the discussion at

      id:87wqhcxb5j.fsf@maritornes.cs.unb.ca

In general newlines seem to be just whitespace to the xapian query
parser, so this should be mainly harmless.

10 years agoman: escape backslash in notmuch-tag example
David Bremner [Sat, 15 Feb 2014 03:24:58 +0000 (23:24 -0400)]
man: escape backslash in notmuch-tag example

The example was originally intended to have a literal backslash in it, but
'\ ' is interpreted by nroff as a non-breaking space.

It doesn't make much difference to the example, but the non-breaking
space triggers a bug in doclifter.

10 years agoemacs: Fix `notmuch-user-other-email' when no other emails are configured
Austin Clements [Thu, 20 Feb 2014 19:16:36 +0000 (14:16 -0500)]
emacs: Fix `notmuch-user-other-email' when no other emails are configured

Thanks to the previous patch, this no longer crashes in this
situation, but now would return ("").  Fix it to return () when no
emails are configured.

10 years agoemacs: Fix exception when fetching empty or unconfigured settings
Austin Clements [Thu, 20 Feb 2014 19:16:35 +0000 (14:16 -0500)]
emacs: Fix exception when fetching empty or unconfigured settings

When "notmuch config" is called with the name of an empty or
unconfigured setting, it prints nothing (not even a new line).
Previously, `notmuch-config-get' assumed it would always print a
newline.  As a result, when `notmuch-config-get' was called with the
name of an empty of unconfigured setting, it would attempt to
(substring "" 0 -1) to strip the newline, which would fail with a
(args-out-of-range "" 0 -1) exception.

Fix this by only stripping the newline if there actually is one.

10 years agoemacs: Build forwarded message buffer more directly
Austin Clements [Thu, 20 Feb 2014 19:16:34 +0000 (14:16 -0500)]
emacs: Build forwarded message buffer more directly

Previously, we used `message-forward' to build forwarded messages, but
this function is simply too high-level to be a good fit for some of
what we do.

First, since `message-forward' builds a full forward message buffer
given the message to forward, we have to duplicate much of the logic
in `notmuch-mua-mail' to patch the notmuch-y things into the built
buffer.

Second, `message-forward' constructs the From header from
user-full-name and user-mail-address.  As a result, if we prompt the
user for an identity, we have to parse it into name and address
components, just to have it put back together by `message-forward'.
This process is not entirely loss-less because
`mail-extract-address-components' does a lot of canonicalization
(since it's intended for displaying addresses, not for parsing them).

To fix these problems, don't use `message-forward' at all.
`message-forward' itself is basically just a call to `message-mail'
and `message-forward-make-body'.  Do this ourselves, but call
`notmuch-mua-mail' instead of `message-mail' so we can directly build
a notmuch-y message and control the From header.

This also fixes a bug that was a direct consequence of our use of
`mail-extract-address-components': if the user chose an identity that
had no name part (or the name part matched the mailbox), we would bind
user-full-name to nil, which would cause an exception in the bowels of
message-mode because user-full-name is expected to always be a string
(even if it's just "").

10 years agoman: fix typo in notmuch.1
David Bremner [Sat, 22 Feb 2014 01:22:46 +0000 (21:22 -0400)]
man: fix typo in notmuch.1

Fix for Debian bug 739556

10 years agoruby bindings message: docstring typo
Gaute Hope [Thu, 30 Jan 2014 19:11:51 +0000 (20:11 +0100)]
ruby bindings message: docstring typo

10 years agonmbug-status: replace __values__() with values() in OrderedDict stub
Tomi Ollila [Tue, 18 Feb 2014 18:34:52 +0000 (20:34 +0200)]
nmbug-status: replace __values__() with values() in OrderedDict stub

Python dict() object does not have __values__() function which
OrderedDict().values() (the stub provided in nmbug-status) could call
to provide ordered list of values. By renaming this thinko to
values() will make our stub work as expected -- dict items listed out
in order those were added to the dictionary.

10 years agoemacs: Avoid rebuilding .eldeps even when there's nothing to do
Austin Clements [Thu, 20 Feb 2014 04:24:24 +0000 (23:24 -0500)]
emacs: Avoid rebuilding .eldeps even when there's nothing to do

Previously, we updated .eldeps only if the file contents actually
needed to change.  This was done to avoid unnecessary make restarts
(if the .eldeps rule changes the mtime of .eldeps, make has to restart
to collect the new dependencies).  However, this meant that, after a
modification to any .el file that did not change dependencies, .eldeps
would always be out of date, so every make invocation would run the
.eldeps rule, which is both expensive because it starts up Emacs and
noisy.  This was true even when there was nothing to do.  E.g.,

$ make clean && make
...
$ touch emacs/notmuch-lib.el && make
...
$ make
Use "make V=1" to see the verbose compile lines.
EMACS emacs/.eldeps
make: Nothing to be done for `all'.
$ make
Use "make V=1" to see the verbose compile lines.
EMACS emacs/.eldeps
make: Nothing to be done for `all'.

Fix this by replacing .eldeps with two files with identical content.
One tracks the mtime of the dependency information and triggers the
Emacs call to rebuild dependencies only when it may be necessary.  The
other tracks the content only; this rule over-triggers in the same way
the old rule did, but this rule is cheap and quiet.

10 years agoMerge tag 'debian/0.17-4'
David Bremner [Sat, 22 Feb 2014 01:05:05 +0000 (21:05 -0400)]
Merge tag 'debian/0.17-4'

uploaded to Debian unstable

10 years agochangelog stanza for 0.17-4 debian/0.17-4
David Bremner [Wed, 19 Feb 2014 01:38:55 +0000 (21:38 -0400)]
changelog stanza for 0.17-4

10 years agodebian: update ruby binary extension install path
David Bremner [Wed, 19 Feb 2014 01:05:14 +0000 (21:05 -0400)]
debian:  update ruby binary extension install path

From Christian Hofstaedler, Debian bug 739120:

When ruby-defaults > 1:2.0 will be uploaded to sid, the version of
Ruby provided by the 'ruby' and 'ruby-dev' packages will change to
version 2.0.  This version change includes a change to the path for
binary extensions.

This patch works for Ruby 1.9.1 as well as Ruby 2.0, so it's safe to
apply now.

10 years agoemacs: update alist for mail-archive.com API change
Jed Brown [Thu, 13 Feb 2014 15:04:22 +0000 (08:04 -0700)]
emacs: update alist for mail-archive.com API change

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 <amdragon@MIT.EDU>
10 years agonmbug-status: Hardcode UTF-8 instead of using the user's locale
W. Trevor King [Fri, 14 Feb 2014 16:48:55 +0000 (08:48 -0800)]
nmbug-status: Hardcode UTF-8 instead of using the user's locale

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.fsf@guru.guru-group.fi"
     http://article.gmane.org/gmane.mail.notmuch.general/17209

10 years agonmbug-status: Encode output using the user's locale
W. Trevor King [Fri, 14 Feb 2014 16:48:54 +0000 (08:48 -0800)]
nmbug-status: Encode output using the user's locale

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
;).

10 years agonmbug-status: Add inter-message padding
W. Trevor King [Fri, 14 Feb 2014 16:48:53 +0000 (08:48 -0800)]
nmbug-status: Add inter-message padding

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

10 years agonmbug-status: Color threads in HTML output
W. Trevor King [Fri, 14 Feb 2014 16:48:52 +0000 (08:48 -0800)]
nmbug-status: Color threads in HTML output

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

10 years agonew: Detect dirent.d_type support at configure time
Austin Clements [Thu, 13 Feb 2014 06:50:59 +0000 (01:50 -0500)]
new: Detect dirent.d_type support at configure time

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.

10 years agonmbug-status: Escape &, <, and > in HTML display data
W. Trevor King [Thu, 13 Feb 2014 16:47:20 +0000 (08:47 -0800)]
nmbug-status: Escape &, <, and > in HTML display data

'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

10 years agonmbug-status: Use <code> and <p> markup where appropriate
W. Trevor King [Thu, 13 Feb 2014 16:47:18 +0000 (08:47 -0800)]
nmbug-status: Use <code> and <p> markup where appropriate

* Wrap free text in <p> tags.
* Convert <blockquote> to <p><code> 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 content [2]) in <body> (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

10 years agonmbug-status: Slug the title when using it as an id
W. Trevor King [Thu, 13 Feb 2014 16:47:17 +0000 (08:47 -0800)]
nmbug-status: Slug the title when using it as an id

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

10 years agonmbug-status: Anchor with h3 ids instead of a names
W. Trevor King [Thu, 13 Feb 2014 16:47:16 +0000 (08:47 -0800)]
nmbug-status: Anchor with h3 ids instead of a names

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

10 years agodoc: notmuch_result_move_to_next -> notmuch_tags_move_to_next
Gaute Hope [Sun, 9 Feb 2014 10:50:48 +0000 (11:50 +0100)]
doc: notmuch_result_move_to_next -> notmuch_tags_move_to_next

Fix typo in docs.

10 years agonmbug-status: Convert from XHTML 1.0 to HTML 5
W. Trevor King [Mon, 10 Feb 2014 18:40:34 +0000 (10:40 -0800)]
nmbug-status: Convert from XHTML 1.0 to HTML 5

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/
  --2014-02-02 21:20:39--  http://nmbug.tethera.net/status/
  Resolving nmbug.tethera.net... 87.98.215.224
  Connecting to nmbug.tethera.net|87.98.215.224|:80... connected.
  HTTP request sent, awaiting response...
    HTTP/1.1 200 OK
    Vary: Accept-Encoding
    Content-Type: text/html
  ...

This also matches the Content-Type in the generated HTML's http-equiv
meta.

[1]: http://www.w3.org/TR/html5/dom.html#the-lang-and-xml:lang-attributes

10 years agonmbug-status: Normalize table HTML indentation
W. Trevor King [Mon, 10 Feb 2014 18:40:33 +0000 (10:40 -0800)]
nmbug-status: Normalize table HTML indentation

I don't think I've ever seen '</td><td>{value}\n' before :p.  The new
formatting avoids mixing tag levels and content across lines.

10 years agonmbug-status: Add an OrderedDict stub for Python 2.6
W. Trevor King [Mon, 10 Feb 2014 18:40:32 +0000 (10:40 -0800)]
nmbug-status: Add an OrderedDict stub for Python 2.6

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.  Once we reach a point where Python
2.6 is no longer important (it's already out of it's security-fix
window [1]), we can pull this stub back out.

[1]: http://www.python.org/download/releases/2.6.9/

10 years agonmbug-status: Add Page and HtmlPage for modular rendering
W. Trevor King [Mon, 10 Feb 2014 18:40:31 +0000 (10:40 -0800)]
nmbug-status: Add Page and HtmlPage for modular rendering

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 it should also be easier to build other
renderers if folks want to customize the layout for other projects.

Timezones
=========

This commit has not effect on the output, except that some dates have
been converted from the sender's timezone to UTC due to:

  -            val = m.get_header(header)
  -            ...
  -            if header == 'date':
  -                val = str.join(' ', val.split(None)[1:4])
  -                val = str(datetime.datetime.strptime(val, '%d %b %Y').date())
  ...
  +                value = str(datetime.datetime.utcfromtimestamp(
  +                    message.get_date()).date())

I also tweaked the HTML header date to be utcnow instead of the local
now() to make all times independent of the generator's local time.
This matches Gmane, which converts all Date headers to UTC (although
they use a 'GMT' suffix).  Notmuch uses
g_mime_utils_header_decode_date to calculate the UTC timestamps, but
uses a NULL tz_offset which drops the information we'd need to get
back to the sender's local time [1].  With the generator's local time
arbitrarily different from the sender's and viewer's local time,
sticking with UTC seems the best bet.

[1]: https://developer.gnome.org/gmime/stable/gmime-gmime-utils.html#g-mime-utils-header-decode-date

10 years agonmbug-status: Add a Python-3-compatible urllib.parse.quote import
W. Trevor King [Mon, 10 Feb 2014 18:40:30 +0000 (10:40 -0800)]
nmbug-status: Add a Python-3-compatible urllib.parse.quote import

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

10 years agonmbug-status: Consolidate HTML header printing
W. Trevor King [Mon, 10 Feb 2014 18:40:29 +0000 (10:40 -0800)]
nmbug-status: Consolidate HTML header printing

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

10 years agonmbug-status: Don't require write access
W. Trevor King [Mon, 10 Feb 2014 18:40:28 +0000 (10:40 -0800)]
nmbug-status: Don't require write access

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 last):
    File "./nmbug-status", line 182, in <module>
      db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)
    File "/…/notmuch/database.py", line 154, in __init__
      self.open(path, mode)
    File "/…/notmuch/database.py", line 214, in open
      raise NotmuchError(status)
  notmuch.errors.XapianError

10 years agonmbug-status: Consolidate functions and main code
W. Trevor King [Mon, 10 Feb 2014 18:40:27 +0000 (10:40 -0800)]
nmbug-status: Consolidate functions and main code

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 instead of a module-level
  global.  The list -> tuple conversion avoids having a mutable
  default argument, which makes some people jumpy ;).

* Made 'db' a print_view argument instead of relying on the global
  namespace to access it from print_view.

10 years agonmbug-status: Add metavars for --config and --get-query
W. Trevor King [Mon, 10 Feb 2014 18:40:26 +0000 (10:40 -0800)]
nmbug-status: Add metavars for --config and --get-query

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]
                      [--get-query GET_QUERY]

10 years agonmbug-status: Factor config-loading out into read_config
W. Trevor King [Mon, 10 Feb 2014 18:40:25 +0000 (10:40 -0800)]
nmbug-status: Factor config-loading out into read_config

By isolating this peripheral handling, we make the core logic of
nmbug-status easier to read.

10 years agonmbug-status: Decode Popen output using the user's locale
W. Trevor King [Mon, 10 Feb 2014 18:40:24 +0000 (10:40 -0800)]
nmbug-status: Decode Popen output using the user's locale

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.  On Python 2, this conversion is str -> unicode; on
Python 3 it is bytes -> str.

_ENCODING is derived from the user's locale (or system default) in an
attempt to match Git's output encoding.  It may be more robust to skip
the encoding/decoding by using a Python wrapper like pygit2 [1] for
Git access.  That's a fairly heavy dependency though, and using the
locale will probably work.

[1]: http://www.pygit2.org/

10 years agonmbug-status: Use email.utils instead of rfc822
W. Trevor King [Mon, 10 Feb 2014 18:40:23 +0000 (10:40 -0800)]
nmbug-status: Use email.utils instead of rfc822

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

10 years agonmbug-status: Convert to Python-3-compatible print functions
W. Trevor King [Mon, 10 Feb 2014 18:40:22 +0000 (10:40 -0800)]
nmbug-status: Convert to Python-3-compatible print functions

We shouldn't require folks to install Python 2 to run nmbug-status.

10 years agoemacs: initialize ido(-completing-read) in emacs 23.[123]
Tomi Ollila [Mon, 27 Jan 2014 20:23:37 +0000 (22:23 +0200)]
emacs: initialize ido(-completing-read) in emacs 23.[123]

Otherwise `ido-completing-read' will freeze after PROMPT is displayed.

10 years agocompletion: bash completion for notmuch new --quiet option
Jani Nikula [Sun, 2 Feb 2014 12:49:09 +0000 (14:49 +0200)]
completion: bash completion for notmuch new --quiet option

notmuch new now has --quiet option, complete it too.

10 years agoconfigure: only install bash completion if supported
Jani Nikula [Sun, 2 Feb 2014 16:47:57 +0000 (18:47 +0200)]
configure: only install bash completion if supported

Our bash completion depends on bash-completion 1.90 or later. Only
install where available.

10 years agoemacs: ad-activate 'mm-shr after ad-disable-advice 'mm-shr
Tomi Ollila [Mon, 27 Jan 2014 20:32:12 +0000 (22:32 +0200)]
emacs: ad-activate 'mm-shr after ad-disable-advice 'mm-shr

Imitated from "Enabling advice" in Emacs lisp manual...

ad-disable-advice by itself only changes the enable flag for a
piece of advice. To make the change take effect in the
advised definition, the advice needs to be activated again.

10 years agotest: add basic tests for notmuch new --quiet option
Jani Nikula [Sun, 26 Jan 2014 18:58:46 +0000 (20:58 +0200)]
test: add basic tests for notmuch new --quiet option

This does not cover all the possible paths notmuch new could output
stuff, but it's better than nothing.

10 years agoemacs: add notmuch-assert-cli-sane to notmuch-hello
David Bremner [Sun, 26 Jan 2014 18:44:27 +0000 (14:44 -0400)]
emacs: add notmuch-assert-cli-sane to notmuch-hello

This is meant to be the friendly entrypoint, so let's do something
better than the mangled output described in

       id:5228989D.8030607@fifthhorseman.net

10 years agoemacs: add function notmuch-assert-cli-sane
David Bremner [Sun, 26 Jan 2014 18:36:37 +0000 (14:36 -0400)]
emacs: add function notmuch-assert-cli-sane

If the CLI seems borked, signal an error, and log a suggestion for the
user about how to recover.

10 years agoemacs: add a function to heuristically test if the CLI is configured OK.
David Bremner [Sun, 26 Jan 2014 18:13:48 +0000 (14:13 -0400)]
emacs: add a function to heuristically test if the CLI is configured OK.

We cache the result so that we can call the function many places
without worrying about the cost.

10 years agoman: document notmuch new --quiet option
Jani Nikula [Sun, 19 Jan 2014 20:32:28 +0000 (22:32 +0200)]
man: document notmuch new --quiet option

10 years agocli: add --quiet option to notmuch new
Jani Nikula [Sun, 19 Jan 2014 20:32:27 +0000 (22:32 +0200)]
cli: add --quiet option to notmuch new

Tie it to --verbose (resulting in verbosity levels of quiet, normal,
and verbose) but leave --debug orthogonal. Do some drive-by cleaning
while at it.

10 years agocli: abstract notmuch new result printing
Jani Nikula [Sun, 19 Jan 2014 20:32:26 +0000 (22:32 +0200)]
cli: abstract notmuch new result printing

The notmuch_new_command() function has grown huge, chop it up a
bit. This should also be helpful when adding a --quiet option to
notmuch new. No functional changes.

10 years agocli: for loop is more customary
Jani Nikula [Sun, 19 Jan 2014 20:32:25 +0000 (22:32 +0200)]
cli: for loop is more customary

With the happy day stop condition within the while, it was
confusing. Switch to the paradigm for loop. No functional changes.

10 years agocli: use dirent_type in count_files too
Jani Nikula [Sun, 19 Jan 2014 20:32:24 +0000 (22:32 +0200)]
cli: use dirent_type in count_files too

Avoid an extra stat per file, if possible, also when counting the
files for initial indexing.

10 years agocli: only check the ignore list if needed
Jani Nikula [Sun, 19 Jan 2014 20:32:23 +0000 (22:32 +0200)]
cli: only check the ignore list if needed

Premature optimization is the root of all evil, but this is simple
enough.

10 years agocli: extract single message addition in notmuch new to clarify code
Jani Nikula [Sun, 19 Jan 2014 20:32:22 +0000 (22:32 +0200)]
cli: extract single message addition in notmuch new to clarify code

The add_files() function has grown huge, chop it up a bit. No
functional changes.

10 years agolib: update documentation for notmuch_database_get_directory
David Bremner [Sat, 25 Jan 2014 03:07:43 +0000 (23:07 -0400)]
lib: update documentation for notmuch_database_get_directory

Clarify that using the directory after destroying the corresponding
database is not permitted.

This is implicit in the description of notmuch_database_destroy, but
it doesn't hurt to be explicit, and we do express similar "ownership"
relationships at other places in the docs.

10 years agobuild: delete the default .SUFFIXES
Tomi Ollila [Sat, 25 Jan 2014 12:33:55 +0000 (14:33 +0200)]
build: delete the default .SUFFIXES

All implicit rules in notmuch Makefiles are "pattern rules"; Deleting the
default suffixes (to support obsolete, old-fashioned "suffix rules") from
make reduces the output of 'make -d' by 40 to 90 percent, helping e.g.
debugging make problems.

10 years agonotmuch-show: detect NULL pointer returned from notmuch_query_search_threads
David Bremner [Thu, 23 Jan 2014 12:24:01 +0000 (08:24 -0400)]
notmuch-show: detect NULL pointer returned from notmuch_query_search_threads

We want to return an error status, not 0 or (worse) segfault.

10 years agolib: make notmuch_threads_valid return FALSE when passed NULL
David Bremner [Thu, 23 Jan 2014 12:24:00 +0000 (08:24 -0400)]
lib: make notmuch_threads_valid return FALSE when passed NULL

Without this patch, the example code in the header docs crashes for certain
invalid queries (see id:871u00oimv.fsf@approx.mit.edu)

10 years agotest: add known broken test exit code of notmuch show
David Bremner [Thu, 23 Jan 2014 12:23:59 +0000 (08:23 -0400)]
test: add known broken test exit code of notmuch show

This test catches a segfault on a syntactically invalid query. It also
catches a problem with my initial fix, which still returned 0.

10 years agoman: update notmuch-dump man page for new default.
David Bremner [Thu, 23 Jan 2014 13:02:47 +0000 (09:02 -0400)]
man: update notmuch-dump man page for new default.

Actually the previous default was not documented explicitely.  I moved
the batch-tag section first because it seemed that the formats were
previously documented in order default, other.

10 years agonotmuch dump: default to batch-tag format.
David Bremner [Thu, 23 Jan 2014 13:02:46 +0000 (09:02 -0400)]
notmuch dump: default to batch-tag format.

Although we didn't formally deprecate the old format, the new one has
been available for a year.

10 years agocli: abstract common config get/set code
Jani Nikula [Fri, 17 Jan 2014 16:38:58 +0000 (18:38 +0200)]
cli: abstract common config get/set code

Pretty straightforward abstraction similar to get/set list.

10 years agolib: fix error handling
Tomi Valkeinen [Tue, 19 Nov 2013 05:10:31 +0000 (07:10 +0200)]
lib: fix error handling

Currently if a Xapian exception happens in notmuch_message_get_header,
the exception is not caught leading to crash. In
notmuch_message_get_date the exception is caught, but an internal error
is raised, again leading to crash.

This patch fixes the error handling by making both functions catch the
Xapian exceptions, print an error and return NULL or 0.

The 'notmuch->exception_reported' is also set, as is done elsewhere,
even if I don't really get the idea of that field.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
10 years agocli: close config and do talloc report also on errors
Jani Nikula [Fri, 10 Jan 2014 21:28:54 +0000 (23:28 +0200)]
cli: close config and do talloc report also on errors

Seems like the sensible thing to do.

10 years agocli: clean up exit status code returned by the cli commands
Jani Nikula [Fri, 10 Jan 2014 21:28:53 +0000 (23:28 +0200)]
cli: clean up exit status code returned by the cli commands

Apart from the status codes for format mismatches, the non-zero exit
status codes have been arbitrary. Make the cli consistently return
either EXIT_SUCCESS or EXIT_FAILURE.

10 years agoemacs: tree: use tag-format-tags
Mark Walters [Sat, 11 Jan 2014 21:49:52 +0000 (21:49 +0000)]
emacs: tree: use tag-format-tags

Previously tree did not use tag-format-tags: since tree wants to
distinguish matching messages from non-matching messages it is not a
perfect fit.

However, in preparation for allowing tag-changes to be shown (i.e.,
added or deleted tags to be indicated) it is convenient to make all
places displaying tags call the same routines.

We modify notmuch-tag-format-tags slightly so that it can take and
argument for the default characteristics of the face before the
special tag features are applied.

This also means that things like the star symbol for flagged messages
all work in tree.

10 years agoemacs: tree: default face for matching/non-matching messages
Mark Walters [Sat, 11 Jan 2014 21:41:42 +0000 (21:41 +0000)]
emacs: tree: default face for matching/non-matching messages

This adds default faces for matching and non-matching messages. This
makes it easier for a user to do broad customization without having to
customize every field. It also fits more neatly with the next patch
which switches to using notmuch-tag-format-tags for tag formatting.

We set the field specific face customization to nil for all the fields
which use the message default face to make it clear to a user which
fields customizations are being used.

10 years agotest: leave T\d\d\d- in variable $this_test and introduce $this_test_bare
Tomi Ollila [Wed, 15 Jan 2014 19:02:03 +0000 (21:02 +0200)]
test: leave T\d\d\d- in variable $this_test and introduce $this_test_bare

Script `notmuch-test` expects the results file have T\d\d\d- part
intact so the results files (and some test output files) are now
name as such.
Without this change `notmuch-test` will exit in case the test
script it was executing exited with nonzero value.

The T\d\d\d- part is dropped in new variable $this_test_bare which is
used in progress informational messages and when loading .el files in
emacs tests (whenever $this_test_bare.el exists).

10 years agolib: fix clang compiler warning
Jani Nikula [Fri, 17 Jan 2014 16:21:05 +0000 (18:21 +0200)]
lib: fix clang compiler warning

With some combination of clang and talloc, not using the return value
of talloc_steal() produces a warning. Ignore it, as talloc_steal() has
no failure modes per documentation.

10 years agotest: add test for syntax of emacs test library
David Bremner [Sun, 12 Jan 2014 00:10:21 +0000 (20:10 -0400)]
test: add test for syntax of emacs test library

If there is a syntax error in the emacs test library, it causes other
tests to hang or crash without a useful error message.

This test could be eliminated if the error reporting for emacs tests
was somehow improved.

10 years agocli: initialize quiet variable in compact
Jani Nikula [Fri, 10 Jan 2014 20:23:09 +0000 (22:23 +0200)]
cli: initialize quiet variable in compact

Surprisingly there's no compiler warning!

10 years agotest: renamed test scripts to format T\d\d\d-name.sh
Tomi Ollila [Thu, 9 Jan 2014 15:18:59 +0000 (17:18 +0200)]
test: renamed test scripts to format T\d\d\d-name.sh

All test scripts to be executed are now named as T\d\d\d-name.sh,
numers in increments of 10.

This eases adding new tests and developers to see which are test scripts
that are executed by test suite and in which order.

10 years agotest: basic: drop 'ensure all available tests are run'
Tomi Ollila [Thu, 9 Jan 2014 15:18:58 +0000 (17:18 +0200)]
test: basic: drop 'ensure all available tests are run'

When naming test scripts in format 'T\d\d\d-name.sh' the list of
tests to run are created dynamically. This makes test

'Ensure that all available tests will be run by notmuch-test'

in test/basic obsolete.

10 years agoemacs: tree remove comma separator tags
Mark Walters [Thu, 19 Dec 2013 19:12:23 +0000 (19:12 +0000)]
emacs: tree remove comma separator tags

Previously the tags on each line in tree view were separarted by ", "
not just " ". This is different from show and search views.

This patch removes this comma. This is a large patch as essentially
every line of each of the expected outputs in the tree tests needs
updating.

Apart from aesthetic reasons this simplifies the switch to
notmuch-tag-format-tags in the next patch.

10 years agobuild: remove trailing '/.' when doing mkdir -p .deps/.
Tomi Ollila [Sun, 3 Nov 2013 14:05:35 +0000 (16:05 +0200)]
build: remove trailing '/.' when doing mkdir -p .deps/.

When make variable $@ does not contain directory part, $(@D)
resolves as '.'. In this case .deps/$(@D) is '.deps/.'
In some systems `mkdir [-p] directory/.` fails.
To make this compatible with more system substitute trailing
'/.' (slashdot) with '' (empty string) whenever it occurs there.

10 years agoemacs: Makefile.local: HAVE_EMACS usage fixes
Tomi Ollila [Tue, 27 Aug 2013 19:00:47 +0000 (22:00 +0300)]
emacs: Makefile.local: HAVE_EMACS usage fixes

If we don't have emacs, disable targets that used EMACS while doing
the recipes of that target.

If we do have emacs, make install-emacs depend on *.elc files,
as making the target will attempt to install those.

10 years agoMerge tag 'debian/0.17-3'
David Bremner [Sun, 12 Jan 2014 23:56:25 +0000 (19:56 -0400)]
Merge tag 'debian/0.17-3'

uploaded to Debian unstable

10 years agodebian: add single-debian-patch
David Bremner [Sun, 12 Jan 2014 12:55:00 +0000 (08:55 -0400)]
debian: add single-debian-patch

The point of fancy patch systems is to share things with upstream. We
have met the upstream and he is us.

10 years agodebian: finalize changelog for 0.17-3
David Bremner [Sun, 12 Jan 2014 12:53:28 +0000 (08:53 -0400)]
debian: finalize changelog for 0.17-3

10 years agotest/emacs: replace the use of process-attributes with signal-process
David Bremner [Sat, 11 Jan 2014 17:25:39 +0000 (13:25 -0400)]
test/emacs: replace the use of process-attributes with signal-process

In some environments (at least Hurd), process-attributes is
unimplimented and always returns nil.  This ends up causing test
failures (see e.g. id:87a9ffofsc.fsf@zancas.localnet).

Historically and according to POSIX 1003.1-2001, a signal of 0 can be
used to check the validity of a pid. This seems less heinous than
parsing the output of ps(1).

10 years agodebian: update notmuch-emacs for emacs policy 2.0.6
David Bremner [Sun, 12 Jan 2014 03:05:33 +0000 (23:05 -0400)]
debian: update notmuch-emacs for emacs policy 2.0.6

This involves
- the meta-flavour emacs has gone away
- a compat file is needed (also installed by dh_installemacsen)
- a conflict with pre-2.0.0 emacsen-common
- manually managing the "installed" semaphore file

10 years agolib: modify notmuch.h for automatic document generation
Jani Nikula [Wed, 1 Jan 2014 17:52:54 +0000 (19:52 +0200)]
lib: modify notmuch.h for automatic document generation

Minimal changes to produce a sensible result.

10 years agodevel: add doxygen configuration file
Jani Nikula [Wed, 1 Jan 2014 17:52:53 +0000 (19:52 +0200)]
devel: add doxygen configuration file

This is a pretty basic config to get started, generated using 'doxygen
-s -g' and mildly tweaked.

To generate the library man page man/man3/notmuch.3 from lib/notmuch.h
use:

$ doxygen devel/doxygen.cfg

10 years agoinsert: respect maildir.synchronize_flags
Jani Nikula [Wed, 1 Jan 2014 15:20:14 +0000 (17:20 +0200)]
insert: respect maildir.synchronize_flags

Don't synchronize maildir flags if the user doesn't want it.

10 years agotest: notmuch insert with maildir.synchronize_flags=false
Jani Nikula [Wed, 1 Jan 2014 15:20:13 +0000 (17:20 +0200)]
test: notmuch insert with maildir.synchronize_flags=false

Known broken, notmuch insert does not respect the config option.

10 years agoemacs: tree: bare-id in tree
Mark Walters [Thu, 19 Dec 2013 19:16:51 +0000 (19:16 +0000)]
emacs: tree: bare-id in tree

Previously notmuch-tree-get-message-id always returned the id
including the prefix "id:". Modify the function to take an optional
`bare' argument saying to return the raw string.

This will be useful later and brings the function in line with
notmuch-show-get-message-id.