]> git.notmuchmail.org Git - notmuch/log
notmuch
14 years agonotmuch-test: Test "notmuch reply" with multiple recipients
Carl Worth [Thu, 4 Feb 2010 20:03:30 +0000 (12:03 -0800)]
notmuch-test: Test "notmuch reply" with multiple recipients

The feature tested here is that we reply to both the sender and to
others addresses on the To: line of the original message, but that we
don't reply to our own address.

14 years agonotmuch-test: Add test for "notmuch reply" with a CC header.
Carl Worth [Thu, 4 Feb 2010 19:55:57 +0000 (11:55 -0800)]
notmuch-test: Add test for "notmuch reply" with a CC header.

A simple test to help round out the set of tested features.

14 years agonotmuch-test: Add "notmuch reply" test for reply-to support.
Carl Worth [Thu, 4 Feb 2010 19:52:08 +0000 (11:52 -0800)]
notmuch-test: Add "notmuch reply" test for reply-to support.

This is the standard support of reply-to, (replying to that address
rather than the from address). It has nothing to do with the proposed
feature for extra-clever handling of a mail from a mailing-list that
has munged the reply-to header.

14 years agonotmuch-test: Test "notmuch reply" from alternate address.
Carl Worth [Thu, 4 Feb 2010 19:39:31 +0000 (11:39 -0800)]
notmuch-test: Test "notmuch reply" from alternate address.

When reply to a message addresses to an address configured in the
other_email setting in the configuration file, the reply should use
that address in the From header. Test this.

14 years agonotmuch-test: Add a basic test of "notmuch reply"
Carl Worth [Thu, 4 Feb 2010 19:33:56 +0000 (11:33 -0800)]
notmuch-test: Add a basic test of "notmuch reply"

Simply ensuring that the reply template is formatted as expected.

14 years agonotmuch-test: Eliminate sleeps to speed up test suite run
Carl Worth [Thu, 4 Feb 2010 19:31:01 +0000 (11:31 -0800)]
notmuch-test: Eliminate sleeps to speed up test suite run

We were sleeping merely to ensure that our updates to the mail store
would result in the mtime of the appropriate directories being
updated. We make the test suite run faster by not sleeping, but
instead explicitly updating the mtime of the directory to a future
time with touch.

We're careful to ensure that the time is not merely in the future
compared to the current time, but also later than any previous update
to the same directory mtime.

14 years agonotmuch-test: Allow custom headers when generating messages
Carl Worth [Thu, 4 Feb 2010 16:39:23 +0000 (08:39 -0800)]
notmuch-test: Allow custom headers when generating messages

This provides the control that future tests will need, (for example,
adding a CC field to ensure proper handling with "notmuch reply",
etc.)

14 years agonotmuch-test: Use named-parameters for generate_message function
Carl Worth [Thu, 4 Feb 2010 01:24:01 +0000 (17:24 -0800)]
notmuch-test: Use named-parameters for generate_message function

This makes the test suite bash-specific, but that's not much of
an issue for me, (if somebody else would prefer some other language
then they can rewrite the test suite and maintain it).

The advantage here is that we'll now be able to easily generate
custom messages for testing operations that depend on the message
content, (such as "notmuch reply", etc.).

14 years agoAdd actual testing to notmuch-test
Carl Worth [Wed, 3 Feb 2010 00:24:53 +0000 (16:24 -0800)]
Add actual testing to notmuch-test

We verify that each command creates output exactly as expected (after
ignoring variable output such as the report of how long an operation
took).

14 years agoAdd a very rough beginning of a test suite.
Carl Worth [Sat, 23 Jan 2010 18:36:39 +0000 (07:36 +1300)]
Add a very rough beginning of a test suite.

This notmuch-test script simply runs a few different notmuch operations,
(things that I found were useful while testing the rename-support code).

It's not useful as a test suite yet, since it doesn't actually check
the results of any operation, (the user of the suite has to know what
the results should be and must manually verify them. So there's no
integration with the build system yet, (no "make test" target).

But I didn't want to lose what I had so far, so here it is.

14 years agonotmuch.desktop: Clarify that this is the emacs interface to notmuch.
Carl Worth [Sat, 23 Jan 2010 18:28:19 +0000 (07:28 +1300)]
notmuch.desktop: Clarify that this is the emacs interface to notmuch.

And the name is notmuch not not much.

14 years agoAdd install target for notmuch.desktop file.
Jeffrey C. Ollie [Sun, 22 Nov 2009 21:17:11 +0000 (15:17 -0600)]
Add install target for notmuch.desktop file.

Add an install target that uses desktop-file-install to install the
desktop file in the appropriate location.  The location of the install
can be modified by changing the desktop_dir variable.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
14 years agoFix misspelling of DT_UNKNOWN.
Carl Worth [Sat, 23 Jan 2010 09:45:23 +0000 (22:45 +1300)]
Fix misspelling of DT_UNKNOWN.

How foolish of me to advertise the fact that I pushed a commit without
compiling it first...

14 years agoREADME: Tighten up the text a bit.
Carl Worth [Sat, 23 Jan 2010 06:00:25 +0000 (19:00 +1300)]
README: Tighten up the text a bit.

As Keith pointed out, (with a humorous citation from Mark Twain),
the two uses of "very" added nothing to the description. Also,
"large collection of email" was repeated uselessly.

14 years agoAdd some comments to document the recently-fixed handling of d_type.
Carl Worth [Sat, 23 Jan 2010 05:58:30 +0000 (18:58 +1300)]
Add some comments to document the recently-fixed handling of d_type.

The fix was subtle, (requiring less code than originally expected), so
it behooves us to document it well.

14 years agonotmuch new: Fix to work on filesystems returning DT_UNKNOWN
Geo Carncross [Thu, 21 Jan 2010 20:10:18 +0000 (15:10 -0500)]
notmuch new: Fix to work on filesystems returning DT_UNKNOWN

Such as reiserfs or xfs. This has been broken since the merge of
support for rename and deletion of files from the mail store.

Here's the original justification for the patch:

A review of notmuch-new.c shows three uses of ->d_type:

Near line 153, in _entries_resemble_maildir() we can simply allow for
DT_UNKNOWN. This would fail if people have MH-style folders which have
three folders called "new" "cur" and "tmp", but that seems unlikely, in
which case the "tmp" folder would simply not be scanned.

Near line 273 in add_files_recursive() we have another check. If
DT_UNKNOWN, we fall through, then add_files_recursive() does a stat
almost immediately, returning with success if the path isn't a
directory.

Thus, the fallback is already written.

Finally, near line 343, in add_files_recursive() (a long function) we
have another check. Here we can simply treat DT_UNKNOWN as DT_LNK, since
the logic for the stat() results are the same.

14 years agoInstall zsh completion file
martin f. krafft [Fri, 8 Jan 2010 22:49:34 +0000 (11:49 +1300)]
Install zsh completion file

According to the Debian zsh maintainer Clint Adams, this is the first
time that a package installs its own completer into zsh. Part of the
reason this is not usually done is because zsh does not provide a stable
API.

We agreed to try it, given that notmuch is expected to change quite
a bit initially. If there are problems or the completer goes stable,
we'll move it into the upstream zsh repository.

Signed-off-by: martin f. krafft <madduck@debian.org>
14 years agonotmuch new: Print upgrade progress report as a percentage.
Carl Worth [Sun, 10 Jan 2010 01:38:23 +0000 (17:38 -0800)]
notmuch new: Print upgrade progress report as a percentage.

Previously we were printing a number of messages upgraded so far. The
original motivation for this was to accurately reflect the fact that
there are two passes, (so each message is processed twice and it's not
accurate to represent with a single count). But as it turns out, the
second pass takes zero time (relatively speaking) so we're still not
accounting for it.

If nothing else, the percentage-based reporting makes for a cleaner
API for the progress_notify function.

14 years agolib: Add non-content terms with a WDF value of 0.
Carl Worth [Sat, 9 Jan 2010 19:18:27 +0000 (11:18 -0800)]
lib: Add non-content terms with a WDF value of 0.

The WDF is the "within-document frequency" value for a particular
term. It's intended to provide an indication of how frequent a term is
within a document, (for use in computing relevance). Xapian's term
generator already computes WDF values when we use that, (which we do
for indexing all mail content).

We don't use the term generator when adding single terms for things
that don't actually appear in the mail document, (such as tags, the
filename, etc.). In this case, the WDF value for these terms doesn't
matter much.

But Xapian's flint backend can be more efficient with changes to terms
that don't affect the document "length". So there's a performance
advantage for manipulating tags (with the flint backend) if the WDF of
these terms is 0.

14 years agolib: Explicitly set BoolWeight when searching.
Carl Worth [Sat, 9 Jan 2010 19:16:40 +0000 (11:16 -0800)]
lib: Explicitly set BoolWeight when searching.

All notmuch searches currently sort by value (either date or message
ID) so it's just wasted effort for Xapian to compute relevance values
for each result. We now explicitly tell Xapian that we're uninterested
in the relevance values.

14 years agolib: Split the database upgrade into two phases for safer operation.
Carl Worth [Sat, 9 Jan 2010 19:13:12 +0000 (11:13 -0800)]
lib: Split the database upgrade into two phases for safer operation.

The first phase copies data from the old format to the new format
without deleting anything. This allows an old notmuch to still use the
database if the upgrade process gets interrupted. The second phase
performs the deletion (after updating the database version number). If
the second phase is interrupted, there will be some unused data in the
database, but it shouldn't cause any actual harm.

14 years agolib: Delete stale timestamp documents during database upgrade.
Carl Worth [Fri, 8 Jan 2010 17:52:25 +0000 (09:52 -0800)]
lib: Delete stale timestamp documents during database upgrade.

Once we move the timestamp to the new directory document, we don't
need the old one anymore.

14 years agonotmuch new: Don't prevent database upgrade from being interrupted.
Carl Worth [Fri, 8 Jan 2010 16:45:16 +0000 (08:45 -0800)]
notmuch new: Don't prevent database upgrade from being interrupted.

Our signal handler is designed to quickly flush out changes and then
exit. But if a database upgrade is in progress when the user
interrupts, then we just want to immediately abort. We could do
something fancy like add a return value to our progress_notify
function to allow it to tell the upgrade process to abort. But it's
actually much cleaner and robust to delay the installation of our
signal handler so that the default abort happens on SIGINT.

14 years agonotmuch new: Fix progress notification on database upgrade.
Carl Worth [Fri, 8 Jan 2010 05:24:44 +0000 (21:24 -0800)]
notmuch new: Fix progress notification on database upgrade.

This was firing continuously rather than just once per second as
intended.

14 years agonotmuch new: Automatically upgrade the database if necessary.
Carl Worth [Fri, 8 Jan 2010 02:30:32 +0000 (18:30 -0800)]
notmuch new: Automatically upgrade the database if necessary.

This takes advantage of the recently added library support to detect
if the database needs to be upgraded and then automatically performs
that upgrade, (with a nice progress report).

14 years agolib: Implement versioning in the database and provide upgrade function.
Carl Worth [Fri, 8 Jan 2010 02:26:31 +0000 (18:26 -0800)]
lib: Implement versioning in the database and provide upgrade function.

The recent support for renames in the database is our first time
(since notmuch has had more than a single user) that we have a
database format change. To support smooth upgrades we now encode a
database format version number in the Xapian metadata.

Going forward notmuch will emit a warning if used to read from a
database with a newer version than it natively supports, and will
refuse to write to a database with a newer version.

The library also provides functions to query the database format
version:

notmuch_database_get_version

to ask if notmuch wants a newer version than that:

notmuch_database_needs_upgrade

and a function to actually perform that upgrade:

notmuch_database_upgrade

14 years agonotmuch new: Fix deletion support to recurse on removed directories.
Carl Worth [Fri, 8 Jan 2010 02:20:28 +0000 (18:20 -0800)]
notmuch new: Fix deletion support to recurse on removed directories.

Previously, when notmuch detected that a directory had been deleted it
was only removing files immediately in that directory. We now
correctly recurse to also remove any directories (and files, etc.)
within sub-directories, etc.

14 years agoTODO: Add a couple of ideas that came up during recent coding.
Carl Worth [Fri, 8 Jan 2010 02:17:38 +0000 (18:17 -0800)]
TODO: Add a couple of ideas that came up during recent coding.

The notmuch_query_count_messages functions duplicates a lot of code
undesirably.

14 years agoPrefer READ_ONLY consistently over READONLY.
Carl Worth [Thu, 7 Jan 2010 18:29:05 +0000 (10:29 -0800)]
Prefer READ_ONLY consistently over READONLY.

Previously we had NOTMUCH_DATABASE_MODE_READ_ONLY but
NOTMUCH_STATUS_READONLY_DATABASE which was ugly and confusing. Rename
the latter to NOTMUCH_STATUS_READ_ONLY_DATABASE for consistency.

14 years agolib: Consolidate checks for read-only database.
Carl Worth [Thu, 7 Jan 2010 18:19:44 +0000 (10:19 -0800)]
lib: Consolidate checks for read-only database.

Previously, many checks were deep in the library just before a cast
operation. These have now been replaced with internal errors and new
checks have instead been added at the beginning of all top-levelentry
points requiring a read-write database.

The new checks now also use a single function for checking and
printing the error message. This will give us a convenient location to
extend the check, (such as based on database version as well).

14 years agolib: Clarify internal documentation of _notmuch_database_filename_to_direntry
Carl Worth [Thu, 7 Jan 2010 17:31:58 +0000 (09:31 -0800)]
lib: Clarify internal documentation of _notmuch_database_filename_to_direntry

The original wording made it sound like this function was just doing
some string manipulation. But this function actually creates new
directory documents as a side effect. So make that explicit in its
documentation.

14 years agonotmuch_message_get_filename: Support old-style filename storage.
Carl Worth [Thu, 7 Jan 2010 17:22:34 +0000 (09:22 -0800)]
notmuch_message_get_filename: Support old-style filename storage.

When a notmuch database is upgraded to the new database format, (to
support file rename and deletion), any message documents corresponding
to deleted files will not currently be upgraded. This means that a
search matching these documents will find no filenames in the expected
place.

Go ahead and return the filename as originally stored, (rather than
aborting with an internal error), in this case.

14 years agonotmuch new: Never ask the database for any names from a new directory.
Carl Worth [Wed, 6 Jan 2010 22:35:56 +0000 (14:35 -0800)]
notmuch new: Never ask the database for any names from a new directory.

When we know that we are adding a new directory to the database, (and
we therefore are using inode rather than strcmp-based sorting of the
filenames), then we *never* want to see any names from the
database. If we get any names that could only make us inadvertently
remove files that we just added.

Since it's not obvious from the Xapian documentation whether new terms
being added as part of new documents will appear in the in-progress
all-terms iteration we are using, (and this might differ based on
Xapian backend and also might differ based on how many new directories
are added and whether a flush threshold is reached).

For all of these reasons, we play it safe and use NULL rather than a
real notmuch_filenames_t iterator in this case to avoid any problem.

14 years agolib: Treat NULL as a valid (and empty) notmuch_filenames_t iterator.
Carl Worth [Wed, 6 Jan 2010 22:35:11 +0000 (14:35 -0800)]
lib: Treat NULL as a valid (and empty) notmuch_filenames_t iterator.

This will be convenient to avoid some special-casing in higher-level
code.

14 years agonotmuch new: Fix bug resulting in file removal on initial build of database.
Carl Worth [Wed, 6 Jan 2010 21:54:39 +0000 (13:54 -0800)]
notmuch new: Fix bug resulting in file removal on initial build of database.

The bug here was that we would see that the database did not know
anything about a directory so would get results from the filesystem in
inode rather than strcmp order.

However, we wouldn't actually ask for the list of files from the
database until after recursing into the sub-directories. So by the
time we traverse the filenames looking for deletions, the database
*does* have entries and we end up detecting erroneous deletions
because our filename list from the filesystem isn't in strcmp order.

So ask for the list of names from the database before doing any
additions to avoid this problem.

14 years agonotmuch new: Fix to detect deletions of names at the end of the list.
Carl Worth [Wed, 6 Jan 2010 21:26:47 +0000 (13:26 -0800)]
notmuch new: Fix to detect deletions of names at the end of the list.

Previously we only scanned the list of filenames in the filesystem and
detected a deletion whenever that scan skipped a name that existed in
the database. That much was fine, but we *also* need to continue
walking the list of names from the database when the filesystem list
is exhausted.

Without this, removing the last file or directory within any
particular directory would go undetected.

14 years agonotmuch new: Fix regression preventing addition of symlinked mail files.
Carl Worth [Wed, 6 Jan 2010 18:30:08 +0000 (10:30 -0800)]
notmuch new: Fix regression preventing addition of symlinked mail files.

As described in the previous commit message, we introduced multiple
symlink-based regressions in commit
3df737bc4addfce71c647792ee668725e5221a98

Here, we fix the case of symlinks to regular files by doing an extra
stat of any DT_LNK files to determine if they do, in fact, link to
regular files.

14 years agonotmuch new: Fix regression preventing recursion through symlinks.
Carl Worth [Wed, 6 Jan 2010 18:09:17 +0000 (10:09 -0800)]
notmuch new: Fix regression preventing recursion through symlinks.

In commit 3df737bc4addfce71c647792ee668725e5221a98 we switched from
using stat() to using the d_type field in the result of scandir() to
determine whether a filename is a regular file or a directory. This
change introduced a regression in that the recursion would no longer
traverse through a symlink to a directory. (Since stat() would resolve
the symlink but with scandir() we see a distinct DT_LNK value in
d_type).

We fix this for directories by allowing both DT_DIR and DT_LNK values
to recurse, and then downgrading the existing not-a-directory check
within the recursion to not be an error. We also add a new
not-a-directory check outside the recursion that is an error.

14 years agoFix typo in comment.
Carl Worth [Wed, 6 Jan 2010 18:08:51 +0000 (10:08 -0800)]
Fix typo in comment.

The difference between "now" and "not" ends up being fairly dramatic.

14 years agonotmuch new: Print counts of deleted and renamed messages.
Carl Worth [Wed, 6 Jan 2010 18:07:49 +0000 (10:07 -0800)]
notmuch new: Print counts of deleted and renamed messages.

It's nice to be able to see a report indicating that the recently
added support for detecting file rename and deletion is working.

14 years agolib: Indicate whether notmuch_database_remove_message removed anything.
Carl Worth [Wed, 6 Jan 2010 18:06:00 +0000 (10:06 -0800)]
lib: Indicate whether notmuch_database_remove_message removed anything.

Similar to the return value of notmuch_database_add_message, we now
enhance the return value of notmuch_database_remove_message to
indicate whether the message document was entirely removed (SUCCESS)
or whether only this filename was removed and the document exists
under other filenamed (DUPLICATE_MESSAGE_ID).

14 years agolib: Update documentation of notmuch_database_add_message.
Carl Worth [Wed, 6 Jan 2010 18:03:58 +0000 (10:03 -0800)]
lib: Update documentation of notmuch_database_add_message.

Previously, adding a filename with the same message ID as an existing
message would do nothing. But we recently fixed this to instead add
the new filename to the existing message document. So update the
documentation to match now.

14 years agoIndex content from citations and signatures.
Carl Worth [Wed, 6 Jan 2010 03:14:07 +0000 (19:14 -0800)]
Index content from citations and signatures.

In the presentation we often omit citations and signatures, but this
is not content that should be omitted from the index, (especially
when the citation detection is wrong---see cases where a line
beginning with "From" is corrupted to ">From" by mail processing
tools).

14 years agonotmuch new: Proper support for renamed and deleted files.
Carl Worth [Wed, 6 Jan 2010 02:59:18 +0000 (18:59 -0800)]
notmuch new: Proper support for renamed and deleted files.

The "notmuch new" command will now efficiently notice if any files or
directories have been removed from the mail store and will
appropriately update its database.

Any given mail message (as determined by the message ID) may have
multiple corresponding filenames, and notmuch will return one of
them. When a filen is deleted, the corresponding filename will be
removed from the message in the database. When the last filename is
removed from a message, that message will be entirely removed from the
database.

All file additions are handled before any file removals so that rename
is supported properly.

14 years agonotmuch new: Store detected removed filenames for later processing.
Carl Worth [Wed, 6 Jan 2010 01:56:11 +0000 (17:56 -0800)]
notmuch new: Store detected removed filenames for later processing.

It is essential to defer the actual removal of any filenames from the
database until we are entirely done adding any new files. This is to
avoid any information loss from the database in the case of a renamed
file or directory.

Note that we're *still* not actually doing any removal---still just
printing messages indicating the filenames that were detected as
removed. But we're at least now printing those messages at a time when
we actually *can* do the actual removal.

14 years agonotmuch new: Detect deleted (renamed) files and directories.
Carl Worth [Wed, 6 Jan 2010 01:43:03 +0000 (17:43 -0800)]
notmuch new: Detect deleted (renamed) files and directories.

This takes advantage of the notmuch_directory_t interfaces added
recently (with cooresponding storage of directory documents in the
database) to detect when files or entire directories are deleted or
renamed within the mail store.

This also fixes the recent regression where *all* files would be
processed by every run of "notmuch new", (now only new files are
processed once again).

The deleted files and directories are only detected so far. They
aren't properly removed from the database.

14 years agoadd_files_recursive: Make the maildir detection more efficient.
Carl Worth [Wed, 6 Jan 2010 00:42:14 +0000 (16:42 -0800)]
add_files_recursive: Make the maildir detection more efficient.

Previously, we were re-scanning the entire list of entries for every
directory entry. Instead, we can simply check if the entries look like
a maildir once, up-front.

14 years agoadd_files_recursive: Separate scanning for directories and files for legibility.
Carl Worth [Wed, 6 Jan 2010 00:35:02 +0000 (16:35 -0800)]
add_files_recursive: Separate scanning for directories and files for legibility.

We now do two scans over the entries returned from scandir. The first
scan is looking for directories (and making the recursive call). The
second scan is looking for new files to add to the database.

This is easier to read than the previous code which had a single loop
and some if statements with ridiculously long bodies. It also has the
advantage that once the directory scan is complete we can do a single
comparison of the filesystem and database mtimes and entirely skip the
second scan if it's not needed.

14 years agoadd_files_recursive: Use consistent naming for array and count variables.
Carl Worth [Wed, 6 Jan 2010 00:15:43 +0000 (16:15 -0800)]
add_files_recursive: Use consistent naming for array and count variables.

Previously we had an array named "namelist" and its count named
"num_entries". We now use an array name of "fs_entries" and a count
named "num_fs_entries" to try to preserve sanity.

14 years agonotmuch new: Remove an unnecessary stat of every regular file in the mail store.
Carl Worth [Wed, 6 Jan 2010 00:06:46 +0000 (16:06 -0800)]
notmuch new: Remove an unnecessary stat of every regular file in the mail store.

We were previousl using the stat for two reasons. One was to obtain
the mtime of the file. This usage was removed in the previous commit,
(since the mtime is unreliable in the case of a file being moved into
the mail store).

The second reason was to identify regular and directory file
types. But this information is already available in the result we get
from scandir.

What's left is simply a stat for each directory in the mailstore,
(which we are still using to compare filesystem mtime with the mtime
stored in the database).

14 years agonotmuch new: Eliminate the check on the mtime of regular files before adding.
Carl Worth [Tue, 5 Jan 2010 23:59:11 +0000 (15:59 -0800)]
notmuch new: Eliminate the check on the mtime of regular files before adding.

This check was buggy in that moving a pre-existing file into the mail
store, (where the file existed before the last run of "notmuch new"),
does not update the mtime of the file. So the message would never be
added to the database.

The fix here is not practical in the long run, (since it causes *all*
files in the mail store to be processed in every run of "notmuch new"
(!)). But this change will let us drop a stat() call that we don't
otherwise need and will help move us toward proper database-backed
detection of new files, (which will fix the bug without the
performance impact of the current fix).

14 years agonotmuch new: Fix internal documentation of add_files_recursive.
Carl Worth [Tue, 5 Jan 2010 23:52:59 +0000 (15:52 -0800)]
notmuch new: Fix internal documentation of add_files_recursive.

To make it more clear that the mtime of a directory does not affect
whether further sub-directories are examined, (they are examined
unconditionally).

14 years agonotmuch new: Rename the various timestamp variables to be more clear.
Carl Worth [Tue, 5 Jan 2010 23:31:56 +0000 (15:31 -0800)]
notmuch new: Rename the various timestamp variables to be more clear.

The previous name of "path_mtime" was very ambiguous. The new names
are much more obvious (fs_mtime is the mtime from the filesystem and
db_mtime is the mtime from the database).

14 years agonotmuch new: Avoid updating directory timestamp if interrupted.
Carl Worth [Tue, 5 Jan 2010 23:23:52 +0000 (15:23 -0800)]
notmuch new: Avoid updating directory timestamp if interrupted.

This was a very dangerous bug. An interrupted "notmuch new" session
would still update the timestamp for the directory in the
database. This would result in mail files that were not processed due
to the original interruption *never* being picked up by future runs of
"notmuch new". Yikes!

14 years agonotmuch-new: Remove dead add_files_callback code.
Carl Worth [Tue, 5 Jan 2010 23:13:16 +0000 (15:13 -0800)]
notmuch-new: Remove dead add_files_callback code.

Always satisfying to delete code (even if tiny).

14 years agoMake the add_files function static within notmuch-new.c.
Carl Worth [Tue, 5 Jan 2010 23:11:21 +0000 (15:11 -0800)]
Make the add_files function static within notmuch-new.c.

No other files need this function so we don't need it exported in
notmuch-client.h.

14 years agoMakefiles: Use .DEFAULT to support arbitrary targets from sub directories.
Carl Worth [Tue, 5 Jan 2010 23:05:57 +0000 (15:05 -0800)]
Makefiles: Use .DEFAULT to support arbitrary targets from sub directories.

Taking advantage of the .DEFAULT construct means that we won't need to
explicitly list targets such as "clean", etc. in each sub-Makefile.

14 years agoAdd missing comment for NOTMUCH_STATUS_READONLY_DATABASE.
Carl Worth [Tue, 5 Jan 2010 23:01:58 +0000 (15:01 -0800)]
Add missing comment for NOTMUCH_STATUS_READONLY_DATABASE.

And adjust the string representation of the same to match.

14 years agolib: Implement new notmuch_directory_t API.
Carl Worth [Tue, 5 Jan 2010 21:29:23 +0000 (13:29 -0800)]
lib: Implement new notmuch_directory_t API.

This new directory ojbect provides all the infrastructure needed to
detect when files or directories are deleted or renamed. There's still
code needed on top of this (within "notmuch new") to actually do that
detection.

14 years agoRevamp the proposed directory-tracking API slightly.
Carl Worth [Tue, 5 Jan 2010 21:06:24 +0000 (13:06 -0800)]
Revamp the proposed directory-tracking API slightly.

This commit contains my changes to the API proposed by Keith. Nothing
is dramatically different. There are minor things like changing
notmuch_files_t to notmuch_filenames_t and then various things needed
for completeness as noticed while implementing this, (such as
notmuch_directory_destroy and notmuch_directory_set_mtime).

14 years agoPrototypes for directory tracking
Keith Packard [Wed, 9 Dec 2009 08:51:52 +0000 (00:51 -0800)]
Prototypes for directory tracking

There's no functionality here yet---just a sketch of what the
interface could look like.

14 years agodatabase: Add new, public notmuch_database_remove_message
Carl Worth [Mon, 21 Dec 2009 23:14:32 +0000 (15:14 -0800)]
database: Add new, public notmuch_database_remove_message

This will allow applications to support the removal of messages, (such
as when a file is deleted from the mail store). No removal support is
provided yet in commands such as "notmuch new".

14 years agodatabase: Add new find_doc_ids_for_term interface.
Carl Worth [Mon, 21 Dec 2009 23:12:52 +0000 (15:12 -0800)]
database: Add new find_doc_ids_for_term interface.

The existing find_doc_ids function is convenient when the caller
doesn't want to be bothered constructing a term. But when the caller
*does* have the term already, that interface is just wasteful. So we
export a lower-level interface that maps a pre-constructed term to a
document-ID iterators.

14 years agodatabase: Make find_unique_doc_id enforce uniqueness (for a debug build)
Carl Worth [Mon, 21 Dec 2009 23:11:32 +0000 (15:11 -0800)]
database: Make find_unique_doc_id enforce uniqueness (for a debug build)

Catching any violation of this unique-ness constraint is very much in
line with similar, existing INTERNAL_ERROR cases.

14 years agodatabase: Abstract _filename_to_direntry from _add_message
Carl Worth [Mon, 21 Dec 2009 23:09:56 +0000 (15:09 -0800)]
database: Abstract _filename_to_direntry from _add_message

The code to map a filename to a direntry is something that we're going
to want in a future _remove_message function, so put it in a new
function _notmuch_database_filename_to_direntry .

14 years agodatabase: Allowing storing multiple filenames for a single message ID.
Carl Worth [Mon, 21 Dec 2009 20:08:46 +0000 (12:08 -0800)]
database: Allowing storing  multiple filenames for a single message ID.

The library interface is unchanged so far, (still just
notmuch_database_add_message), but internally, the old
_set_filename function is now _add_filename instead.

14 years agodatabase: Store mail filename as a new 'direntry' term, not as 'data'.
Carl Worth [Mon, 21 Dec 2009 16:23:26 +0000 (08:23 -0800)]
database: Store mail filename as a new 'direntry' term, not as 'data'.

Instead of storing the complete message filename in the data portion
of a mail document we now store a 'direntry' term that contains the
document ID of a directory document and also the basename of the
message filename within that directory. This will allow us to easily
store multple filenames for a single message, and will also allow us
to find mail documents for files that previously existed in a
directory but that have since been deleted.

14 years agodatabase: Split _find_parent_id into _split_path and _find_directory_id
Carl Worth [Mon, 21 Dec 2009 16:14:52 +0000 (08:14 -0800)]
database: Split _find_parent_id into _split_path and _find_directory_id

Some pending commits want the _split_path functionality separate from
mapping a directory to a document ID. The split_path function now
returns the basename as well as the directory name.

14 years agodatabase: Store directory path in 'data' of directory documents.
Carl Worth [Sun, 20 Dec 2009 23:46:41 +0000 (15:46 -0800)]
database: Store directory path in 'data' of directory documents.

We're planning to have mail documents refer to directory documents for
the path of the containing directory. To support this, we need the
path in the data, (since the path in the 'directory' term can be
irretrievable as it will be the SHA1 sum of the path for a very long
path).

14 years agodatabase: Export _notmuch_database_find_parent_id for internal use.
Carl Worth [Sat, 19 Dec 2009 23:11:55 +0000 (15:11 -0800)]
database: Export _notmuch_database_find_parent_id for internal use.

We'll soon have mail documents referring to their parent directory's
directory documents, so we'll need access to _find_parent_id in files
such as message.cc.

14 years agodatabase: Store the parent ID for each directory document.
Carl Worth [Sat, 19 Dec 2009 21:20:26 +0000 (13:20 -0800)]
database: Store the parent ID for each directory document.

Storing the document ID of the parent of each directory document will
allow us to find all child-directory documents for a given directory
document. We will need this in order to detect directories that have
been removed from the mail store, (though we aren't yet doing this).

14 years agodatabase: Rename internal directory value from XTIMESTAMP to XDIRECTORY.
Carl Worth [Sat, 19 Dec 2009 21:18:18 +0000 (13:18 -0800)]
database: Rename internal directory value from XTIMESTAMP to XDIRECTORY.

The recent change from storing absolute paths to relative paths means
that new directory documents will already be created, (and the old
ones will just linger stale in the database). Given that, we might as
well put a clean name on the term in the new documents, (and no real
flag day is needed).

14 years agodatabase: Store directory paths as relative, not absolute.
Carl Worth [Sat, 19 Dec 2009 21:11:00 +0000 (13:11 -0800)]
database: Store directory paths as relative, not absolute.

We were already storing relative mail filenames, so this is consistent
with that. Additionally, it means that directory documents remain
valid even if the database is relocated within its containing
filesystem.

14 years agolib: Document that the filename is stored in the 'data' of a mail document
Carl Worth [Sat, 19 Dec 2009 21:05:06 +0000 (13:05 -0800)]
lib: Document that the filename is stored in the 'data' of a mail document

Our database schema documentation previously didn't give any
indication of where this most essential piece of information is
stored.

14 years agolib: Rename set/get_timestamp to set/get_directory_mtime.
Carl Worth [Thu, 17 Dec 2009 22:33:34 +0000 (14:33 -0800)]
lib: Rename set/get_timestamp to set/get_directory_mtime.

I've been suitably scolded by Keith for doing a premature
generalization that ended up just making the documentation more
convoluted. Fix that.

14 years agolib: Abstract the extraction of a relative path from set_filename
Carl Worth [Sat, 19 Dec 2009 20:32:11 +0000 (12:32 -0800)]
lib: Abstract the extraction of a relative path from set_filename

We'll soon be having multiple entry points that accept a filename
path, so we want common code for getting a relative path from a
potentially absolute path.

14 years agonotmuch new: Remove hack to ignore read-only directories in mail store.
Carl Worth [Mon, 14 Dec 2009 23:57:44 +0000 (15:57 -0800)]
notmuch new: Remove hack to ignore read-only directories in mail store.

This was really the last thing keeping the initial run of "notmuch
new" being different from all other runs. And I'm taking a fresh
look at the performance of "notmuch new" anyway, so I think we can
safely drop this optimization.

14 years agolib: Add missing value to notmuch_private_status_t enum.
Carl Worth [Sat, 19 Dec 2009 20:34:06 +0000 (12:34 -0800)]
lib: Add missing value to notmuch_private_status_t enum.

And fix the initialization such that the private enum will always have
distinct values from the public enum even if we similarly miss the
addition of a new public value in the future.

14 years agonotmuch new: Restrict the "not much" pun to the first run.
Carl Worth [Tue, 15 Dec 2009 00:06:37 +0000 (16:06 -0800)]
notmuch new: Restrict the "not much" pun to the first run.

Several people complained that the humor wore thin very quickly.  The
most significant case of "not much mail" is when counting the user's
initial mail collection. We've promised on the web page that no matter
how much mail the user has, notmuch will consider it to be "not much"
so let's say so. (This message was in place very early on, but was
inadvertently dropped at some point.)

14 years agoconfigure: Look for both Xapian 1.1 and 1.0 and allow user override.
Carl Worth [Sun, 13 Dec 2009 23:17:35 +0000 (15:17 -0800)]
configure: Look for both Xapian 1.1 and 1.0 and allow user override.

The in-development version of Xapian provides a config program named
xapian-config-1.1 while the released version provides a program named
xapian-config instead. By default, we now try each of these in turn,
and we also allow the user to set a XAPIAN_CONFIG environment variable
to explicitly specify a particular program.

14 years agoemacs: Add instructions to the hidden citations/signatures.
Carl Worth [Fri, 11 Dec 2009 23:52:40 +0000 (15:52 -0800)]
emacs: Add instructions to the hidden citations/signatures.

We've received a user report that the hidden citations were annoying
since the user couldn't tell what was being referred to by subsequent
text. Apparently it wasn't obvious enough that the hidden citation
could be revealed by clicking or by pressing Enter. So make the button
text say as much.

14 years agoemacs: Don't insert extra line after citations.
Carl Worth [Fri, 11 Dec 2009 23:36:41 +0000 (15:36 -0800)]
emacs: Don't insert extra line after citations.

This extra line had been annoying me for a while, so I'm glad to see
it go away.

14 years agoemacs: Don't regard a manually indented '>' as introducing a citation.
Carl Worth [Fri, 11 Dec 2009 23:31:10 +0000 (15:31 -0800)]
emacs: Don't regard a manually indented '>' as introducing a citation.

In the message mentioned in the previous commit, an ASCII diagram was
included in which '>' was used as the first non-whitespace character
in a line. Notmuch previously (and mistakenly) regarded this as a
citation.

We fix this by only regarding a '>' in the first column of an email as
introducing a citation.

14 years agoemacs: Avoid infinite loop when marking up citations.
Carl Worth [Fri, 11 Dec 2009 23:25:55 +0000 (15:25 -0800)]
emacs: Avoid infinite loop when marking up citations.

Thanks to Dirk Hohndel for reporting the bug. The infinite loop was first
noticed in the following message (available from the Linux kernel mailing list):

alpine.LFD.2.00.0912081304070.3560@localhost.localdomain

Note that the bug does not show up when viewing the message in
isolation---the bug was triggered only when viewing this file indented
to a depth of at least 13.

The fix is simply to use a marker rather than an integer position when
recording a point we plan to move back to later, (since inserting the
indented button causes the buffer position of the desired marker to
change).

14 years agoExpand scope of items considered when saving attachments
Keith Amidon [Sat, 5 Dec 2009 22:53:59 +0000 (14:53 -0800)]
Expand scope of items considered when saving attachments

Previously only mime parts that indicated specified a "disposition" of
"attachment" were saved.  However there are time when it is important
to be able to save inline content as well.  After this commit any mime
part that specifies a filename will be considered when saving
attachments.

14 years agoemacs: Fix '+' and '-' in case of thread no longer matching current search.
Carl Worth [Thu, 10 Dec 2009 18:35:18 +0000 (10:35 -0800)]
emacs: Fix '+' and '-' in case of thread no longer matching current search.

Similar to the way thread-viewing was broken after a thread was
archived, (and recently fixed), tag manipulation has also been broken
when the thread no longer matches the current search.

This also means that the behavior of '+' and '-' are now different
than that of '*'. The '+' and '-' bindings now return to the previous
behavior old affecting all messages in the thread, (and not simply
those matching the search).

I actually prefer this behavior, since otherwise a '-' operation on a
thread might not actually remove the tag from the thread, (since it
could operate on a subset of the thread and not hit all messages with
the given tag).

So I'd now like to fix '*' to be consistent with '+' and '-', for
which we add an item to TODO.

14 years agonotmuch.el: patch notmuch-show to call notmuch show without query-context (i.e. witho...
David Bremner [Thu, 10 Dec 2009 15:14:35 +0000 (11:14 -0400)]
notmuch.el: patch notmuch-show to call notmuch show without query-context (i.e. without tag:inbox) if the first query returns nothing.

This fixes the annoying bug of archiving a thread, and then going back
to open it and getting an error.  It needs the notmuch-show API
changing patch of 1259979997-31544-3-git-send-email-david@tethera.net.

14 years agonotmuch-show: add optional argument for query context instead of using global binding...
David Bremner [Sat, 5 Dec 2009 02:26:37 +0000 (22:26 -0400)]
notmuch-show: add optional argument for query context instead of using global binding notmuch-search-query-string

Also modify the one call to notmuch-show in notmuch.el.  This makes
the call (notmuch-show thread-id) will work when there is no binding
for notmuch-search-query-string; e.g. when called from user code
outside notmuch.

14 years agonotmuch-search-process-filter: add text properties for authors and subject to each...
David Bremner [Sat, 5 Dec 2009 02:26:36 +0000 (22:26 -0400)]
notmuch-search-process-filter: add text properties for authors and subject to each line

Add functions notmuch-search-find-authors and notmuch-find-subject to
match notmuch-find-thread-id.  These functions are just a wrapper
around get-text-property, but in principle that could change.

14 years agoTODO: Add idea for an --exclude-threads options to "notmuch search".
Carl Worth [Wed, 9 Dec 2009 22:03:03 +0000 (14:03 -0800)]
TODO: Add idea for an --exclude-threads options to "notmuch search".

This would provide support for "muted" threads, as well as allowing for negative
filtering based on messages not matched by the original search, (but present in
threads that do have at least one matched message).

14 years agoNuke the remainings of _notmuch_message_add_thread_id.
Fernando Carrijo [Wed, 9 Dec 2009 19:09:01 +0000 (17:09 -0200)]
Nuke the remainings of _notmuch_message_add_thread_id.

The function _notmuch_message_add_thread_id has been removed
from the private interface of notmuch. There's no reason for
one to keep a declaration of its prototype in the code base.
Also, lets update a commentary that referenced that function
and escaped from previous scrutiny.

Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
14 years agoTODO: Note that we should report when two "copies" of a message differ.
Carl Worth [Wed, 9 Dec 2009 06:12:43 +0000 (22:12 -0800)]
TODO: Note that we should report when two "copies" of a message differ.

Marten Veldthuis pointed out on the mailing list that intentional
spoofing is something that the user should be told about.

14 years agoRevert "Add some very rudimentary support for handling html parts"
Carl Worth [Mon, 7 Dec 2009 17:34:06 +0000 (09:34 -0800)]
Revert "Add some very rudimentary support for handling html parts"

This reverts commit ed16edc94d6a50ca86ff1575d9ea6fb9168b2e81.

The performance hit is just far too severe, (threads with many HTML
messages make emacs stop and pause for seconds before displaying the
thread even if most of the HTML messages are entirely hidden).

14 years agofix Makefile.local to install bash completion definitions as not executable
Jameson Graef Rollins [Sat, 28 Nov 2009 23:57:37 +0000 (18:57 -0500)]
fix Makefile.local to install bash completion definitions as not executable

14 years agoMakefile: Mention "./configure --help" now that it exists.
Carl Worth [Sat, 5 Dec 2009 00:09:40 +0000 (16:09 -0800)]
Makefile: Mention "./configure --help" now that it exists.

Since we're directing the user to ./confgiure for more options,
actually tell the user how to discover what those options are.

14 years agoconfigure: Implement a --help option to document --prefix.
Carl Worth [Sat, 5 Dec 2009 00:05:12 +0000 (16:05 -0800)]
configure: Implement a --help option to document --prefix.

Also document that values for CC, CFLAGS, etc. can be specified
via environment variables.

14 years agoMakefile: Silence compiler errors during dependency generation.
Carl Worth [Fri, 4 Dec 2009 23:37:39 +0000 (15:37 -0800)]
Makefile: Silence compiler errors during dependency generation.

We have a bootstrapping issue with our dependency generation. When the
Makefile.config doesn't exist yet, the complete compilation flags are
not yet available for passing to the compiler to generate the
dependencies.

But we don't have explicit rules to create these dependency files,
(just the implicit rule that is created by the -include), so we can't
control when make will attempt to create them.

We do have a dependency of the dependency files on Makefile.config, so
make should eventually call the compiler with the correct flags and
everything should be good. So in the meantime, silence any complaints.

14 years agoMakefile: Inform user that they might want to call ./configure explicitly.
Carl Worth [Fri, 4 Dec 2009 23:32:05 +0000 (15:32 -0800)]
Makefile: Inform user that they might want to call ./configure explicitly.

If the Makefile does this for the user, then no arguments are passed. So
it's only polite to let the user know that it's possible to get pass those
arguments.

14 years agoconfigure: Support the capturing of CFLAGS and CXXFLAGS at configure time.
Carl Worth [Fri, 4 Dec 2009 23:20:12 +0000 (15:20 -0800)]
configure: Support the capturing of CFLAGS and CXXFLAGS at configure time.

These variables can now be set via configure time via environment
variables like so:

CFLAGS=-g ./configure

and subsequent builds will remember these values. The values can
still be overridden at compile time by passing make variables:

      make CFLAGS=-O2

The CXXFLAGS variable is optional. If unset at either configure
time or at compile time, it will inherit its value from the
CFLAGS variable. (Though if explicitly set at configure time
it must be explicitly overriden at compile time---just overriding
CFLAGS will not override CXXFLAGS as well.)

14 years agoFix quiet compilation to print the user's CFLAGS, CXXFLAGS, LDFLAGS.
Carl Worth [Fri, 4 Dec 2009 23:08:37 +0000 (15:08 -0800)]
Fix quiet compilation to print the user's CFLAGS, CXXFLAGS, LDFLAGS.

The only reason I ever call "make V=1" myself, (other than when
debugging the compiler command-line for some reason), is to ensure
whether my CFLAGS, (like "-g -O0" or "-O2"), are actually making it to
the command-line.

But these are hard to find in the V=1 output, and really, we should
just print these even in the quiet case. So do that.