10 years agoremove GCC visibility pragmas
Tomi Ollila [Mon, 31 Oct 2011 12:01:28 +0000 (14:01 +0200)]
remove GCC visibility pragmas* linking fail on some environments. According to
David Bremner on irc:
 "We jump through hoops with the linker script (notmuch.sym) so
 the pragmas are not needed. And they are a little bizarre in a
 library anyway..."

10 years agoxregcomp: don't consider every regex compilation failure an internal error.
David Bremner [Sun, 23 Oct 2011 20:52:19 +0000 (17:52 -0300)]
xregcomp: don't consider every regex compilation failure an internal error.

This pushes the error handling up one step, but makes the function
more flexible. Running out of memory still triggers an internal error,
in the spirit of other xutils functions.

10 years agoxutil.c: remove duplicate copies, create new library libutil.a to contain xutil.
David Bremner [Sun, 23 Oct 2011 15:05:13 +0000 (12:05 -0300)]
xutil.c: remove duplicate copies, create new library libutil.a to contain xutil.

We keep the lib/xutil.c version. As a consequence, also factor out
_internal_error and associated macros.  It might be overkill to make a
new file error_util.c for this, but _internal_error does not really
belong in

10 years agobuild system: target to make a Debian snapshot package.
David Bremner [Thu, 13 Oct 2011 01:23:33 +0000 (22:23 -0300)]
build system: target to make a Debian snapshot package.

Currently this builds a native package, but since the source package
is throw away, it should not matter too much, except for the extra
warnings from lintian.

The extra +1 is so that if $(VERSION) is the same as the last released
version (for example outside a git repo) then the versions still order

10 years agobuild system: remove dashes from git-describe generated version.
David Bremner [Thu, 13 Oct 2011 01:23:32 +0000 (22:23 -0300)]
build system: remove dashes from git-describe generated version.

This makes it less confusing with released Debian versions, now that we have
non-native Debian versions.

10 years agoemacs: Turn id:"<message-id>" elements into buttons for notmuch searches
Daniel Schoepe [Fri, 28 Oct 2011 14:48:58 +0000 (16:48 +0200)]
emacs: Turn id:"<message-id>" elements into buttons for notmuch searches

This fixes the minor annoyance that message ids were parsed as mail
addresses by goto-address-mode in notmuch-show buffers.

10 years agoSeparate Emacs misc. files dir. from Emacs code dir.
Amadeusz Żołnowski [Tue, 25 Oct 2011 08:07:02 +0000 (10:07 +0200)]
Separate Emacs misc. files dir. from Emacs code dir.

New option --emacsetcdir was added, but it's set default to the same
value as --emacslispdir for backward compatibility.

10 years agoPrefix lib/notmuch.h and lib/ with $(srcdir)
Amadeusz Żołnowski [Sun, 23 Oct 2011 14:44:01 +0000 (16:44 +0200)]
Prefix lib/notmuch.h and lib/ with $(srcdir)

lib/notmuch.h and lib/ couldn't have been found
when building out of sources directory.

10 years agodocs: Update news, man page, and online help for restore --accumulate
David Bremner [Fri, 21 Oct 2011 22:09:49 +0000 (19:09 -0300)]
docs: Update news, man page, and online help for restore --accumulate

As a side effect, reformat the NEWs entry for notmuch dump for
consistency with the notmuch restore NEWS submitted by Thomas

10 years agonotmuch-restore: check for extra arguments.
David Bremner [Fri, 21 Oct 2011 18:46:54 +0000 (15:46 -0300)]
notmuch-restore: check for extra arguments.

We consider it an error to pass more than one file to restore, since
extra ones are ignored.

10 years agonotmuch-restore: implement --accumulate option
David Bremner [Wed, 19 Oct 2011 21:18:24 +0000 (18:18 -0300)]
notmuch-restore: implement --accumulate option

Modify command line argument handling to take a --accumulate flag.
Test for extra arguments beyond the input file.

The --accumulate switch causes the union of the existing and new tags to be
applied, instead of replacing each message's tags as they are read in from the
dump file.

Based on a patch by Thomas Schwinge:


10 years agotest/dump-restore: add tests for restore --accumulate
David Bremner [Fri, 21 Oct 2011 16:04:46 +0000 (13:04 -0300)]
test/dump-restore: add tests for restore --accumulate

Flesh out what ``notmuch restore --accumulate'' is supposed to do.
Its tests are currently XFAILed; the functionality will be added in
future patch(es).

Based on a patch by Thomas Schwinge:


10 years agonotmuch.1: typo fixes new wording for dump/restore
David Bremner [Fri, 21 Oct 2011 22:08:11 +0000 (19:08 -0300)]
notmuch.1: typo fixes new wording for dump/restore

These changes were included in Thomas's restore --accumulate patch,
but are actually more generally applicable.

10 years agotest/dump-restore: Fix quoting on grep
David Bremner [Fri, 21 Oct 2011 00:14:30 +0000 (21:14 -0300)]
test/dump-restore: Fix quoting on grep

Thanks to Thomas Schwinge for noticing yet another place where quoting
matters. Since the shell translates \. to ., the regex passed to grep
is too generous without the quotes.

The use of [.] is the suggestion of Tomi Ollila.

10 years agotest/dump-restore: expand test suite for dump-restore, make more robust
David Bremner [Wed, 19 Oct 2011 21:03:12 +0000 (18:03 -0300)]
test/dump-restore: expand test suite for dump-restore, make more robust

Several new tests are added, and existing use of test_begin_subtest is
replaced by test_expect_success to catch failing commands in cases where
we execute more than one command.

Based on changes in


10 years agotest/ update comments
David Bremner [Wed, 19 Oct 2011 20:51:24 +0000 (17:51 -0300)]
test/ update comments

- explain test_expect_equal_file
- remove mention of test_expect_failure, since that function was removed.

Based on id:""

10 years agocli: change argument parsing convention for subcommands
David Bremner [Fri, 21 Oct 2011 12:19:17 +0000 (09:19 -0300)]
cli: change argument parsing convention for subcommands

previously we deleted the subcommand name from argv before passing to
the subcommand. In this version, the deletion is done in the actual
subcommands. Although this causes some duplication of code, it allows
us to be more flexible about how we parse command line arguments in
the subcommand, including possibly using off-the-shelf routines like
getopt_long that expect the name of the command in argv[0].

10 years agodocs: Update man page, NEWS and online help for new dump arguments.
David Bremner [Wed, 12 Oct 2011 21:34:43 +0000 (18:34 -0300)]
docs: Update man page, NEWS and online help for new dump arguments.

We mention in all three places that using the filename argument is

10 years agonotmuch-dump: deprecate use of output file argument.
David Bremner [Mon, 10 Oct 2011 13:44:07 +0000 (10:44 -0300)]
notmuch-dump: deprecate use of output file argument.

We print an intentionally non-specific message on stderr, since it
isn't clear if there will be some global output file argument to

We update the test suite atomically, since it relies on having the
same text in two files.

10 years agonotmuch-dump: treat any remaining arguments after the filename as search terms
David Bremner [Sun, 9 Oct 2011 14:12:30 +0000 (11:12 -0300)]
notmuch-dump: treat any remaining arguments after the filename as search terms

The main motivation here is allow the fast dumping of tag data for
messages having certain tags.  In practice it seems too slow to pipe
dump to grep.

All dump-restore tests should be working now, so we update test/dump-restore

10 years agonotmuch-dump: update handling of file name argument
David Bremner [Sun, 9 Oct 2011 13:57:03 +0000 (10:57 -0300)]
notmuch-dump: update handling of file name argument

We permit -- as an "option processing terminator".

Currently this does not do anything useful, but we plan to add
search terms after the --.

10 years agotest: add tests for command line arguments to notmuch-dump
David Bremner [Mon, 10 Oct 2011 12:27:20 +0000 (09:27 -0300)]
test: add tests for command line arguments to notmuch-dump

The plan is to add the possibility of search terms after the file name,
and the use of -- to stop looking for an output file name.

10 years agotest: update dump-restore to use redirection instead of filename args
David Bremner [Sun, 9 Oct 2011 13:29:22 +0000 (10:29 -0300)]
test: update dump-restore to use redirection instead of filename args

The idea here is that we want to deprecate the use of arguments to
dump and restore to specify paths, since in particular we want to use
the non-option arguments to dump to form a query.

10 years agodebian: changelog stanza for 0.9 0.9
David Bremner [Wed, 12 Oct 2011 00:53:57 +0000 (21:53 -0300)]
debian: changelog stanza for 0.9

Admit that there have been no changes since the last release

10 years agoversion: bump to 0.9
David Bremner [Wed, 12 Oct 2011 00:50:56 +0000 (21:50 -0300)]
version: bump to 0.9

also bump python bindings version.

10 years agoNEWS: document API changes to n_d_find_message{,_by_filename}
David Bremner [Tue, 11 Oct 2011 12:10:33 +0000 (09:10 -0300)]
NEWS: document API changes to n_d_find_message{,_by_filename}

For details the user will have to refer to the source.  Reformat Ruby
news consistently with Python.

10 years agoNEWS: document API changes to n_d_find_message{,_by_filename}
David Bremner [Tue, 11 Oct 2011 12:05:41 +0000 (09:05 -0300)]
NEWS: document API changes to n_d_find_message{,_by_filename}

For details the user will have to refer to the source.

10 years agotest: add two emacs tests for show mode refresh
Jameson Graef Rollins [Sun, 9 Oct 2011 03:21:26 +0000 (20:21 -0700)]
test: add two emacs tests for show mode refresh

The first test tests that the notmuch-show-refresh-view function
produces the exact same output for an unmodified show buffer.  This
test should pass since the relevant functionality has already been

The second test tests show refresh for a show buffer that has been
modified by navigation and message visibility toggling.  Ideally
refresh-view should preserve this state of the notmuch-show buffer.
Unfortunately it currently does not, so this test is know to be broken
and is marked as such.

10 years agoNEWS: add notes about emacs improvements and reply formating cleanup
Jameson Graef Rollins [Sun, 9 Oct 2011 03:47:47 +0000 (20:47 -0700)]
NEWS: add notes about emacs improvements and reply formating cleanup

10 years agoversion: bump to 0.9~rc2
David Bremner [Sat, 8 Oct 2011 01:42:18 +0000 (22:42 -0300)]
version: bump to 0.9~rc2

We continue to keep the python bindings version in sync manually

10 years agodebian: update changelog for 0.9~rc2-1
David Bremner [Fri, 7 Oct 2011 21:54:27 +0000 (18:54 -0300)]
debian: update changelog for 0.9~rc2-1

Document upstream changes since 0.9~rc1-1

10 years agoemacs: add notmuch-show-refresh-view function
Jameson Graef Rollins [Sun, 29 May 2011 00:09:43 +0000 (17:09 -0700)]
emacs: add notmuch-show-refresh-view function

This function, like the equivalent for notmuch-search, just refreshes
the current show view.  Like in notmuch-search, this new function is
bound to "=".  If a prefix is given then the redisplay happens with the
crypto-switch set, which displays the thread with the opposite logic
of whatever is set in the notmuch-crypto-process-mime customization

10 years agoemacs: Add callback functions to crypto sigstatus button.
Jameson Graef Rollins [Tue, 31 May 2011 17:07:13 +0000 (10:07 -0700)]
emacs: Add callback functions to crypto sigstatus button.

This adds two callback functions to the sigstatus button.  If the sig
status is "good", then clicking the button displays the output of "gpg
--list-keys" on the key fingerprint.  If the sigstatus is "bad", then
clicking the button will retrieve the key from the keyserver, and
redisplay the current buffer.

Thanks to David Bremner <> for help with this.

10 years agoIgnore "application/pgp-*" parts in reply.
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:09 +0000 (12:30 -0700)]
Ignore "application/pgp-*" parts in reply.

The quoted text doesn't need to mention that the message being replied
to had these crufty parts.

10 years agotest: test for absence of "Non-text part: application/pgp-*" lines in reply
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:08 +0000 (12:30 -0700)]
test: test for absence of "Non-text part: application/pgp-*" lines in reply

In reply, the quoted text does not need to mention that the original
message had "application/pgp-signed" or "application/pgp-encrypted"

10 years agoFix notmuch-reply to not output "Non-text part:" lines for non-leafnode parts.
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:07 +0000 (12:30 -0700)]
Fix notmuch-reply to not output "Non-text part:" lines for non-leafnode parts.

These lines are just cruft in this case, and can be removed.

10 years agotest/multipart: test for absence of "Non-text part:" lines in reply for multipart...
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:06 +0000 (12:30 -0700)]
test/multipart: test for absence of "Non-text part:" lines in reply for multipart/* and message/rfc822 parts

There's no reason to output "Non-text part:" lines for parts that are
not leaf nodes, eg. multipart/* and message/rfc822.  We fix the text
here to test for their absence.  The next patch will fix reply

10 years agopython: Set status in the class definitions
Sebastian Spaeth [Wed, 5 Oct 2011 15:57:46 +0000 (17:57 +0200)]
python: Set status in the class definitions

Technically, this is a superfluous change, as the self.status variable
currently gets set in NotmuchErrors's __new__ function. However, in the
long run I would like to get rid of the weird __new__ implementation which
might be somewhat confusing for users (NotmuchError(status) returns a
different class, e.g. OutOfMemoryError)

Signed-off-by: Sebastian Spaeth <>
10 years agopython: help function Query._assert_query_is_initialized
Sebastian Spaeth [Wed, 5 Oct 2011 15:55:30 +0000 (17:55 +0200)]
python: help function Query._assert_query_is_initialized

Remove code duplication by using the new helper function. Also raise the
new fine grained exceptions in many cases, rather than the more generic

Signed-off-by: Sebastian Spaeth <>
10 years agopython: clean up docstrings and API documentation
Sebastian Spaeth [Wed, 5 Oct 2011 15:54:09 +0000 (17:54 +0200)]
python: clean up docstrings and API documentation

Signed-off-by: Sebastian Spaeth <>
10 years agopython: whitespace fixed in docstrings
Sebastian Spaeth [Wed, 5 Oct 2011 15:05:37 +0000 (17:05 +0200)]
python: whitespace fixed in docstrings

Signed-off-by: Sebastian Spaeth <>
10 years agopython: Add the new exception types in the API documentation
Sebastian Spaeth [Wed, 5 Oct 2011 14:58:13 +0000 (16:58 +0200)]
python: Add the new exception types in the API documentation

as they should be documented...

Signed-off-by: Sebastian Spaeth <>
10 years agopython: Catch up with find_message(by_filename) API changes
Sebastian Spaeth [Wed, 5 Oct 2011 14:44:35 +0000 (16:44 +0200)]
python: Catch up with find_message(by_filename) API changes

message is now an out parameter, and we get an additional status code as
a result. Hurray \o/.

Signed-off-by: Sebastian Spaeth <>
10 years agopython: also use
Sebastian Spaeth [Wed, 5 Oct 2011 13:46:03 +0000 (15:46 +0200)]
python: also use

Catch up with the major version bump. I wonder if this could somehow be
automatically made the correct version number. Oh well, I hope it
doesn't change too often :-).

Signed-off-by: Sebastian Spaeth <>
10 years agodebian: update packaging for new soname
David Bremner [Tue, 4 Oct 2011 17:01:21 +0000 (14:01 -0300)]
debian: update packaging for new soname

we need
   - a new changelog stanza, because the symbols files need a new version
   - s/libnotmuch1/libnotmuch2/ everywhere
   - update symbols file, s/.so.1/.so.2/, and bump minimum versions on changed
     symbols (although the latter is just documentation)

10 years agolib: bump SONAME
David Bremner [Tue, 4 Oct 2011 16:47:04 +0000 (13:47 -0300)]
lib: bump SONAME

Based on discussions with amdragon, tschwinge, and others on IRC, I concluded that

1) symbol versioning was probably overkill for libnotmuch
2) It was also probably GNU ld specific
3) Most importantly, nobody could tell me on short notice how exactly it works.

So since the change to the notmuch_database_find_message breaks the
previous ABI, we need to bump the SONAME.

10 years agoruby: Fix macros, use quoting
Ali Polatel [Tue, 4 Oct 2011 13:57:33 +0000 (16:57 +0300)]
ruby: Fix macros, use quoting

Fix Data_Get_Notmuch_* macro definitions broken by prev. commit
Adequate quoting for Data_Get_Notmuch_* macros
Remove duplicated RSTRING_PTR() macros, move it to defs.h

10 years agoruby: Really add wrappers for database_find_message*
Ali Polatel [Tue, 4 Oct 2011 13:48:34 +0000 (16:48 +0300)]
ruby: Really add wrappers for database_find_message*

Commit 898613116db746aa0f915ae43da8aba28545203d only added wrapper
functions but did not register them. Register the functions in module's
initialization function.

10 years agoruby: be consistent with notmuch's coding style
Ali Polatel [Tue, 4 Oct 2011 13:41:52 +0000 (16:41 +0300)]
ruby: be consistent with notmuch's coding style

No functional change, just indentation

10 years agoruby: Add wrappers for database_find_message*
Ali Polatel [Tue, 4 Oct 2011 13:06:20 +0000 (16:06 +0300)]
ruby: Add wrappers for database_find_message*

Two new wrappers:
Notmuch::Database.find_message(id) => Notmuch::Message or nil
Notmuch::Database.find_message_by_filename(path) => Notmuch::Message or nil

10 years agoMerge remote-tracking branch 'alip/find_message-v3'
David Bremner [Tue, 4 Oct 2011 10:35:40 +0000 (07:35 -0300)]
Merge remote-tracking branch 'alip/find_message-v3'

10 years agolib: make find_message{,by_filename) report errors
Ali Polatel [Tue, 4 Oct 2011 04:55:29 +0000 (07:55 +0300)]
lib: make find_message{,by_filename) report errors

Previously, the functions notmuch_database_find_message() and
notmuch_database_find_message_by_filename() functions did not properly
report error condition to the library user.

For more information, read the thread on the notmuch mailing list
starting with my mail ""

Make these functions accept a pointer to 'notmuch_message_t' as argument
and return notmuch_status_t which may be used to check for any error

restore: Modify for the new notmuch_database_find_message()
new: Modify for the new notmuch_database_find_message_by_filename()

10 years agolib: destroy message object after message removal
Ali Polatel [Mon, 3 Oct 2011 20:27:32 +0000 (23:27 +0300)]
lib: destroy message object after message removal

notmuch_database_remove_message() must call notmuch_message_destroy()
once it is done handling message removal.

10 years agopython: fix Message.get_filenames()
Thomas Jost [Fri, 30 Sep 2011 10:16:47 +0000 (12:16 +0200)]
python: fix Message.get_filenames()

Previously, the Filenames generator only yielded *one* filename before
returning, making Message.get_filenames() behave as Message.get_filename(). This
commit fixes this incorrect behavior: now the generator yields all the
filenames, as expected.

10 years agopython: rework creating of Subclasses
Sebastian Spaeth [Fri, 30 Sep 2011 14:04:42 +0000 (16:04 +0200)]
python: rework creating of Subclasses

Add some smart magic, so that when we invoke a
NotmuchError(STATUSVALUE), a nicely derived subclass is created, e.g. a
OutOfMemoryError. This way users can easily distinguish between error
types, while still catching NotmuchError.

I have tested this, and hope it works for others too.

Signed-off-by: Sebastian Spaeth <>
10 years agopython: provide more exception classes
Justus Winter [Mon, 26 Sep 2011 01:05:35 +0000 (03:05 +0200)]
python: provide more exception classes

To make the exception handling more effective in code using the
python bindings it is necessary to differentiate between the
different kind of failures.

Add an exception class for each status code and add a decode
classmethod to the NotmuchError class that acts as a factory.

Import the new classes in so they can be easily
imported by anyone.

Patch modifed by Sebastian Spaeth.

Signed-off-by: Sebastian Spaeth <>
Signed-off-by: Justus Winter <>
10 years agopython: fix docstring of Message.get_header()
Justus Winter [Fri, 30 Sep 2011 01:05:04 +0000 (03:05 +0200)]
python: fix docstring of Message.get_header()

Update the docstring from notmuch.h.

Signed-off-by: Justus Winter <>
10 years agopython: Add new functions in API documentation
Sebastian Spaeth [Thu, 29 Sep 2011 09:00:43 +0000 (11:00 +0200)]
python: Add new functions in API documentation

Add documentation for the three new functions and add in which version
they have been added.

Signed-off-by: Sebastian Spaeth <>
10 years agopython: Improve code documentation
Sebastian Spaeth [Thu, 29 Sep 2011 08:47:28 +0000 (10:47 +0200)]
python: Improve code documentation

1) Fix added .gitignore from commit dc8a1745 to work on the docs folder
2) Improve in-code developer documentation to produce better
   sphinx-generated documentation. No code changes.

Signed-off-by: Sebastian Spaeth <>
10 years agoNEWS: Note implementation bug for python binding
Sebastian Spaeth [Thu, 29 Sep 2011 07:55:14 +0000 (09:55 +0200)]
NEWS: Note implementation bug for python binding

Make note that find_message_by_name currently crashes the python process
if the Database is READ-ONLY. This should be fixed in the underlying

Signed-off-by: Sebastian Spaeth <>
10 years agoNEWS: Update with python binding news
Sebastian Spaeth [Thu, 29 Sep 2011 07:51:42 +0000 (09:51 +0200)]
NEWS: Update with python binding news

List major changes.

Signed-off-by: Sebastian Spaeth <>
10 years agoproperly raise exceptions in python bindings
Justus Winter [Sun, 25 Sep 2011 21:07:35 +0000 (23:07 +0200)]
properly raise exceptions in python bindings

There are various locations where exceptions are constructed but
not raised. This patch adds the necessary raise statements.

Signed-off-by: Justus Winter <>
10 years agopython: raise a more specific error in Messages.print_messages
Justus Winter [Mon, 26 Sep 2011 01:05:37 +0000 (03:05 +0200)]
python: raise a more specific error in Messages.print_messages

Raising Exception is considered bad since the only way to catch
it is to do 'except Exception'. Raising a TypeError is more

Since the format parameter has already been validated, checking
it again is not necessary. Simplify this conditional.

Signed-off-by: Justus Winter <>
10 years agopython: rename _verify_dir_initialized to _assert_dir_is_initialized
Justus Winter [Mon, 26 Sep 2011 01:05:34 +0000 (03:05 +0200)]
python: rename _verify_dir_initialized to _assert_dir_is_initialized

Rename the function to clarify its effect and remove all the comments
accompanying each call to the function.

Modified by Sebastian Spaeth to apply cleanly again and remove some
blank lines.

Signed-off-by: Justus Winter <>
Signed-off-by: Sebastian Spaeth <>
10 years agopython: rename _verify_initialized_db to _assert_db_is_initialized
Justus Winter [Mon, 26 Sep 2011 01:05:33 +0000 (03:05 +0200)]
python: rename _verify_initialized_db to _assert_db_is_initialized

Rename the function to clarify its effect and remove all the comments
accompanying each call to the function.

Modified slightly by Sebastian Spaeth to catch all new instances and
remove some blank lines too.

Signed-off-by: Sebastian Spaeth <>
Signed-off-by: Justus Winter <>
10 years agopython: fix NotmuchError.__str__ if status == None
Justus Winter [Mon, 26 Sep 2011 01:05:32 +0000 (03:05 +0200)]
python: fix NotmuchError.__str__ if status == None

Passing None to STATUS.status2str raises an ArgumentError. Add a
check for this case and provide a generic message.

Signed-off-by: Justus Winter <>
10 years agopython: add status and message attributes to NotmuchError
Justus Winter [Mon, 26 Sep 2011 01:05:30 +0000 (03:05 +0200)]
python: add status and message attributes to NotmuchError

Providing exception objects with meaningful attribute names
is much nicer than using e.args[].

Signed-off-by: Justus Winter <>
10 years agopython: add a .gitignore file and refine the toplevel one
Justus Winter [Mon, 26 Sep 2011 01:05:29 +0000 (03:05 +0200)]
python: add a .gitignore file and refine the toplevel one

The line 'notmuch' in the toplevel .gitignore file is to broad
and matches bindings/python/notmuch making it cumbersome to
git-add files within that directory.

Refine the toplevel file to only match the generated notmuch
executable and add a more specialized .gitignore file to the
python directory.

Signed-off-by: Justus Winter <>
10 years agopython: add begin|end_atomic bindings
Sebastian Spaeth [Wed, 28 Sep 2011 15:50:57 +0000 (17:50 +0200)]
python: add begin|end_atomic bindings

* Add UNBALANCED_ATOMIC status code
  Catch up with the notmuch status codes, and add the UNBALANCED_ATOMIC
* Add the begin_atomic and end_atomic calls to libnotmuch

Signed-off-by: Sebastian Spaeth <>
10 years agopython: Add database_find_message_by_filename bindings
Sebastian Spaeth [Wed, 28 Sep 2011 16:27:44 +0000 (18:27 +0200)]
python: Add database_find_message_by_filename bindings

Add it :-)

Signed-off-by: Sebastian Spaeth <>
10 years agoNEWS: add item for python bindings.
David Bremner [Mon, 26 Sep 2011 23:27:42 +0000 (20:27 -0300)]
NEWS: add item for python bindings.

Just the one unicode related change this release.

10 years agoNEWS: add item for Ruby bindings.
David Bremner [Mon, 26 Sep 2011 23:23:23 +0000 (20:23 -0300)]
NEWS: add item for Ruby bindings.

This is based on a quick scan of git log.

10 years agoNEWS: start release notes for 0.9
David Bremner [Mon, 26 Sep 2011 23:18:55 +0000 (20:18 -0300)]
NEWS: start release notes for 0.9

Thanks to Austin Clements for providing these notes, and the patches
they describe.

10 years agodebian: add brief summary of changes since 0.8 0.9_rc1 debian/0.9_rc1-1
David Bremner [Sun, 25 Sep 2011 14:27:03 +0000 (11:27 -0300)]
debian: add brief summary of changes since 0.8

10 years agodebian: build-depend on gdb
David Bremner [Sun, 25 Sep 2011 14:16:06 +0000 (11:16 -0300)]
debian: build-depend on gdb

This is needed to enable the atomicity tests at build time.

10 years agotest/atomicity: redirect output from "which"
David Bremner [Sun, 25 Sep 2011 12:12:48 +0000 (09:12 -0300)]
test/atomicity: redirect output from "which"

Without redirection, this produced some slightly confusing output in
case gdb was present.

10 years agodebian: close bug 642240
David Bremner [Sun, 25 Sep 2011 02:15:01 +0000 (23:15 -0300)]
debian: close bug 642240

The bug was really closed by the commit that updated the dependency,
of course.

10 years agotest: make atomicity setup conditional on gdb being present.
David Bremner [Sun, 25 Sep 2011 01:45:33 +0000 (22:45 -0300)]
test: make atomicity setup conditional on gdb being present.

The setup is useless if gdb is not present, so it doesn't hurt to skip
it.  The diff here is huge, but the commit is really just moving most
of the script inside the initial if, and adding an else block to print
a warning.

10 years agolib: bump library minor version because of new symbols.
David Bremner [Sat, 24 Sep 2011 19:13:49 +0000 (16:13 -0300)]
lib: bump library minor version because of new symbols.

This bump is because of the new symbols introduced by the atomicity

10 years agodebian: set versioned dependency on notmuch for notmuch-emacs
David Bremner [Sat, 24 Sep 2011 18:37:27 +0000 (14:37 -0400)]
debian: set versioned dependency on notmuch for notmuch-emacs

As long as we have no version information in the json output, this
seems like the only possible way of ensuring that the emacs client
code understands the output from the command line tool notmuch.

10 years agoversion: bump to 0.9~rc1
David Bremner [Sat, 24 Sep 2011 16:19:32 +0000 (12:19 -0400)]
version: bump to 0.9~rc1

This version number change should not be taken as definitive, rather
refer to the signed tag.

10 years agodebian: changlog stanza for release candidate
David Bremner [Sat, 24 Sep 2011 16:15:47 +0000 (12:15 -0400)]
debian: changlog stanza for release candidate

10 years agodebian: new symbols for atomicity api
David Bremner [Sat, 24 Sep 2011 18:17:44 +0000 (14:17 -0400)]
debian: new symbols for atomicity api

There are three new symbols in libnotmuch. In addition to notmuch_{begin,end)_atomic,
notmuch_database_find_message_by_filename was exposed.

10 years agolib: Improve notmuch_database_{add,remove}_message documentation.
Austin Clements [Sat, 11 Jun 2011 19:34:11 +0000 (15:34 -0400)]
lib: Improve notmuch_database_{add,remove}_message documentation.

State up front that these functions may add a filename to an existing
message or remove only a filename (and not the message), respectively.
Previously, this key information was buried in return value
documentation or in "notes", which made it seem secondary to these
functions' semantics.

10 years agonew: Wrap adding and removing messages in atomic sections.
Austin Clements [Sat, 29 Jan 2011 16:25:56 +0000 (11:25 -0500)]
new: Wrap adding and removing messages in atomic sections.

This addresses atomicity of tag synchronization, the last atomicity
problems in notmuch new.  Each message add or remove is wrapped in its
own atomic section, so interrupting notmuch new doesn't lose progress.

10 years agonew: Synchronize maildir flags eagerly.
Austin Clements [Fri, 28 Jan 2011 01:51:04 +0000 (20:51 -0500)]
new: Synchronize maildir flags eagerly.

Because flag synchronization is stateless, it can be performed at any
time as long as it's guaranteed to be performed after any change to a
message's filename list.  Take advantage of this to synchronize tags
immediately after a filename is added or removed.

This does not yet make adding or removing a message atomic, but it is
a big step toward atomicity because it reduces the window where the
database tags are inconsistent from nearly the entire notmuch-new to
just around when the message is added or removed.

10 years agonew: Cleanup. De-duplicate file name removal code.
Austin Clements [Sun, 6 Feb 2011 09:28:01 +0000 (04:28 -0500)]
new: Cleanup.  De-duplicate file name removal code.

Previously, file name removal was implemented identically in two
places.  Now it's captured in one function.

This is important because file name removal is about to get slightly
more complicated with eager tag synchronization and correct removal

10 years agonew: Cleanup. Put removed/renamed message count in add_files_state_t.
Austin Clements [Sat, 11 Jun 2011 16:54:05 +0000 (12:54 -0400)]
new: Cleanup.  Put removed/renamed message count in add_files_state_t.

Previously, pointers to these variables were passed around
individually.  This was okay when only one function needed them, but
we're about to need them in a few more places.

10 years agolib: Wrap notmuch_database_add_message in an atomic section.
Austin Clements [Sat, 11 Jun 2011 04:42:58 +0000 (00:42 -0400)]
lib: Wrap notmuch_database_add_message in an atomic section.

Adding a message may involve changes to multiple database documents,
and thus needs to be done in a transaction.  This makes add_message
(and, I think, the whole library) atomicity-safe: library callers only
needs to use atomic sections if they needs atomicity across multiple
library calls.

10 years agolib: Add an API to find a message by filename.
Austin Clements [Sat, 11 Jun 2011 04:19:31 +0000 (00:19 -0400)]
lib: Add an API to find a message by filename.

notmuch_database_find_message_by_filename is mostly stolen from
notmuch_database_remove_message, so this patch also vastly simplfies
the latter using the former.

This API is also useful in its own right and will be used in a later
patch for eager maildir flag synchronization.

10 years agoruby: New exception Notmuch::UnbalancedAtomicError
Ali Polatel [Sat, 24 Sep 2011 12:54:45 +0000 (15:54 +0300)]
ruby: New exception Notmuch::UnbalancedAtomicError

This exception wraps NOTMUCH_STATUS_UNBALANCED_ATOMIC which was added
with the commit e59cc0031fbf84f49e32dedb9927f427d2c49309.

10 years agoruby: Wrap notmuch_database_{begin,end}_atomic
Ali Polatel [Sat, 24 Sep 2011 12:43:43 +0000 (15:43 +0300)]
ruby: Wrap notmuch_database_{begin,end}_atomic

Adding ruby wrappers for functions:
- notmuch_database_begin_atomic()
- notmuch_database_end_atomic()
added by 957f1ba3fc1d737887029ff1787fc6bea94de00b

New functions:

10 years agoruby: Rename destroy to destroy!
Ali Polatel [Sat, 24 Sep 2011 12:25:24 +0000 (15:25 +0300)]
ruby: Rename destroy to destroy!

According to the common Ruby function naming convention, potentially
dangerous functions or functions which operate on the object itself are
suffixed with an exclamation mark. Both of these are true for object
destroying functions.

The following modules are affected:
- Notmuch::Directory
- Notmuch::FileNames
- Notmuch::Query
- Notmuch::Threads
- Notmuch::Thread
- Notmuch::Messages
- Notmuch::Message
- Notmuch::Tags

10 years agolib: Remove message document directly after removing the last file name.
Austin Clements [Sat, 11 Jun 2011 04:07:54 +0000 (00:07 -0400)]
lib: Remove message document directly after removing the last file name.

Previously, notmuch_database_remove_message would remove the message
file name, sync the change to the message document, re-find the
message document, and then delete it if there were no more file names.
An interruption after sync'ing would result in a file-name-less,
permanently un-removable zombie message that would produce errors and
odd results in searches.  We could wrap this in an atomic section, but
it's much simpler to eliminate the round-about approach and just
delete the message document instead of sync'ing it if we removed the
last filename.

10 years agolib: Indicate if there are more filenames after removal.
Austin Clements [Sun, 6 Feb 2011 09:17:49 +0000 (04:17 -0500)]
lib: Indicate if there are more filenames after removal.

Make _notmuch_message_remove_filename return
NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID if the message has more filenames
and fix callers to handle this.

10 years agolib: Add support for nested atomic sections.
Austin Clements [Sat, 11 Jun 2011 03:35:06 +0000 (23:35 -0400)]
lib: Add support for nested atomic sections.

notmuch_database_t now keeps a nesting count and we only start a
transaction or commit for the outermost atomic section.


10 years agolib: Add notmuch_database_{begin,end}_atomic.
Austin Clements [Sat, 29 Jan 2011 16:25:24 +0000 (11:25 -0500)]
lib: Add notmuch_database_{begin,end}_atomic.

These operations translate into non-flushed Xapian transactions,
allowing arbitrary groups of database operations to be performed

10 years agonew: Defer updating directory mtimes until the end.
Austin Clements [Tue, 8 Feb 2011 23:24:33 +0000 (18:24 -0500)]
new: Defer updating directory mtimes until the end.

Previously, if notmuch new were interrupted between updating the
directory mtime and handling removals from that directory, a
subsequent notmuch new would not handle those removals until something
else changed in that directory.  This defers recording the updated
mtime until after removals are handled to eliminate this problem.

10 years agopython: Ensure that we pass utf-8 encoded string to libnotmuch
Martin Owens [Fri, 16 Sep 2011 11:19:14 +0000 (13:19 +0200)]
python: Ensure that we pass utf-8 encoded string to libnotmuch

If we use unicode objects, libnotmuch would not cope with null bytes in
the byte array, so we need to make sure they are nicely formatted as

Introduce a helper function _str which does this throughout the code.

Patch slightly modified by Sebastian Spaeth.

Signed-off-by: Sebastian Spaeth <>
10 years agonew: Don't lose messages on SIGINT.
Austin Clements [Wed, 9 Feb 2011 01:56:31 +0000 (20:56 -0500)]
new: Don't lose messages on SIGINT.

Previously, message removals were always performed, even after a
SIGINT.  As a result, when a message was moved from one folder to
another, a SIGINT between processing the directory the message was
removed from and processing the directory it was added to would result
in notmuch removing that message from the database.