]> git.notmuchmail.org Git - notmuch/log
notmuch
13 years agoInitial import of Go bindings for notmuch
Sebastien Binet [Wed, 10 Nov 2010 17:18:44 +0000 (18:18 +0100)]
Initial import of Go bindings for notmuch

13 years agoTODO: Note that folder: has now been implemented.
Carl Worth [Thu, 20 Jan 2011 01:04:10 +0000 (17:04 -0800)]
TODO: Note that folder: has now been implemented.

This feature has been mentioned in the TODO file (more than once) for
quite some time now.

13 years agoruby: Add wrapper for message_get_filenames
Ali Polatel [Mon, 10 Jan 2011 14:03:31 +0000 (16:03 +0200)]
ruby: Add wrapper for message_get_filenames

13 years agoruby: Add wrappers for maildir sync. interface
Ali Polatel [Mon, 10 Jan 2011 14:02:43 +0000 (16:02 +0200)]
ruby: Add wrappers for maildir sync. interface

New wrappers:
notmuch_message_maildir_flags_to_tags(): MESSAGE.maildir_flags_to_tags
notmuch_message_tags_to_maildir_flags(): MESSAGE.tags_to_maildir_flags

13 years agoruby: Add wrappers for query_get_s{ort,tring}
Ali Polatel [Mon, 10 Jan 2011 13:59:18 +0000 (15:59 +0200)]
ruby: Add wrappers for query_get_s{ort,tring}

New wrappers:
notmuch_query_get_sort(): QUERY.sort
notmuch_query_get_query_string(): QUERY.to_s

13 years agoAdd documentation for the recently added folder-based searching.
Carl Worth [Sat, 15 Jan 2011 22:18:45 +0000 (14:18 -0800)]
Add documentation for the recently added folder-based searching.

Augmenting both the builtin help as well as the manual page.

13 years agoAdd support for folder-based searching.
Carl Worth [Sat, 15 Jan 2011 22:09:04 +0000 (14:09 -0800)]
Add support for folder-based searching.

A new "folder:" prefix in the query string can now be used to match
the directories in which mail files are stored.

The addition of this feature causes the recently added
search-by-folder tests to now pass.

13 years agotest: Add new tests for folder-based searching.
Carl Worth [Sat, 15 Jan 2011 22:05:10 +0000 (14:05 -0800)]
test: Add new tests for folder-based searching.

This is a new feature which is not implemente yet, so these tests mostly
fail currently. A subsequent commit will add the feature and cause these
tests to start passing.

These tests verify that we can search for containing folders of mail files
by word or by phrase and that the search terms are updated correctly when
directories are renamed.

13 years agoFix misspelling in a comment.
Carl Worth [Sat, 15 Jan 2011 22:04:38 +0000 (14:04 -0800)]
Fix misspelling in a comment.

Just a simple change I noticed in passing.

13 years agotest/basic: Ignore new files ending in ~
Carl Worth [Sat, 15 Jan 2011 22:03:33 +0000 (14:03 -0800)]
test/basic: Ignore new files ending in ~

We don't need to complain that temporary editor backups are not added
to the list of tests to be run.

13 years agoTighten up a memory allocation.
Carl Worth [Sat, 15 Jan 2011 22:01:43 +0000 (14:01 -0800)]
Tighten up a memory allocation.

Using the local talloc context ensures that the memory we are using
here will be freed shortly, (rather than hanging on for a long time
with the notmuch database object).

13 years agoCorrect some minor typos in a comment
Carl Worth [Thu, 13 Jan 2011 01:04:10 +0000 (17:04 -0800)]
Correct some minor typos in a comment

Nothing too important here. Just some misspellings I noticed while reading
nearby code.

13 years agopython: Update metainformation to point to new URL and version number
Sebastian Spaeth [Thu, 13 Jan 2011 11:35:59 +0000 (12:35 +0100)]
python: Update metainformation to point to new URL and version number

Convert the meta information to point to the notmuchmail.org repository, rather
than the old cnotmuch location. I will delete the "cnotmuch" package
from http://pypi.python.org/pypi/cnotmuch and create a new "notmuch"
package there that contains the current versions.

Also bump the version number to 0.4. I will need to upgrade the API
first before I can release the 0.5 of the bindings, there are still some
methods missing.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
13 years agoOptimize thread search using matched docid sets.
Austin Clements [Wed, 17 Nov 2010 19:28:26 +0000 (14:28 -0500)]
Optimize thread search using matched docid sets.

This reduces thread search's 1+2t Xapian queries (where t is the
number of matched threads) to 1+t queries and constructs exactly one
notmuch_message_t for each message instead of 2 to 3.
notmuch_query_search_threads eagerly fetches the docids of all
messages matching the user query instead of lazily constructing
message objects and fetching thread ID's from term lists.
_notmuch_thread_create takes a seed docid and the set of all matched
docids and uses a single Xapian query to expand this docid to its
containing thread, using the matched docid set to determine which
messages in the thread match the user query instead of using a second
Xapian query.

This reduces the amount of time required to load my inbox from 4.523
seconds to 3.025 seconds (1.5X faster).

13 years agoUpdate test suite for 7 tests that were recently fixed.
Carl Worth [Wed, 8 Dec 2010 00:35:47 +0000 (16:35 -0800)]
Update test suite for 7 tests that were recently fixed.

These tests had been broken, but were fixed by the preceding commit,
so update the test suite to print PASS rather than FIXED for these.

13 years agonotmuch search: Fix to display authors in date order.
Carl Worth [Wed, 8 Dec 2010 00:33:29 +0000 (16:33 -0800)]
notmuch search: Fix to display authors in date order.

Previously, the authors of the thread were displayed in
reverse-chronological order, which was fairly confusing.

13 years agolib: Set thread subject at the same time as setting thread->{oldest,newest}
Carl Worth [Wed, 8 Dec 2010 00:26:38 +0000 (16:26 -0800)]
lib: Set thread subject at the same time as setting thread->{oldest,newest}

We really want to change the thread subject at the same time we set
the date, (if the sort order indicates this is necessary). The
previous code for setting the thread subject was sensitive on the
query sort when adding matching messages. An independent bug fix is
about to change that query sort order, so we remove the dependency on
it here.

13 years agoRevert "test: Break on test script (or other) error"
Carl Worth [Tue, 7 Dec 2010 23:28:44 +0000 (15:28 -0800)]
Revert "test: Break on test script (or other) error"

This reverts commit f22a7ec1e28d1264cf9d67d78796b8ab22e09a35.

Interrupting the test suite due to an actual bug in a test script
would be just fine, but interrupting the run of the entire test suite
at the first test failure is unacceptable.

13 years agotest: Leave tmp.<testname> for broken tests
Carl Worth [Tue, 7 Dec 2010 22:24:00 +0000 (14:24 -0800)]
test: Leave tmp.<testname> for broken tests

Previously, this directory was only preserved for failing tests. But
it's important to be able to easily debug known-broken tests, so
preserve the actual vs. expected output for those as well.

13 years agoMake author order tests more strict.
Austin Clements [Wed, 17 Nov 2010 19:27:59 +0000 (14:27 -0500)]
Make author order tests more strict.

Use varying dates in the test messages to test the order authors are
listed in.  Add tests with repeated author names and unusual date
ordering.  Most of these are broken at the moment, but will be fixed
shortly.

Edited-by: Carl Worth <cworth@cworth.org>: Also update the expected
results for existing emacs tests that currently codify the incorrect
author ordering, (and similarly note them as broken in the current
test suite).

13 years agoFix handling of broken tests.
Austin Clements [Wed, 17 Nov 2010 19:27:20 +0000 (14:27 -0500)]
Fix handling of broken tests.

Make sure to close the subtest for test_expect_equal_failure, just
like in test_expect_equal.

13 years agoemacs: Remove over-eager regular expressions from notmuch-wash-tidy-citations.
David Edmondson [Wed, 17 Nov 2010 13:32:33 +0000 (13:32 +0000)]
emacs: Remove over-eager regular expressions from notmuch-wash-tidy-citations.

The removed expressions, which were used to ensure that citations were
both preceded and followed by a blank line, were poorly implemented
and caused a regexp stack overflow on messages more than a few
thousand lines long.

13 years agoemacs: Improve the display of truncated authors.
David Edmondson [Wed, 17 Nov 2010 12:05:04 +0000 (12:05 +0000)]
emacs: Improve the display of truncated authors.

Incremental search does not match strings that span a
visible/invisible boundary. This results in failure to correctly
isearch for authors in `notmuch-search' mode if the name of the author
is split between the visible and invisible components of the authors
string. To avoid this, attempt to truncate the visible component of
the authors string on a boundary between authors, such that the
entirety of an author's name is either visible or invisible.

13 years agoemacs: Use truenames for Fcc paths.
David Edmondson [Fri, 12 Nov 2010 08:07:02 +0000 (08:07 +0000)]
emacs: Use truenames for Fcc paths.

Appease the test suite by using the true name for the Fcc directory
path, otherwise a value for `notmuch-database-path' which includes
symbolic links causes test suite failures.

13 years agotest: Ignore files created during test failures.
David Edmondson [Fri, 12 Nov 2010 08:07:01 +0000 (08:07 +0000)]
test: Ignore files created during test failures.

When a test fails, a tmp.<testname> file is left behind. These files
are useful for the person debugging the test failure, but are never
anything we want to commit.

Edited-by: Carl Worth <cworth@cworth.org>: Changed from tmp.emacs to
tmp.* and added explanation in the commit message.

13 years agonotmuch new: Scan directory whenever fs mtime is not equal to db mtime
Carl Worth [Sun, 5 Dec 2010 09:40:16 +0000 (01:40 -0800)]
notmuch new: Scan directory whenever fs mtime is not equal to db mtime

Previously, we would only scan a directory if the filesystem
modification time was strictly newer than the database modification
time for the directory. This would cause a problem for systems with an
unstable clock, (if a new mail was added to the filesystem, then the
system clock rolled backward, "notmuch new" would not find the message
until the clock caught up and the directory was modified again).

Now, we always scan the directory if the modification time of the
directory is not exactly the same between the filesystem and the
database. This avoids the problem described above even with an
unstable system clock.

13 years agoFix to index the "Re" term present in any subject.
Carl Worth [Wed, 24 Nov 2010 02:11:04 +0000 (18:11 -0800)]
Fix to index the "Re" term present in any subject.

This was a misfeature where notmuch had extra code that just threw
away legitimate information. It was never indexing an initial "Re"
term in a subject. But some users have legitimately wanted to search
for this term.

The original code was written this way merely for strict compatiblity
with the indexing performed by sup, but we're not taking advantage of
that now anyway.

13 years agonotmuch search: Fix missing final newline in "notmuch search --output=tags"
Carl Worth [Wed, 24 Nov 2010 01:58:00 +0000 (17:58 -0800)]
notmuch search: Fix missing final newline in "notmuch search --output=tags"

As mentioned in the recent test commits, this also fixes the missing
'[' and ']' characters in the --format=json variant of "notmuch search
--output=tags" as well.

13 years agotest: Add --format=json testing to the "notmuch search --format" tests.
Carl Worth [Wed, 24 Nov 2010 01:54:47 +0000 (17:54 -0800)]
test: Add --format=json testing to the "notmuch search --format" tests.

This testing *does* capture the bug of missing '[' and ']' characters
int "notmuch search --output=tags" case. This is another manifestation
of the same bug causing the missing final newline (as mentioned in the
previous commit).

13 years agotest: Add simple tests for "notmuch search --output=<>"
Carl Worth [Wed, 24 Nov 2010 01:41:25 +0000 (17:41 -0800)]
test: Add simple tests for "notmuch search --output=<>"

This code simply wasn't being exercised by the test suite before, so
this will be useful.

Meanwhile, there's currently a bug in "notmuch search --output=tags"
in that it doesn't print a final newline. But the current test suite
isn't able to catch this bug since the $() construct of the shell
doesn't preserve the distinction of whether the final newline is
present or not.

13 years agoTODO: Note missing keybindings for next/previous thread in emacs client.
Carl Worth [Wed, 24 Nov 2010 01:25:54 +0000 (17:25 -0800)]
TODO: Note missing keybindings for next/previous thread in emacs client.

Seems a fairly obvious shortcoming to have survived this long.

13 years agocompatibility with emacs22
James Vasile [Sun, 28 Feb 2010 01:34:45 +0000 (20:34 -0500)]
compatibility with emacs22

Emacs22 lacks apply-partially and mouse-event-p, so define them if emacs
version is less than 23.  With this change, I was able to begin using
notmuch in emacs22.

The definitions of apply-partially and mouse-event-p are copied from
the emacs 23 distribution, (which is distributed under the GPLv3+ just
as notmuch).

13 years agoTODO: Add several items recently mentioned on the mailing list.
Carl Worth [Tue, 16 Nov 2010 20:03:03 +0000 (12:03 -0800)]
TODO: Add several items recently mentioned on the mailing list.

Getting things listed here means that I can safely archive away those
messages without worrying that the ideas will get lost.

13 years agotest: Don't print a test result for preliminary test setup
Carl Worth [Tue, 16 Nov 2010 19:29:47 +0000 (11:29 -0800)]
test: Don't print a test result for preliminary test setup

This test script does some initial test setup (generating a few
messages), which is all well and good, but we don't need to print that
as a test result---particularly since the test result was effectively
hard-coded to always pass.

13 years agotest: Fix bugs detected thanks to the previous commit
Michal Sojka [Sun, 14 Nov 2010 21:54:32 +0000 (22:54 +0100)]
test: Fix bugs detected thanks to the previous commit

13 years agotest: Detect unfinished subsets
Michal Sojka [Sun, 14 Nov 2010 21:54:31 +0000 (22:54 +0100)]
test: Detect unfinished subsets

When test_begin_subtest is not followed by corresponding test_expect_equal,
the output of the rest of the test script is errornously suppressed. Add
code to detect these bugs in test scripts.

13 years agotest: Break on test script (or other) error
Michal Sojka [Sun, 14 Nov 2010 21:54:30 +0000 (22:54 +0100)]
test: Break on test script (or other) error

Break notmuch-test whenever a test script returns non-zero status.
This happens either when some test from the script fails or when there
is an error in the script.

This is especially useful in the latter case since the error may not
appear in the final aggregated results.

13 years agotest: Add trailing newline to error messages
Michal Sojka [Sun, 14 Nov 2010 21:54:29 +0000 (22:54 +0100)]
test: Add trailing newline to error messages

The newline was removed from say_color in commit 222926ab to allow
printing test status in the beginning of the line. Error messages are
never followed by other text so we add the newline to error function.

13 years agotest: Better handling of stdout and stderr
Michal Sojka [Sun, 14 Nov 2010 21:54:28 +0000 (22:54 +0100)]
test: Better handling of stdout and stderr

Git-style tests (test_expect_success etc.) suppress stdout and stderr
unless -v is given. Notmuch-style tests (created by test_begin_subtest
and test_expect_equal) do not have this behavior so implement it the
same.

Additionally, for both test styles, the test-lib.sh is changed so that
the content of suppressed stdout and stderr is shown in case of failed
test.

Finally a test for this functionality is added to basic tests.

13 years agoemacs: Use `view-mode' when examining raw messages.
David Edmondson [Mon, 15 Nov 2010 14:21:53 +0000 (14:21 +0000)]
emacs: Use `view-mode' when examining raw messages.

Explained-by: Carl Worth: This gives convenient keybindings for
navigating the file and for quitting from the buffer, (since, with a
raw message file the user will generally want to just view the
message, not edit it).

13 years agoconfigure: Add explicit check for glib >= 2.14
Carl Worth [Tue, 16 Nov 2010 17:00:34 +0000 (09:00 -0800)]
configure: Add explicit check for glib >= 2.14

For cases where GMime is present, but happy with glib 2.12, for example.

13 years agoconfigure: Use pkg-config --exists rather than --modversion
Carl Worth [Tue, 16 Nov 2010 16:51:50 +0000 (08:51 -0800)]
configure: Use pkg-config --exists rather than --modversion

With --modversion we were asking for output that we were just throwing
away anyway. The --exists option does just what we want, (no output
and communivating only via return value).

Also, --exists allows for testing versions of the package as well.

13 years agolib: Fix missing initialization of status field. 0.5
Carl Worth [Fri, 12 Nov 2010 04:54:41 +0000 (20:54 -0800)]
lib: Fix missing initialization of status field.

This could have been a problematic bug. Fortuinately "gcc -O2" warns
about it.

13 years agolib: Add two missing static qualifiers
Carl Worth [Fri, 12 Nov 2010 04:53:21 +0000 (20:53 -0800)]
lib: Add two missing static qualifiers

The debian packaging is nice enough to notice when we accidentally
leak private symbols to the public interface.

13 years agodebian: Update list of symbols for libnotmuch
Carl Worth [Fri, 12 Nov 2010 04:51:29 +0000 (20:51 -0800)]
debian: Update list of symbols for libnotmuch

This release adds three new functions to the library interface.

13 years agodebian: Add changelog entry for 0.5
Carl Worth [Fri, 12 Nov 2010 04:49:25 +0000 (20:49 -0800)]
debian: Add changelog entry for 0.5

Just pulling things from NEWS as usual.

13 years agoIncrement notmuch version to 0.5
Carl Worth [Fri, 12 Nov 2010 04:43:56 +0000 (20:43 -0800)]
Increment notmuch version to 0.5

The big change here is the support for maildir-flag synchronization.

But there are a number of other thigns as well---library support for
multiple filenames, new ruby bindings, improvements to the vim
interface, and a few tweaks to the emacs interface.

13 years agoIncrement library version to 1.3.0
Carl Worth [Fri, 12 Nov 2010 04:42:45 +0000 (20:42 -0800)]
Increment library version to 1.3.0

For the addition of three functions:

notmuch_message_get_filenames
notmuch_message_tags_to_maildir_flags
notmuch_message_maildir_flags_to_tags

13 years agoNEWS: Add notes for 0.5 release.
Carl Worth [Fri, 12 Nov 2010 04:41:06 +0000 (20:41 -0800)]
NEWS: Add notes for 0.5 release.

Which is ready to go now.

13 years agoconfig: Fix confusing of "tag" and "flag" oin documentation.
Carl Worth [Fri, 12 Nov 2010 04:39:22 +0000 (20:39 -0800)]
config: Fix confusing of "tag" and "flag" oin documentation.

It has been very difficult to get all of these right. I would not be
surprised if I've still missed some.

13 years agoemacs: add stash thread-id function to notmuch-search mode
Jameson Rollins [Sat, 18 Sep 2010 19:48:22 +0000 (15:48 -0400)]
emacs: add stash thread-id function to notmuch-search mode

This add a "stash-map" for search-mode, just like in show-mode, and
adds one function, bound to "i" to stash the thread-id of the current
selected thread.

Couldn't think of the correct way to stash other thread info, so I
didn't add any other stash functions for now.

13 years agoemacs: mv notmuch-{show,common}-do-stash
Jameson Rollins [Sat, 18 Sep 2010 19:48:21 +0000 (15:48 -0400)]
emacs: mv notmuch-{show,common}-do-stash

Here we move the notmuch-show/notmuch-show-do-stash function to
notmuch-lib/notmuch-common-do-stash.  Nothing in this function is
notmuch-show mode specific, so this move will make it cleaner to be
used by other modes (such as notmuch-search).

13 years agoemacs: Improve the definition and use of `notmuch-fcc-dirs'.
David Edmondson [Mon, 8 Nov 2010 15:01:25 +0000 (15:01 +0000)]
emacs: Improve the definition and use of `notmuch-fcc-dirs'.

Re-work the declaration and definition of `notmuch-fcc-dirs'. The
variable now allows three types of values:

- nil: no Fcc header is added,

- a string: the value of `notmuch-fcc-dirs' is the name of the
  folder to use,

- a list: the folder is chosen based on the From address of the
  current message using a list of regular expressions and
  corresponding folders:

     ((\"Sebastian@SSpaeth.de\" . \"privat\")
      (\"spaetz@sspaeth.de\" . \"OUTBOX.OSS\")
      (\".*\" . \"defaultinbox\"))

  If none of the regular expressions match the From address, no
  Fcc header will be added.

13 years agoemacs: Use the header line to show the subject of the thread.
David Edmondson [Mon, 8 Nov 2010 14:18:25 +0000 (14:18 +0000)]
emacs: Use the header line to show the subject of the thread.

13 years agoemacs: Simplify subjects more aggressively.
David Edmondson [Mon, 8 Nov 2010 10:50:29 +0000 (10:50 +0000)]
emacs: Simplify subjects more aggressively.

Remove 're: ' or 'Re: ' from anywhere within a subject line rather
than just at the beginning. This is to accommodate threads where a
mailing list sometimes inserts a subject prefix.

For example, if a thread has the subjects:

    [Orgmode] org-indent, org-inlinetask: patches on github
    Re: [Orgmode] org-indent, org-inlinetask: patches on github
    [Orgmode] Re: org-indent, org-inlinetask: patches on github

the last of these would not have been considered the same and would
therefore have been shown.

13 years agoemacs: Elide the display of repeated subjects in thread display mode.
David Edmondson [Mon, 8 Nov 2010 10:44:08 +0000 (10:44 +0000)]
emacs: Elide the display of repeated subjects in thread display mode.

Collapsed messages do not show a "Subject:" line if the subject is the
same as that of the previous message.

13 years agotest: Update emacs tests for fix to counting of signature lines.
Carl Worth [Fri, 12 Nov 2010 01:00:15 +0000 (17:00 -0800)]
test: Update emacs tests for fix to counting of signature lines.

The recent bug fix invalidated some expected test results. Fix them up.

13 years agoemacs: Correctly count the number of lines in a signature.
David Edmondson [Tue, 9 Nov 2010 18:15:31 +0000 (18:15 +0000)]
emacs: Correctly count the number of lines in a signature.

13 years agoUpdate of the spec file to the 0.4 release.
Scott Henson [Fri, 12 Nov 2010 00:30:50 +0000 (16:30 -0800)]
Update of the spec file to the 0.4 release.

13 years agotags_to_maildir_flags: Fix to preserve existing, unsupported flags
Carl Worth [Fri, 12 Nov 2010 00:36:02 +0000 (16:36 -0800)]
tags_to_maildir_flags: Fix to preserve existing, unsupported flags

This is to prevent notmuch from destroying any information the user
has encoded as flags in the maildir filename. Tests are also added to
the test suite to verify the documented behavior.

13 years agonotmuch_message_tags_to_maildir_flags: Do nothing outside of "new" and "cur"
Carl Worth [Thu, 11 Nov 2010 22:32:17 +0000 (14:32 -0800)]
notmuch_message_tags_to_maildir_flags: Do nothing outside of "new" and "cur"

Some people use notmuch with non-maildir files, (for example, email
messages in MH format, or else cool things like using sluk[*] to suck
down feeds into a format that notmuch can index).

To better support uses like that, don't do any renaming for files that
are not in a directory named either "new" or "cur".

[*] https://github.com/krl/sluk/

13 years agolib: Be honest in the documentation of the maildir functions
Carl Worth [Thu, 11 Nov 2010 12:51:55 +0000 (04:51 -0800)]
lib: Be honest in the documentation of the maildir functions

I had originally hoped for better semantics, such as doing nothing in
non-maildir directories, and preserving unknown maildir flags that
happen to be present.

We could still do those things, of course, but for now, remove them
from the documentation since the implementation does not do these
things yet.

13 years agonotmuch setup: Fix to add maildir group (with comment) to existing file
Carl Worth [Thu, 11 Nov 2010 12:28:01 +0000 (04:28 -0800)]
notmuch setup: Fix to add maildir group (with comment) to existing file

The intent of "notmuch setup" is that it adds new, documented sections
to configuration files that were created before such sections were
defined. But to make this work, we have to explicitly set an option
in the maildir group if it didn't exist previously.

13 years agotest: Move corpus emails into maildir directory structure
Carl Worth [Thu, 11 Nov 2010 12:17:29 +0000 (04:17 -0800)]
test: Move corpus emails into maildir directory structure

Now that we have maildir synchronization turned on by default, it's
advantageous to make all of the tests exercise it as much as possible.

13 years agotest: Fix emacs FCC test to account for new maildir synchronization
Carl Worth [Thu, 11 Nov 2010 12:12:43 +0000 (04:12 -0800)]
test: Fix emacs FCC test to account for new maildir synchronization

The FCC code saves a message in maildir format, and sets the S flag by
default, so now, automatically, FCC messages will not show up as
"unread", (which seems natural enough).

13 years agoEnable maildir synchronization by default.
Carl Worth [Thu, 11 Nov 2010 12:11:21 +0000 (04:11 -0800)]
Enable maildir synchronization by default.

This is a useful feature that most people should want, so enable it by
default, (still allowing customization to disable it of course).

13 years agonotmuch config: Add more documentation for maildir.synchronize_flags
Carl Worth [Thu, 11 Nov 2010 12:06:23 +0000 (04:06 -0800)]
notmuch config: Add more documentation for maildir.synchronize_flags

Including details on which actual flags are synchronized with which tags.

13 years agonotmuch setup: Don't prompt about maildir synchronization
Carl Worth [Thu, 11 Nov 2010 11:53:14 +0000 (03:53 -0800)]
notmuch setup: Don't prompt about maildir synchronization

This synchronization is one of those features that should just happen
automatically. We allow for customization in case someone *really*
wants to turn it off, but we don't need to prompt for this
interactively.

People with special needs can find the configuration file on their
own.

13 years agonotmuch_message_tags_to_maildir_flags: Don't exit on failure to rename.
Carl Worth [Thu, 11 Nov 2010 11:50:42 +0000 (03:50 -0800)]
notmuch_message_tags_to_maildir_flags: Don't exit on failure to rename.

It is totally legitimate for a non-maildir directory to be named "new"
(and not have a directory next to it named "cur"). To support this
case at least, be silent about any rename failure.

13 years agotest: Drop test for propagating flag changes from one file to another
Carl Worth [Thu, 11 Nov 2010 11:43:09 +0000 (03:43 -0800)]
test: Drop test for propagating flag changes from one file to another

There's nothing in the current API documentation that would suggest
the behavior being tested here. Attempt to implement this could have
some nasty side effects, (such as notmuch_message_maildir_flags_to_tags
implicitly calling notmuch_message_tags_to_maildir_flags and maybe
even opening up some bad looping possibilities).

Much better to stick with what we have documented, which we believe will
actually be useful, (and easy enough to comprehend).

13 years agonotmuch_message_tags_to_maildir_flags: Fix to rename multiple files
Carl Worth [Thu, 11 Nov 2010 11:41:39 +0000 (03:41 -0800)]
notmuch_message_tags_to_maildir_flags: Fix to rename multiple files

This function was documented as modifying every filename associated
with the message. Fix it to actually do that.

13 years agonotmuch_filenames_create: Take a reference to underlying filename list
Carl Worth [Thu, 11 Nov 2010 11:36:13 +0000 (03:36 -0800)]
notmuch_filenames_create: Take a reference to underlying filename list

The notmuch_filenames_t object might easily outlive the original object
owning the filename list. So take a talloc reference to keep things safe.

13 years agomaildir_flags_to_tags: Avoid interpreting "no info" as "no flags set".
Carl Worth [Thu, 11 Nov 2010 10:55:13 +0000 (02:55 -0800)]
maildir_flags_to_tags: Avoid interpreting "no info" as "no flags set".

If a filename has no maildir info at all, (that is, it does not
contain the sequence ":2,"), we consider this distinct from a filename
with an empty maildir info, (the ":2," separator is present, but no
flags characters follow).

Specifically, we regard a missing info field as providing no
information, so tags will remain unchanged. On the other hand, an info
field that is present but has no flags set will cause various tags to
be cleared, (or in the case of "unread", added).

This fixes the "remove info" case of the maildir-sync tests in the
test suite.

13 years agonotmuch new: Defer maildir_flags synchronization until after removals
Carl Worth [Thu, 11 Nov 2010 10:49:24 +0000 (02:49 -0800)]
notmuch new: Defer maildir_flags synchronization until after removals

When a file in the mailstore is renamed, this appears to "notmuch new"
as both an added file and a removed file (for the same message). We
want the synchronization of the maildir_flags to reflect the final
state, (after the rename is complete). Therefore, it's incorrect to
perform the synchronization immediately after adding a new
file. Instead we queue up these synchronizations (by message ID[*])
and perform them after the removals are complete.

With this change, the "dump/restore" case of the maildir-sync tests,
as well as the recent "remove 'S'" case both now pass where they were
failing before.

Interestingly, the "remove info" test was passing before, but now
fails. This is actually due to a separate bug, (and the bug just fixed
was masking it, by preventing the test from performing as desired).

[*] It's important to queue by message ID---queueing actual message
objects does not work since the message objects will retain stale data
such as the old filenames.

13 years agolib: Document that absence of maildir flags can also remove/add tags
Carl Worth [Thu, 11 Nov 2010 10:45:24 +0000 (02:45 -0800)]
lib: Document that absence of maildir flags can also remove/add tags

Previously the documentation of notmuch_message_maildir_flags_to_tags
suggested that the presence of a flag would cause tags to be added,
(or in the case of "unread", removed). But the case of absent maildir
flags was not explicitly described.

What we actually want, is that for supported flags, the absence of the
flag in all messages causes the corresponding tag to be removed,
(or in the case of "unread", added). So document that explicitly.

This is the case recently added to the test suite as a failing test,
(so we'll need to do bug fixing before the documentation is honest
here).

13 years agotest: Add a new test that removal of a maildir flag also changes tags
Carl Worth [Thu, 11 Nov 2010 10:43:21 +0000 (02:43 -0800)]
test: Add a new test that removal of a maildir flag also changes tags

This test exposes an existing bug, so is currently failing.

13 years agoFix notmuch_message_tags_to_maildir_flags to effect rename immediately
Carl Worth [Thu, 11 Nov 2010 08:26:04 +0000 (00:26 -0800)]
Fix notmuch_message_tags_to_maildir_flags to effect rename immediately

We have tests to ensure that when the notmuch library renames a file
that that rename takes place immediately in the database, (without
requiring something like "notmuch new" to notice the change).

This was working when the code was first added, but recently broke in
the reworking of the maildir-synchronization interface since the
tags_to_maildir_flags function can no longer assume that it is being
called as part of _notmuch_message_sync.

Fortunately, the fix is as simple as adding an explicit call to
_notmuch_message_sync.

13 years agoFix notmuch_message_maildir_flags_to_tags to iterate over filenames
Carl Worth [Thu, 11 Nov 2010 08:18:35 +0000 (00:18 -0800)]
Fix notmuch_message_maildir_flags_to_tags to iterate over filenames

As documented, this function now iterates over all filenames for the
message, computing a logical OR of the flags set on the filenames,
then uses the final result to set tags on the message.

This change fixes 3 of the 10 maildir-sync tests that have been
failing since being added.

13 years agolib: Add new, public notmuch_message_get_filenames
Carl Worth [Thu, 11 Nov 2010 08:07:24 +0000 (00:07 -0800)]
lib: Add new, public notmuch_message_get_filenames

This augments the existing notmuch_message_get_filename by allowing
the caller access to all filenames in the case of multiple files for a
single message.

To support this, we split the iterator (notmuch_filenames_t) away from
the list storage (notmuch_filename_list_t) where previously these were
a single object (notmuch_filenames_t). Then, whenever the user asks
for a file or filename, the message object lazily creates a complete
notmuch_filename_list_t and then:

For notmuch_message_get_filename, returns the first filename
in the list.

For notmuch_message_get_filenames, creates and returns a new
iterator for the filename list.

13 years agolib: Add new implementation of notmuch_filenames_t
Carl Worth [Thu, 11 Nov 2010 07:26:31 +0000 (23:26 -0800)]
lib: Add new implementation of notmuch_filenames_t

The new implementation is simply a talloc-based list of strings. The
former support (a list of database terms with a common prefix) is
implemented by simply pre-iterating over the terms and populating the
list. This should provide no performance disadvantage as callers of
thigns like notmuch_directory_get_child_files are very likely to
always iterate over all filenames anyway.

This new implementation of notmuch_filenames_t is in preparation for
adding API to query all of the filenames for a single message.

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>