Commit graph

165 commits

Author SHA1 Message Date
Carl Worth
af65f52acf notmuch setup: Print a few protecting spaces after progress reports.
This is to help keep the report looking clean when a new report
is shorter than a previous reports, (say, when crossing the
boundary from over one minute remaining to less than one minute
remaining).

This used to be here, but I must have accidentally dropped it
when reformatting the progress report recently.
2009-10-21 00:32:30 -07:00
Carl Worth
6519aff957 query: Remove the magic NOTMUCH_QUERY_ALL
Using the address of a static char* was clever, but really
unnecessary. An empty string is much less magic, and even
easier to understand as the way to query everything from
the database.
2009-10-20 22:40:37 -07:00
Carl Worth
aad13c3ac9 notmuch dump: Free each message as it's used.
Previously we were leaking[*] memory in that the memory footprint of
a "notmuch dump" run would continue to grow until the output was
complete, and then finally all the memory would be freed.

Now, the memory footprint is small and constant, O(1) rather than
O(n) in the number of messages.

[*] Not leaking in a valgrind sense---every byte was still carefully
being accounted for and freed eventually.
2009-10-20 22:27:56 -07:00
Carl Worth
466a7bbf62 Implement 'notmuch dump'.
This is a fairly big milestone for notmuch. It's our first command
to do anything besides building the index, so it proves we can
actually read valid results out from the index.

It also puts in place almost all of the API and infrastructure we
will need to allow searching of the database.

Finally, with this change we are now using talloc inside of notmuch
which is truly a delight to use. And now that I figured out how
to use C++ objects with talloc allocation, (it requires grotty
parts of C++ such as "placement new" and "explicit destructors"),
we are valgrind-clean for "notmuch dump", (as in "no leaks are
possible").
2009-10-20 21:21:39 -07:00
Carl Worth
28fa0bc2d6 notmuch: Fix setup so that accepting the default mail path works.
The recent change from GIOChannel to getline, (with a semantic
change of the newline terminator now being included in the
result that setup_command sees), broke this.
2009-10-20 13:17:56 -07:00
Carl Worth
00b65cad98 notmuch: Use GNU libc getline() instead of glib GIOChannel
Less reliance on glib is always nice for our memory-leak testing
efforts.
2009-10-20 12:47:23 -07:00
Carl Worth
67a0ee2ebb Add some explanation about NOTMUCH_BASE to setup_command.
Since we allow the user to enter a custom directory, we need to
let the user know how to make this persistent. Of course, a better
answer would be to take what the user entered and shove it into
a ~/.notmuch-config file or so, but for now this will have to do.
2009-10-20 10:09:17 -07:00
Carl Worth
55c8ee9a86 notmuch_database_create/open: Fix to handle NULL as documented.
When documenting these functions I described support for a
NOTMUCH_BASE environment variable to be consulted in the case
of a NULL path. Only, I had forgotten to actually write the
code.

This code exists now, with a new, exported function:

     notmuch_database_default_path
2009-10-20 09:58:40 -07:00
Carl Worth
5f8d44fa5b notmuch: Revamp help message a bit.
The big update here is the addition of the dump and restore commands
which are next on my list. Also, I've now come up with a syntax for
documenting the arguments of sub-commands.
2009-10-19 23:41:31 -07:00
Carl Worth
ad784f38ce notmuch: Ignore files that don't look like email messages.
This is helpful for things like indexes that other mail programs
may have left around. It also means we can make the initial
instructions much easier, (the user need not worry about moving
away auxiliary files from some other email program).
2009-10-19 23:16:05 -07:00
Carl Worth
2269106466 notmuch: Reword the progress report slightly.
I noticed this style during a recent Debian install and I liked
how much less busy it is compared to what we had before, (while
still telling the user everything she might want).
2009-10-19 18:30:48 -07:00
Carl Worth
c5eea2b77e Document which pieces of glib we're still using.
Looks like we can copy in a hash-table implementation, (from cairo,
say), and then a few _ascii_ functions from glib, (we'll need to
switch a few current uses if things like isspace, etc. to locale-
independent versions as well). So not too hard to free ourselves
of glib for now, (until we add GMime back in later, of course).
2009-10-19 13:40:56 -07:00
Carl Worth
9bc4253fa8 notmuch: Ignore .notmuch when counting files.
We were correctly ignoring this when adding files, but not when
doing the initial count. Clearly we need better code sharing
here.
2009-10-19 12:52:46 -07:00
Carl Worth
10c176ba0e notmuch: Start actually adding messages to the index.
This is the beginning of the notmuch library as well, with its
interface in notmuch.h. So far we've got create, open, close, and
add_message (all with a notmuch_database prefix).

The current add_message function has already been whittled down from
what we have in notmuch-index-message to add only references,
message-id, and thread-id to the index, (that is---just enough to do
thread-linkage but nothing for full-text searching).

The concept here is to do something quickly so that the user can get
some data into notmuch and start using it. (The most interesting stuff
is then thread-linkage and labels like inbox and unread.)  We can
defer the full-text indexing of the body of the messages for later,
(such as in the background while the user is reading mail).

The initial thread-stitching step is still slower than I would like.
We may have to stop using libgmime for this step as its overhead is
not worth it for the simple case of just parsing the message-id,
references, and in-reply-to headers.
2009-10-18 20:56:30 -07:00
Carl Worth
36640b303e Start a new top-level executable: notmuch.
Of course, there's not much that this program does yet. It's got
some structure for some sub-commands that don't do anything. And
it has a main command that prints some explanatory text and then
counts all the regular files in your mail archive.
2009-10-17 08:26:58 -07:00