]> git.notmuchmail.org Git - notmuch/log
notmuch
11 years agoperformance-test/README: update instructions for fetching corpus.
David Bremner [Wed, 28 Nov 2012 21:27:00 +0000 (17:27 -0400)]
performance-test/README: update instructions for fetching corpus.

It turns out not everybody on the planet has my gpg key.

11 years agotest: Don't print 'nil' at the beginning of emacs-subject-to-filename
Austin Clements [Wed, 28 Nov 2012 04:55:38 +0000 (23:55 -0500)]
test: Don't print 'nil' at the beginning of emacs-subject-to-filename

11 years agotest: Use associative arrays to track external prereqs
Austin Clements [Wed, 28 Nov 2012 04:54:01 +0000 (23:54 -0500)]
test: Use associative arrays to track external prereqs

Previously, the test framework generated a variable name for each
external prereq as a poor man's associative array.  Unfortunately,
prereqs names may not be legal variable names, leading to
unintelligible bash errors like
  test_missing_external_prereq_emacsclient.emacs24_=t: command not found

Using proper associative arrays to track prereqs, in addition to being
much cleaner than generating variable names and using grep to
carefully construct unique string lists, removes restrictions on
prereq names.

11 years agotest: Abort driver if a test script aborts
Austin Clements [Wed, 28 Nov 2012 04:13:16 +0000 (23:13 -0500)]
test: Abort driver if a test script aborts

Previously, if a test script aborted (e.g., because it passed too few
arguments to a test function), the test driver loop would simply
continue on to the next test script and the final results would
declare that everything passed (except that the test count would look
suspiciously low, but maybe you just misremembered how many tests
there were).

Now, if a test script exits with a non-zero status and did not produce
a final results file, we propagate that failure out of the driver loop
immediately.

To keep this simple, this patch removes the PID from the test-results
file name.  This PID was inherited from the git test system and seems
unnecessary, since the file name already includes the name of the test
script and the test-results directory is created anew for each run.

11 years agotest: Make the emacsclient binary user-configurable
Austin Clements [Wed, 28 Nov 2012 03:24:59 +0000 (22:24 -0500)]
test: Make the emacsclient binary user-configurable

And require that if TEST_EMACS is specified, so is TEST_EMACSCLIENT.

Previously, the test framework always used "emacsclient", even if the
Emacs in use was overridden by TEST_EMACS.  This causes problems if
both Emacs 23 and Emacs 24 are installed, the Emacs 23 emacsclient is
the system default, but TEST_EMACS is set to emacs24.  Specifically,
with an Emacs 24 server and an Emacs 23 client, emacs tests that run
very quickly may produce no output from emacsclient, causing the test
to fail.

The Emacs server uses a very simple line-oriented protocol in which
the client sends a request to evaluate an expression and the server
sends a request to print the result of evaluation.  Prior to Emacs bzr
commit 107565 on March 11th, 2012 (released in Emacs 24.1), if
multiple commands were sent to the emacsclient between when it sent
the evaluation command and when it entered its receive loop, it would
only process the first response command, ignoring the rest of the
received buffer.  This wasn't a problem with the Emacs 23 server
because it sent only the command to print the evaluation result.
However, the Emacs 24 server first sends an unprompted command
specifying the PID of the Emacs server, then processes the evaluation
request, then sends the command to print the result.  If the
evaluation is fast enough, it can send both of these commands before
emacsclient enters the receive loop.  Hence, if an Emacs 24 server is
used with an Emacs 23 emacsclient, it may miss the response printing
command, ultimately causing intermittent notmuch test failures.

11 years agotest: Quote $output in calls to test_expect_equal
Austin Clements [Tue, 27 Nov 2012 04:58:17 +0000 (23:58 -0500)]
test: Quote $output in calls to test_expect_equal

Previously, many tests in emacs-subject-to-filename didn't quote the
$output argument to test_expect_equal.  As a result, if $output was
empty, test_expect_equal would be passed only one argument and would
abort the entire test script.  By quoting the argument, we ensure
test_expect_equal will always receive two arguments.

11 years agonew: Skip ignored broken symlinks
Austin Clements [Sun, 25 Nov 2012 05:25:45 +0000 (00:25 -0500)]
new: Skip ignored broken symlinks

We now test for user ignore patterns before attempting to determine if
a directory entry is itself a directory.  As a result, we no longer
abort for broken symlinks if the user has explicitly ignored them.

This fixes the test added in the previous patch.  It also slightly
changes the debug output checked by another test of ignores.

11 years agotest: Add a test for skipping ignored broken symlinks
Austin Clements [Sun, 25 Nov 2012 05:25:44 +0000 (00:25 -0500)]
test: Add a test for skipping ignored broken symlinks

Currently marked as broken because we abort on broken symlinks, even
if they are in the ignore list.

11 years agoemacs: less guessing of character set in messages
Tomi Ollila [Sun, 18 Nov 2012 20:06:25 +0000 (22:06 +0200)]
emacs: less guessing of character set in messages

The macro with-current-notmuch-show-message executes command
`notmuch show --format=raw id:...` which just outputs the contents
of the mail file verbatim (into temporary buffer). In case e.g. utf-8
locale is used the temporary buffer has buffer-file-coding-system as
utf-8. In this case Emacs converts the data to multibyte format, guessing
that input is in utf-8.
However, the "raw" (MIME) message may contain octet data in any other
8bit format, and as no (MIME-)content spesific handling to the message
is done at this point, conversion to other formats may lose information.
By setting coding-system-for-read 'no-conversion drops the conversion part
and makes this handle input as notmuch-get-bodypart-internal() does.
This marks the broken test in previous change fixed.

11 years agotest/emacs: test saving of attachment containing 8bit octets
Tomi Ollila [Sun, 18 Nov 2012 20:06:24 +0000 (22:06 +0200)]
test/emacs: test saving of attachment containing 8bit octets

This test catches the case 8bit octets in an attachment gets converted
or lost when saving attachment to the file.
This test is marked known broken.

11 years agolib: Reject multi-message mboxes and deprecate single-message mbox
Austin Clements [Sun, 25 Nov 2012 06:16:01 +0000 (01:16 -0500)]
lib: Reject multi-message mboxes and deprecate single-message mbox

Previously, we would treat multi-message mboxes as one giant email,
which, besides the obvious incorrect indexing, often led to
out-of-memory errors for archival mboxes.  Now we explicitly reject
multi-message mboxes.  For historical reasons, we retain support for
single-message mboxes, but official deprecate this behavior.

11 years agotest: Test for ignoring multi-message mbox
Austin Clements [Sun, 25 Nov 2012 06:16:00 +0000 (01:16 -0500)]
test: Test for ignoring multi-message mbox

This test is currently broken.  Note that its brokenness cascades and
causes the next test to fail as well (because notmuch incorrectly
indexes the mbox file).

11 years agotest: Test notmuch new for single-message mbox
Austin Clements [Sun, 25 Nov 2012 06:15:59 +0000 (01:15 -0500)]
test: Test notmuch new for single-message mbox

We support this for historical reasons.

11 years agotest: initial performance testing infrastructure
David Bremner [Sat, 17 Nov 2012 16:28:15 +0000 (12:28 -0400)]
test: initial performance testing infrastructure

This is not near as fancy as as the unit tests, on the theory that
the code should typically be crashing when performance tuning.
Nonetheless, there is plenty of room for improvement.  Several more of
the pieces of the test infrastructure (e.g. the option parsing) could
be factored out into test/test-lib-common.sh

11 years agotest: factor out part of test-lib.sh into test-lib-common.sh
David Bremner [Sat, 17 Nov 2012 20:14:41 +0000 (16:14 -0400)]
test: factor out part of test-lib.sh into test-lib-common.sh

The idea is to use some of the simpler parts of the test suite
infrastructure to help run performance tests.

11 years agonotmuch-show.el: handle the case where icalendar-import-buffer returns nil
Tomi Ollila [Thu, 8 Nov 2012 12:08:00 +0000 (14:08 +0200)]
notmuch-show.el: handle the case where icalendar-import-buffer returns nil

icalendar-import-buffer can fail by an error signal (which have been
witnessed) but according to its docstring it can also return nil
when failing (it returns t when succeeding).

Now that the error is caught by the caller of notmuch-show-inset-part-*
functions in case icalendar-import-buffer returns nil an explicit
error is signaled and unwind-protect takes care of deleting the
temporary file (just in case, it is usually not written to the fs yet).

11 years agonotmuch-show.el: import calendar data with public function after CR removal
Tomi Ollila [Thu, 8 Nov 2012 12:07:59 +0000 (14:07 +0200)]
notmuch-show.el: import calendar data with public function after CR removal

notmuch-get-bodypart-content provides raw data to its caller so
that it can be stored verbatim whenever needed. icalendar functions
expect Emacs to do EOL conversion for the data given to these. Therefore
it the CRLF -> LF conversion is now done explicitly.

The calls to private functions icalendar--convert-ical-to-diary and
icalendar--read-element are replaced with call to public function
icalendar-import-buffer.

11 years agotest: always source test-lib.sh as ./test-lib.sh
Tomi Ollila [Wed, 21 Nov 2012 15:16:14 +0000 (17:16 +0200)]
test: always source test-lib.sh as ./test-lib.sh

There are currently 45 TESTS scripts. 36 of those load
test-lib.sh using '. ./test-lib.sh' and 9 '. test-lib.sh'.

In latter case test-lib.sh is first searched from directories
in PATH (posix) and then from current directory (bash feature).

Changed the 9 files to execute '. ./test-lib.sh'. The test-lib.sh
should never be loaded from directory in PATH.

11 years agotest: Produce useful output when the HTML with images test fails
Austin Clements [Tue, 20 Nov 2012 15:58:45 +0000 (10:58 -0500)]
test: Produce useful output when the HTML with images test fails

Previously, this would simply indicate that the grep failed without
any indication of the Emacs output it failed on.  Now we take
advantage of the test framework's handling of stdout to display the
incorrect Emacs output if the test fails.

11 years agocontrib: notmuch-pick: add tests
Mark Walters [Wed, 7 Nov 2012 20:43:27 +0000 (20:43 +0000)]
contrib: notmuch-pick: add tests

The test should be run using the wrapper run-tests.sh.  This links
the tests into the normal notmuch TEST_DIRECTORY and runs them from
there. After the test is complete then the links are removed.

11 years agotest: add nontrivial test for restore --accumulate.
David Bremner [Fri, 16 Nov 2012 12:31:19 +0000 (08:31 -0400)]
test: add nontrivial test for restore --accumulate.

It seems we have never tested the case that restore --accumulate
actually adds tags. I noticed this when I started optimizing and no
tests failed.

The bracketing with "restore --input=dump.expected" are to make sure
we start in a known state, and we leave the database in a known state
for the next test.

11 years agotest: add more informative titles to restore --accumulate tests
David Bremner [Sat, 17 Nov 2012 14:18:00 +0000 (10:18 -0400)]
test: add more informative titles to restore --accumulate tests

Thanks to Ethan for the suggestion.

11 years agoFixed 2 misspellings of word 'separate'
Tomi Ollila [Fri, 16 Nov 2012 18:18:14 +0000 (20:18 +0200)]
Fixed 2 misspellings of word 'separate'

"Seperate: The second most common misspelling on the Internet..."
(from http://www.re-vision.com/spelling/separate.html).

s/seperate/separate/ in debian/NEWS.Debian & test/README done.

11 years agocontrib: pick: bugfix when trying to show a non-message
Mark Walters [Sat, 10 Nov 2012 17:02:18 +0000 (17:02 +0000)]
contrib: pick: bugfix when trying to show a non-message

If the user pressed return on the end result status line it gave a
blank message. Modify the function notmuch-pick-get-message-id to
return nil rather than an empty message-id in this case to fix this.

This also fixes a bug in the (lack of) quoting of the id string.

11 years agoUpdate notmuch-mutt requirements in README file.
Kevin J. McCarthy [Sat, 10 Nov 2012 19:06:43 +0000 (11:06 -0800)]
Update notmuch-mutt requirements in README file.

This updates the notmuch-mutt README file with requirements for the
recently added duplicate removal patch.

-Kevin

11 years agonotmuch-dump: tidy formatting
David Bremner [Thu, 15 Nov 2012 01:33:22 +0000 (21:33 -0400)]
notmuch-dump: tidy formatting

More uncrustify at work.

11 years agonotmuch-restore: tidy formatting
David Bremner [Thu, 15 Nov 2012 01:33:21 +0000 (21:33 -0400)]
notmuch-restore: tidy formatting

This is again the work of uncrustify.

I remember there is some controversy about "! foo" versus "!foo", but
in context I think "! foo" looks OK. Also, for functions "! foo
(blah)" seems better than "!foo (blah)".

11 years agonotmuch-tag: tidy formatting
David Bremner [Thu, 15 Nov 2012 01:33:20 +0000 (21:33 -0400)]
notmuch-tag: tidy formatting

This is just the result of running uncrustify.

11 years agoNEWS (for 0.15): Added note about Bcc & Reply-To headers in json output
Tomi Ollila [Fri, 16 Nov 2012 10:33:03 +0000 (12:33 +0200)]
NEWS (for 0.15): Added note about Bcc & Reply-To headers in json output

notmuch show --format json now includes Bcc and Reply-To headers of
the message. Mention that in NEWS.
(Heavily modified version of text originally from Michal Nazarewicz.)

11 years agonotmuch-restore: fix error message for extra positional parameter.
David Bremner [Thu, 15 Nov 2012 02:42:39 +0000 (22:42 -0400)]
notmuch-restore: fix error message for extra positional parameter.

Note that a single positional parameter will take this code path also,
so the old message really makes no sense anymore.

11 years agonotmuch-restore: remove extra increment of optind
David Bremner [Thu, 15 Nov 2012 02:42:38 +0000 (22:42 -0400)]
notmuch-restore: remove extra increment of optind

This is left over from when the file name was a positional parameter.

11 years agotest: Fix HTML rendering test
Austin Clements [Mon, 12 Nov 2012 01:12:07 +0000 (20:12 -0500)]
test: Fix HTML rendering test

The test designed to exercise Emacs' rendering of HTML emails
containing images inadvertently assumed w3m was available under Emacs
23.  The real point of this test was to check that Emacs 24's shr
renderer didn't crash when given img tags, so use shr if it's
available, html2text otherwise (which is built in), and do only a
simple sanity check of the result.

11 years agoemacs: Buttonize mid: links
Austin Clements [Thu, 15 Nov 2012 19:49:54 +0000 (14:49 -0500)]
emacs: Buttonize mid: links

This adds support for RFC 2392 mid: message ID links.

11 years agoemacs: Improve the regexp used to match id:'s in messages
Austin Clements [Thu, 15 Nov 2012 19:49:53 +0000 (14:49 -0500)]
emacs: Improve the regexp used to match id:'s in messages

This regexp agrees with Xapian query syntax much more closely, though
we specifically disallow various cases that would be confusing in the
context of an email body (e.g., punctuation at the end of an id: link
is not considered part of the id: link because it's probably part of
the surrounding text).

In particular, this handles id: links that are not surrounded by
quotes much better, which stash is much more likely to generate now
that we don't quote id's that don't need to be quoted.  It also
handles quoted id: links better.

We update the buttonization test to reflect the new pattern.

11 years agotest: Test buttonization of id: links
Austin Clements [Thu, 15 Nov 2012 19:49:52 +0000 (14:49 -0500)]
test: Test buttonization of id: links

This matches the current behavior of the buttonizer, so it passes, but
many of these cases are not what you'd want (and some of them aren't
even valid Xapian queries).  The next patch will fix the handling of
these cases and update the test.

11 years agotest: expand regex in test/basic
David Bremner [Sat, 10 Nov 2012 19:16:04 +0000 (15:16 -0400)]
test: expand regex in test/basic

Over time, maintaining this very long regex has become irritating,
especially when resolving conflicts.

This patch replaces the call to sed with multiple extra arguments to
find.  Since each test binary is now on it's own line, this should
make resolving conflicts easier.

11 years agodevel: Document schemata in STYLE
Austin Clements [Wed, 7 Nov 2012 15:27:02 +0000 (10:27 -0500)]
devel: Document schemata in STYLE

11 years agoshow: More aggressively document the presence of devel/schemata
Austin Clements [Wed, 7 Nov 2012 15:27:01 +0000 (10:27 -0500)]
show: More aggressively document the presence of devel/schemata

Previously, the only mention of devel/schemata was a comment at the
top of format_part_json, but the JSON output code is spread across
several functions that are distributed across notmuch-show.c.  Add
references from the other three key JSON output functions.

11 years agodevel: Add Reply-to to the schemata
Austin Clements [Wed, 7 Nov 2012 15:27:00 +0000 (10:27 -0500)]
devel: Add Reply-to to the schemata

The code got out of sync with the documentation in 7d3c06dc.

11 years agoemacs/notmuch-show.el: handle bodypart insert error
Tomi Ollila [Sun, 21 Oct 2012 13:35:09 +0000 (16:35 +0300)]
emacs/notmuch-show.el: handle bodypart insert error

When inserting of email bodypart failes, insert a failure message
to the buffer (and continue) instead of halting the insertion of
the rest of that email thread in question.

11 years agotest: add test for showing Reply-To headers
Peter Wang [Tue, 30 Oct 2012 10:12:47 +0000 (21:12 +1100)]
test: add test for showing Reply-To headers

Test that show --format=json now outputs Reply-To header fields when
present.

11 years agoshow: include Reply-To header in json output
Peter Wang [Tue, 30 Oct 2012 10:12:46 +0000 (21:12 +1100)]
show: include Reply-To header in json output

Output the Reply-To header field if present in a message.
I want to be able to see what the sender intended in my mail client,
before hitting the reply key.  Only json output is changed,
like the recently added Bcc field.

11 years agouncrustify.cfg: added 3 new types for uncrustify to know
Tomi Ollila [Fri, 2 Nov 2012 14:07:06 +0000 (16:07 +0200)]
uncrustify.cfg: added 3 new types for uncrustify to know

Added FILE, notmuch_show_params_t and sprinter_t to be
types when uncrustifying sources. This affect spacing
when uncrustify is deciding for type declaration instead
of binary multiplication operation.

11 years agotest: add tests for date:since..until range queries
Jani Nikula [Tue, 30 Oct 2012 20:32:38 +0000 (22:32 +0200)]
test: add tests for date:since..until range queries

A brief initial test set.

11 years agoNEWS: date range search support
Jani Nikula [Tue, 30 Oct 2012 20:32:40 +0000 (22:32 +0200)]
NEWS: date range search support

11 years agoman: document the date:since..until range queries
Jani Nikula [Tue, 30 Oct 2012 20:32:39 +0000 (22:32 +0200)]
man: document the date:since..until range queries

11 years agolib: add date range query support
Jani Nikula [Tue, 30 Oct 2012 20:32:37 +0000 (22:32 +0200)]
lib: add date range query support

Add a custom value range processor to enable date and time searches of
the form date:since..until, where "since" and "until" are expressions
understood by the previously added date/time parser, to restrict the
results to messages within a particular time range (based on the Date:
header).

If "since" or "until" describes date/time at an accuracy of days or
less, the values are rounded according to the accuracy, towards past
for "since" and towards future for "until". For example,
date:november..yesterday would match from the beginning of November
until the end of yesterday. Expressions such as date:today..today
means since the beginning of today until the end of today.

Open-ended ranges are supported (since Xapian 1.2.1), i.e. you can
specify date:..until or date:since.. to not limit the start or end
date, respectively.

CAVEATS:

Xapian does not support spaces in range expressions. You can replace
the spaces with '_', or (in most cases) '-', or (in some cases) leave
the spaces out altogether.

Entering date:expr without ".." (for example date:yesterday) will not
work as you might expect. You can achieve the expected result by
duplicating the expr both sides of ".." (for example
date:yesterday..yesterday).

Open-ended ranges won't work with pre-1.2.1 Xapian, but they don't
produce an error either.

Signed-off-by: Jani Nikula <jani@nikula.org>
11 years agobuild: build parse-time-string as part of the notmuch lib and static cli
Jani Nikula [Tue, 30 Oct 2012 20:32:36 +0000 (22:32 +0200)]
build: build parse-time-string as part of the notmuch lib and static cli

11 years agotest: add smoke tests for the date/time parser module
Jani Nikula [Tue, 30 Oct 2012 20:32:35 +0000 (22:32 +0200)]
test: add smoke tests for the date/time parser module

Test the date/time parser module directly, independent of notmuch,
using the parse-time test tool.

Credits to Michal Sojka <sojkam1@fel.cvut.cz> for writing most of the
tests.

11 years agotest: add new test tool parse-time for date/time parser
Jani Nikula [Tue, 30 Oct 2012 20:32:34 +0000 (22:32 +0200)]
test: add new test tool parse-time for date/time parser

Add a smoke testing tool to support testing the date/time parser
module directly and independent of the rest of notmuch.

Credits to Michal Sojka <sojkam1@fel.cvut.cz> for the stdin parsing
idea and consequent massive improvement in testability.

11 years agoparse-time-string: add a date/time parser to notmuch
Jani Nikula [Tue, 30 Oct 2012 20:32:33 +0000 (22:32 +0200)]
parse-time-string: add a date/time parser to notmuch

Add a date/time parser to notmuch, to be used for adding date range
query support for notmuch lib later on. Add the parser to a directory
of its own to make it independent of the rest of the notmuch code
base.

Signed-off-by: Jani Nikula <jani@nikula.org>
11 years agobuild: drop the -Wswitch-enum warning
Jani Nikula [Tue, 30 Oct 2012 20:32:32 +0000 (22:32 +0200)]
build: drop the -Wswitch-enum warning

-Wswitch-enum is a bit awkward if a switch statement is intended to
handle just some of the named codes of an enumeration especially, and
leave the rest to the default label.

We already have -Wall, which enables -Wswitch by default, and per GCC
documentation, "The only difference between -Wswitch and this option
[-Wswitch-enum] is that this option gives a warning about an omitted
enumeration code even if there is a default label."

Drop -Wswitch-enum to not force listing all named codes of
enumerations in switch statements that have a default label.

11 years agoemacs: Move the incremental JSON parser to notmuch-lib.el
Mark Walters [Sat, 27 Oct 2012 09:34:12 +0000 (10:34 +0100)]
emacs: Move the incremental JSON parser to notmuch-lib.el

This just moves the newly split out incremental json parser (together
with its state variables) to lib.

There should be no functional change.

11 years agoemacs: Rename incremental JSON internal variables
Mark Walters [Sat, 27 Oct 2012 09:34:11 +0000 (10:34 +0100)]
emacs: Rename incremental JSON internal variables

This patch just renames the internal variables for the JSON parser now
it is no longer specific to search mode. It also fixes up the white
space after the previous patch. There should be no functional changes.

11 years agoemacs: Split out the incremental json parser into its own function
Mark Walters [Sat, 27 Oct 2012 09:34:10 +0000 (10:34 +0100)]
emacs: Split out the incremental json parser into its own function

This patch splits out the incremental json parser into its own
function.

It moves the main logic of the parser to happen inside the parse
buffer rather than inside the results buffer, but makes sure all
results and all errors are displayed in the results buffer.

It also changes the local parser variables from being buffer
local to the results buffer to being buffer local to the parse buffer,
and sets them up automatically so the caller does not need to.

Finally to keep the diff small this patch does not fix the whitespace,
nor complete the code movement (these are done in subsequent patches)
but it should contain all the functional changes.

11 years agocontrib: add pick TODO file
Mark Walters [Sat, 27 Oct 2012 11:26:40 +0000 (12:26 +0100)]
contrib: add pick TODO file

11 years agocontrib: add pick README.
Mark Walters [Sat, 27 Oct 2012 13:38:26 +0000 (14:38 +0100)]
contrib: add pick README.

11 years agocontrib: add notmuch-pick.el file itself
Mark Walters [Sat, 27 Oct 2012 11:26:38 +0000 (12:26 +0100)]
contrib: add notmuch-pick.el file itself

This adds the main notmuch-pick.el file.

11 years agoSupport OpenBSD
Austin Clements [Wed, 24 Oct 2012 21:43:28 +0000 (17:43 -0400)]
Support OpenBSD

OpenBSD's build flags are identical to FreeBSD, except that libraries
need to be explicitly linked against libc.  No code changes are
necessary.

From: Cody Cutler <ccutler@csail.mit.edu>

11 years agoemacs: Escape tag queries suggested by tab completion
Austin Clements [Fri, 26 Oct 2012 20:18:12 +0000 (16:18 -0400)]
emacs: Escape tag queries suggested by tab completion

11 years agoemacs: Escape tag queries performed by hello
Austin Clements [Fri, 26 Oct 2012 20:18:11 +0000 (16:18 -0400)]
emacs: Escape tag queries performed by hello

11 years agoemacs: Introduce generic boolean term escaping function
Austin Clements [Fri, 26 Oct 2012 20:18:10 +0000 (16:18 -0400)]
emacs: Introduce generic boolean term escaping function

Currently, we only properly escape stashed id queries, but there are
other places where the Emacs UI constructs queries for boolean terms.
Since this escaping function is meant to be used in other places, it
avoids escaping strings that don't need escaping.

11 years agoNews for restrictions on tag names
Austin Clements [Fri, 26 Oct 2012 20:54:13 +0000 (16:54 -0400)]
News for restrictions on tag names

11 years agotag: Disallow adding malformed tags to messages
Austin Clements [Fri, 26 Oct 2012 20:54:12 +0000 (16:54 -0400)]
tag: Disallow adding malformed tags to messages

This disallows adding empty tags, since nothing but confusion follows
in their wake, and disallows adding tags that begin with "-" because
they are also confusing, the tag "-" is impossible to remove using the
CLI, and because the syntax for removing such tags conflicts with long
argument syntax.

This does not place any restrictions on what tags can be removed, as
that would make it difficult for people who have the misfortune of
already having malformed tags to remove these tags.

11 years agocontrib/nmbug/nmbug-status: combine thread messages
Tomi Ollila [Wed, 24 Oct 2012 06:59:59 +0000 (09:59 +0300)]
contrib/nmbug/nmbug-status: combine thread messages

Newer patch email containing In-Reply-To: to an email sent some time ago
(i.e. to a "thread") was not visible in that "thread" in patch view when
another patch "thread" was submitted in between. This change collects
all messages in every (notmuch-created) thread together before printing
all these threads out in a patch view.

Thanks to Ethan Glasser-Camp for initial review and suggestions with
code examples.

11 years agocontrib/nmbug/nmbug-status: added table of views
Tomi Ollila [Wed, 24 Oct 2012 06:59:58 +0000 (09:59 +0300)]
contrib/nmbug/nmbug-status: added table of views

In latest configuration quite a few long views were added to the
Notmuch Patches page. To ease navigating to the views a 'Views'
section was added to the beginning of page containing hyperlink
to every view.

11 years agonotmuch-show: include Bcc header in json output
Michal Nazarewicz [Mon, 10 Sep 2012 06:35:30 +0000 (08:35 +0200)]
notmuch-show: include Bcc header in json output

With this change, emacs users can use notmuch-message-headers
variable to configure notmuch-show display Bcc header.

11 years agotest: new: Fix intermittent test failures with --debug
Ethan Glasser-Camp [Sun, 21 Oct 2012 13:14:58 +0000 (09:14 -0400)]
test: new: Fix intermittent test failures with --debug

Although messages are created in a particular order, it seems that
when they are created on a tmpfs, they do not always come back in the
same order, leading to the same files being ignored but being output
in a different order. This causes the test to fail because the outputs
being compared are the same.

Fix the failures by sorting the output of notmuch --debug and
comparing this to a hand-sorted version of its output.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
11 years agotest/test-lib.sh: take the --background feature in smtp-dummy into use
Tomi Ollila [Tue, 18 Sep 2012 14:23:02 +0000 (17:23 +0300)]
test/test-lib.sh: take the --background feature in smtp-dummy into use

The use of --background option (instead of shell '&') ensures that
smtp-dummy is listening its server socket until execution of shell
script can continue, thus the client will always have socket where
to connect.

smtp-dummy outputs smtp_dummy_pid variable in shell assignment format;
eval'ing that output makes that variable available for the shell.

As the smtp-dummy instance is no longer child process of the script
the SIGKILL signal sent to it will ensure it is going away in case
the mail sender fails to connect to smtp-dummy.

11 years agotest/smtp-dummy: add --background option and functionality
Tomi Ollila [Tue, 18 Sep 2012 14:23:01 +0000 (17:23 +0300)]
test/smtp-dummy: add --background option and functionality

When shell executes background process using '&' the scheduling of
that new process is arbitrary. It could be that smtp-dummy doesn't
get execution time to listen() it's server socket until some other
process attempts to connect() to it. The --background option in
smtp-dummy makes it to go background *after* it started to listen
its server socket.

When --background option is used, the line "smtp_dummy_pid='<pid>'"
is printed to stdout from where shell can eval it.

11 years agotest: another test wrt ignoring user-specified files and directories
Pieter Praet [Fri, 12 Oct 2012 19:32:38 +0000 (15:32 -0400)]
test: another test wrt ignoring user-specified files and directories

Demonstrates that *every* file/directory which matches one of the values
in 'new.ignore' will be ignored, independent of its depth/location in
the mail store.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
11 years agotest-lib.sh: pass 'NOTMUCH_NEW's args down to 'notmuch new'
Pieter Praet [Sun, 19 Feb 2012 20:47:55 +0000 (21:47 +0100)]
test-lib.sh: pass 'NOTMUCH_NEW's args down to 'notmuch new'

Obviates the need to create a 'NOTMUCH_NEW' clone which runs
'notmuch new --debug'.  This will be used in a later patch.

Doesn't cause any issues for other tests.

11 years agocli: notmuch new: optionally output debug information when ignoring files/directories
Pieter Praet [Sun, 19 Feb 2012 20:47:54 +0000 (21:47 +0100)]
cli: notmuch new: optionally output debug information when ignoring files/directories

When running 'notmuch new' with the '--debug' option, output debug
information regarding explicitly ignored files and directories.

11 years agocli: add '--debug' option to 'notmuch new'
Pieter Praet [Sun, 19 Feb 2012 20:47:53 +0000 (21:47 +0100)]
cli: add '--debug' option to 'notmuch new'

This will be used in later patches to test the 'new.ignore'
config option more thoroughly.

11 years agoemacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'
Pieter Praet [Wed, 22 Feb 2012 18:43:30 +0000 (19:43 +0100)]
emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

* emacs/notmuch-show.el

  (notmuch-show-toggle-headers):
    Rename to `notmuch-show-toggle-visibility-headers'.

  (notmuch-show-mode-map):
    Update "h" binding wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers):
    Update docstring wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers-visible):
    Update docstring wrt renamed `notmuch-show-toggle-headers'.
    Also fixed a small typo.

* test/emacs:

  Update subtest wrt renamed `notmuch-show-toggle-headers':
  - "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)"

11 years agotest: emacs: new tests "notmuch-show: {, un}collapse all messages in thread"
Pieter Praet [Wed, 22 Feb 2012 18:43:29 +0000 (19:43 +0100)]
test: emacs: new tests "notmuch-show: {, un}collapse all messages in thread"

* test/emacs:

  - New subtest "notmuch-show: collapse all messages in thread":
    `notmuch-show-open-or-close-all' with prefix arg ("C-u M-RET")
    collapses all messages in thread.

  - New subtest "notmuch-show: uncollapse all messages in thread":
    `notmuch-show-open-or-close-all' without prefix arg ("M-RET")
    uncollapses all messages in thread.

11 years agotest: emacs: new tests "notmuch-show: {show, hide} message headers"
Pieter Praet [Wed, 22 Feb 2012 18:43:28 +0000 (19:43 +0100)]
test: emacs: new tests "notmuch-show: {show, hide} message headers"

* test/emacs:

  - New subtest "notmuch-show: show message headers":
    Setting `notmuch-message-headers-visible' to t causes all headers
    defined in `notmuch-message-headers' to be shown.

  - New subtest "notmuch-show: hide message headers":
    Setting `notmuch-message-headers-visible' to nil causes all headers
    defined in `notmuch-message-headers' to be hidden.
    ("Subject:" may be an exception;  See the use of `headers-start' in
    `notmuch-show-insert-msg')

  - New subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)":
    Setting `notmuch-message-headers-visible' to t causes all headers
    defined in `notmuch-message-headers' to be shown, but they can be
    hidden for the current message by running `notmuch-show-toggle-headers'.

11 years agotest: Move tests from emacs to emacs-show
Ethan Glasser-Camp [Thu, 18 Oct 2012 02:16:52 +0000 (22:16 -0400)]
test: Move tests from emacs to emacs-show

This requires changing the contents of the crypto tests, as one thread
that was marked read by the earlier tests in test/emacs is no longer
marked read.

This moves tests for:

09d19ac "test: emacs: toggle eliding of non-matching messages in
   `notmuch-show'", which should have actually read: "test: emacs:
   toggle processing of cryptographic MIME parts in `notmuch-show'".
   See commit 19ec74c5.

5ea1dbe "test: emacs: toggle eliding of non-matching messages in
  `notmuch-show'"

345faab "test: emacs: toggle thread content indentation in
  `notmuch-show'"

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
11 years agotest: handle filenames that have directories in them
Ethan Glasser-Camp [Fri, 12 Oct 2012 20:43:28 +0000 (16:43 -0400)]
test: handle filenames that have directories in them

Since $TEST_DIRECTORY is an absolute path, any filenames generated
with it will be complete paths. Only use the basename to generate
suffixes for filenames.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
11 years agotest: emacs: toggle thread content indentation in `notmuch-show'
Pieter Praet [Sun, 19 Feb 2012 20:56:30 +0000 (21:56 +0100)]
test: emacs: toggle thread content indentation in `notmuch-show'

See commit c205e8ff.

11 years agotest: emacs: toggle eliding of non-matching messages in `notmuch-show'
Pieter Praet [Sun, 19 Feb 2012 20:56:29 +0000 (21:56 +0100)]
test: emacs: toggle eliding of non-matching messages in `notmuch-show'

See commits 44a544ed866ce8b1668b66ec.

11 years agotest: emacs: toggle eliding of non-matching messages in `notmuch-show'
Pieter Praet [Wed, 17 Oct 2012 23:59:59 +0000 (19:59 -0400)]
test: emacs: toggle eliding of non-matching messages in `notmuch-show'

See commits 44a544ed866ce8b1668b66ec.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
11 years agoemacs: Work around gnus-inhibit-images bug in mm-shr
Austin Clements [Sat, 29 Sep 2012 18:03:43 +0000 (14:03 -0400)]
emacs: Work around gnus-inhibit-images bug in mm-shr

Emacs 24's mm-shr HTML email renderer fails to load gnus-art before
referencing gnus-inhibit-images, resulting in a void-variable error
when notmuch attempts to render an HTML email with inline images.
This works around this bug by advising mm-shr to load gnus-art.

mm-shr is the only function outside of gnus-art itself that references
gnus-inhibit-images, so this workaround should be correct.  If this
ever changes, hopefully they will have fixed this bug upstream first.

This fixes the "Rendering HTML mail with images" test for Emacs 24.

11 years agotest: Add a test for HTML email with inline images
Austin Clements [Sat, 29 Sep 2012 17:55:13 +0000 (13:55 -0400)]
test: Add a test for HTML email with inline images

Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
on some Linux distributions).

11 years agotest: Clear test-output output file before running Emacs tests
Austin Clements [Sat, 29 Sep 2012 17:55:12 +0000 (13:55 -0400)]
test: Clear test-output output file before running Emacs tests

Most Emacs tests end with a call to (test-output), which saves the
buffer to a filed called OUTPUT.  Previously, if the test code failed
with an exception before this call, the test framework would then
compare against the OUTPUT file from the last Emacs test, resulting in
confusing diffs.

This requires one tweak to an emacs test that made two calls to
test_emacs and expected an OUTPUT file from the first call.  We simply
reverse the order of the test_emacs calls.

11 years agoemacs: simplify point placement in notmuch-hello refresh
Jani Nikula [Sun, 30 Sep 2012 07:36:12 +0000 (10:36 +0300)]
emacs: simplify point placement in notmuch-hello refresh

notmuch-hello (called also through notmuch-hello-update, bound to '='
by default) tries to find the widget under or following point before
refresh, and put the point back to the widget afterwards. The code has
grown quite complicated, and has at least the following issues:

1) All the individual section functions have to include code to
   support point placement. If there is no such support, point is
   dropped to the search box. Only saved searches and all tags
   sections support point placement.

2) Point placement is based on widget-value. If there are two widgets
   with the same widget-value (for example a saved search with the
   same name as a tag) the point is moved to the earlier one, even if
   point was on the later one.

3) When first entering notmuch-hello notmuch-hello-target is nil, and
   point is dropped to the search box.

Moving the point to the search box is annoying because the user is
required to move the point before being able to enter key bindings.

Simplify the code by removing all point placement based on widgets, as
it does not work properly, and trying to fix that would unnecessarily
complicate the code.

Save current line and column before refresh, and restore them
afterwards. Sometimes, if notmuch-show-empty-saved-searches is nil,
and the refresh adds or removes saved searches from the list, this has
the appearance of moving the point relative to the nearest
widgets. This is a much smaller and less frequent problem than the
ones listed above.

11 years agoAvoid potentially dereferencing a NULL pointer
Justus Winter [Mon, 24 Sep 2012 15:21:20 +0000 (17:21 +0200)]
Avoid potentially dereferencing a NULL pointer

GMIME_IS_MULTIPART and GMIME_IS_MESSAGE both handle NULL pointers
gracefully, but the G_OBJECT_TYPE used in the error handling block
dereferences it without checking it first.

Fix this by checking whether parent->part is valid.

Found using the clang static analyzer.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoAnnotate internal_error with the attribute noreturn
Justus Winter [Mon, 24 Sep 2012 15:21:19 +0000 (17:21 +0200)]
Annotate internal_error with the attribute noreturn

Annotating functions that do not return with the noreturn attribute
(which is understood by both gcc and clang) prevents static analyzers
from generating false positives (internal_error is used to terminate
the process and is used extensively in error handling code paths).

Remove the return statement that was placed there to appease the
compiler. Functions annotated with noreturn are not supposed to return
any values.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoFix the COERCE_STATUS macro
Justus Winter [Mon, 24 Sep 2012 15:21:18 +0000 (17:21 +0200)]
Fix the COERCE_STATUS macro

Fix the COERCE_STATUS macro to handle _internal_error being declared
as void function.

Note that the function _internal_error does not return. Evaluating to
NOTMUCH_STATUS_SUCCESS is done purely to appease the compiler.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoExtend compat/README
Justus Winter [Mon, 24 Sep 2012 15:21:17 +0000 (17:21 +0200)]
Extend compat/README

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoProvide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE
Justus Winter [Mon, 24 Sep 2012 15:21:16 +0000 (17:21 +0200)]
Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE

This attribute is understood by gcc since version 2.5. clang provides
support for testing for function attributes using __has_attribute. For
other compilers this macro evaluates to the empty string.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoProvide a __has_attribute compatibility macro
Justus Winter [Mon, 24 Sep 2012 15:21:15 +0000 (17:21 +0200)]
Provide a __has_attribute compatibility macro

__has_attribute is defined by clang and tests whether a given function
attribute is supported by clang.

Add a compatibility macro for other compilers.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoRun `notmuch-show-hook' after setting `header-line-format'
Damien Cassou [Mon, 17 Sep 2012 16:43:28 +0000 (18:43 +0200)]
Run `notmuch-show-hook' after setting `header-line-format'

This patch makes it possible for notmuch-show hooks to change the
header line.

Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
11 years agoemacs: add support for reversing notmuch-show-mark-read tag changes
Jani Nikula [Thu, 6 Sep 2012 15:32:42 +0000 (18:32 +0300)]
emacs: add support for reversing notmuch-show-mark-read tag changes

Since marking a message as read can now be a user customized set of
tag changes, make reversing this easier. Allow a prefix argument to
notmuch-show-mark-read to reverse the marking as read, similar to the
unarchiving in notmuch-show-archive-message.

While at it, update the relevant documentation to match that of other
automatic tagging (i.e. archive and reply).

11 years agoemacs: add support for reversing notmuch-search-archive-thread tag changes
Jani Nikula [Thu, 6 Sep 2012 15:32:41 +0000 (18:32 +0300)]
emacs: add support for reversing notmuch-search-archive-thread tag changes

Since archiving a thread can now be a user customized set of tag
changes, make reversing this easier. Allow a prefix argument to
notmuch-search-archive-thread to reverse the archiving, similar to the
unarchiving in notmuch-show-archive-message.

11 years agoemacs: add support for custom tag changes on message/thread archive
Jani Nikula [Thu, 6 Sep 2012 15:32:40 +0000 (18:32 +0300)]
emacs: add support for custom tag changes on message/thread archive

Add support for customization of the tag changes that are applied when
a message or a thread is archived. Instead of hard-coded removal of
the "inbox" tag, the user can now specify a list of tag changes to
perform.

11 years agoemacs: use new tag change helper to mark messages as replied
Jani Nikula [Thu, 6 Sep 2012 15:32:39 +0000 (18:32 +0300)]
emacs: use new tag change helper to mark messages as replied

Clarify documentation while at it.

11 years agoemacs: fix notmuch-message-replied-tags defcustom type
Jani Nikula [Thu, 6 Sep 2012 15:32:38 +0000 (18:32 +0300)]
emacs: fix notmuch-message-replied-tags defcustom type

11 years agoemacs: add helper for tag change list manipulation
Jani Nikula [Thu, 6 Sep 2012 15:32:37 +0000 (18:32 +0300)]
emacs: add helper for tag change list manipulation

Add a helper to create (and optionally reverse) a list of tag changes.

11 years ago{., man}/Makefile.local: edit/remove release-checks.sh related targets
Tomi Ollila [Tue, 4 Sep 2012 14:49:13 +0000 (17:49 +0300)]
{., man}/Makefile.local: edit/remove release-checks.sh related targets

Use new target release-checks in place of verify-version-debian,
verify-version-python verify-version-manpage. This target executes
devel/release-checks.sh which does all the verifications the three
dropped targets did, and some more.