]> git.notmuchmail.org Git - notmuch/log
notmuch
11 years agonmbug: use 'notmuch tag --batch'
David Bremner [Wed, 20 Feb 2013 22:24:35 +0000 (18:24 -0400)]
nmbug: use 'notmuch tag --batch'

This should be more robust with respect to tags with whitespace and
and other special characters. It also (hopefully) fixes a remaining
bug handling message-ids with whitespace.  It should also be
noticeably faster for large sets of changes since it does one exec per
change set as opposed to one exec per tag changed.

11 years agonmbug: use dump --format=batch-tag
David Bremner [Wed, 20 Feb 2013 22:24:34 +0000 (18:24 -0400)]
nmbug: use dump --format=batch-tag

This should make nmbug tolerate tags with whitespace and other special
characters it.  At the moment this relies on _not_ passing calls to
notmuch tag through the shell, which is a documented feature of perl's
system function.

11 years agoman: show and reply --decrypt option requires gpg-agent
Jani Nikula [Fri, 1 Mar 2013 16:43:26 +0000 (18:43 +0200)]
man: show and reply --decrypt option requires gpg-agent

11 years agocli: crypto: tell gmime to use gpg-agent
Jani Nikula [Wed, 27 Feb 2013 07:40:38 +0000 (09:40 +0200)]
cli: crypto: tell gmime to use gpg-agent

For decryption, we expect there to be a functioning gpg-agent, and we
want gpg to talk to it for any needed credentials. There's a gmime
function to declare that: g_mime_gpg_context_set_use_agent() [1], [2].
Start using it.

I had gpg-agent running, but gpg "use-agent" configuration option
disabled. This resulted in an error message from 'notmuch show':

  Failed to decrypt part: Canceled.

and json had this:

  "encstatus" : [ { "status" : "bad" } ]

One could argue the "use-agent" option should be enabled, but I'd like
to use the agent only as a last resort. I think that's irrelevant
though. There's a gmime function to declare what we expect, so we
should use it. Conveniently it also fixes the problem in a user
friendly way.

[1] http://git.gnome.org/browse/gmime/commit/?id=ed985397843a9da3745a8b5de3d1d652acd24724
[2] https://bugzilla.gnome.org/show_bug.cgi?id=651826

11 years agoNEWS: one typo fixed and 0.15.1 header line tidied up
Tomi Ollila [Tue, 19 Feb 2013 17:43:17 +0000 (19:43 +0200)]
NEWS: one typo fixed and 0.15.1 header line tidied up

11 years agoMerge branch 'release'
David Bremner [Tue, 19 Feb 2013 00:33:48 +0000 (20:33 -0400)]
Merge branch 'release'

add in NEWS from 0.15.2

Conflicts:
NEWS

11 years agodevel/release-checks.sh: added check that 1st NEWS header is tidy
Tomi Ollila [Wed, 30 Jan 2013 15:01:35 +0000 (17:01 +0200)]
devel/release-checks.sh: added check that 1st NEWS header is tidy

Check that the underlining '===...' for first (header) line in NEWS
file is of the same length as the header text and it is all '=':s.

-- extra execs removed by db.

11 years agoruby: Add bindings for notmuch_thread_get_messages
Austin Clements [Sun, 25 Nov 2012 04:57:07 +0000 (23:57 -0500)]
ruby: Add bindings for notmuch_thread_get_messages

11 years agolib: Add an iterator over all messages in a thread
Austin Clements [Sun, 25 Nov 2012 04:57:05 +0000 (23:57 -0500)]
lib: Add an iterator over all messages in a thread

Previously, getting the list of all messages in a thread required
recursively traversing the thread's message hierarchy, which was both
difficult and resulted in messages being out of order.  This adds a
public function to retrieve an iterator over all of the messages in a
thread in oldest-first order.

11 years agolib: Eliminate _notmuch_message_list_append
Austin Clements [Sun, 25 Nov 2012 04:57:04 +0000 (23:57 -0500)]
lib: Eliminate _notmuch_message_list_append

This API invited micro-optimized and complicated list pointer
manipulation and is no longer used.

11 years agolib: Separate list of all messages from top-level messages
Austin Clements [Sun, 25 Nov 2012 04:57:03 +0000 (23:57 -0500)]
lib: Separate list of all messages from top-level messages

Previously, thread.cc built up a list of all messages, then
proceeded to tear it apart to transform it into a list of
top-level messages.  Now we simply build a new list of top-level
messages.

This simplifies the interface to _notmuch_message_add_reply,
eliminates the pointer acrobatics from
_resolve_thread_relationships, and will enable us to do things
with the list of all messages in the following patches.

11 years agolib: Clean up error handling in _notmuch_thread_create
Austin Clements [Sun, 25 Nov 2012 04:57:02 +0000 (23:57 -0500)]
lib: Clean up error handling in _notmuch_thread_create

Previously, there were various opportunities for memory leaks in the
error-handling paths of this function.  Use a local talloc context and
some reparenting to make eliminate these leaks, while keeping the
control flow simple.

11 years agotest/test-lib.sh: separate signaled exit
Tomi Ollila [Mon, 21 Jan 2013 03:01:46 +0000 (05:01 +0200)]
test/test-lib.sh: separate signaled exit

When execution of tests is interrupted by signal coming outside of the
test system itself, output just one line "interrupted by signal <num>"
message to standard output. This distinguishes the case from internal
exit and reduces noise.

11 years agotest/test-lib.sh: use $test_subtest_name in all tests
Tomi Ollila [Mon, 21 Jan 2013 03:01:45 +0000 (05:01 +0200)]
test/test-lib.sh: use $test_subtest_name in all tests

Set the variable '$test_subtest_name' in all functions which starts
a new test and use that variable in all functions that output
test results.

Additionally output the latest '$test_subtest_name' in case of
abnormal exit, to avoid confusion.

11 years agoemacs: show: make buttons select window
Mark Walters [Mon, 7 Jan 2013 21:07:20 +0000 (21:07 +0000)]
emacs: show: make buttons select window

Emacs has two button type objects: widgets (as used for saved searches
in notmuch-hello) and buttons as used by parts/citations and id links
in notmuch-show. These two behave subtly differently when clicked with
the mouse: widgets select the window clicked before running the
action, buttons do not.

This patch makes all of these behave the same: clicking always selects
the clicked window. It does this by defining a notmuch-button-type
supertype that the other notmuch buttons can inherit from. This
supertype binds the mouse-action to select the window and then
activate the button.

11 years agobump versions to 0.15.2 0.15.2
David Bremner [Sun, 17 Feb 2013 13:40:52 +0000 (09:40 -0400)]
bump versions to 0.15.2

11 years agodebian: changelog stanza for 0.15.2-1
David Bremner [Tue, 29 Jan 2013 23:20:11 +0000 (19:20 -0400)]
debian: changelog stanza for 0.15.2-1

11 years agoNEWS: News for 0.15.2
David Bremner [Tue, 29 Jan 2013 23:16:12 +0000 (19:16 -0400)]
NEWS: News for 0.15.2

Another couple of build fixes.

11 years agonotmuch-mutt: improve robustness of mutt macros
Kevin J. McCarthy [Fri, 15 Feb 2013 00:12:47 +0000 (16:12 -0800)]
notmuch-mutt: improve robustness of mutt macros

Details:
- $pipe_decode is turned off, to prevent message-id from being
  filtered out by "ignore" settings in the muttrc.
- Original values for $pipe_decode and $wait_key are saved and restored.
- The macros, being much longer now, are line wrapped for improved
  readability.

11 years agonotmuch-mutt: Use of uninitialized value.
Stefano Zacchiroli [Thu, 14 Feb 2013 08:37:13 +0000 (09:37 +0100)]
notmuch-mutt: Use of uninitialized value.

On Thu, Feb 14, 2013 at 12:36:58AM +0100, Profpatsch wrote:
> On 13-02-13 02:35pm, Kevin J. McCarthy wrote:
> > A more likely idea is to check whether you have $pipe_decode set.
>
> BRILLIANT!
> So much for copying a basic rc from someone else.
> Of course, that was it and I’m officially an idiot.

Neat, thanks Kevin for debugging the issue down to $pipe_decode (which
I've never used, mutt never stops to amaze me :-)).

> And apparently Mail::Internet errors out if there is no Message-ID.
> (Which mentioned in the docs at CPAN…)
>
> Mystery solved.

Right, but still a more graceful failure model would be nice.

Please find attached a patch that in such cases should 1) give a
supposedly nice error message explaining what's going on and 2) empty
the results dir to avoid showing you unrelated results. It works for me.
But extra checking never hurts, in particular for the tag action, which
I don't personally use.

I guess it would also be nice to actually disable $pipe_decode in the
relevant Mutt macros, but I'm not sure about to do that without
interfering with user desired configuration. Kevin: do you know if there
is a common Mutt trick to store the value of a variable before changing
it, and restoring it a posteriori?  More isolation for this kind of
things in Mutt would definitely be welcome...

Cheers.
--
Stefano Zacchiroli  . . . . . . .  zack@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Debian Project Leader . . . . . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

From b67ab95855ce7d279d8c0b3ddcbc20e679afc70b Mon Sep 17 00:00:00 2001
From: Stefano Zacchiroli <zack@upsilon.cc>
Date: Thu, 14 Feb 2013 09:31:37 +0100
Subject: [PATCH] notmuch-mutt: more graceful handling of missing Message-Id
 errors

in particular:
- the "thread" action would print an error and empty results dir
- the "tag action would print an error

11 years agodebian: stop building a binary package for notmuch-vim
David Bremner [Sat, 16 Feb 2013 12:06:48 +0000 (08:06 -0400)]
debian: stop building a binary package for notmuch-vim

Since it is deprecated upstream, we don't want to encourage more
users to install it.

11 years agonotmuch-vim: deprecate, move to contrib
David Bremner [Sat, 16 Feb 2013 12:03:09 +0000 (08:03 -0400)]
notmuch-vim: deprecate, move to contrib

As discussed in id:871udhcmks.fsf@zancas.localnet, notmuch-vim doesn't
really meet the standards of the CLI, emacs interface, or python
bindings in terms of being well maintained.

11 years agonmbug: move from contrib to devel
David Bremner [Sat, 16 Feb 2013 11:54:33 +0000 (07:54 -0400)]
nmbug: move from contrib to devel

There seems to be consensus to use presence in contrib as
documentation of limited support by the notmuch developers; in fact
nmbug is pretty integrated into our current development process, so
devel seems more appropriate.

11 years agobitmap:improve memory usage using CHAR_BITS and unsigned CHAR
Robert Mast [Wed, 13 Feb 2013 15:32:57 +0000 (16:32 +0100)]
bitmap:improve memory usage using CHAR_BITS and unsigned CHAR

Using char instead of int allows for simpler definitions of the
DOCIDSET macros so the code is easier to understand and consistent with
respect to memory-usage. Estimated reduction of memory-usage for
bitmap about 8 times.

11 years agonmbug: only push master branch on nmbug push
Jani Nikula [Sat, 9 Feb 2013 22:49:00 +0000 (00:49 +0200)]
nmbug: only push master branch on nmbug push

nmbug pull only merges upstream master, but nmbug push tries to push
all local branches. The asymmetry results in conflicts whenever there
have been changes in the config branch in the origin:

$ nmbug push
To nmbug@nmbug.tethera.net:nmbug-tags
 ! [rejected]        config -> config (non-fast-forward)
error: failed to push some refs to 'nmbug@nmbug.tethera.net:nmbug-tags'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration
hint: variable to 'current' or 'upstream' to push only the current branch.
'git push origin' exited with nonzero value

To fix this, only push the master branch on nmbug push. Any config
changes need to be done manually via git anyway.

11 years agoCLI: add simple error handling for talloc logging
David Bremner [Tue, 29 Jan 2013 12:13:40 +0000 (08:13 -0400)]
CLI: add simple error handling for talloc logging

This really should have been there before. I think it's better to do
the actual operation and then possibly fail writing the memory log,
but it would not be too hard to change it to abort earlier.

11 years agoman: document NOTMUCH_TALLOC_REPORT environment variable
David Bremner [Tue, 29 Jan 2013 12:13:39 +0000 (08:13 -0400)]
man: document NOTMUCH_TALLOC_REPORT environment variable

11 years agotest: delay watchdog checks in emacs.
David Bremner [Tue, 29 Jan 2013 23:06:37 +0000 (19:06 -0400)]
test: delay watchdog checks in emacs.

Instead of checking immediately for the watched process, delay a
minute, or in the case that process-attributes returns nil, for two
minutes.  This is intended to cope with the case that
process-attributes is unimplimented, and returns always returns nil.
In this case, the watchdog check is the same as the two minute limit
imposed by timeout.

11 years agolib/Makefile.local: depend on libs we are linking with
Amadeusz Żołnowski [Mon, 21 Jan 2013 19:41:15 +0000 (20:41 +0100)]
lib/Makefile.local: depend on libs we are linking with

11 years agoMerge branch 'release'
David Bremner [Fri, 25 Jan 2013 02:29:09 +0000 (22:29 -0400)]
Merge branch 'release'

Conflicts:
NEWS

Inserted news from 0.15.1

11 years agoTODO: update entry on date range queries
Jani Nikula [Tue, 22 Jan 2013 18:19:25 +0000 (20:19 +0200)]
TODO: update entry on date range queries

11 years agoTODO: cleanup stuff that has been done
Jani Nikula [Tue, 22 Jan 2013 19:23:16 +0000 (21:23 +0200)]
TODO: cleanup stuff that has been done

M-RET notmuch-show-open-or-close-all opens all closed messages.

The archiving change is mentioned twice, remove dupe.

"notmuch search" supports --format=text0 to work with xargs -0

11 years agodebian: changelog stanza for 0.15.1-1 0.15.1 debian/0.15.1-1
David Bremner [Thu, 24 Jan 2013 11:23:15 +0000 (07:23 -0400)]
debian: changelog stanza for 0.15.1-1

11 years agoNEWS: update for 0.15.1
David Bremner [Thu, 24 Jan 2013 11:18:58 +0000 (07:18 -0400)]
NEWS: update for 0.15.1

Not much to report here, just the one patch

11 years agodebian: re-enable tests
David Bremner [Thu, 24 Jan 2013 11:13:16 +0000 (07:13 -0400)]
debian: re-enable tests

Now that we have Tomi's fix to set TERM for dtach, it should be safe to
run the tests on the autobuilders.

11 years agoversion: bump to 0.15.1
David Bremner [Thu, 24 Jan 2013 11:11:27 +0000 (07:11 -0400)]
version: bump to 0.15.1

A simple bugfix release, no user visible changes

11 years agotest/test-lib.sh: use vt100 as dtach terminal if TERM dumb or unset/empty
Tomi Ollila [Thu, 24 Jan 2013 07:39:02 +0000 (09:39 +0200)]
test/test-lib.sh: use vt100 as dtach terminal if TERM dumb or unset/empty

The TERM environment variable is set to 'dumb' when running tests, but
the original value of it is stored for echoing colors and running emacs
(somewhat interactively) in detached session. Emacs requires some
terminal control sequences to be available for interactive operation.
In case original TERM is (also) 'dumb' (or unset/empty) emacs cannot
run interactively. To fix this problem dtach (and emacs as it's child
process) is run with TERM=vt100 in case original TERM was unset, empty
or 'dumb'. This way there is a chance to run emacs tests with different
user terminals and potentially find problems there.

11 years agopython: fix the creation of notmuch databases
Justus Winter [Wed, 23 Jan 2013 17:12:04 +0000 (18:12 +0100)]
python: fix the creation of notmuch databases

Remove the superfluous mode argument given to notmuch_database_create
fixing the creation of notmuch databases using python code.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
11 years agoman: document existing top level options
David Bremner [Sat, 19 Jan 2013 18:25:55 +0000 (14:25 -0400)]
man: document existing top level options

The options --help and --version were not documented before.  One
could quibble about how useful that documentation is, but we will soon
add more options.

11 years agoCLI: convert top level argument parsing to use command-line-arguments
David Bremner [Sat, 19 Jan 2013 18:25:54 +0000 (14:25 -0400)]
CLI: convert top level argument parsing to use command-line-arguments

This isn't really a win for conciseness yet, but will make it easier
to add options.

11 years agoCLI: remove alias machinery, and "part", "search-tags" commands
David Bremner [Sat, 19 Jan 2013 18:25:53 +0000 (14:25 -0400)]
CLI: remove alias machinery, and "part", "search-tags" commands

The commands are long deprecated, so removal is probably overdue. The
real motivation is to simplify argument handling for notmuch so that
we can migrate to the common argument parsing framework.

11 years agoemacs: don't use deprecated "notmuch search-tags" command
David Bremner [Sat, 19 Jan 2013 18:25:52 +0000 (14:25 -0400)]
emacs: don't use deprecated "notmuch search-tags" command

A followup patch will finally remove this command, so we need to stop
using it.

11 years agoNEWS: correction to section 0.15 for markdown processing
Tomi Ollila [Sun, 20 Jan 2013 21:36:46 +0000 (23:36 +0200)]
NEWS: correction to section 0.15 for markdown processing

At the end of section 0.15 the strings TEST_EMACS & TEST_EMACSCLIENT
are now put inside ``:s for better output after markdown processing.

11 years agolib/Makefile.local: depend on libs we are linking with
Amadeusz Żołnowski [Mon, 21 Jan 2013 19:41:15 +0000 (20:41 +0100)]
lib/Makefile.local: depend on libs we are linking with

11 years agoMerge tag 'debian/0.15-2'
David Bremner [Mon, 21 Jan 2013 12:06:51 +0000 (08:06 -0400)]
Merge tag 'debian/0.15-2'

debian bug fix release, disable tests

11 years agodebian: disable running tests. debian/0.15-2
David Bremner [Sun, 20 Jan 2013 22:37:17 +0000 (18:37 -0400)]
debian: disable running tests.

Hopefully this is temporary, but I don't want to rush a fix for the
tests.

11 years agodevel/release-checks.sh: version string problem does not halt execution
Tomi Ollila [Sat, 19 Jan 2013 02:13:17 +0000 (04:13 +0200)]
devel/release-checks.sh: version string problem does not halt execution

Version string has strict format requirements in release-check.sh:
only numbers and periods (in sane order) are accepted.
Mismatch there used to halt further execution.
In this case, checking versions like '*~rc1' for (more) problems
was not possible.
This 'fatal error' is now changed buffered error message like in
following tests, and is displayed at the end of execution.

11 years agonotmuch-tag: initialize with enum instead of 0
David Bremner [Sat, 19 Jan 2013 13:14:46 +0000 (09:14 -0400)]
notmuch-tag: initialize with enum instead of 0

This is just a cosmetic fix to make the "type" of ret more clear.

11 years agoversion: update to 0.15 0.15 debian/0.15-1
David Bremner [Sat, 19 Jan 2013 01:27:57 +0000 (21:27 -0400)]
version: update to 0.15

Bump the version in-place in NEWS.

11 years agodebian: changelog stanza for 0.15
David Bremner [Sat, 19 Jan 2013 01:26:35 +0000 (21:26 -0400)]
debian: changelog stanza for 0.15

Cribbed from NEWS.

11 years agoNEWS: document that print message prints all parts including hidden parts
Mark Walters [Thu, 17 Jan 2013 00:44:10 +0000 (00:44 +0000)]
NEWS: document that print message prints all parts including hidden parts

11 years agoNEWS: describe 'batch-tag' dump/restore/tag
David Bremner [Fri, 18 Jan 2013 03:23:20 +0000 (23:23 -0400)]
NEWS: describe 'batch-tag' dump/restore/tag

Hopefully it is clear that more details are available in the man
pages.

11 years agodebian: add install file for python3-notmuch 0.15_rc1 debian/0.15_rc1-1
David Bremner [Thu, 17 Jan 2013 10:01:58 +0000 (06:01 -0400)]
debian: add install file for python3-notmuch

Without this file, the created package is empty.

11 years agoversion: set version to 0.15~rc1
David Bremner [Thu, 17 Jan 2013 03:02:32 +0000 (23:02 -0400)]
version: set version to 0.15~rc1

This is in some sense a rollback, but it makes all the automation
happier if the Debian and upstream versions match.

11 years agodebian: note that ical bug is fixed
David Bremner [Wed, 16 Jan 2013 12:30:22 +0000 (08:30 -0400)]
debian: note that ical bug is fixed

This was fixed a while ago in git, but not released yet.

11 years agodebian: add python 3 bindings
David Bremner [Wed, 16 Jan 2013 12:17:19 +0000 (08:17 -0400)]
debian: add python 3 bindings

This patch is due to Jakub Wilk <jwilk@debian.org>.

It does add a build depend on python3 for people using the "make
debian-snapshot" target.

11 years agodebian/compat: upgrade to compat level 9
David Bremner [Sun, 25 Nov 2012 19:40:22 +0000 (15:40 -0400)]
debian/compat: upgrade to compat level 9

- enable hardening

- fix dh syntax. Now that we have compat level 9, the old, wrong
  syntax is no longer accepted.

- update debian/libnotmuch{3,-dev}.install for multiarch.

- update versioned dependency on debhelper.

11 years agodebian: remove Dm-Upload-Allowed field.
David Bremner [Tue, 8 Jan 2013 02:22:06 +0000 (22:22 -0400)]
debian: remove Dm-Upload-Allowed field.

If we have some DMs we want to upload, we have to enable it with a
signed command file to dak.

11 years agodebian: change priority to optional.
David Bremner [Tue, 8 Jan 2013 02:20:00 +0000 (22:20 -0400)]
debian: change priority to optional.

The distinction between extra and optional is generally not very
important, except that being extra forces anything that depends on you
to be extra.

11 years agocli: propagate batch tagging warnings to exit value
Tomi Ollila [Sat, 12 Jan 2013 07:40:14 +0000 (09:40 +0200)]
cli: propagate batch tagging warnings to exit value

In case last input for batch tagging was either invalid or skippable
line, notmuch command exited with non-zero value.
After this change if there is at least one invalid line, notmuch
command will exit with non-zero value. Additionally, skipped lines
(last or other) doesn't cause non-zero value to be returned.

11 years agoemacs: show: w3m/invisibility workaround
Mark Walters [Sun, 13 Jan 2013 12:43:52 +0000 (12:43 +0000)]
emacs: show: w3m/invisibility workaround

There is a bug in the current notmuch code with w3m and invisible
parts. w3m sets a keymap, and if we have a hidden [text/html] point
at the start of the following line still gets this w3m keymap which
causes some strange effects. For example, RET gives an error "No URL
at Point" rather than hiding the message, <down> goes to the next link
rather than just down a line.

These keybinding are also inconvenient when the text/html part is
displayed so we ask w3m not to install a keymap.

This is only likely to be a problem for emacs 23 as shr is preferred
as html renderer on emacs 24 (although the user can set the renderer
to w3m even on emacs 24).

This solution was suggested by Tomi Ollila <tomi.ollila@iki.fi>

11 years agoman: tag changes are applied in the order they are specified in notmuch tag
Jani Nikula [Wed, 9 Jan 2013 20:36:20 +0000 (22:36 +0200)]
man: tag changes are applied in the order they are specified in notmuch tag

11 years agocli: bail out and propagate tagging errors in notmuch tag
Jani Nikula [Tue, 8 Jan 2013 21:41:54 +0000 (23:41 +0200)]
cli: bail out and propagate tagging errors in notmuch tag

Checking and propagating tag_op_list_apply() errors is especially
important with batch tagging, as the processing of the batch input
would not stop otherwise. Additionally this sets the exit code, which
is useful in scripts.

Amended by: David Bremner

11 years agodebian/changelog: start stanze for 0.15~rc1-1
David Bremner [Tue, 8 Jan 2013 02:13:05 +0000 (22:13 -0400)]
debian/changelog: start stanze for 0.15~rc1-1

as usual (and doubly so since Debian is in release freeze), destined
for experimental.

11 years agoversion: bump to 0.15
David Bremner [Tue, 8 Jan 2013 01:38:20 +0000 (21:38 -0400)]
version: bump to 0.15

"Atomically" update the python bindings and man page versions.

11 years agostring-util: Disallow empty prefixes in parse_boolean_term
Austin Clements [Mon, 7 Jan 2013 21:20:40 +0000 (16:20 -0500)]
string-util: Disallow empty prefixes in parse_boolean_term

Xapian doesn't consider ":abc" to be a prefixed term.  This makes
parse_boolean_term similarly reject queries with an empty prefix.

11 years agotest/tagging: add test for naked punctuation in tags; compare with quoting spaces.
David Bremner [Tue, 25 Dec 2012 19:42:47 +0000 (15:42 -0400)]
test/tagging: add test for naked punctuation in tags; compare with quoting spaces.

This test also serves as documentation of the quoting
requirements. The comment lines are so that it exactly matches the man
page. Nothing more embarrassing than having an example in the man page
fail.

11 years agoman: document notmuch tag --batch, --input options
Jani Nikula [Tue, 25 Dec 2012 19:42:46 +0000 (15:42 -0400)]
man: document notmuch tag --batch, --input options

11 years agotest/tagging: add test for exotic message-ids and batch tagging
David Bremner [Tue, 25 Dec 2012 19:42:44 +0000 (15:42 -0400)]
test/tagging: add test for exotic message-ids and batch tagging

The (now fixed) bug that this test revealed is that unquoted
message-ids with whitespace or other control characters in them are
split into several tokens by the Xapian query parser.

11 years agotest/tagging: add tests for exotic tags
David Bremner [Tue, 25 Dec 2012 19:42:43 +0000 (15:42 -0400)]
test/tagging: add tests for exotic tags

We test quotes seperately because they matter to the query escaper.

11 years agotest/tagging: add basic tests for batch tagging functionality
David Bremner [Tue, 25 Dec 2012 19:42:42 +0000 (15:42 -0400)]
test/tagging: add basic tests for batch tagging functionality

This tests argument parsing, blank lines and comments, and basic hex
decoding functionality.

11 years agotest/tagging: add test for error messages of tag --batch
David Bremner [Tue, 25 Dec 2012 19:42:41 +0000 (15:42 -0400)]
test/tagging: add test for error messages of tag --batch

This is based on the similar test for notmuch restore, but the parser
in batch tagging mode is less tolerant of a few cases, in particular
those tested by illegal_tag.

11 years agocli: add support for batch tagging operations to "notmuch tag"
Jani Nikula [Tue, 25 Dec 2012 19:42:40 +0000 (15:42 -0400)]
cli: add support for batch tagging operations to "notmuch tag"

Add support for batch tagging operations through stdin to "notmuch
tag". This can be enabled with the new --batch command line option to
"notmuch tag". The input must consist of lines of the format:

+<tag>|-<tag> [...] [--] <query> [...]

Each line is interpreted similarly to "notmuch tag" command line
arguments. The delimiter is one or more spaces ' '. Any characters in
<tag> MAY be hex encoded with %NN where NN is the hexadecimal value of
the character. Any ' ' and '%' characters in <tag> and MUST be hex
encoded (using %20 and %25, respectively). For future-proofing, any
'"' characters in <tag> SHOULD be hex-encoded.

Any characters that are not part of <tag> or
MUST NOT be hex encoded.

<query> is passed verbatim to Xapian

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

Signed-off-by: Jani Nikula <jani@nikula.org>
Hacked-like-crazy-by: David Bremner <david@tethera.net>
11 years agonotmuch-tag.c: convert to use tag-util
David Bremner [Tue, 25 Dec 2012 19:42:39 +0000 (15:42 -0400)]
notmuch-tag.c: convert to use tag-util

Command line parsing is factored out into a function
parse_tag_command_line in tag-util.c.

There is some duplicated code eliminated in tag_query, and a bunch of
translation from using the bare tag_op structs to using that tag-utils
API.

11 years agotag-util: factor out rules for illegal tags, use in parse_tag_line
David Bremner [Tue, 25 Dec 2012 19:42:38 +0000 (15:42 -0400)]
tag-util: factor out rules for illegal tags, use in parse_tag_line

This will allow us to be consistent between batch tagging and command
line tagging as far as what is an illegal tag.

11 years agofix line breaks in one comment paragraph in generated .notmuch-config file
Tomi Ollila [Sat, 5 Jan 2013 12:49:01 +0000 (14:49 +0200)]
fix line breaks in one comment paragraph in generated .notmuch-config file

While one comment in generated .notmuch-config file looked good in the
source file notmuch-config.c, the generated output was inconsistently
wide -- even breaking the 80-column boundary.

11 years agoemacs: Use the minibuffer for CLI error reporting
Austin Clements [Thu, 3 Jan 2013 21:47:49 +0000 (16:47 -0500)]
emacs: Use the minibuffer for CLI error reporting

We recently switched to popping up a buffer to report CLI errors, but
this was too intrusive, especially for transient errors and especially
since we made fewer things ignore errors.  This patch changes this to
display a basic error message in the minibuffer (using Emacs' usual
error handling path) and, if there are additional details, to log
these to a separate error buffer and reference the error buffer from
the minibuffer message.  This is more in line with how Emacs typically
handles errors, but makes the details available to the user without
flooding them with the details.

Given this split, we pare down the basic message and make it more
user-friendly, and also make the verbose message even more detailed
(and more debugging-oriented).

11 years agoman: Update notmuch-dump(1) and notmuch-restore(1)
Austin Clements [Sun, 6 Jan 2013 20:22:42 +0000 (15:22 -0500)]
man: Update notmuch-dump(1) and notmuch-restore(1)

Describe the new batch-tag format.  For notmuch-restore, rather than
half-heartedly duplicating the description, we now cite notmuch-dump.

11 years agodump/restore: Use Xapian queries for batch-tag format
Austin Clements [Sun, 6 Jan 2013 20:22:41 +0000 (15:22 -0500)]
dump/restore: Use Xapian queries for batch-tag format

This switches the new batch-tag format away from using a home-grown
hex-encoding scheme for message IDs in the dump to simply using Xapian
queries with Xapian quoting syntax.

This has a variety of advantages beyond presenting a cleaner and more
consistent interface.  Foremost is that it will dramatically simplify
the quoting for batch tagging, which shares the same input format.
While the hex-encoding is no better or worse for the simple ID queries
used by dump/restore, it becomes onerous for general-purpose queries
used in batch tagging.  It also better handles strange cases like
"id:foo and bar", since this is no longer syntactically valid.

11 years agodump: Disallow \n in message IDs
Austin Clements [Sun, 6 Jan 2013 20:22:40 +0000 (15:22 -0500)]
dump: Disallow \n in message IDs

When we switch to using regular Xapian queries in the dump format, \n
will cause problems, so we disallow it.  Specially, while Xapian can
quote and parse queries containing \n without difficultly, quoted
queries containing \n still span multiple lines, which breaks the
line-orientedness of the dump format.  Strictly speaking, we could
still round-trip these, but it would significantly complicate restore
as well as scripts that deal with tag dumps.  This complexity would
come at absolutely no benefit: because of the RFC 2822 unfolding
rules, no amount of standards negligence can produce a message with a
message ID containing a line break (not even Outlook can do it!).

Hence, we simply disallow it.

11 years agoutil: Function to parse boolean term queries
Austin Clements [Sun, 6 Jan 2013 20:22:39 +0000 (15:22 -0500)]
util: Function to parse boolean term queries

This parses the subset of Xapian's boolean term quoting rules that are
used by make_boolean_term.  This is provided as a generic string
utility, but will be used shortly in notmuch restore to parse and
optimize for ID queries.

11 years agoutil: Factor out boolean term quoting routine
Austin Clements [Sun, 6 Jan 2013 20:22:38 +0000 (15:22 -0500)]
util: Factor out boolean term quoting routine

This is now a generic boolean term quoting function.  It performs
minimal quoting to produce user-friendly queries.

This could live in tag-util as well, but it is really nothing specific
to tags (although the conventions are specific to Xapian).

The API is changed from "caller-allocates" to "readline-like".  The
scan for max tag length is pushed down into the quoting routine.
Furthermore, this now combines the term prefix with the quoted term;
arguably this is just as easy to do in the caller, but this will
nicely parallel the boolean term parsing function to be introduced
shortly.

This is an amalgamation of code written by David Bremner and myself.

11 years agorestore: Make missing messages non-fatal (again)
Austin Clements [Sun, 6 Jan 2013 20:22:37 +0000 (15:22 -0500)]
restore: Make missing messages non-fatal (again)

Previously, restore would abort if a message ID in the dump was
missing.  Furthermore, it would only report this as a warning.  This
patch makes it distinguish abort-worthy lookup failures like
out-of-memory from non-fatal failure to find a message ID.  The former
is reported as an error and causes restore to abort, while the latter
is reported as a warning and does not cause an abort.

This restores 0.14's non-fatal handling of missing message IDs in
restore (though 0.14 also considered serious errors non-fatal; we
retain the new and better handling of serious errors).

11 years agonotmuch-restore: handle empty input file, leading blank lines and comments.
David Bremner [Wed, 26 Dec 2012 19:36:33 +0000 (15:36 -0400)]
notmuch-restore: handle empty input file, leading blank lines and comments.

This patch corrects several undesirable behaviours:

1) Empty files were not detected, leading to buffer read overrun.

2) An initial blank line cause restore to silently abort

3) Initial comment line caused format detection to fail

11 years agotest/dump-restore: new tests for empty files and leading comments/whitespace.
David Bremner [Wed, 26 Dec 2012 19:36:32 +0000 (15:36 -0400)]
test/dump-restore: new tests for empty files and leading comments/whitespace.

Three of these are marked broken; the third is a regression test,
since it passes by virtue of batch-tag being the default input format.

11 years agoperf-test: initial support for talloc leak report in memory tests
David Bremner [Wed, 26 Dec 2012 16:29:45 +0000 (12:29 -0400)]
perf-test: initial support for talloc leak report in memory tests

As with the valgrind logs, we print a (very) brief summary and leave
the log for inspection.

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.