]> git.notmuchmail.org Git - notmuch/log
notmuch
11 years agonotmuch-restore: use debug version of talloc_strndup
David Bremner [Mon, 17 Dec 2012 03:14:42 +0000 (23:14 -0400)]
notmuch-restore: use debug version of talloc_strndup

This gives line numbers for better debugging.

11 years agoutil: add talloc-extra.[ch]
David Bremner [Mon, 17 Dec 2012 03:12:51 +0000 (23:12 -0400)]
util: add talloc-extra.[ch]

These are intended to be simple wrappers to provide slightly better
debugging information than what talloc currently provides natively.

11 years agoCLI: add talloc leak report, controlled by an environment variable.
David Bremner [Mon, 17 Dec 2012 03:08:49 +0000 (23:08 -0400)]
CLI: add talloc leak report, controlled by an environment variable.

The argument handling in notmuch.c seems due for an overhaul, but
until then use an environment variable to specify a location to write
the talloc leak report to.  This is only enabled for the (interesting)
case where some notmuch subcommand is invoked.

11 years agonotmuch-tag.1: tidy synopsis formatting, reference
David Bremner [Tue, 25 Dec 2012 19:42:45 +0000 (15:42 -0400)]
notmuch-tag.1: tidy synopsis formatting, reference

Consistently use [...]; one less space. Use singular <search-term>

11 years agoparse_tag_line: use enum for return value.
David Bremner [Tue, 25 Dec 2012 19:42:37 +0000 (15:42 -0400)]
parse_tag_line: use enum for return value.

This is essentially cosmetic, since success=0 is promised by
the comments in tag-utils.h.

11 years agocontrib: pick: close message pane when quitting from show in the message pane
Mark Walters [Tue, 25 Dec 2012 11:47:17 +0000 (11:47 +0000)]
contrib: pick: close message pane when quitting from show in the message pane

We add a hook to the show buffer in the message window to close the
message window when that buffer quits.  It checks that the
message-window is still displaying the show-message buffer and then
closes it.

11 years agoNEWS for emacs part visibility change
Mark Walters [Tue, 25 Dec 2012 11:10:21 +0000 (11:10 +0000)]
NEWS for emacs part visibility change

Wording suggested by Austin.

11 years agoperf-test: add memory leak test for dump restore
David Bremner [Sun, 16 Dec 2012 18:14:13 +0000 (14:14 -0400)]
perf-test: add memory leak test for dump restore

In id:87vcc2q5n2.fsf@nikula.org, Jani points out a memory leak in the
current version of the sup restore code. Among other things, this test
is intended to verify a fix for that leak.

11 years agoperf-test: initial version of memory test infrastructure.
David Bremner [Sun, 16 Dec 2012 12:33:17 +0000 (08:33 -0400)]
perf-test: initial version of memory test infrastructure.

The idea is run some code under valgrind --leak-check=full and report
a summary, leaving the user to peruse the log file if they want.

We go to some lengths to preserve the log files from accidental
overwriting; the full corpus takes about 3 hours to run under valgrind
on my machine.

The naming of the log directories may be slightly controversial; in
the unlikely event of two runs in less than a second, the log will be
overwritten. A previous version with mktemp+timestamp was dismissed as
overkill; just mktemp alone does not sort nicely.

One new test is included, to check notmuch new for memory leaks.

11 years agoperf-test: rename current tests as "time tests"
David Bremner [Sun, 16 Dec 2012 14:55:51 +0000 (10:55 -0400)]
perf-test: rename current tests as "time tests"

This is almost entirely renaming files, except for updating a few
references to those file names, and changing the makefile target.

A new set of memory tests will be run separately because they take
much longer.

11 years agoperf-test: remove redundant "initial notmuch new"
David Bremner [Sun, 16 Dec 2012 17:24:00 +0000 (13:24 -0400)]
perf-test: remove redundant "initial notmuch new"

The initial notmuch-new and caching are now done automatically by
time_start

11 years agocontrib: pick: slightly tweak running search and pick from pick buffer
Mark Walters [Sat, 8 Dec 2012 12:44:34 +0000 (12:44 +0000)]
contrib: pick: slightly tweak running search and pick from pick buffer

Previously running search or pick from the pick buffer did not close
the message pane (if open). This meant that then new search ends up in
a very small window. Fix this so that the message pane is
shut. However, make it so that the pane is shut after the search
string is entered in case the user is basing the search on something
in the current message.

11 years ago_notmuch_message_index_file: unref (free) address lists from gmime.
David Bremner [Tue, 11 Dec 2012 03:33:40 +0000 (23:33 -0400)]
_notmuch_message_index_file: unref (free) address lists from gmime.

Apparently as of GMime 2.4, you don't need to call
internet_address_list_destroy anymore, but you still need to call
g_object_unref (from the GMime Changelog).

On the medium performance corpus, valgrind shows "possibly lost"
leakage in "notmuch new" dropping from 7M to 300k.

11 years agolib/message-file.c: use g_malloc () & g_free () in hash table values
Tomi Ollila [Fri, 21 Dec 2012 17:52:01 +0000 (19:52 +0200)]
lib/message-file.c: use g_malloc () & g_free () in hash table values

The message->headers hash table values get data returned by
g_mime_utils_header_decode_text ().

The pointer returned by g_mime_utils_header_decode_text is from the
following line in rfc2047_decode_tokens

        return g_string_free (decoded, FALSE);

The docs for g_string_free say

 Frees the memory allocated for the GString. If free_segment is TRUE
 it also frees the character data. If it's FALSE, the caller gains
 ownership of the buffer and must free it after use with g_free().

The remaining frees and allocations referencing to message->headers hash
values have been changed to use g_free and g_malloc functions.

This combines and completes the changes started by David Bremner.

11 years agoNEWS: emacs: hello point placement, tagging customization, thread id stashing
Jani Nikula [Fri, 21 Dec 2012 23:18:02 +0000 (01:18 +0200)]
NEWS: emacs: hello point placement, tagging customization, thread id stashing

11 years agoNEWS: notmuch search --format=text0
Jani Nikula [Fri, 21 Dec 2012 23:18:01 +0000 (01:18 +0200)]
NEWS: notmuch search --format=text0

11 years agonotmuch-restore: allocate a temporary talloc context for each line parsed.
David Bremner [Sun, 16 Dec 2012 20:05:58 +0000 (16:05 -0400)]
notmuch-restore: allocate a temporary talloc context for each line parsed.

This lets the high level code in notmuch restore be ignorant about
what the lower level code is doing as far as allocating memory.

11 years agotag-utils: use the tag_opt_list_t as talloc context, if possible.
David Bremner [Sun, 16 Dec 2012 19:58:15 +0000 (15:58 -0400)]
tag-utils: use the tag_opt_list_t as talloc context, if possible.

The memory usage discipline of tag_op_list_t is never to free the
internal array of tag operations before freeing the whole list, so it
makes sense to take advantage of hierarchical de-allocation by talloc.

By not relying on the context passed into tag_parse_line, we can allow
tag_op_list_t structures to live longer than that context.

11 years agonotmuch-restore: fix return value propagation
David Bremner [Sun, 16 Dec 2012 20:04:21 +0000 (16:04 -0400)]
notmuch-restore: fix return value propagation

Previously notmuch_restore_command returned 0 if tag_message returned
a non-zero (failure) value. This is wrong, since non-zero status
indicates something mysterious went wrong with retrieving the message,
or applying it.

There was also a failure to check or propagate the return value from
tag_op_list_apply in tag_message.

11 years agoemacs: show: set default show-all-multipart/alternatives to nil
Mark Walters [Tue, 18 Dec 2012 19:28:00 +0000 (19:28 +0000)]
emacs: show: set default show-all-multipart/alternatives to nil

Now that the invisibility display of parts is present we no longer
need to force the display of all multipart/alternatives: users can
toggle them for themselves when needed.

11 years agoemacs: show: add invisibility button action
Mark Walters [Tue, 18 Dec 2012 19:27:59 +0000 (19:27 +0000)]
emacs: show: add invisibility button action

This adds a button action to show hidden parts. In this version "RET"
toggles the visibility of any part which puts content in the buffer
(as opposed to attachments such as application/pdf).

The button is used to hide parts when appropriate (eg text/html in
multipart/alternative).

11 years agoemacs: show: add overlays for each part
Mark Walters [Tue, 18 Dec 2012 19:27:58 +0000 (19:27 +0000)]
emacs: show: add overlays for each part

This makes notmuch-show-insert-bodypart add an overlay for any
non-trivial part with a button header (currently the first text/plain
part does not have a button). At this point the overlay is available
to the button but there is no action using it yet.

In addition the argument HIDE is passed down to
notmuch-show-insert-part-overlays to request that the part be hidden
by default but this is not acted on yet.

11 years agoemacs: show: modify insert-part-header to save the button text
Mark Walters [Tue, 18 Dec 2012 19:27:57 +0000 (19:27 +0000)]
emacs: show: modify insert-part-header to save the button text

This just make notmuch-show-insert-part-header save the basic button
text for parts as an attribute. This makes it simpler for the button
action (added in a later patch) to reword the label as appropriate (eg
append "(not shown)" or not as appropriate).

11 years agoemacs: Eliminate buffer invisibility specs from show and wash
Austin Clements [Tue, 18 Dec 2012 06:40:10 +0000 (01:40 -0500)]
emacs: Eliminate buffer invisibility specs from show and wash

Previously, all visibility in show buffers for headers, message
bodies, and washed text was specified by generating one or more
symbols for each region and creating overlays with their 'invisible
property set to carefully crafted combinations of these symbols.
Visibility was controlled not by modifying the overlays directly, but
by adding and removing the generated symbols from a gigantic buffer
invisibilty spec.

This has myriad negative consequences.  It's slow because Emacs'
display engine has to traverse the buffer invisibility list for every
overlay and, since every overlay has its own symbol, this makes
rendering O(N^2) in the number of overlays.  It composes poorly
because symbol-type 'invisible properties are taken from the highest
priority overlay over a given character (which is often ambiguous!),
rather than being gathered from all overlays over a character.  As a
result, we have to include symbols related to message hiding in the
wash code lest the wash overlays un-hide parts of hidden messages.  It
also requires various workarounds for isearch to properly open
overlays, to set up buffer-invisibility-spec for
remove-from-invisibility-spec to work right, and to explicitly refresh
the display after updating the buffer invisibility spec.

None of this is necessary.

This patch converts show and wash to use simple boolean 'invisible
properties and to not use the buffer invisibility spec.  Rather than
adding and removing generated symbols from the invisibility spec, the
code now directly toggles the 'invisible property of the appropriate
overlay.  This speeds up rendering because the display engine only has
to check the boolean values of the overlays over a character.  It
composes nicely because text will be invisible if *any* overlay over
it has 'invisible t, which means we can overlap invisibility overlays
with abandon.  We no longer need any of the workarounds mentioned
above.  And it fixes a minor bug for free: now, when isearch opens a
washed region, the button text will update to say "Click/Enter to
hide" rather than remaining unchanged.

11 years agonews: Promote some things to a general section
Austin Clements [Tue, 18 Dec 2012 20:15:40 +0000 (15:15 -0500)]
news: Promote some things to a general section

Date range search may be implemented as a library change, but it's an
important user-facing change that affects all notmuch usage.  Tag name
restrictions aren't as important, but they affect both the CLI
interface and the Emacs interface.

11 years agoNews for changes from Austin Clements
Austin Clements [Tue, 18 Dec 2012 20:15:39 +0000 (15:15 -0500)]
News for changes from Austin Clements

I fear I've fallen behind on my NEWS duties.

11 years agopython: remove now unused import of module sys
Justus Winter [Fri, 21 Dec 2012 13:23:54 +0000 (14:23 +0100)]
python: remove now unused import of module sys

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agopython: remove functions that have been marked as deprecated in 0.14
Justus Winter [Fri, 21 Dec 2012 09:41:29 +0000 (10:41 +0100)]
python: remove functions that have been marked as deprecated in 0.14

Removes Message.{format,print}_messages.

This code adds functionality at the python level that is unlikely to
be useful for anyone. Furthermore the python bindings strive to be a
thin wrapper around libnotmuch. The code has been marked as deprecated
in 0.14 and is now removed.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agopython: remove Database.db_p
Justus Winter [Fri, 21 Dec 2012 09:37:54 +0000 (10:37 +0100)]
python: remove Database.db_p

The function has been marked as deprecated in 0.14 and is now removed.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoman: document notmuch search --format=text0
Jani Nikula [Sun, 16 Dec 2012 22:05:13 +0000 (00:05 +0200)]
man: document notmuch search --format=text0

11 years agotest: notmuch search --format=text0
Jani Nikula [Sun, 16 Dec 2012 22:05:12 +0000 (00:05 +0200)]
test: notmuch search --format=text0

11 years agocli: add --format=text0 to notmuch search
Jani Nikula [Sun, 16 Dec 2012 22:05:11 +0000 (00:05 +0200)]
cli: add --format=text0 to notmuch search

Add new format text0, which is otherwise the same as text, but use the
null character as separator instead of the newline character. This is
similar to find(1) -print0 option, and works together with the
xargs(1) -0 option.

11 years agosprinter: add text0 formatter for null character separated text
Jani Nikula [Sun, 16 Dec 2012 22:05:10 +0000 (00:05 +0200)]
sprinter: add text0 formatter for null character separated text

Same as the text formatter, but with each field separated by a null
character rather than a newline character.

11 years agosprinter: clarify separator documentation
Jani Nikula [Sun, 16 Dec 2012 22:05:09 +0000 (00:05 +0200)]
sprinter: clarify separator documentation

For text printers, the separator is a syntactic element.

11 years agocontrib: pick: Do not indent messages in the message pane
Mark Walters [Sun, 9 Dec 2012 20:30:19 +0000 (20:30 +0000)]
contrib: pick: Do not indent messages in the message pane

Currently pick just uses notmuch-show to display messages in the
message pane: this means that they get indented just as show
would. However, since pick is only displaying one message at a time
there is no need to indent so override the indentation.

11 years agotest: conform to content length, encoding fields
Peter Wang [Sat, 15 Dec 2012 03:06:45 +0000 (14:06 +1100)]
test: conform to content length, encoding fields

Update tests to expect content-length and content-transfer-encoding
fields in show --format=json output, for leaf parts with omitted body
content.

11 years agoshow: indicate length, encoding of omitted body content
Peter Wang [Sat, 15 Dec 2012 23:24:23 +0000 (10:24 +1100)]
show: indicate length, encoding of omitted body content

If a leaf part's body content is omitted, return the encoded length and
transfer encoding in --format=json output.  This information may be used
by the consumer, e.g. to decide whether to download a large attachment
over a slow link.

Returning the _encoded_ content length is more efficient than returning
the _decoded_ content length.  Returning the transfer encoding allows
the consumer to estimate the decoded content length.

11 years agoshow: indicate charset for all omitted parts
Peter Wang [Sat, 15 Dec 2012 23:22:50 +0000 (10:22 +1100)]
show: indicate charset for all omitted parts

Write a "charset" field for all omitted parts for which it is applicable,
not only text/html parts. Factor out the code to a separate function.
It will be extended with more fields next.

11 years agotest: normalize only message filenames in show json
Peter Wang [Sat, 15 Dec 2012 03:06:42 +0000 (14:06 +1100)]
test: normalize only message filenames in show json

notmuch_json_show_sanitize replaced "filename" field values even in part
structures, where the value is predictable.  Make it only normalize the
filename value if it is an absolute path (begins with slash), which is
true of the Maildir filenames that were intended to be normalized away.

11 years agoemacs: Use --format-version for search, show, and reply
Austin Clements [Sun, 16 Dec 2012 03:17:29 +0000 (22:17 -0500)]
emacs: Use --format-version for search, show, and reply

11 years agoemacs: Special handling for version mismatch errors
Austin Clements [Sun, 16 Dec 2012 03:17:28 +0000 (22:17 -0500)]
emacs: Special handling for version mismatch errors

Since Emacs has more semantic information, we suppress the generic
format version error from the CLI and give a more informative error.

11 years agotest: Sanity tests for the --format-version argument
Austin Clements [Sun, 16 Dec 2012 03:17:27 +0000 (22:17 -0500)]
test: Sanity tests for the --format-version argument

11 years agoreply: Support --format-version
Austin Clements [Sun, 16 Dec 2012 03:17:26 +0000 (22:17 -0500)]
reply: Support --format-version

11 years agoshow: Support --format-version
Austin Clements [Sun, 16 Dec 2012 03:17:25 +0000 (22:17 -0500)]
show: Support --format-version

11 years agosearch: Support --format-version
Austin Clements [Sun, 16 Dec 2012 03:17:24 +0000 (22:17 -0500)]
search: Support --format-version

11 years agocli: Framework for structured output versioning
Austin Clements [Sun, 16 Dec 2012 03:17:23 +0000 (22:17 -0500)]
cli: Framework for structured output versioning

Currently there is a period of pain whenever we make
backward-incompatible changes to the structured output format, which
discourages not only backward-incompatible improvements to the format,
but also backwards-compatible additions that may not be "perfect".  In
the end, these problems limit experimentation and innovation.

This series of patches introduces a way for CLI callers to request a
specific format version on the command line and to determine if the
CLI does not supported the requested version (and perhaps present a
useful diagnostic to the user).  Since the caller requests a format
version, it's also possible for the CLI to support multiple
incompatible versions simultaneously, unlike the alternate approach of
including version information in the output.

This patch lays the groundwork by introducing a versioning convention,
standard exit codes, and a utility function to check the requested
version and produce standardized diagnostic messages and exit
statuses.

11 years agotest: Test search's handling of subprocess errors
Austin Clements [Sat, 15 Dec 2012 20:04:20 +0000 (15:04 -0500)]
test: Test search's handling of subprocess errors

11 years agoemacs: Use unified error handling in search
Austin Clements [Sat, 15 Dec 2012 20:04:19 +0000 (15:04 -0500)]
emacs: Use unified error handling in search

This slightly changes the output of an existing test since we now
report non-zero exits with a pop-up buffer instead of at the end of
the search results.

11 years agotest: Test show's handling of subprocess errors
Austin Clements [Sat, 15 Dec 2012 20:04:18 +0000 (15:04 -0500)]
test: Test show's handling of subprocess errors

11 years agoemacs: Improve error handling for notmuch-call-notmuch-json
Austin Clements [Sat, 15 Dec 2012 20:04:17 +0000 (15:04 -0500)]
emacs: Improve error handling for notmuch-call-notmuch-json

This checks for non-zero exit status from JSON CLI calls and pops up
an error buffer with stderr and stdout.  A consequence of this is that
show and reply now handle errors, rather than ignoring them.

11 years agoemacs: Factor out synchronous notmuch JSON invocations
Austin Clements [Sat, 15 Dec 2012 20:04:16 +0000 (15:04 -0500)]
emacs: Factor out synchronous notmuch JSON invocations

Previously this code was duplicated between show and reply.  This
factors out synchronously invoking notmuch and parsing the output as
JSON.

11 years agoemacs: Use unified error handling in notmuch-call-notmuch-process
Austin Clements [Sat, 15 Dec 2012 20:04:15 +0000 (15:04 -0500)]
emacs: Use unified error handling in notmuch-call-notmuch-process

This makes notmuch-call-notmuch-process use the unified CLI error
handling, which basically refines the error handling this function
already did.

11 years agoemacs: Centralize notmuch command error handling
Austin Clements [Sat, 15 Dec 2012 20:04:14 +0000 (15:04 -0500)]
emacs: Centralize notmuch command error handling

This provides library functions for unified handling of errors from
the notmuch CLI.  Follow-up patches will convert some scattered error
handling to use this and add error handling where we currently ignore
errors.

11 years agocontrib: pick: archive message updated
Mark Walters [Sat, 8 Dec 2012 12:41:34 +0000 (12:41 +0000)]
contrib: pick: archive message updated

Update pick's archive message to respect notmuch-archive-tags. Also
split archive message into an archiving part and a separate
"then-next" part, to move more inline with show. Update the keybinding
so default behaviour is unchanged.

11 years agoemacs: Fix bug in resynchronizing after a JSON parse error
Austin Clements [Fri, 14 Dec 2012 15:07:35 +0000 (10:07 -0500)]
emacs: Fix bug in resynchronizing after a JSON parse error

Previously, if the input stream consisted only of an error message,
notmuch-json-begin-compound would signal a (wrong-type-argument
number-or-marker-p nil) error when reaching the end of the error
message.  This happened because notmuch-json-scan-to-value would think
that it reached a value and put the parser into the 'value state.
Even after notmuch-json-begin-compound signaled the syntax error, the
parser would remain in this state and when the resynchronization logic
reached the end of the buffer, the parser would fail because the
'value state indicates that characters are available.

This fixes this problem by restoring the parser's previous state if it
encounters a syntax error.

11 years agoperf-test: use nmbug tags in dump-restore tests
David Bremner [Thu, 6 Dec 2012 02:12:16 +0000 (22:12 -0400)]
perf-test: use nmbug tags in dump-restore tests

This makes the tag set a bit less trivial.

Note that if you use the small corpus, this is not so interesting (and
is also a bit noisy) since the messages will not be found. In the
future this could be checked for.

Conflicts:
performance-test/01-dump-restore

11 years agoperf-test: split basic into 00-new, 01-dump-restore, and 02-tag
David Bremner [Thu, 6 Dec 2012 01:34:30 +0000 (21:34 -0400)]
perf-test: split basic into 00-new, 01-dump-restore, and 02-tag

We use the new "time_start" function to restore the database from cache
if possible.

11 years agoperf-test: unpack tags.
David Bremner [Tue, 4 Dec 2012 02:59:56 +0000 (22:59 -0400)]
perf-test: unpack tags.

There is only one set of tags, independant of the size of message
corpus chosen.

11 years agoperf-test: bump corpus version to 0.3
David Bremner [Tue, 4 Dec 2012 02:58:18 +0000 (22:58 -0400)]
perf-test: bump corpus version to 0.3

The new version ships with some tags, and an updated archive of the
notmuch mailing list.

11 years agoperf-test: update README
David Bremner [Wed, 5 Dec 2012 12:48:50 +0000 (08:48 -0400)]
perf-test: update README

Describe new argument parsing and mention cache handling routines.

11 years agoperf-test: add caching of xapian database
David Bremner [Mon, 3 Dec 2012 12:48:53 +0000 (08:48 -0400)]
perf-test: add caching of xapian database

The caching and uncaching seem to be necessarily manual, as timing the
initial notmuch new is one of our goals with this suite.

11 years agoperf-test: cache unpacked corpus
David Bremner [Mon, 3 Dec 2012 12:13:31 +0000 (08:13 -0400)]
perf-test: cache unpacked corpus

Unpacking is not really the expensive step (compared to the initial
notmuch new), but this is a pre-requisite to caching the database.

11 years agoperf-test: optionally print description for each group of tests
David Bremner [Thu, 6 Dec 2012 01:41:44 +0000 (21:41 -0400)]
perf-test: optionally print description for each group of tests

Output from tests is indented slightly in the same style as the
correctness tests.

11 years agoperf-test: add corpus size to output, compact I/O stats
David Bremner [Tue, 4 Dec 2012 02:51:14 +0000 (22:51 -0400)]
perf-test: add corpus size to output, compact I/O stats

Austin suggested a while ago that the corpus size be printed in the
header. In the end it seems the corpus will be fixed per test script,
so this suggestion indeed makes sense.

The tabbing was wrapping on my usual 80 column terminal, so I joined
the input and output columns together.

11 years agoperf-test: add argument parsing for performance tests
David Bremner [Mon, 3 Dec 2012 23:56:20 +0000 (19:56 -0400)]
perf-test: add argument parsing for performance tests

This patch just sets (non-exported) variables. The variable $debug is
already used, and $corpus_size will be used in following commits.

11 years agoperf-test: propagate non-zero returns from /usr/bin/time
David Bremner [Thu, 6 Dec 2012 01:37:29 +0000 (21:37 -0400)]
perf-test: propagate non-zero returns from /usr/bin/time

Unlike in the correctness tests, the most common cause of non-zero
return seems to be the user interrupting, so killing the run seems
like the friendly thing to do.

11 years agotest: emacs: new tests "notmuch-show: {add,remove} multiple tags {to,from} single...
Pieter Praet [Fri, 24 Feb 2012 22:30:35 +0000 (23:30 +0100)]
test: emacs: new tests "notmuch-show: {add,remove} multiple tags {to,from} single message"

* test/emacs:

  - Rename subtests "{Add,Remove} tag from notmuch-show view" to
    "notmuch-show: {add,remove} single tag {to,from} single message"
    to be consistent with the following tests.

  - New subtest "notmuch-show: add multiple tags to single message":
    `notmuch-show-add-tag' ("+") can add multiple tags to a message.

  - New subtest "notmuch-show: remove multiple tags from single message":
    `notmuch-show-remove-tag' ("-") can remove multiple tags from a message.

11 years agocontrib: pick: bugfix for pick splitting the window excessively
Mark Walters [Sun, 9 Dec 2012 20:17:29 +0000 (20:17 +0000)]
contrib: pick: bugfix for pick splitting the window excessively

Previously if you carried on past the last message in a pick view pick
would get confused and `forget' about the split pane and would try and
re-split when moving up again. This was due to faulty logic in
notmuch-pick-show-message: something that should have been in the (when message)
clause was not.

Thanks to jrollins for the bug report.

11 years agoNEWS: under-the-hood Emacs interface fixes
Tomi Ollila [Sun, 9 Dec 2012 11:56:35 +0000 (13:56 +0200)]
NEWS: under-the-hood Emacs interface fixes

Added the following Emacs Interface NEWS entries:

Catch errors bodypart insertions may throw,
Improved text/calendar content handling and
Disabled coding conversions when reading in
`with-current-notmuch-show-message`.

Thanks to Austin and David for content improvements.

11 years agoemacs: add support for stashing the thread id in show view
Jani Nikula [Thu, 6 Dec 2012 22:48:05 +0000 (00:48 +0200)]
emacs: add support for stashing the thread id in show view

Add a prefix argument to notmuch-show-stash-message-id to stash thread
id instead of message id.

11 years agotag-util: optimization of tag application
David Bremner [Tue, 13 Nov 2012 04:23:49 +0000 (00:23 -0400)]
tag-util: optimization of tag application

The idea is not to bother with restore operations if they don't change
the set of tags. This is actually a relatively common case.

In order to avoid fancy datastructures, this method is quadratic in
the number of tags; at least on my mail database this doesn't seem to
be a big problem.

11 years agonotmuch-{dump,restore}.1: document new format options
David Bremner [Mon, 2 Jan 2012 19:07:33 +0000 (15:07 -0400)]
notmuch-{dump,restore}.1: document new format options

More or less arbitrarily, notmuch-dump.1 gets the more detailed
description of the format.

11 years agotest/dump-restore: add test for warning/error messages
David Bremner [Sat, 8 Dec 2012 12:34:00 +0000 (08:34 -0400)]
test/dump-restore: add test for warning/error messages

We want to test both that error/warning messages are generated when
they should be, and not generated when they should not be. This varies
between restore and batch tagging.

11 years agotest: second set of dump/restore --format=batch-tag tests
David Bremner [Sat, 24 Nov 2012 21:20:15 +0000 (17:20 -0400)]
test: second set of dump/restore --format=batch-tag tests

These one need the completed functionality in notmuch-restore. Fairly
exotic tags are tested, but no weird message id's.

We test each possible input to autodetection, both explicit (with
--format=auto) and implicit (without --format).

11 years agotest: update dump-restore roundtripping test for batch-tag format
David Bremner [Tue, 13 Dec 2011 03:22:53 +0000 (23:22 -0400)]
test: update dump-restore roundtripping test for batch-tag format

Now we can actually round trip these crazy tags and and message ids.
hex-xcode is no longer needed as it's built in.

11 years agonotmuch-restore: normalize case of error messages.
David Bremner [Sat, 8 Dec 2012 21:57:10 +0000 (17:57 -0400)]
notmuch-restore: normalize case of error messages.

In English, (unlike German) one does not capitalize the first word
after a colon.

11 years agonotmuch-restore: add support for input format 'batch-tag'
David Bremner [Sun, 11 Nov 2012 14:13:48 +0000 (10:13 -0400)]
notmuch-restore: add support for input format 'batch-tag'

This can be enabled with the new --format=batch-tag command line
option to "notmuch restore". The input must consist of lines of the
format:

    +<tag>|-<tag> [...] [--] id:<msg-id>

Each line is interpreted similarly to "notmuch tag" command line
arguments. The delimiter is one or more spaces ' '. Any characters in
<tag> and <search-terms> MAY be hex encoded with %NN where NN is the
hexadecimal value of the character. Any ' ' and '%' characters in
<tag> and <msg-id> MUST be hex encoded (using %20 and %25,
respectively). Any characters that are not part of <tag> or
<search-terms> MUST NOT be hex encoded.

Leading and trailing space ' ' is ignored. Empty lines and lines
beginning with '#' are ignored.

Commit message mainly stolen from Jani's batch tagging commit, to
follow.

11 years agotag-util.[ch]: New files for common tagging routines
David Bremner [Tue, 13 Nov 2012 01:54:16 +0000 (21:54 -0400)]
tag-util.[ch]: New files for common tagging routines

These are meant to be shared between notmuch-tag and notmuch-restore.

The bulk of the routines implement a "tag operation list" abstract
data type act as a structured representation of a set of tag
operations (typically coming from a single tag command or line of
input).

11 years agoutil: add string-util.[ch]
David Bremner [Sat, 24 Nov 2012 13:43:42 +0000 (09:43 -0400)]
util: add string-util.[ch]

This is to give a home to strtok_len. It's a bit silly to add a header
for one routine, but it needs to be shared between several compilation
units (or at least that's the most natural design).

11 years agotest: add sanity check for dump --format=batch-tag.
David Bremner [Wed, 5 Dec 2012 02:48:37 +0000 (22:48 -0400)]
test: add sanity check for dump --format=batch-tag.

It's important this does not rely on restore, since it hasn't been
written yet.

11 years agonotmuch-dump: add --format=(batch-tag|sup)
David Bremner [Thu, 14 Jun 2012 22:08:42 +0000 (01:08 +0300)]
notmuch-dump: add --format=(batch-tag|sup)

sup is the old format, and remains the default, at least until
restore is converted to parse this format.

Each line of the batch-tag format is modelled on the syntax of notmuch tag:
- "notmuch tag" is omitted from the front of the line
- The dump format only uses query strings of a single message-id.
- Each space seperated tag/message-id is 'hex-encoded' to remove
  trouble-making characters.
- It is permitted (and will be useful) for there to be no tags before
  the query.

In particular this format won't have the same problem with e.g. spaces
in message-ids or tags; they will be round-trip-able.

11 years agoUpdating man pages for new S-Expression output format.
Peter Feigl [Thu, 6 Dec 2012 21:12:15 +0000 (22:12 +0100)]
Updating man pages for new S-Expression output format.

Add sections about the new S-Expression output format (--format=sexp) to
the notmuch-search, notmuch-reply and notmuch-show man pages.

11 years agoAdding tests for --format=sexp.
Peter Feigl [Thu, 6 Dec 2012 21:12:14 +0000 (22:12 +0100)]
Adding tests for --format=sexp.

Add basic tests, the same as for json, for the S-Expression output
format.

11 years agoUse the S-Expression structured printer in notmuch-show, notmuch-reply and notmuch...
Peter Feigl [Thu, 6 Dec 2012 21:12:13 +0000 (22:12 +0100)]
Use the S-Expression structured printer in notmuch-show, notmuch-reply and notmuch-search.

This patch uses the new S-Expression printer in the notmuch CLI (show,
search and reply). You can now use --format=sexp for any of them.

11 years agoRename the -json printer functions in notmuch-reply and notmuch-show to generic ...
Peter Feigl [Thu, 6 Dec 2012 21:12:12 +0000 (22:12 +0100)]
Rename the -json printer functions in notmuch-reply and notmuch-show to generic -sprinter functions.

All the structured output functions in notmuch-reply and notmuch-show
are renamed to a generic name (as they do not contain any json-specific
code anyway). This patch is a preparation to actually using the new
S-Expression sprinter in notmuch-reply and notmuch-show.

11 years agoAdding an S-expression structured output printer.
Peter Feigl [Thu, 6 Dec 2012 21:12:11 +0000 (22:12 +0100)]
Adding an S-expression structured output printer.

This commit adds a structured output printer for Lisp
S-Expressions. Later commits will use this printer in notmuch search,
show and reply.

The structure is the same as json, but:
- arrays are written as lists: ("foo" "bar" "baaz" 1 2 3)
- maps are written as p-lists: (:key "value" :other-key "other-value")
- true is written as t
- false is written as nil
- null is written as nil

[ whitespace changes by db ]

11 years agotest: use perl instead of sed -r for portability
Jani Nikula [Tue, 4 Dec 2012 21:26:33 +0000 (23:26 +0200)]
test: use perl instead of sed -r for portability

Our OS X users report -r is not a supported option for sed. Use perl
instead.

11 years agotest: wrap 'wc -l' results in arithmetic evaluation to strip whitespace
Jani Nikula [Tue, 4 Dec 2012 21:26:32 +0000 (23:26 +0200)]
test: wrap 'wc -l' results in arithmetic evaluation to strip whitespace

This is for portability, as 'wc -l' emits whitespace on some BSD
variants. Suggested by Tomi Ollila <tomi.ollila@iki.fi>.

11 years agotest: fix count test
Jani Nikula [Tue, 4 Dec 2012 21:26:31 +0000 (23:26 +0200)]
test: fix count test

The quoting for ${SEARCH} is broken when it's supposed to be '*', and
it seems tricky to get it right. Just drop the variable and use '*'
directly. Before this, none of the messages ever matched, and the test
was comparing zeros.

11 years agotest: Fix UTF-8 JSON tests in Python 3
Austin Clements [Tue, 4 Dec 2012 15:24:14 +0000 (10:24 -0500)]
test: Fix UTF-8 JSON tests in Python 3

test_expect_equal_json uses json.tool from the system Python.  While
Python 2 wasn't picky about the encoding of stdin, Python 3 decodes
stdin strictly according to the environment.  Since we set LC_ALL=C
for the tests, Python 3's json.tool was assuming stdin would be in
ASCII and aborting when it couldn't decode the UTF-8 characters from
some of the JSON tests.  This patch sets the PYTHONIOENCODING
environment variable to utf-8 when invoking json.tool to override
Python's default encoding choice.

11 years agoChanging build tool for test/random-corpus to CXX instead of CC.
Peter Feigl [Tue, 4 Dec 2012 13:47:00 +0000 (14:47 +0100)]
Changing build tool for test/random-corpus to CXX instead of CC.

Without this change, GCC complains as follows:
gcc  test/random-corpus.o test/database-test.o notmuch-config.o command-line-arguments.o lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a -o test/random-corpus -lgmime-2.6 -lgio-2.0 -lgobject-2.0 -lglib-2.0   -Wl,-rpath,/usr/lib -ltalloc   -lxapian
/usr/bin/ld: lib/libnotmuch.a(database.o): undefined reference to symbol '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4'
/usr/bin/ld: note: '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4' is defined in DSO /usr/lib/libstdc++.so.6 so try adding it to the linker command line
/usr/lib/libstdc++.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [test/random-corpus] Error 1

11 years agoAdding parse-time to test/.gitignore
Peter Feigl [Tue, 4 Dec 2012 14:05:58 +0000 (15:05 +0100)]
Adding parse-time to test/.gitignore

test/parse-time is a binary that is generated when running make test. It should be ignored by git.

11 years agoNEWS: removal of notmuch-folders
Jani Nikula [Tue, 4 Dec 2012 16:20:29 +0000 (18:20 +0200)]
NEWS: removal of notmuch-folders

11 years agoemacs: show: refresh buffer did not remove overlays
Mark Walters [Wed, 5 Dec 2012 12:11:49 +0000 (12:11 +0000)]
emacs: show: refresh buffer did not remove overlays

Previously refreshing the notmuch show buffer did not remove overlays
which meant that if the user refreshed a message with images the
images would remain and then the new text was added after.

One might have guessed that erase-buffer would have removed them but
it seems not.  Thus force the removal of overlays with remove-overlays.

11 years agoemacs: stash bugfix
Mark Walters [Wed, 5 Dec 2012 12:20:54 +0000 (12:20 +0000)]
emacs: stash bugfix

Currently an attempt to stash a non-existent field (eg cc when not
present) throws an error. Catch this case and give the user a warning
message.

11 years agocli: convert "notmuch new" to the argument parser
Jani Nikula [Mon, 3 Dec 2012 20:56:13 +0000 (22:56 +0200)]
cli: convert "notmuch new" to the argument parser

Use the notmuch argument parser to handle arguments in "notmuch
new". As a side effect, this fixes broken STRNCMP_LITERAL usage that
accepts, for example, --verbosefoo for --verbose.

11 years agocli: fix notmuch top level argument parsing
Jani Nikula [Mon, 3 Dec 2012 20:56:12 +0000 (22:56 +0200)]
cli: fix notmuch top level argument parsing

Use strcmp instead of STRNCMP_LITERAL, which matches the prefix
instead of the whole argument.

11 years agoemacs: drop support for deprecated notmuch-folders
Jani Nikula [Mon, 3 Dec 2012 21:23:44 +0000 (23:23 +0200)]
emacs: drop support for deprecated notmuch-folders

Remove notmuch-folders which has been deprecated since

commit a4669217600e4536dc0c49f0255af5e2d9bc183f
Author: Carl Worth <cworth@cworth.org>
Date:   Mon Apr 26 22:42:07 2010 -0700

    emacs: Rip out all of the notmuch-folder code.

This lets us simplify the notmuch-saved-searches code slightly.

11 years agotest: fix an evident copy-paste error in argument parsing test
Jani Nikula [Mon, 3 Dec 2012 22:54:52 +0000 (00:54 +0200)]
test: fix an evident copy-paste error in argument parsing test

11 years agocontrib: pick: use notmuch-clean-address
Mark Walters [Sat, 1 Dec 2012 18:02:02 +0000 (18:02 +0000)]
contrib: pick: use notmuch-clean-address

Now notmuch-clean-address is split out in show pick can use that (with a small
wrapper).