Commit graph

5522 commits

Author SHA1 Message Date
Carl Worth
1b10c32a52 Add an INSTALL file.
The README file was already referring to this, so we actually add it
now.
2009-11-02 09:25:04 -08:00
Carl Worth
ddb4713b4b 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.
2009-11-02 09:11:37 -08:00
Carl Worth
f6183a92b5 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.
2009-11-02 07:18:49 -08:00
Carl Worth
5e2a479e69 README: Add a simple file explaining notmuch and pointing out resources.
This is part of getting notmuch ready for a more public announcement.
2009-11-02 07:18:49 -08:00
Carl Worth
1a579dfe6b Add a simple manual page for notmuch.
By pulling content out of notmuch help, and also the messages
printed by "notmuch setup".
2009-11-02 07:18:31 -08:00
Carl Worth
2405b45a06 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).
2009-10-31 16:40:47 -07:00
Carl Worth
c96021a477 Rename message_results/thread_results to messages/threads.
Shorter naming without being any less clear. A definite win.
2009-10-31 16:32:30 -07:00
Carl Worth
c33eed84f2 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
)
2009-10-31 12:09:06 -07:00
Carl Worth
c37b1bdf2d 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.
2009-10-31 12:08:00 -07:00
Carl Worth
acdc9988a2 notmuch.el: Add final '*' to generated buffer names.
Just looks a little neater that way.
2009-10-31 01:55:12 -07:00
Carl Worth
1c75d622c9 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.
2009-10-31 01:41:44 -07:00
Carl Worth
8c9cc63a2e 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.
2009-10-31 01:06:10 -07:00
Carl Worth
095a5ac382 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.
2009-10-31 00:44:39 -07:00
Carl Worth
eb1a5b441b 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.
2009-10-30 23:42:39 -07:00
Carl Worth
7e8ba9adf8 notmuch.el: Add notmuch-search command as well as notmuch
This allows for entering a query string interactively.
2009-10-30 17:18:19 -07:00
Carl Worth
ea97496081 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.
2009-10-30 17:17:16 -07:00
Carl Worth
95865596df notmuch.el: Rename from notmuch-mode.el to notmuch.el
Also add the copyright and licensing blurb.
2009-10-30 15:20:34 -07:00
Carl Worth
299874ce29 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.
2009-10-30 15:12:49 -07:00
Carl Worth
17a0b8a95f 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.
2009-10-30 15:05:53 -07:00
Carl Worth
f365024166 TODO: Add man page and compiling a libnotmuch library to the list.
These are things we'll want done before any big announcement.
2009-10-30 12:02:11 -07:00
Carl Worth
2b819ae83d Makefile: Add a simple target for "make install".
The more I do here, the less I see the need for autotools.
2009-10-30 12:00:55 -07:00
Carl Worth
bdde726388 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).
2009-10-30 12:00:48 -07:00
Carl Worth
a2f0445e1b 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).
2009-10-29 17:42:21 -07:00
Carl Worth
c771eaf362 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.
2009-10-29 17:31:07 -07:00
Carl Worth
41c7ad2c91 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.
2009-10-29 17:30:56 -07:00
Carl Worth
8b93875b27 notmuch show: Trim down header list.
This is for now a non-configurable list of Subject, From, To, Cc,
Bcc, and Date.
2009-10-29 14:07:45 -07:00
Carl Worth
90a0ef4ac4 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.
2009-10-29 09:06:53 -07:00
Carl Worth
bf78a89196 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.
2009-10-29 08:51:12 -07:00
Carl Worth
b39ebca8c9 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.
2009-10-28 16:52:45 -07:00
Carl Worth
a1135f0b7e 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.
2009-10-28 16:51:56 -07:00
Carl Worth
fbf55bfe2f 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.
2009-10-28 16:09:19 -07:00
Carl Worth
56218ddbb4 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 "-- ".
2009-10-28 15:41:42 -07:00
Carl Worth
cfa228a3d4 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.
2009-10-28 13:35:10 -07:00
Carl Worth
81861514c9 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.
2009-10-28 13:13:23 -07:00
Carl Worth
3a91df21ca 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.
2009-10-28 13:09:08 -07:00
Carl Worth
f9bbd7baa0 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.
2009-10-28 12:50:10 -07:00
Carl Worth
b04cc33738 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
2009-10-28 10:35:26 -07:00
Carl Worth
df959868d9 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.
2009-10-28 07:28:01 -07:00
Carl Worth
f8a14b698f 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).
2009-10-28 01:46:24 -07:00
Carl Worth
19ec20192c 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").
2009-10-28 01:37:57 -07:00
Carl Worth
450b054245 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.
2009-10-28 00:58:26 -07:00
Carl Worth
88bf876bae 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. :-)
2009-10-27 23:59:06 -07:00
Carl Worth
07aa759b68 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.
2009-10-27 23:57:37 -07:00
Carl Worth
5eaec1e316 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.
2009-10-27 23:55:08 -07:00
Carl Worth
326f73374e 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.
2009-10-27 17:15:27 -07:00
Carl Worth
203a717d64 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.
2009-10-27 16:19:20 -07:00
Carl Worth
854f82fb91 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.
2009-10-27 16:17:22 -07:00
Carl Worth
b0190e59ac 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.
2009-10-27 16:12:08 -07:00
Carl Worth
8969720108 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.
2009-10-27 16:07:27 -07:00
Carl Worth
16003e1f8f 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?
2009-10-27 12:00:58 -07:00