]> git.notmuchmail.org Git - notmuch/log
notmuch
13 years agolib: Remove the notion of TAGS_INVALID
Carl Worth [Thu, 11 Nov 2010 01:45:59 +0000 (17:45 -0800)]
lib: Remove the notion of TAGS_INVALID

This rather ugly hack was recently obviated by the removal of the
notmuch_database_set_maildir_sync function. Now, clients must make
explicit calls to do any syncrhonization between maildir flags and
tags. So the library no longer needs to worry about doing inconsistent
synchronization while a message is only partially added.

13 years agolib: Rework interface for maildir_flags synchronization
Carl Worth [Thu, 11 Nov 2010 01:36:09 +0000 (17:36 -0800)]
lib: Rework interface for maildir_flags synchronization

Instead of having an API for setting a library-wide flag for
synchronization (notmuch_database_set_maildir_sync) we instead
implement maildir synchronization with two new library functions:

notmuch_message_maildir_flags_to_tags
  and   notmuch_message_tags_to_maildir_flags

These functions are nicely documented here, (though the implementation
does not quite match the documentation yet---as plainly evidenced by
the current results of the test suite).

13 years agoAvoid abbreviation, preferring notmuch_config_get_maildir_synchronize_flags
Carl Worth [Thu, 11 Nov 2010 00:26:14 +0000 (16:26 -0800)]
Avoid abbreviation, preferring notmuch_config_get_maildir_synchronize_flags

Since the name of the configuration parameter here is:

maildir.synchronize_flags

the convention is that the functions to get and set this parameter
should match it in name. Hence:

       notmuch_config_get_maildir_synchronize_flags

etc. (as opposed to notmuch_config_get_maildir_sync).

13 years agotest: Rework recently-added additional maildir-sync tests
Carl Worth [Wed, 10 Nov 2010 20:36:31 +0000 (12:36 -0800)]
test: Rework recently-added additional maildir-sync tests

These needed to be changed to be brought up to the current state of
the maildir-sync tests. This includes style changes, but also the
elimination of any assumption about pre-existing message filenames,
(such as msg-003) which actually don't exist anymore.

Also, the known broken tests are changed to emit FAIL rather than
BROKEN simply to make them easier to fix, (so that they print the
current problems rather than hiding them).

Finally, an additional test is added to ensure that when a duplicate
file is added without flags, it doesn't invalidate flags from other
duplicates, (instead the flags are effectively merged).

13 years agotest: More maildir synchronization tests
Michal Sojka [Wed, 10 Nov 2010 10:27:50 +0000 (11:27 +0100)]
test: More maildir synchronization tests

Add maildir synchronization tests for multiple messages with the same
message-id. As this is not yet implemented in notmuch, some of these
teste are marked as BROKEN.

I use $(< ) operator to avoid fiddling with stripped trailing newlines
from test results which happens when output+=$(command) is used.

13 years agolib: Remove the synchronization of 'T' flag with "deleted" tag.
Carl Worth [Tue, 9 Nov 2010 23:48:46 +0000 (15:48 -0800)]
lib: Remove the synchronization of 'T' flag with "deleted" tag.

Tags in a notmuch database affect all messages with the identical
message-ID. But maildir tags affect individual files. And since
multiple files can contain the identical message-ID, there is not a
one-to-one correspondence between messages affected by tags and flags.

This is particularly dangerous with the 'T' (== "trashed") maildir
flag and the corresponding "deleted" tag in the notmuch
database. Since these flags/tags are often used to trigger
irreversible deletion operations, the lack of one-to-one
correspondence can be potentially dangerous.

For example, consider the following sequence:

  1. A third-party application is used to identify duplicate messages
     in the mail store, and mark all-but-one of each duplicate with
     the 'T' flag for subsequent deletion.

  2. A "notmuch new" operation reads that 'T' flag, adding the
     "deleted" flag to the corresponding messages within the notmuch
     database.

  3. A subsequent notmuch operation, (such as a "notmuch dump; notmuch
     restore" cycle) synchronized the "deleted" tag back to the mail
     store, applying the 'T' flag to all(!) filenames with duplicate
     message IDs.

  4. A third-party application reads the 'T' flags and irreversibly
     deletes all mail messages which had any duplicates(!).

In order to avoid this scenario, we simply refuse to synchronize the
'T' flag with the "deleted" tag. Instead, applications can set 'T' and
act on it to delete files, or can set "deleted" and act on it to
delete files. But in either case the semantics are clear and there is
never dangerous propagation through the one-to-many mapping of notmuch
message objects to files.

13 years agotest: Rework testing of maildir-synchronization feature.
Carl Worth [Tue, 9 Nov 2010 23:36:49 +0000 (15:36 -0800)]
test: Rework testing of maildir-synchronization feature.

This change reworks these tests in several ways:

1. Bring tests into "new" test style preferring test_expect_equal over
   test_expect_success in almost all cases.

2. Don't emit test results for intermediate items not actually being
   tested, (things like "no new messages", "search for message",
   etc.). Those things are already covered by existing tests such as
   "basic" or "search" and only serve to obscure what's actually being
   tested.

3. Change sense of the test showing failure to rename a file from
   "new" to "cur" when "cur" doesn't exist.

   In this case, notmuch should detect that this is not a maildir and
   should not attempt to do any renaming of the file.

4. Extend dump/restore test to also exercise addition of tag, not just
   removal.

Both items #3 and #4 above show shortcomings in the current
implementation. These are currently resulting in test results of FAIL
and indicate bugs that need to be fixed.

13 years agoTests for maildir synchronization
Michal Sojka [Sun, 31 Oct 2010 21:29:18 +0000 (22:29 +0100)]
Tests for maildir synchronization

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agoMake maildir synchronization configurable
Michal Sojka [Sun, 31 Oct 2010 21:29:17 +0000 (22:29 +0100)]
Make maildir synchronization configurable

This adds group [maildir] and key 'synchronize_flags' to the
configuration file. Its value enables (true) or diables (false) the
synchronization between notmuch tags and maildir flags. By default,
the synchronization is disabled.

13 years agoMaildir synchronization
Michal Sojka [Sun, 31 Oct 2010 21:29:16 +0000 (22:29 +0100)]
Maildir synchronization

This patch allows bi-directional synchronization between maildir
flags and certain tags. The flag-to-tag mapping is defined by flag2tag
array.

The synchronization works this way:

1) Whenever notmuch new is executed, the following happens:
   o New messages are tagged with configured new_tags.
   o For new or renamed messages with maildir info present in the file
     name, the tags defined in flag2tag are either added or removed
     depending on the flags from the file name.

2) Whenever notmuch tag (or notmuch restore) is executed, a new set of
   flags based on the tags is constructed for every message and a new
   file name is prepared based on the old file name but with the new
   flags. If the flags differs and the old message was in 'new'
   directory then this is replaced with 'cur' in the new file name. If
   the new and old file names differ, the file is renamed and notmuch
   database is updated accordingly.

   The rename happens before the database is updated. In case of crash
   between rename and database update, the next run of notmuch new
   brings the database in sync with the mail store again.

13 years agolib: Return added message even if it already was in the database
Michal Sojka [Sun, 31 Oct 2010 21:29:15 +0000 (22:29 +0100)]
lib: Return added message even if it already was in the database

13 years agotest: Don't strip portions of test name after '-' for temporary files.
Carl Worth [Wed, 10 Nov 2010 20:15:46 +0000 (12:15 -0800)]
test: Don't strip portions of test name after '-' for temporary files.

We have test names like maildir-sync now, so it's cleaner if the
temporary files created are named things like maildir-sync-10.out
rather than maildir-10.out. Presumably the extra stripping here came
from naming conventions in git's test suite.

13 years agoMerge in ruby bindings.
Carl Worth [Mon, 8 Nov 2010 18:08:27 +0000 (10:08 -0800)]
Merge in ruby bindings.

Thanks to Ali Polatel for these bindings. This code was fetched from
the ruby branch of:

git://github.com/alip/notmuch.git

13 years agovim: include own improved git-diff syntax
Felipe Contreras [Sat, 5 Jun 2010 11:12:42 +0000 (14:12 +0300)]
vim: include own improved git-diff syntax

The old one wasn't working at all on newer vims.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agovim: run(): optimize non-debug path
Felipe Contreras [Sat, 5 Jun 2010 11:12:41 +0000 (14:12 +0300)]
vim: run(): optimize non-debug path

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agovim: use mailx for sending
Felipe Contreras [Sat, 5 Jun 2010 11:12:40 +0000 (14:12 +0300)]
vim: use mailx for sending

Possilby used by more systems, and besides the code wasn't really
working properly anyway.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agovim: add option to mark as read + archive
Felipe Contreras [Sat, 5 Jun 2010 11:12:39 +0000 (14:12 +0300)]
vim: add option to mark as read + archive

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agovim: remove add_remove_tags_on_screen()
Felipe Contreras [Sat, 5 Jun 2010 11:12:38 +0000 (14:12 +0300)]
vim: remove add_remove_tags_on_screen()

It's not working properly; the current message is jumping around and the
tags not really added/removed properly.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agovim: cleanup search syntax
Felipe Contreras [Sat, 5 Jun 2010 11:12:37 +0000 (14:12 +0300)]
vim: cleanup search syntax

It was *sloooooow*.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agovim: cleanup search buffer
Felipe Contreras [Sat, 5 Jun 2010 11:12:36 +0000 (14:12 +0300)]
vim: cleanup search buffer

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agovim: add archive support from 'show'
Felipe Contreras [Sat, 5 Jun 2010 11:12:35 +0000 (14:12 +0300)]
vim: add archive support from 'show'

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agoDon't use kill-this-buffer to kill notmuch emacs buffers
Jameson Rollins [Sat, 6 Nov 2010 20:49:28 +0000 (16:49 -0400)]
Don't use kill-this-buffer to kill notmuch emacs buffers

kill-this-buffer appears to be a function intended specifically for
use in the menu bar, and causes problem killing notmuch buffers when
multiple frames have been used.  This patch replaces kill-this-buffer
with notmuch-kill-this-buffer, which in turn just simply calls
(kill-buffer (current-buffer)).

13 years agoemacs: Fix notmuch-show-pipe-message to use notmuch-command variable
Michal Sojka [Sat, 6 Nov 2010 23:09:18 +0000 (00:09 +0100)]
emacs: Fix notmuch-show-pipe-message to use notmuch-command variable

Previously notmuch command name was hardcoded into this function,
which made remote use of pipe command impossible.

13 years agoNEWS: Update NEWS files for a couple of recent changes.
Carl Worth [Sat, 6 Nov 2010 21:43:44 +0000 (14:43 -0700)]
NEWS: Update NEWS files for a couple of recent changes.

These two changes since the 0.4 release are noteworthy.

13 years agotest: Add test for viewing raw message within emacs.
Carl Worth [Sat, 6 Nov 2010 21:33:30 +0000 (14:33 -0700)]
test: Add test for viewing raw message within emacs.

This provides further coverage for the recently added (and recently
modified) use of "notmuch show --format=raw" within emacs.

13 years agoRename "notmuch cat" to "notmuch show --format=raw"
Carl Worth [Sat, 6 Nov 2010 19:03:51 +0000 (12:03 -0700)]
Rename "notmuch cat" to "notmuch show --format=raw"

This is part of an effort to avoid proliferation of excessive
top-level notmuch commands. Also, "raw" better captures the
functionality here, (as opposed to "cat" which is a fairly oblique
reference to a bad Unix abbreviation whose metaphor doesn't work here
since "notmuch cat" operates only on a single message and hence cannot
"con'cat'enate" anything).

13 years agotest: Add test for saving an attachment from emacs
Carl Worth [Sat, 6 Nov 2010 18:25:56 +0000 (11:25 -0700)]
test: Add test for saving an attachment from emacs

This tests the use of "notmuch cat" recently added to the emacs
interface.

13 years agoemacs: Access raw messages via cat subcommand
Michal Sojka [Fri, 22 Oct 2010 09:28:04 +0000 (11:28 +0200)]
emacs: Access raw messages via cat subcommand

This patch modifies the following commands to access the messages via
cat subcommand:
- view/save attachments ('v', 'w'),
- view a raw message ('V') and
- pipe a message to a command ('|').

With this patch, it is straightforward to use notmuch emacs interface
with a remote database accessed over SSH. To do this, it is sufficient
to redefine notmuch-command variable to contain the name of a script
containing:

    ssh user@host notmuch "$@"

If the ssh client has enabled connection sharing (ControlMaster option
in OpenSSH), the emacs interface is almost as responsive as when
notmuch is invoked locally.

13 years agoAdd 'cat' subcommand
Michal Sojka [Fri, 22 Oct 2010 09:28:03 +0000 (11:28 +0200)]
Add 'cat' subcommand

This command outputs a raw message matched by search term to the
standard output. It allows MUAs to access the messages for piping,
attachment manipulation, etc. by running notmuch cat rather then
directly access the file. This will simplify the MUAs when they need
to operate on a remote database.

Edited-by: Carl Worth <cworth@cworth.org>: Remove trailing whitespace,
add missing "test_done" to new test script to avoid "Unexpected exit"
error.

13 years agoMakefile: Support "make check" as alias for "make test"
Carl Worth [Sat, 6 Nov 2010 00:50:12 +0000 (17:50 -0700)]
Makefile: Support "make check" as alias for "make test"

I'm told that some people have been trained by autotools to expect
this target name.

13 years agotest: Don't mess with user's HOME directory
Carl Worth [Sat, 6 Nov 2010 00:43:27 +0000 (17:43 -0700)]
test: Don't mess with user's HOME directory

This was too rude of a thing to do and could easily introduce
problems, (as reported by Rob Browning whose environment required some
HOME-specific things for shell startup).

Instead, implement more focused changes to ensure that particular file
in $HOME don't cause problems. Specifically, we fix known problems
with ~/.signature and ~/.mailrc here.

13 years agotest: Update mail corpus with original mails (with attachments).
Carl Worth [Sat, 6 Nov 2010 00:17:53 +0000 (17:17 -0700)]
test: Update mail corpus with original mails (with attachments).

The original mails used to pupulate the mail corpus had had their
attachments (obnoxiously) scrubbed by the pipermail mail archiver.
Since we actually want to test the handling of attachments, this is
less than useful. Restore these files from my own collection, (with
some Received and similar headers pruned).

13 years agotest: Clear the "BROKEN" flag on an existing emacs test
Carl Worth [Fri, 5 Nov 2010 20:59:45 +0000 (13:59 -0700)]
test: Clear the "BROKEN" flag on an existing emacs test

I still don't know everything about how I want search order to be
customizable, but I do like the current defaults, (namely, performing
a new search gives results newest first, but performing a saved search
like "tag:inbox" gives results as oldest first).

Until we come up with a better plan for people to select what *they*
want, (rather than just getting what I want), let's codify the current
results in the test suite.

13 years agotest: Generate a little run_emacs script to help debug any failures.
Carl Worth [Fri, 5 Nov 2010 21:20:52 +0000 (14:20 -0700)]
test: Generate a little run_emacs script to help debug any failures.

After any emacs test failure, the tmp.emacs directory will have this
run_emacs script in it which the user can use to run emacs within the
test suite environment, (pointing at the test suite's notmuch
database, using the local notmuch command-line program, and the local
notmuch emacs lisp code).

13 years agoTODO: Add idea for notmuch-bcc and notmuch-cc variables.
Carl Worth [Fri, 5 Nov 2010 20:49:33 +0000 (13:49 -0700)]
TODO: Add idea for notmuch-bcc and notmuch-cc variables.

To more easily support those folks that want to Bcc with every
message.

13 years agoPrint nothing when search result is empty
Michal Sojka [Mon, 1 Nov 2010 16:15:40 +0000 (17:15 +0100)]
Print nothing when search result is empty

This change affects both text and json formats. Now, text format
behaves as before commit 6dcb7592, but json format is changed.
Earlier, the empty search returned '[]', now it returns ''. The emacs
interface seems not to be affected by this change.

13 years agotest: Search for non-existent message should return nothing
Michal Sojka [Mon, 1 Nov 2010 16:15:39 +0000 (17:15 +0100)]
test: Search for non-existent message should return nothing

My scripts expect that empty search result is actually empty. Since
commit 6dcb7592, even empty search prints a newline character and this
breaks my scripts.

This patch adds a test for this bug. In the test I cannot use
test_expect_equal function as $() operator suppresses the final
newline and this kind of difference is not detected.

 test/search |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

13 years agodebian: Add a file stating the intended symbols to appear in the library 0.4
Carl Worth [Tue, 2 Nov 2010 06:02:31 +0000 (23:02 -0700)]
debian: Add a file stating the intended symbols to appear in the library

This is almost totally clearn. The (mangled) names of the Xapian
exception classes appear here. That's not actually desired, as the
notmuch library is never intended to throw any exceptions. But Xapian
does not currently provide a mechanism for us to avoid these.

13 years agoMakefile: Move the -Wl,-as-needed option earlier in the command line.
Carl Worth [Tue, 2 Nov 2010 06:17:48 +0000 (23:17 -0700)]
Makefile: Move the -Wl,-as-needed option earlier in the command line.

This option wasn't having the desired effect, and sure enough, the
documentation states that it only affects the linking of libraries
that appear after this option on the command line. So put it early for
the desired effect.

13 years agolib: Eliminate some redundant includes of xapian.h
Carl Worth [Tue, 2 Nov 2010 05:31:45 +0000 (22:31 -0700)]
lib: Eliminate some redundant includes of xapian.h

Most files including this already include database-private.h which
includes xapian.h already.

13 years agolib: Add GCC visibility(hidden) pragmas to private header files.
Carl Worth [Tue, 2 Nov 2010 05:01:15 +0000 (22:01 -0700)]
lib: Add GCC visibility(hidden) pragmas to private header files.

This prevents any of the private functions from being leaked out
through the library interface (at least when compiling with a
recent-enough gcc to support the visibility pragma).

13 years agolib: Add some missing static qualifiers.
Carl Worth [Tue, 2 Nov 2010 04:58:43 +0000 (21:58 -0700)]
lib: Add some missing static qualifiers.

These various functions and data are all used only locally, so should
be marked static. Ensuring we get these right will avoid us accidentally
leaking unintended symbols through the library interface.

13 years agodebian: Use the correct maintainer address for the package upload.
Carl Worth [Mon, 1 Nov 2010 23:55:13 +0000 (16:55 -0700)]
debian: Use the correct maintainer address for the package upload.

Otherwise, Debian tools think this is an NMU.

13 years agodebian: Declare conformance with Standard-Version 3.9.1.0
Carl Worth [Mon, 1 Nov 2010 23:54:27 +0000 (16:54 -0700)]
debian: Declare conformance with Standard-Version 3.9.1.0

I ran through the upgrading-checklist and found nothing needing to be
changed for this package.

13 years agoMakefile: Build library with -Wl,--as-needed
Carl Worth [Mon, 1 Nov 2010 23:52:22 +0000 (16:52 -0700)]
Makefile: Build library with -Wl,--as-needed

Previously, we were building the final binary with this option, but not
the library. The library can benefit from it as well, (as pointed out
by Debian's lintian).

13 years agomanpage: Add escaping for hyphen used as minus
Carl Worth [Mon, 1 Nov 2010 23:51:00 +0000 (16:51 -0700)]
manpage: Add escaping for hyphen used as minus

As pointed out by Debian lintian, options with '-' might not be
copy/pastable if formatted with an unescaped '-' character.

13 years agodebian: Add changelog entry for the 0.4 release.
Carl Worth [Mon, 1 Nov 2010 23:24:07 +0000 (16:24 -0700)]
debian: Add changelog entry for the 0.4 release.

Which is just about to be made.

13 years agoIncrement notmuch version to 0.4.
Carl Worth [Mon, 1 Nov 2010 23:16:03 +0000 (16:16 -0700)]
Increment notmuch version to 0.4.

As reminded in the RELEASING instructions, the correct version is 0.4,
not 0.4.0, so update this in the NEWS file as well.

13 years agoUpdate library version to 1.2.0
Carl Worth [Mon, 1 Nov 2010 23:13:44 +0000 (16:13 -0700)]
Update library version to 1.2.0

This increment is for the recently-added functions:

notmuch_query_get_query_string
notmuch_query_get_sort

These were recently added to the library interface, but the library
version was not incremented at that time, (shame on me).

13 years agoNEWS: Add notes for the 0.4.0 release
Carl Worth [Mon, 1 Nov 2010 23:11:23 +0000 (16:11 -0700)]
NEWS: Add notes for the 0.4.0 release

Which is about to be pushed out.

13 years agoconfigure: Add a check for the -Wl,--as-needed flag.
Carl Worth [Sat, 30 Oct 2010 20:20:33 +0000 (13:20 -0700)]
configure: Add a check for the -Wl,--as-needed flag.

This fits with our general build philosophy of checking at configure
time for desired support, (rather than putting platform-specific
conditionals into our Makefiles).

13 years agofixup
Carl Worth [Sat, 30 Oct 2010 20:16:50 +0000 (13:16 -0700)]
fixup

13 years agobuild: only link to what we really use
Felipe Contreras [Fri, 29 Oct 2010 23:16:47 +0000 (02:16 +0300)]
build: only link to what we really use

At least linux has the -Wl,--as-needed option.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agoconfigure: Remove a debugging print message.
Carl Worth [Sat, 30 Oct 2010 20:11:22 +0000 (13:11 -0700)]
configure: Remove a debugging print message.

This was never intended to be committed.

13 years agoconfigure: Test for flag to set rpath
Carl Worth [Sat, 30 Oct 2010 19:55:09 +0000 (12:55 -0700)]
configure: Test for flag to set rpath

This is better than the previous approach which had a hardcoded Linux-specific
value in the Makefile.

13 years agoconfigure: Test for each compiler warning before enabling it.
Carl Worth [Sat, 30 Oct 2010 19:36:06 +0000 (12:36 -0700)]
configure: Test for each compiler warning before enabling it.

This should allow the build to be much more automatically portable
to compilers with different sets of warning options.

13 years agotest: Test emacs notmuch-hello with no saved searches to display.
Carl Worth [Fri, 29 Oct 2010 22:53:34 +0000 (15:53 -0700)]
test: Test emacs notmuch-hello with no saved searches to display.

Haippily, this works just fine, but we might as well test that.

13 years agotest: Test emacs notmuch-hello when displaying a saved search with 0 results.
Carl Worth [Fri, 29 Oct 2010 22:49:59 +0000 (15:49 -0700)]
test: Test emacs notmuch-hello when displaying a saved search with 0 results.

This test verifies that the bug fix in the previous commit is working.

13 years agoFix problem with notmuch-hello-nice-number
Dirk Hohndel [Fri, 29 Oct 2010 22:49:01 +0000 (15:49 -0700)]
Fix problem with notmuch-hello-nice-number

Without this little patch notmuch fails if asked to display a saved
search that has zero results

Edited-by: David Edmondson <dme@dme.org>: With code that is a little
more "emacsy".

13 years agoemacs: Re-work the implementation of highlighting in notmuch-search-mode.
David Edmondson [Mon, 7 Jun 2010 14:35:10 +0000 (15:35 +0100)]
emacs: Re-work the implementation of highlighting in notmuch-search-mode.

Re-write `notmuch-search-color-line', with the following improvements:
 - create overlays only if they will be needed,
 - merge the properties specified for a tag on top of any matching a
   previous tag.

13 years agodebian: Add emacs autoloads for all top-level notmuch functions.
Carl Worth [Fri, 29 Oct 2010 22:28:18 +0000 (15:28 -0700)]
debian: Add emacs autoloads for all top-level notmuch functions.

With this, users will be able to simply "apt-get install emacs" and
then "emacs -f notmuch" without having to edit ~/.emacs to add a
("require 'notmuch)".

13 years agoemacs: Fix the autoload comments
Carl Worth [Fri, 29 Oct 2010 22:27:01 +0000 (15:27 -0700)]
emacs: Fix the autoload comments

Remove them from non-top-level entry points, (such as the functions to
set notmuch modes and the deprecated notmuch-folder function). And add
one to the notmuch-hello function. Also, add missing documentation
string to notmuch-hello.

13 years agoconfigure: Set XAPIAN_CONFIG to only "xapian-config" by default.
Carl Worth [Fri, 29 Oct 2010 21:49:20 +0000 (14:49 -0700)]
configure: Set XAPIAN_CONFIG to only "xapian-config" by default.

Previously, we preferred a value of "xapian-config-1.1" first. This
was convenient for compiling against Xapian 1.1 while Xapian 1.2 was
unreleased. But now that Xapian 1.2 is realease, and since it ships a
xapian-config, the xapian-config-1.1 value can mask the newer library.

Instead of trying to track the latest xapian-config-1.x in our
configure script let's simply expect the user to set
XAPIAN_CONFIG=xapian-config-1.x in order to compile against an
unreleased Xapian.

13 years agoconfigure: optimize uname finding a bit
Felipe Contreras [Sat, 5 Jun 2010 11:05:15 +0000 (14:05 +0300)]
configure: optimize uname finding a bit

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agoMakefile: Fix notmuch binary to directly link against Xapian and GMime.
Carl Worth [Fri, 29 Oct 2010 21:25:09 +0000 (14:25 -0700)]
Makefile: Fix notmuch binary to directly link against Xapian and GMime.

Without this, trying to link with the gold linker would fail, (which meant
that notmuch could not be compiled out of the box on recent Fedora, nor
even on Debian when the binutils-gold package is installed).

13 years agoDon't involve the shell in notmuch searches
David Benjamin [Fri, 4 Jun 2010 00:29:32 +0000 (20:29 -0400)]
Don't involve the shell in notmuch searches

The shell isn't needed to interpret any of the arguments, so don't
bother using it at all.

Signed-off-by: David Benjamin <davidben@mit.edu>
13 years agonotmuch-setup.c: Initialize getline(3) response_size to 0
Mike Kelly [Thu, 14 Oct 2010 18:18:19 +0000 (14:18 -0400)]
notmuch-setup.c: Initialize getline(3) response_size to 0

This appears to be necessary on FreeBSD. If this isn't done, we get a
nasty segfault.

See: id:20101013094340.41580a2f@pioto.org

13 years agoDo not call ldconfig when building Debian package
Michal Sojka [Wed, 16 Jun 2010 14:14:18 +0000 (16:14 +0200)]
Do not call ldconfig when building Debian package

Hi,

If I want to build Debian package, it fails with the following message:

    ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
    make[1]: *** [install-lib] Error 1

The reason is that I build the package as a non-root user and make
install invokes ldconfig unconditionally. The following patch contains a
workaround, but I think that a more correct solution would be to check
the condition LIBDIR_IN_LDCONFIG directly when make install is invoked
rather than in configure as it is done now.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agodocumentation: Add the "files" option to the synopsis of "search --output="
Carl Worth [Thu, 28 Oct 2010 19:15:51 +0000 (12:15 -0700)]
documentation: Add the "files" option to the synopsis of "search --output="

This was inadvertently left off when --output=files was recently added
as a new option.

13 years agopython: lambda(p) is not P3k-compliant
Sebastian Spaeth [Thu, 28 Oct 2010 12:37:16 +0000 (14:37 +0200)]
python: lambda(p) is not P3k-compliant

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
13 years agopython: Import explicit including package name
Sebastian Spaeth [Thu, 28 Oct 2010 12:37:15 +0000 (14:37 +0200)]
python: Import explicit including package name

To make python3 happy

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
13 years agotest: Emit a friendly error message if run with bash < 4.0.
Carl Worth [Thu, 28 Oct 2010 19:07:42 +0000 (12:07 -0700)]
test: Emit a friendly error message if run with bash < 4.0.

The bash code in the test suite is using associative arrays which were
only added to bash as of release 4.0.

If the test suite is run with an older bash, we now immediately error
out and explain the situation, (instead of emitting confusing error
messages and failing dozens of tests, which is what happened before
this change).

13 years agotest: Avoid using unreliable, hard-coded thread ID values in test suite.
Carl Worth [Thu, 28 Oct 2010 18:45:50 +0000 (11:45 -0700)]
test: Avoid using unreliable, hard-coded thread ID values in test suite.

Some recently-added tests used hard-coded thread ID values in search
specifications. This is unreliable since the thread IDs depend on the
order in which "notmuch new" encounters new files, (which in turn can
depend on inode ordering within the filesystem).

Fix these by using the new "notmuch search --output=threads" to find the
correct thread IDs given a hard-coded (but reliable) message ID.

13 years agoemacs: Use copy-sequence instead of copy-seq.
Carl Worth [Thu, 28 Oct 2010 17:39:52 +0000 (10:39 -0700)]
emacs: Use copy-sequence instead of copy-seq.

I don't see copy-seq documented within emacs at all, and some users
have encountered failures of the form:

notmuch-show-del-tags-worker: Symbol's function definition is void: copy-seq

This should eliminate that problem.

13 years agonotmuch search: Add a new "notmuch search --output=files"
Carl Worth [Thu, 28 Oct 2010 18:33:55 +0000 (11:33 -0700)]
notmuch search: Add a new "notmuch search --output=files"

Yet another thing that will be extremely handy for scripts.

13 years agonotmuch search: Add a new --output=(summary|threads|messages|tags) option.
Carl Worth [Thu, 28 Oct 2010 18:19:53 +0000 (11:19 -0700)]
notmuch search: Add a new --output=(summary|threads|messages|tags) option.

This can be handy for scripts which need to extract just a thread ID from
a search term, for example.

13 years agolib: Add two functions: notmuch_query_get_query_string and _get_sort
Carl Worth [Thu, 28 Oct 2010 17:30:26 +0000 (10:30 -0700)]
lib: Add two functions: notmuch_query_get_query_string and _get_sort

It can be handy to be able to query these settings from an existing
query object.

13 years agoTODO: Remove several items that have been completed.
Carl Worth [Thu, 28 Oct 2010 16:02:34 +0000 (09:02 -0700)]
TODO: Remove several items that have been completed.

We've done a lot of work recently without also taking care to update
the TODO file to indicate the progress.

13 years agoemacs: Eliminate duplicate From header in replies.
Carl Worth [Thu, 28 Oct 2010 01:44:05 +0000 (18:44 -0700)]
emacs: Eliminate duplicate From header in replies.

The original code was intended to work, but clearly wasn't tested. Use
mail-header (as in existing code) to extract a header from a header alist.

This fixes the duplicate-from-line bug that is exercised by the test
just added to the test suite.

13 years agotest: Add test for reply functionality within emacs.
Carl Worth [Thu, 28 Oct 2010 01:43:09 +0000 (18:43 -0700)]
test: Add test for reply functionality within emacs.

The reply is primarily taken care of by "notmuch reply" which is already
thoroughly tested. But a recent bug is inserting a duplicate From header
in the emacs-based reply. So exercise that bug here.

13 years agonotmuch: Eliminate some const-correctness warnings.
Carl Worth [Thu, 28 Oct 2010 01:07:37 +0000 (18:07 -0700)]
notmuch: Eliminate some const-correctness warnings.

These were introduced as a side-effect of commit
b9eac48c22f53f84ed1d9c1d8ca862a7b638c9ac (shame on me for doing
side-effect commits like that!).

For me, at least, compilation is now warning-free.

13 years agoemacs: Eliminate warning of calling function with excess arguments.
Carl Worth [Thu, 28 Oct 2010 01:04:38 +0000 (18:04 -0700)]
emacs: Eliminate warning of calling function with excess arguments.

Yet another case of "how could this have possibly worked before?!".

I guess we were just getting very lucky with the emacs lisp calling
conventions and what happens with extra arguments, but, ick! Much
better now.

13 years agoemacs: Remove non-interactive call of goto-line
Carl Worth [Thu, 28 Oct 2010 00:58:19 +0000 (17:58 -0700)]
emacs: Remove non-interactive call of goto-line

As the emacs compiler warns, the goto-line function is only intended for
interactive use. Instead use the approach recommended in the goto-line
documentation to avoid this.

13 years agoemacs: Fix to eliminate warning in notmuch-query-map-aux
Carl Worth [Thu, 28 Oct 2010 00:54:38 +0000 (17:54 -0700)]
emacs: Fix to eliminate warning in notmuch-query-map-aux

This is one of those cases where the warning looks absolutely correct,
(complaining about a free variable), but I'm left wondering how the
original code could have worked at all.

From what I can tell, this code wasn't actually being called by any
of the current code in notmuch.

13 years agoemacs: Avoid runtime use of `cl'.
David Edmondson [Thu, 29 Apr 2010 10:33:36 +0000 (11:33 +0100)]
emacs: Avoid runtime use of `cl'.

The GNU Emacs Lisp Reference Manual section D.1 says:

> *  Please don't require the cl package of Common Lisp extensions at
>    run time. Use of this package is optional, and it is not part of
>    the standard Emacs namespace. If your package loads cl at run time,
>    that could cause name clashes for users who don't use that package.
>
>    However, there is no problem with using the cl package at compile
>    time, with (eval-when-compile (require 'cl)). That's sufficient for
>    using the macros in the cl package, because the compiler expands
>    them before generating the byte-code.

Follow this advice, requiring the following changes where `cl' was
used at runtime:

- replace `rassoc-if' in `notmuch-search-buffer-title' with the `loop'
  macro and inline code. At the same time find the longest prefix
  which matches the query rather than simply the last,
- replace `union', `intersection' and `set-difference' in
  `notmuch-show-add-tag' and `notmuch-show-remove-tag' with local code
  to calculate the result of adding and removing a list of tags from
  another list of tags.

13 years agoMove notmuch-fcc-header-setup to message-header-setup-hook.
Rob Browning [Sun, 12 Sep 2010 20:23:38 +0000 (15:23 -0500)]
Move notmuch-fcc-header-setup to message-header-setup-hook.

Call notmuch-fcc-header-setup from message-header-setup-hook rather
than message-send-hook.  This allows you to see what's going to
happen, and to make manual adjustments if desired.  Gnus does
something similar.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
13 years agotest: Update tests with removal of bcc from reply
Jameson Rollins [Thu, 28 Oct 2010 00:34:02 +0000 (17:34 -0700)]
test: Update tests with removal of bcc from reply

Update the tests so that they no longer expect the Bcc header in the
output of "notmuch reply" now that it has been removed.

Edited-by Carl Worth: Simply applying the change to our newly
modularized test suite.

13 years agoRemove bcc header from notmuch reply.
Jameson Rollins [Thu, 28 Oct 2010 00:15:42 +0000 (17:15 -0700)]
Remove bcc header from notmuch reply.

Notmuch reply should not be Bcc'ing the sender by default.  This is
not the appropriate way to save copies of sent mail (which should
probably be handled by an Fcc header[*]) and it doesn't give the user the
option to not be bcc'd.  This is really something that should be
handled by the reader UI.  For instance, emacs message-mode can easily
be configured to add Bcc's if the user wishes.

[*] Carl Worth: The FCC header is now in place by default in the emacs
user-interface (and tested in the test suite) so the Bcc is ready to
be eliminated.

13 years agotest: Add test for fully-roundtripped FCC
Carl Worth [Thu, 28 Oct 2010 00:08:09 +0000 (17:08 -0700)]
test: Add test for fully-roundtripped FCC

We test that the message we sent via (fake) SMTP is included in the mail
index after a "notmuch new". This verifies that the FCC setting indeed
successfully saved the sent message within the notmuch mail store.

13 years agotest: Use an explicit date in the message sent via (fake) SMTP
Carl Worth [Thu, 28 Oct 2010 00:06:26 +0000 (17:06 -0700)]
test: Use an explicit date in the message sent via (fake) SMTP

Simply setting an explicit date is cleaner than letting the current,
(arbitrary), date get generated for the email message and then constantly
filtering that date out of search results.

13 years agoemacs: Explicitly set the From address when composing a new message.
Carl Worth [Wed, 27 Oct 2010 23:58:44 +0000 (16:58 -0700)]
emacs: Explicitly set the From address when composing a new message.

Previously, underlying emacs code was setting this header. Now, we do the
right thing and query the notmuch configuration for the default value here.

13 years agoemacs: Enable FCC (to a directory named "sent") by default.
Carl Worth [Wed, 27 Oct 2010 23:35:53 +0000 (16:35 -0700)]
emacs: Enable FCC (to a directory named "sent") by default.

Now that the FCC code is fixed to use the notmuch database path, we can
actually enable this by default, which should be highly useful for all
new users of notmuch.

13 years agoemacs: Change FCC to be relative to notmuch mail store, not message-directory
Carl Worth [Wed, 27 Oct 2010 23:27:43 +0000 (16:27 -0700)]
emacs: Change FCC to be relative to notmuch mail store, not message-directory

Otherwise, FCC is too hard to use, (user must set it and also set message-
directory variable to match notmuch mail datbase path). As a rule, I'd like
for users of notmuch to not be required to muck around with non-notmuch
mail settings in emacs.

The above is only really possible now thanks to the recent addition of the
"notmuch config get" command which allows emacs to query the currently
configured notmuch database path.

This also now allows an absolute-path FCC to be set if desired.

13 years agonotmuch config: Allow for new "notmuch config set" in addition to get
Carl Worth [Wed, 27 Oct 2010 22:38:16 +0000 (15:38 -0700)]
notmuch config: Allow for new "notmuch config set" in addition to get

It is now possible to set configuration items from the command-line in
a manner quite similar to the support for querying configuration
items.

13 years agonotmuch config: Provide support for querying non-standard configuration values.
Carl Worth [Wed, 27 Oct 2010 20:26:32 +0000 (13:26 -0700)]
notmuch config: Provide support for querying non-standard configuration values.

We might as well be general here, and allow the "notmuch config" command
to query any stored value from the configuration file, (whether or not
the rest of the code actually knows anything about that value).

13 years agonotmuch: Add a new "notmuch config" command for querying configuration.
Carl Worth [Wed, 27 Oct 2010 20:02:17 +0000 (13:02 -0700)]
notmuch: Add a new "notmuch config" command for querying configuration.

So far, we implement only "notmuch config get". It won't be too much
work from here to also implement "notmuch config set".

13 years agoTODO: Note idea for a new "notmuch compose"
Carl Worth [Wed, 27 Oct 2010 17:48:40 +0000 (10:48 -0700)]
TODO: Note idea for a new "notmuch compose"

Which would also allow the recently added test of sending an email
message with the emacs interface to be a little more honest about the
From address.

13 years agotest: Add test that emacs interface actually sends mail.
Carl Worth [Wed, 27 Oct 2010 17:42:46 +0000 (10:42 -0700)]
test: Add test that emacs interface actually sends mail.

Rather than *reall* sending mail here, we instead have a new test
program, smtp-dummy which implements (a small piece of) the
server-side SMTP protocol and saves a mail message to the filename
provided. This gives us reasonable test coverage of a large chunk of
the notmuch+emacs code base (down to talking to an SMTP server with
the final mail contents).

13 years agotest: Set alternate HOME during tests.
Carl Worth [Wed, 27 Oct 2010 17:40:44 +0000 (10:40 -0700)]
test: Set alternate HOME during tests.

We set the HOME environment variable to the test directory to avoid
the tests relying on any configuration files from the test author's
own home directory, (such as ${HOME}/.emacs or similar).

13 years agotest: Fix false failure from the "available tests" test.
Carl Worth [Sat, 23 Oct 2010 01:00:17 +0000 (18:00 -0700)]
test: Fix false failure from the "available tests" test.

We recently added a new sub-directory below test, so we have to
blacklist it explicitly in this test.