notmuch.git
15 years agonotmuch.el: Hide email headers by default.
Carl Worth [Tue, 3 Nov 2009 06:24:35 +0000 (22:24 -0800)]
notmuch.el: Hide email headers by default.

The display of the header can be toggled with the 'h' key.

15 years agonotmuch show: Switch to control character to mark sections of output
Carl Worth [Tue, 3 Nov 2009 05:13:19 +0000 (21:13 -0800)]
notmuch show: Switch to control character to mark sections of output

We were previously using things like "%message{" which were not
guaranteed to never appear in an email message. Using a control
character (^L or '\f' instead of '%') gives us better assurance that
our delimiter doesn't show up in an original email message.

This still isn't entirely safe since we're decoding encoded text in
the body of the email message so almost all bets are off really.

15 years agonotmuch.el: Make 'n' and 'p' bring the current message to the top.
Carl Worth [Tue, 3 Nov 2009 04:47:11 +0000 (20:47 -0800)]
notmuch.el: Make 'n' and 'p' bring the current message to the top.

This is much more convenient for reading the messages, and happens
to match the behavior of sup.

15 years agonotmuch.el: Add (n)ext and (p)revious bindings to notmuch-show mode.
Carl Worth [Tue, 3 Nov 2009 02:45:17 +0000 (18:45 -0800)]
notmuch.el: Add (n)ext and (p)revious bindings to notmuch-show mode.

Almost starting to get usable now. Still need to make it mark messages
as they are read, (by removing the unread tag), and selectively hiding
the full header.

15 years agoTODO: Add an idea from talking with keithp on the train.
Carl Worth [Tue, 3 Nov 2009 02:44:34 +0000 (18:44 -0800)]
TODO: Add an idea from talking with keithp on the train.

I mentioned the read-only directory optimization to Keith, and he
liked it but wanted to be able to configure it to be fully automated.

15 years agonotmuch.el: Add '<' and '>' bindings to goto first/last thread.
Carl Worth [Tue, 3 Nov 2009 02:23:06 +0000 (18:23 -0800)]
notmuch.el: Add '<' and '>' bindings to goto first/last thread.

Also, take care to remove a final blank line to avoid the point
going beyond the last thread in the buffer.

15 years agoTODO: Organize tasks based on emacs interface, command-line tool, or library.
Carl Worth [Tue, 3 Nov 2009 02:02:38 +0000 (18:02 -0800)]
TODO: Organize tasks based on emacs interface, command-line tool, or library.

There are conceptually three different projects here, so it helps
to keep the tasks for each separated.

15 years agonotmuch.el: Add commands to (s)earch globally, and (f)ilter a search
Carl Worth [Tue, 3 Nov 2009 01:56:18 +0000 (17:56 -0800)]
notmuch.el: Add commands to (s)earch globally, and (f)ilter a search

Also add 'q' and 'x' keybindings to kill the current buffer.

15 years agoTweak relative dates to be close to the same length.
Carl Worth [Tue, 3 Nov 2009 00:18:28 +0000 (16:18 -0800)]
Tweak relative dates to be close to the same length.

Most all of the returned strings will now fill most of a 12-character
string, (depending on the length of the month).

15 years agoRemove notmuch_message_get_header_size and notmuch_message_get_all_headers
Carl Worth [Tue, 3 Nov 2009 00:08:24 +0000 (16:08 -0800)]
Remove notmuch_message_get_header_size and notmuch_message_get_all_headers

The notmuch.c main program now uses GMime directly rather than using
these functions, and I'd rather not export any functions unless we
have good evidence that the functions are necessary.

15 years agonotmuch.el: Hide thread IDs in notmuch-search mode.
Carl Worth [Tue, 3 Nov 2009 00:02:32 +0000 (16:02 -0800)]
notmuch.el: Hide thread IDs in notmuch-search mode.

One more baby step toward something that's pleasant to use.

15 years agonotmuch.el: Implement visual feedback for add/remove tags.
Carl Worth [Mon, 2 Nov 2009 23:48:21 +0000 (15:48 -0800)]
notmuch.el: Implement visual feedback for add/remove tags.

There's no undo still, but at least you can see what you are doing
now.

15 years agoDrop date.c file, (use identical function from GMime instead).
Carl Worth [Mon, 2 Nov 2009 22:36:33 +0000 (14:36 -0800)]
Drop date.c file, (use identical function from GMime instead).

We had originally copied this function in at a time when notmuch
wasn't actually depending on the GMime library. Now that it does,
we might as well call the function that exists there rather
than having a private copy of it.

15 years agonotmuch show: Don't print non-text MIME parts.
Carl Worth [Mon, 2 Nov 2009 22:33:15 +0000 (14:33 -0800)]
notmuch show: Don't print non-text MIME parts.

Additionally, print a part number for each MIME part so that the
client could (conceivably) ask for the contents of a specific
part by part number.

15 years agoFix to decode header values, (primarily subject).
Carl Worth [Mon, 2 Nov 2009 22:32:20 +0000 (14:32 -0800)]
Fix to decode header values, (primarily subject).

Use GMime function to decode message-header values according to
RFC 2047.

15 years agoPrint "part" markers for each MIME part (with Content-type).
Carl Worth [Mon, 2 Nov 2009 21:27:34 +0000 (13:27 -0800)]
Print "part" markers for each MIME part (with Content-type).

This can allow for the client to hide undesired MIME parts
such as text/html.

15 years agonotmuch show: Use GMime to decode messages.
Carl Worth [Mon, 2 Nov 2009 21:19:39 +0000 (13:19 -0800)]
notmuch show: Use GMime to decode messages.

We now actually get text content rather than blocks of BASE64, etc.

15 years agoTODO: Add several items.
Carl Worth [Mon, 2 Nov 2009 21:18:58 +0000 (13:18 -0800)]
TODO: Add several items.

These are the things that are actively preventing me from being able
to use notmuch as an email-reading client.

15 years agoAdd an INSTALL file.
Carl Worth [Mon, 2 Nov 2009 17:25:04 +0000 (09:25 -0800)]
Add an INSTALL file.

The README file was already referring to this, so we actually add it
now.

15 years agoAdd a simple configure script.
Carl Worth [Mon, 2 Nov 2009 17:11:37 +0000 (09:11 -0800)]
Add a simple configure script.

This is *not* based on autoconf. In fact, this doesn't actually
configure anything, (one can compile notmuch directly with just
"make" without running configure if the dependencies are all
satisfied).

The only thing that this configure script does is to check for the
presence of the various dependencies and provide some guidance to
the user if they are not all available.

15 years agoMakefile: Rewrite to use NOTMUCH rather than MY in variable names.
Carl Worth [Mon, 2 Nov 2009 15:15:54 +0000 (07:15 -0800)]
Makefile: Rewrite to use NOTMUCH rather than MY in variable names.

I was about to refer to these names in some documentation, so I
wanted a slightly better name for them.

15 years agoREADME: Add a simple file explaining notmuch and pointing out resources.
Carl Worth [Mon, 2 Nov 2009 14:30:18 +0000 (06:30 -0800)]
README: Add a simple file explaining notmuch and pointing out resources.

This is part of getting notmuch ready for a more public announcement.

15 years agoAdd a simple manual page for notmuch.
Carl Worth [Mon, 2 Nov 2009 14:13:16 +0000 (06:13 -0800)]
Add a simple manual page for notmuch.

By pulling content out of notmuch help, and also the messages
printed by "notmuch setup".

15 years agonotmuch: Add a talloc context argument to each top-level command function.
Carl Worth [Sat, 31 Oct 2009 23:40:47 +0000 (16:40 -0700)]
notmuch: Add a talloc context argument to each top-level command function.

I had noticed several times earlier that having a talloc context
passed in would make things more convenient. I'm not exercising
that convenience yet, but the context is there now, (and there's
one fewer item on our TODO list).

15 years agoRename message_results/thread_results to messages/threads.
Carl Worth [Sat, 31 Oct 2009 23:32:30 +0000 (16:32 -0700)]
Rename message_results/thread_results to messages/threads.

Shorter naming without being any less clear. A definite win.

15 years agonotmuch.el: Add commands to add tag, remove tag, and archive (== remove inbox tag)
Carl Worth [Sat, 31 Oct 2009 19:09:06 +0000 (12:09 -0700)]
notmuch.el: Add commands to add tag, remove tag, and archive (== remove inbox tag)

These have keybindings of '+', '-', and 'a'. The bug they have so
far is lack of visual feedback for their effect, and lack of undo.

(Also the fact that adding or removing a single tag for a thread
takes way too long--but that's as a Xapian issue as discussed here:

replace_document should make minimal changes to database file
http://trac.xapian.org/ticket/250
)

15 years agonotmuch: Reference help, don't print it for unknown commands.
Carl Worth [Sat, 31 Oct 2009 19:08:00 +0000 (12:08 -0700)]
notmuch: Reference help, don't print it for unknown commands.

The shorter output is much nicer for something that might end up
in an emacs mini-buffer, for example.

15 years agonotmuch.el: Add final '*' to generated buffer names.
Carl Worth [Sat, 31 Oct 2009 08:55:12 +0000 (01:55 -0700)]
notmuch.el: Add final '*' to generated buffer names.

Just looks a little neater that way.

15 years agonotmuch.el: Enter now calls "notmuch show" on the current thread
Carl Worth [Sat, 31 Oct 2009 08:41:44 +0000 (01:41 -0700)]
notmuch.el: Enter now calls "notmuch show" on the current thread

It's remarkable how little code we need for a very functional GUI
here. I think we're doing something right.

15 years agonotmuch.el: Start fleshing out notmuch-search-mode with a custom keymap
Carl Worth [Sat, 31 Oct 2009 08:04:01 +0000 (01:04 -0700)]
notmuch.el: Start fleshing out notmuch-search-mode with a custom keymap

All we have here so far is 'n' and 'p' for going to next and
previous lines respectively.

15 years agonotmuch.el: Switch from start-process to call-process
Carl Worth [Sat, 31 Oct 2009 07:44:39 +0000 (00:44 -0700)]
notmuch.el: Switch from start-process to call-process

We now get the point staying right at the top where we want it.
We also don't get any extraneous noise about "Process notmuch
completed" or anything like that. Just the output in a read-only
buffer.

15 years agonotmuch.el: Switch from compilation-start to start-process
Carl Worth [Sat, 31 Oct 2009 06:42:39 +0000 (23:42 -0700)]
notmuch.el: Switch from compilation-start to start-process

Compilation mode does a bunch of things that we don't want. Instead
of trying to tear it down to what we want, let's start at the other
end and build up only things that we really want.

15 years agonotmuch.el: Add notmuch-search command as well as notmuch
Carl Worth [Sat, 31 Oct 2009 00:18:19 +0000 (17:18 -0700)]
notmuch.el: Add notmuch-search command as well as notmuch

This allows for entering a query string interactively.

15 years agonotmuch.el: Copy copyright information from compilation.el
Carl Worth [Sat, 31 Oct 2009 00:17:16 +0000 (17:17 -0700)]
notmuch.el: Copy copyright information from compilation.el

I'm using that file as my reference here, so I'm likely to end up
copying some code here or there. Might as well be safe and just
copy the copyright statement.

15 years agonotmuch.el: Rename from notmuch-mode.el to notmuch.el
Carl Worth [Fri, 30 Oct 2009 22:17:27 +0000 (15:17 -0700)]
notmuch.el: Rename from notmuch-mode.el to notmuch.el

Also add the copyright and licensing blurb.

15 years agonotmuch-mode: Add an actualy notmuch-search-mode as well
Carl Worth [Fri, 30 Oct 2009 22:12:49 +0000 (15:12 -0700)]
notmuch-mode: Add an actualy notmuch-search-mode as well

Doesn't really do anything so far other than mark the buffer read-
only. This does have the benefit of giving us our own name rather
than "Compilation" for the mode.

15 years agoThe very beginnings of an emacs mode for notmuch in notmuch-mode.el.
Carl Worth [Fri, 30 Oct 2009 22:05:53 +0000 (15:05 -0700)]
The very beginnings of an emacs mode for notmuch in notmuch-mode.el.

As expected, there's not much done here yet---it simply displays the
output of "notmuch search" in a new window.

15 years agoTODO: Add man page and compiling a libnotmuch library to the list.
Carl Worth [Fri, 30 Oct 2009 19:02:11 +0000 (12:02 -0700)]
TODO: Add man page and compiling a libnotmuch library to the list.

These are things we'll want done before any big announcement.

15 years agoMakefile: Add a simple target for "make install".
Carl Worth [Fri, 30 Oct 2009 19:00:55 +0000 (12:00 -0700)]
Makefile: Add a simple target for "make install".

The more I do here, the less I see the need for autotools.

15 years agoTODO: Note that "notmuch show" exists now and list several new ideas.
Carl Worth [Fri, 30 Oct 2009 18:57:43 +0000 (11:57 -0700)]
TODO: Note that "notmuch show" exists now and list several new ideas.

The timestamp stuff we'll want to do soon, since it's a database
change, (though not a major one---at worst a handful of stale
timestamp documents would be left in the database).

15 years agoFix relative date formatting to not split one day into two formats.
Carl Worth [Fri, 30 Oct 2009 00:42:21 +0000 (17:42 -0700)]
Fix relative date formatting to not split one day into two formats.

We were aware of this bug when we wrote the function, (that a date
six days in the past would be treated as the "Friday" or as the
"Oct. 23" case depending on whether its time was before or after
the current time today). We thought it wouldn't be a problem, but
in practice it is. In scanning search results with this output,
the transition between formats makes it look like a day boundary,
(so it would be easy to mistakenly think "Oct. 23" is Thursday).

Fix this to avoid confusion, (still being careful to never print
"Thursday" for a date 7 days in the past when today is Thursday).

15 years agonotmuch search: Add (relative) date to search output
Carl Worth [Fri, 30 Oct 2009 00:31:07 +0000 (17:31 -0700)]
notmuch search: Add (relative) date to search output

The new function for formatting relative dates is nice enough that
we need to start using it more places. Here's one of them.

15 years agonotmuch show: Add a one-line summary of the message before the header.
Carl Worth [Thu, 29 Oct 2009 23:06:27 +0000 (16:06 -0700)]
notmuch show: Add a one-line summary of the message before the header.

The idea here is that a client could usefully display just this one
line while optionally hiding the other header fields.

15 years agonotmuch show: Trim down header list.
Carl Worth [Thu, 29 Oct 2009 21:07:45 +0000 (14:07 -0700)]
notmuch show: Trim down header list.

This is for now a non-configurable list of Subject, From, To, Cc,
Bcc, and Date.

15 years agonotmuch show: Add body of message as well.
Carl Worth [Thu, 29 Oct 2009 16:06:53 +0000 (09:06 -0700)]
notmuch show: Add body of message as well.

This is just the raw message body for now, (so any MIME parsing will
be up to the consumer). And this will likely change in the future.

15 years agonotmuch show: Initial implementation (headers only)
Carl Worth [Thu, 29 Oct 2009 15:51:12 +0000 (08:51 -0700)]
notmuch show: Initial implementation (headers only)

We're using a delimiter syntax that Keith is optimistic about
being able to easily parse in emacs. Note: We're not escaping
any occurrence of the delimiters in the message yet, so we'll
need to fix that.

15 years agoTODO: Update now that full-text indexing is in.
Carl Worth [Wed, 28 Oct 2009 23:52:45 +0000 (16:52 -0700)]
TODO: Update now that full-text indexing is in.

The optimization idea removed here doesn't make sense anymore with
full-text indexing happening up front.

15 years agoFix add_message and get_filename to strip/re-add the database path.
Carl Worth [Wed, 28 Oct 2009 23:50:14 +0000 (16:50 -0700)]
Fix add_message and get_filename to strip/re-add the database path.

We now store only a relative path inside the database so the database
is not nicely relocatable.

15 years agonotmuch setup/new: Print progress once per second instead of after 1000 files.
Carl Worth [Wed, 28 Oct 2009 23:09:19 +0000 (16:09 -0700)]
notmuch setup/new: Print progress once per second instead of after 1000 files.

With the recent addition of full-text indexing, printing only once per
1000 files just isn't often enough. The new timer-based approach will
be reliable regardless of the speed of adding message.

15 years agoindex: Don't bother indexing quoted portions of messages (and signatures).
Carl Worth [Wed, 28 Oct 2009 22:41:42 +0000 (15:41 -0700)]
index: Don't bother indexing quoted portions of messages (and signatures).

Our old notmuch-index-message.cc code had this, but I originally
left it out when adding indexing back in. I was concerned primarily
with mistakenly detecting signature markers and omitting important
text, (for example, I often do long lines of "----" as section
separators).

But now I  see that there's a performance benefit to skippint the
quotations, (about 120 files/sec. instead of 95 files/sec.). I mitigated
the bogus signature checking by recognizing nothing other than the
all-time classic "-- ".

15 years agonotmuch_database_add_message: Sanity check the file as the first thing
Carl Worth [Wed, 28 Oct 2009 20:35:10 +0000 (13:35 -0700)]
notmuch_database_add_message: Sanity check the file as the first thing

This avoids us wasting a bunch of time doing an expensive SHA-1 over a large
file only to discover later that it doesn't even *look* like an email message.

15 years agoTweak formatting of internal error messages.
Carl Worth [Wed, 28 Oct 2009 19:46:50 +0000 (12:46 -0700)]
Tweak formatting of internal error messages.

Was neglecting to print the phrase "Internal error: " before, and for
the duplicate message-ID error it's nice to actually see the duplicate
IDs.

15 years agoindex: Store "Full Name <user@example.com>" addressses in the database
Carl Worth [Wed, 28 Oct 2009 20:09:08 +0000 (13:09 -0700)]
index: Store "Full Name <user@example.com>" addressses in the database

We put these is as a separate term so that they can be extracted.
We don't actually need this for searching, since typing an email
address in as a search term will already trigger a phrase search
that does exactly what's wanted.

15 years agoAdd full-text indexing using the GMime library for parsing.
Carl Worth [Wed, 28 Oct 2009 17:42:07 +0000 (10:42 -0700)]
Add full-text indexing using the GMime library for parsing.

This is based on the old notmuch-index-message.cc from early in
the history of notmuch, but considerably cleaned up now that
we have some experience with Xapian and know just what we want
to index, (rather than just blindly trying to index exactly
what sup does).

This does slow down notmuch_database_add_message a *lot*, but I've
got some ideas for getting some time back.

15 years agonotmuch search: Clarify documentation of implicit Boolean operators
Carl Worth [Wed, 28 Oct 2009 17:35:26 +0000 (10:35 -0700)]
notmuch search: Clarify documentation of implicit Boolean operators

The original documentation of implicit AND is what we want, but
Xapian doesn't actually let us get that today. So be honest about
what the user can actually expect. And let's hope the Xapian
wizards give us the feature we want soon:

http://trac.xapian.org/ticket/402

15 years agoTODO: A couple new items.
Carl Worth [Wed, 28 Oct 2009 14:28:01 +0000 (07:28 -0700)]
TODO: A couple new items.

It's time to put full-text indexing back, and we might want to
experiment with optimization the original thread-stitching phase.

15 years agoTODO: Remove a couple of since-completed items.
Carl Worth [Wed, 28 Oct 2009 08:46:24 +0000 (01:46 -0700)]
TODO: Remove a couple of since-completed items.

"notmuch tag" is implemented now and seems to work great (and fast).

As for the race condition, as noted in the description we're removing
it's not exposed directly in the API, but only in a client that
allows for looping over search results and removing the inbox tag
from all of them. But then, that's exactly what the "notmuch tag"
command does. So, as discussed, we've now documented that command
to highlight the issue. Problem resolved, (as well as we can).

15 years agonotmuch help: Review and augment all of the "notmuch help" documentation.
Carl Worth [Wed, 28 Oct 2009 08:37:57 +0000 (01:37 -0700)]
notmuch help: Review and augment all of the "notmuch help" documentation.

The big addition here is the first description of the syntax for
the query strings for "notmuch search", (and, by reference, for
"notmuch tag").

15 years agonotmuch help: Be less verbose by default and support detailed help
Carl Worth [Wed, 28 Oct 2009 07:58:26 +0000 (00:58 -0700)]
notmuch help: Be less verbose by default and support detailed help

Putting all of our documentation into a single help message was getting
a bit unwieldy. Now, the simple output of "notmuch help" is a reasonable
reminder and a quick reference. Then we now support a new syntax of:
"notmuch help <command>" for the more detailed help messages.

This gives us freedom to put more detailed caveats, etc. into some
sub-commands without worrying about the usage statement getting too
long.

15 years agonotmuch tag: Fix crash when removing a tag that didn't exist
Carl Worth [Wed, 28 Oct 2009 06:59:06 +0000 (23:59 -0700)]
notmuch tag: Fix crash when removing a tag that didn't exist

Xapian is trying to be useful by reporting that the specified term
didn't exist, but this is one case where we just don't care. :-)

15 years agoFix segfault in case of the database lock not being available.
Carl Worth [Wed, 28 Oct 2009 06:57:37 +0000 (23:57 -0700)]
Fix segfault in case of the database lock not being available.

We were nicely reporting the lock-aquisition failure, but then marching
along trying to use the database object and just crashing badly.
So don't do that.

15 years agoUpdate prefix so that "thread:" can be used in search strings.
Carl Worth [Wed, 28 Oct 2009 06:55:08 +0000 (23:55 -0700)]
Update prefix so that "thread:" can be used in search strings.

It's convenient to be able to do things like:

     notmuch tag -inbox thread:<thread-id>

(even though this can run into a race condition as noted in TODO--the fix
for the race is simply to not run "notmuch new" between reading a thread
with the (not yet existent) "notmuch show" and removing its inbox tag
with a command like the above). So we now allow such a thing.

15 years agoAdd new "notmuch tag" command for adding/removing tags.
Carl Worth [Wed, 28 Oct 2009 00:07:14 +0000 (17:07 -0700)]
Add new "notmuch tag" command for adding/removing tags.

This uses the same search functionality as "notmuch search" so
it should be quite powerful. And this global search might be
quick enough to be used for "automatic" adding of tags to new
messages.

Of course, this will all be a lot more useful when we can search
for actual text of messages and not just tags.

15 years agonotmuch_database_add_message: Do not return a message on failure.
Carl Worth [Tue, 27 Oct 2009 23:19:20 +0000 (16:19 -0700)]
notmuch_database_add_message: Do not return a message on failure.

The recent, disastrous failure of "notmuch new" would have been
avoided with this change. The new_command function was basically
assuming that it would only get a message object on success so
wasn't destroying the message in the other cases.

15 years agonotmuch_database_close: Explicitly flush the Xapian database.
Carl Worth [Tue, 27 Oct 2009 23:17:22 +0000 (16:17 -0700)]
notmuch_database_close: Explicitly flush the Xapian database.

This would have helped with the recent bug causing "notmuch new"
to not record any results in the database. I'm not sure why
the explicit flush would be required, (shouldn't the destructor
always ensure that things flush?), but perhaps some outstanding
references from the leak prevented that.

In any case, an explicit flush on close() seems to make sense.

15 years agoMerge branch to fix broken "notmuch setup" and "notmuch new"
Carl Worth [Tue, 27 Oct 2009 23:12:04 +0000 (16:12 -0700)]
Merge branch to fix broken "notmuch setup" and "notmuch new"

I'm trying to stick to a habit of fixing previously-introduced bugs
on side branches off of the commit that introduced the bug. The
idea here is to make it easy to find the commits to cherry pick
if bisecting in the future lands on one of the broken commits.

15 years agoFix "notmuch new" (bad performance, and no committing of results).
Carl Worth [Tue, 27 Oct 2009 23:07:27 +0000 (16:07 -0700)]
Fix "notmuch new" (bad performance, and no committing of results).

We were incorrectly only destroying messages in the case of
successful addition to the database, and not in other cases,
(such as failure due to FILE_NOT_EMAIL).

I'm still not entirely sure why this was performing abysmally, (as in
making an operation that should take a small fraction of a second take
10 seconds), nor why it was causing the database to entirely fail to
get new results.

But fortunately, this all seems to work now.

15 years agoUnbreak the "notmuch setup" command.
Carl Worth [Tue, 27 Oct 2009 19:00:58 +0000 (12:00 -0700)]
Unbreak the "notmuch setup" command.

The recent addition of support for automatically adding tags to
new messages for "notmuch new" caused "notmuch setup" to segfault.
The fix is simple, (just need to move a destroy function to inside
a nearby if block).

Did I mention recently we need to add a test suite?

15 years agoTODO: Several more ideas that have come to mind, that I don't want to forget.
Carl Worth [Tue, 27 Oct 2009 18:35:30 +0000 (11:35 -0700)]
TODO: Several more ideas that have come to mind, that I don't want to forget.

Some of these are simple little code cleanups, but it's nice to write them
down rather than trying to remember them.

15 years agoTODO: More notes on archive-thread and race conditions.
Carl Worth [Tue, 27 Oct 2009 17:19:46 +0000 (10:19 -0700)]
TODO: More notes on archive-thread and race conditions.

Interstingly, it's our simple "notmuch" client that's going to be the
most difficult to fix. There's just not as much information preserved
in the textual representation from "notmuch search" as there is in the
objects returned from notmuch_query_search_threads.

15 years agoTODO: Add "notmuch tag" and thoughts on avoiding races in archiving threads.
Carl Worth [Tue, 27 Oct 2009 17:04:48 +0000 (10:04 -0700)]
TODO: Add "notmuch tag" and thoughts on avoiding races in archiving threads.

The archive-thread race condition doesn't even exist now because there's
no command for modifying tags at the level of a thread (just individual
messages).

15 years agonotmuch restore: Fix to remove all tags before adding tags.
Carl Worth [Tue, 27 Oct 2009 05:25:45 +0000 (22:25 -0700)]
notmuch restore: Fix to remove all tags before adding tags.

This means that the restore operation will now properly pick up the
removal of tags indicated by the tag just not being present in the
dump file.

We added a few new public functions in order to support this:

notmuch_message_freeze
notmuch_message_remove_all_tags
notmuch_message_thaw

15 years agonotmuch restore: Don't bother printing tag values.
Carl Worth [Tue, 27 Oct 2009 05:19:08 +0000 (22:19 -0700)]
notmuch restore: Don't bother printing tag values.

The code was just a little messy here with three parallel conditions
testing for message == NULL.

15 years agoadd_message: Add an optional parameter for getting the just-added message.
Carl Worth [Tue, 27 Oct 2009 04:44:05 +0000 (21:44 -0700)]
add_message: Add an optional parameter for getting the just-added message.

We use this to implement the addition of "inbox" and "unread" tags
for all messages added by "notmuch new".

15 years agoFix incorrect name of _notmuch_thread_get_subject.
Carl Worth [Tue, 27 Oct 2009 03:11:58 +0000 (20:11 -0700)]
Fix incorrect name of _notmuch_thread_get_subject.

Somehow this naming with an underscore crept in, (but only in the
private header, so notmuch.c was compiling with no prototype). Fix
to be the notmuch_thread_get_subject originally intended.

15 years agoAdd public notmuch_thread_get_subject
Carl Worth [Tue, 27 Oct 2009 00:35:31 +0000 (17:35 -0700)]
Add public notmuch_thread_get_subject

And use this in "notmuch search" to display subject line as well as
thread ID.

15 years agoRemove all calls to g_strdup_printf
Carl Worth [Mon, 26 Oct 2009 22:17:10 +0000 (15:17 -0700)]
Remove all calls to g_strdup_printf

Replacing them with calls to talloc_asprintf if possible, otherwise
to asprintf (with it's painful error-handling leaving the pointer
undefined).

15 years agoAdd notmuch_thread_get_tags
Carl Worth [Mon, 26 Oct 2009 21:46:14 +0000 (14:46 -0700)]
Add notmuch_thread_get_tags

And augment "notmuch search" to print tag values as well as thread ID
values. This tool is almost usable now.

15 years agotags: Replace sort() and reset() with prepare_iterator().
Carl Worth [Mon, 26 Oct 2009 21:12:56 +0000 (14:12 -0700)]
tags: Replace sort() and reset() with prepare_iterator().

The previous functions were always called together, so we might as
well just have one function for this. Also, the reset() name was
poor, and prepare_iterator() is much more descriptive.

15 years agoFix memory leak in notmuch_thread_results_t
Carl Worth [Mon, 26 Oct 2009 21:02:58 +0000 (14:02 -0700)]
Fix memory leak in notmuch_thread_results_t

If we were using a talloc-based resizing array then this wouldn't
have happened. Of course, thanks to valgrind for catching this.

15 years agotags: Re-implement tags iterator to avoid having C++ in the interface
Carl Worth [Mon, 26 Oct 2009 16:13:19 +0000 (09:13 -0700)]
tags: Re-implement tags iterator to avoid having C++ in the interface

We want to be able to iterate over tags stored in various ways, so
the previous TermIterator-based tags object just wasn't general
enough. The new interface is nice and simple, and involves only
C datatypes.

15 years agonotmuch restore: Fix leak of FILE* object.
Carl Worth [Mon, 26 Oct 2009 16:20:32 +0000 (09:20 -0700)]
notmuch restore: Fix leak of FILE* object.

Apparently, I didn't copy enough of the "notmuch dump" implementation
since it didn't have a similar leak.

15 years agoHide away the details of the implementation of notmuch_tags_t.
Carl Worth [Mon, 26 Oct 2009 13:00:07 +0000 (06:00 -0700)]
Hide away the details of the implementation of notmuch_tags_t.

We will soon be wanting multiple different implementations of
notmuch_tags_t iterators, so we need to keep the actual structure
as an implementation detail inside of tags.cc.

15 years agoMove terms and tags code to a new tags.cc file.
Carl Worth [Mon, 26 Oct 2009 12:53:40 +0000 (05:53 -0700)]
Move terms and tags code to a new tags.cc file.

We want to start using this from both message.cc and thread.cc so we
need it in a place we can share the code. This also requires a new
notmuch-private-cxx.h header file for interfaces that include
C++-specific datatypes (such as Xapian::Document).

15 years agoresults_get: Fix to return NULL if past the end of the results
Carl Worth [Mon, 26 Oct 2009 12:14:51 +0000 (05:14 -0700)]
results_get: Fix to return NULL if past the end of the results

We had documented both notmuch_thread_results_get and
notmuch_message_results_get to return NULL if (! has_more)
but we hadn't actually implemented that. Fix.

15 years agoAdd TODO file.
Carl Worth [Mon, 26 Oct 2009 06:18:05 +0000 (23:18 -0700)]
Add TODO file.

I've been maintaining this for a while now, so I might as well
start tracking it with revision control as well.

15 years agoAdd an initial implementation of a notmuch_thread_t object.
Carl Worth [Mon, 26 Oct 2009 06:12:20 +0000 (23:12 -0700)]
Add an initial implementation of a notmuch_thread_t object.

We've now got a new notmuch_query_search_threads and a
notmuch_threads_result_t iterator. The thread object itself
doesn't do much yet, (just allows one to get the thread_id),
but that's at least enough to see that "notmuch search" is
actually doing something now, (since it has been converted
to print thread IDs instead of message IDs).

And maybe that's all we need. Getting the messages belonging
to a thread is as simple as a notmuch_query_search_messages
with a string of "thread:<thread-id>".

Though it would be convenient to add notmuch_thread_get_messages
which could use the existing notmuch_message_results_t iterator.

Now we just need an implementation of "notmuch show" and we'll
have something somewhat usable.

15 years agoRename notmuch_query_search to notmuch_query_search_messages
Carl Worth [Mon, 26 Oct 2009 05:11:09 +0000 (22:11 -0700)]
Rename notmuch_query_search to notmuch_query_search_messages

Along with renaming notmuch_results_t to notmuch_message_results_t.
The new type is quite a mouthful, but I don't expect it to be
used much other than the for-loop idiom in the documentation,
(which does at least fit nicely within 80 columns).

This is all in preparation for the addition of a new
notmuch_query_search_threads of course.

15 years agoDrop dead function add_term.
Carl Worth [Sun, 25 Oct 2009 23:12:24 +0000 (16:12 -0700)]
Drop dead function add_term.

Even with the recent warnings work, gcc didn't tell me about a static
function that I'm not calling? Apparently I get "defined but not
used" in C files, but not C++ files. That's bogus, and yet one more
reason for me to push the C++ to a minimal lower layer.

15 years agoFix missing xapian-flags when generating dependencies.
Carl Worth [Sun, 25 Oct 2009 23:09:31 +0000 (16:09 -0700)]
Fix missing xapian-flags when generating dependencies.

I didn't notice this because `xapian-config -cxxflags` gives empty
output on my system. But for someone with the xapian library
installed in some non-standard location this would be important.

15 years agoDrop unused variable.
Carl Worth [Sun, 25 Oct 2009 23:07:46 +0000 (16:07 -0700)]
Drop unused variable.

I didn't end up adding any of the warnings options that aren't allowed
for C++, (such as -Wold-style-definition, -Wnested-externs,
-Werror-implicit-function-declaration, -Wstrict-prototypes,
-Wmissing-prototypes, or -Wbad-function-cast). So for now we can
drop the separate C and C++ variables for warnings.

15 years agoAdd -Wswitch-enum and fix warnings.
Carl Worth [Sun, 25 Oct 2009 23:03:45 +0000 (16:03 -0700)]
Add -Wswitch-enum and fix warnings.

Having to enumerate all the enum values at every switch is annoying,
but this warning actually found a bug, (missing support for
NOTMUCH_STATUS_OUT_OF_MEMORY in notmuch_status_to_string).

15 years agoAdd -Wmising-declarations and fix warnings.
Carl Worth [Sun, 25 Oct 2009 22:58:05 +0000 (15:58 -0700)]
Add -Wmising-declarations and fix warnings.

Wow, lots of missing 'static' on internal functions.

15 years agoAdd -Wwrite-strings and fix warnings.
Carl Worth [Sun, 25 Oct 2009 22:55:23 +0000 (15:55 -0700)]
Add -Wwrite-strings and fix warnings.

Need to be const-clean when handling string literals.

15 years agoRe-enable the warning for unused parameters.
Carl Worth [Sun, 25 Oct 2009 22:53:27 +0000 (15:53 -0700)]
Re-enable the warning for unused parameters.

It's easy enough to squelch the warning with an __attribute__ ((unused))
and it might just catch something for us in the future.

15 years agoAdd -Wextra and fix warnings.
Carl Worth [Sun, 25 Oct 2009 22:39:53 +0000 (15:39 -0700)]
Add -Wextra and fix warnings.

When adding -Wextra we also add -Wno-ununsed-parameters since that
function means well enough, but is really annoying in practice.

So the warnings we fix here are basically all comparsions between
signed and unsigned values.

15 years agoRework Makefile just a bit to enable adding flags for more compiler warnings
Carl Worth [Sun, 25 Oct 2009 22:19:36 +0000 (15:19 -0700)]
Rework Makefile just a bit to enable adding flags for more compiler warnings

We have to carefully separate the C and C++ flags here since a
bunch of the warnings options for gcc are valid for compiling C,
but not for C++.

15 years ago_notmuch_database_linke_message: Fix error-status propagation.
Carl Worth [Sun, 25 Oct 2009 22:01:20 +0000 (15:01 -0700)]
_notmuch_database_linke_message: Fix error-status propagation.

The _notmuch_database_link_message_to_parents function was void
in an earlier draft. Now, ensure that we don't miss any error
return value from it.

15 years agoChange database to store only a single thread ID per message.
Carl Worth [Sun, 25 Oct 2009 21:54:13 +0000 (14:54 -0700)]
Change database to store only a single thread ID per message.

Instead of supporting multiple thread IDs, we now merge together
thread IDs if one message is ever found to belong to more than one
thread. This allows for constructing complete threads when, for
example, a child message doesn't include a complete list of References
headers back to the beginning of the thread.

It also simplifies dealing with mapping a message ID to a thread ID
which is now a simple get_thread_id just like get_message_id, (and no
longer an iterator-based thing like get_tags).

15 years agolink_message: Remove dead code.
Carl Worth [Sun, 25 Oct 2009 18:05:16 +0000 (11:05 -0700)]
link_message: Remove dead code.

We dropped the THREAD_ID value from the database a while back, but here
is code that's carefully computing that value and then never doing
anything with it. Delete, delete, delete.