]> git.notmuchmail.org Git - notmuch/log
notmuch
14 years agonotmuch main(): Remove stale comment.
Carl Worth [Wed, 18 Nov 2009 13:22:14 +0000 (05:22 -0800)]
notmuch main(): Remove stale comment.

The code this comment was referring to has since been deleted.

14 years agonotmuch help: Print to stdout, not to stderr.
Lars Kellogg-Stedman [Wed, 18 Nov 2009 01:01:16 +0000 (20:01 -0500)]
notmuch help: Print to stdout, not to stderr.

Let usage() take a FILE * argument so that you can output to stderr in
response to usage errors, and stdout in response to an explicit
request.

14 years agonotmuch search: Avoid infinite stream of exceptions from "notmuch search"
Carl Worth [Wed, 18 Nov 2009 11:29:30 +0000 (03:29 -0800)]
notmuch search: Avoid infinite stream of exceptions from "notmuch search"

That is, give a nice error message and exit if no search terms are
provided. Thanks to Priit Laes <plaes@plaes.org> for reporting the
error and providing an early version of the fix.

14 years agoREADME: Mention the actual mailing list address now that it exists.
Carl Worth [Wed, 18 Nov 2009 11:24:27 +0000 (03:24 -0800)]
README: Mention the actual mailing list address now that it exists.

Much better than telling people to mail me individually.

14 years agoTypsos
Ingmar Vanhassel [Tue, 17 Nov 2009 23:23:42 +0000 (00:23 +0100)]
Typsos

14 years agoOlder versions of install do not support -C.
Jan Janak [Tue, 17 Nov 2009 22:18:47 +0000 (23:18 +0100)]
Older versions of install do not support -C.

Do not use -C cmdline option of install, older versions, commonly found in
distributions like Debian, do not seem to support it. Running make install
on such systems (tested on Debian Lenny) fails.

Signed-off-by: Jan Janak <jan@ryngle.com>
14 years agolinke_message: Avoid segfault when In-Reply-to header is empty.
Carl Worth [Wed, 18 Nov 2009 09:36:30 +0000 (01:36 -0800)]
linke_message: Avoid segfault when In-Reply-to header is empty.

This was recently introduced in commit:

64c03ae97f2f5294c60ef25d7f41849864e6ebd3

which was adding extra checks to avoid adding a self-referencing
message.

How many times am I going to fix a dumb regression like this and say
"we really need a test suite" before I actually sit down and write the
test suite?

14 years agonotmuch-completion.bash: Update for new commands and help.
Carl Worth [Wed, 18 Nov 2009 09:29:19 +0000 (01:29 -0800)]
notmuch-completion.bash: Update for new commands and help.

Would be nice to add the options for "notmuch search" too.

14 years agonotmuch help: Update documentation (following recent text from notmuch.1)
Carl Worth [Wed, 18 Nov 2009 07:37:21 +0000 (23:37 -0800)]
notmuch help: Update documentation (following recent text from notmuch.1)

We take the recently created text from the notmuch manual page and
update the "notmuch help" command to use similar text. In particular,
we add a new "notmuch help search-terms" for documenting the search
syntax that is common to several commands.

14 years agonotmuch.1: Fix a couple of typos.
Carl Worth [Wed, 18 Nov 2009 07:36:44 +0000 (23:36 -0800)]
notmuch.1: Fix a couple of typos.

Little things I noticed while using this text as reference for the
"notmuch help" documentation.

14 years agoman.1: A big update of the notmuch manual page.
Carl Worth [Wed, 18 Nov 2009 06:16:35 +0000 (22:16 -0800)]
man.1: A big update of the notmuch manual page.

I set out merely to add documentation for the recently-added options
for "notmuch search" (--first, --max-threads, and --sort), but ended
up revamping a lot. A significant change is a new SEARCH SYNTAX
section separate from "notmuch search" that is referred to in the
documentation of search, show, reply, and tag.

Also many sections were updated to reflect recent changes, (such as
the dropping of the NOTMUCH_BASE environment variable, the addition of
the .notmuch-config file, etc.)

14 years agoMakefile: Fix missing dependency for notmuch.1 manual page.
Carl Worth [Wed, 18 Nov 2009 05:04:31 +0000 (21:04 -0800)]
Makefile: Fix missing dependency for notmuch.1 manual page.

The Makefile was failing to regnerate the notmuch.1.gz file when
notmuch.1 was updated, (so stale documentation could potentially be
installed).

14 years agonotmuch search: Change default search order to be newest messages first.
Carl Worth [Wed, 18 Nov 2009 04:52:09 +0000 (20:52 -0800)]
notmuch search: Change default search order to be newest messages first.

This is what most people want for a _search_ command. It's often
different for actually reading mail in an inbox, (where it makes more
sense to have results displayed in chronological order), but in such a
case, ther user is likely using an interface that can simply pass the
--sort=oldest-first option to "notmuch search".

Here we're also change the sort enum from NOTMUCH_SORT_DATE and
NOTMUCH_SORT_DATE_REVERSE to NOTMUCH_SORT_OLDEST_FIRST and
NOTMUCH_SORT_NEWEST_FIRST. Similarly we replace the --reverse option
to "notmuch search" with two options: --sort=oldest-first and
--sort=newest-first.

Finally, these changes are all tracked in the emacs interface, (which
has no change in its behavior).

14 years agonotmuch search: Return first 100 results as quickly as possible.
Carl Worth [Wed, 18 Nov 2009 03:11:05 +0000 (19:11 -0800)]
notmuch search: Return first 100 results as quickly as possible.

This is one of those cases where total time is not the metric of
interest. We increase the total time of the search, (by doing some
redundant work for the initial threads). But more significantly, we
give the user *some* results nearly instantaneously, (so that the user
might see the result of interest without ever even waiting for the
complete results to come in).

14 years agoAdd some const correctness to talloc 'ctx' parameter.
Carl Worth [Wed, 18 Nov 2009 03:10:37 +0000 (19:10 -0800)]
Add some const correctness to talloc 'ctx' parameter.

The tentacles of const just keep reaching out.

14 years agodatabase: Make _parse_message_id static once again.
Carl Worth [Wed, 18 Nov 2009 02:50:13 +0000 (18:50 -0800)]
database: Make _parse_message_id static once again.

We had exposed this to the internal implementation for a short time,
(only while we had the silly code fetching In-Reply-To values from
message files instead of from the database). Make this private again
as it should be.

14 years agodatabase: Add "replyto" to the database schema documentation.
Carl Worth [Wed, 18 Nov 2009 02:48:38 +0000 (18:48 -0800)]
database: Add "replyto" to the database schema documentation.

Maybe ths lack of this documentation is why I forgot we were actually
storing this and wrote the ugly code to fetch In-Reply-To from message
files rather than from the database.

14 years agodatabase: Rename "ref" prefix name to "reference"
Carl Worth [Wed, 18 Nov 2009 02:44:02 +0000 (18:44 -0800)]
database: Rename "ref" prefix name to "reference"

Which is more consistent with the XREFERENCE prefix used in the terms
in the database. Also remove some stale documentation describing the
removal of resolved references from the database (we no longer do
this).

14 years agomessage_file_get_header: Use break where more clear than continue.
Carl Worth [Wed, 18 Nov 2009 02:37:45 +0000 (18:37 -0800)]
message_file_get_header: Use break where more clear than continue.

Calling continue here worked only because we set a flag before the
continue, and, check the flag at the beginning of the loop, and *then*
break. It's much more clear to just break in the first place.

14 years agoFix "too many open files" bug by closing message files when done with them.
Keith Packard [Wed, 18 Nov 2009 02:33:42 +0000 (18:33 -0800)]
Fix "too many open files" bug by closing message files when done with them.

The message file header parsing code parses only enough of the file to
find the desired header fields, then it leaves the file open until the
next header parsing call or when the message is no longer in use. If a
large number of messages end up being active, this will quickly run
out of file descriptors.

Here, we add support to explicitly close the message file within a
message, (_notmuch_message_close) and call that from thread
construction code.

Signed-off-by: Keith Packard <keithp@keithp.com>
Edited-by: Carl Worth <cworth@cworth.org>:
Many portions of Keith's original patch have since been solved other
ways, (such as the code that changed the handling of the In-Reply-To
header). So the final version is clean enough that I think even Keith
would be happy to have his name on it.

14 years agonotmuch show: Detect an internal error if a thread has no messages.
Carl Worth [Wed, 18 Nov 2009 01:53:54 +0000 (17:53 -0800)]
notmuch show: Detect an internal error if a thread has no messages.

This really should be impossible---if there are no messages, then what
was the thread object created from? During recent debugging, it was
useful to have this error detected and reported.

14 years agoadd_message: Don't add any self-references to the database.
Carl Worth [Wed, 18 Nov 2009 01:20:32 +0000 (17:20 -0800)]
add_message: Don't add any self-references to the database.

In our scheme it's illegal for any message to refer to itself, (nor
would it be useful for anything anyway). Cut these self-references off
at the source, before they trip up any internal errors.

14 years agomessage_get_thread_id: Generate internal error if message has no thread ID.
Carl Worth [Tue, 17 Nov 2009 19:07:38 +0000 (11:07 -0800)]
message_get_thread_id: Generate internal error if message has no thread ID.

This case was happening when a message had its own message ID in its
In-Reply-To header. The thread-resolution code would find the
partially constructed message, (with no thread ID yet), get garbage
from this function, and then march right along with that garbage.

With this commit, a self-cyclic message like this will now trigger an
internal error rather than marching along silienty. (And a subsequent
commit will remove the call to this function in this case.)

14 years agoRemove the talloc_owner argument from create_for_message_id.
Carl Worth [Tue, 17 Nov 2009 19:02:33 +0000 (11:02 -0800)]
Remove the talloc_owner argument from create_for_message_id.

This function has only one caller, and that one caller was passing the
same value for both talloc_owner and the notmuch database. Dropping
the redundant argument simplifies the documentation of this function
considerably.

14 years agoget_in_reply_to: Implement via the database, not by opening mail file.
Carl Worth [Wed, 18 Nov 2009 01:40:19 +0000 (17:40 -0800)]
get_in_reply_to: Implement via the database, not by opening mail file.

This reduces our reliance on open message_file objects, (so is a step
toward fixing the "too many open files" bug), but more importantly, it
means we don't load a self-referencing in-reply-to header, (since we
weed those out before adding any replyto terms to the database).

14 years agoMakefile: Manual pages shouldn't be executable
Ingmar Vanhassel [Tue, 17 Nov 2009 21:04:07 +0000 (22:04 +0100)]
Makefile: Manual pages shouldn't be executable

14 years agoMakefile: Change default install prefix from /usr to /usr/local, really
Ingmar Vanhassel [Tue, 17 Nov 2009 21:10:18 +0000 (22:10 +0100)]
Makefile: Change default install prefix from /usr to /usr/local, really

14 years agoMakefile: Change default install prefix from /usr to /usr/local
Carl Worth [Tue, 17 Nov 2009 21:05:16 +0000 (13:05 -0800)]
Makefile: Change default install prefix from /usr to /usr/local

We'll be a much more polite package this way. And the user can change
the prefix by editing Makefile.config. Still to be done is to make
configure write out Makefile.config and to add a --prefix option to
configure.

14 years agoMakefile: Prefer directories as the target for install commands.
Carl Worth [Tue, 17 Nov 2009 20:50:46 +0000 (12:50 -0800)]
Makefile: Prefer directories as the target for install commands.

I was confusing myself with some rules installing to directories and
some installing to files. We do still install to a filename when
simultaneously renaming, (such as notmuch-completion.bash to notmuch).

14 years agoUpdate .gitignore, add objects and static archives
Ingmar Vanhassel [Tue, 17 Nov 2009 19:53:21 +0000 (20:53 +0100)]
Update .gitignore, add objects and static archives

14 years agoMakefile: Create installation directories explicitly
Ingmar Vanhassel [Tue, 17 Nov 2009 19:50:29 +0000 (20:50 +0100)]
Makefile: Create installation directories explicitly

Previously, notmuch.1.gz was installed as /usr/share/man/man1 (a file).

14 years agoDeal with situation where sysconf(_SC_GETPW_R_SIZE_MAX) returns -1
Alexander Botero-Lowry [Tue, 17 Nov 2009 19:30:39 +0000 (11:30 -0800)]
Deal with situation where sysconf(_SC_GETPW_R_SIZE_MAX) returns -1

14 years agoFix broken commit.
Carl Worth [Tue, 17 Nov 2009 17:04:14 +0000 (09:04 -0800)]
Fix broken commit.

Oops. I should have actually compiled before pushing.

14 years agoInclude <stdint.h> to get uint32_t in C++ file with gcc 4.4
Mikhail Gusarov [Tue, 17 Nov 2009 15:28:38 +0000 (21:28 +0600)]
Include <stdint.h> to get uint32_t in C++ file with gcc 4.4

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
14 years agoClose message file after parsing message headers
Mikhail Gusarov [Tue, 17 Nov 2009 15:28:37 +0000 (21:28 +0600)]
Close message file after parsing message headers

Keeping unused files open helps to see "Too many open files" often.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
14 years agoadd_message: Avoid a memory leak when user holds on to message return.
Carl Worth [Tue, 17 Nov 2009 16:50:14 +0000 (08:50 -0800)]
add_message: Avoid a memory leak when user holds on to message return.

When this function was originally written, the 'message' object was
always destroyed locally, so I thought it would be good to use a NULL
talloc context to make it more obvious if there was any leak.

Since then, however, this function has been changed to optionally
return the added message, and in that case we *don't* free the message
locally, so let's let the database be the talloc context.

14 years agonotmuch_message_file_get_header returns "" for missing headers, not NULL
Keith Packard [Tue, 17 Nov 2009 03:57:14 +0000 (19:57 -0800)]
notmuch_message_file_get_header returns "" for missing headers, not NULL

This makes notmuch reply fail to add From: addresses to the list of
recipients.

Signed-off-by: Keith Packard <keithp@keithp.com>
14 years agoUse 'forward-line' instead of 'next-line' while walking search display
Keith Packard [Tue, 17 Nov 2009 03:05:02 +0000 (19:05 -0800)]
Use 'forward-line' instead of 'next-line' while walking search display

The documentation for 'next-line' suggests that 'forward-line' is a
better choice for non-interactive usage. That appears to be the case
here; using next-line caused emacs to spin forever for me.

Signed-off-by: Keith Packard <keithp@keithp.com>
14 years agonotmuch.el: Consider an entire line of underscores as a signature separator.
Carl Worth [Tue, 17 Nov 2009 00:39:59 +0000 (16:39 -0800)]
notmuch.el: Consider an entire line of underscores as a signature separator.

This is the default separator used by mailman, so there's a lot of
clutter in thread displays without this. Also, we not provide a nice
variable to the user (notmuch-show-signature-regexp) for configuring
this.

14 years agonotmuch.el: Insert a newline if the last line of a part is missing one.
Carl Worth [Mon, 16 Nov 2009 22:53:02 +0000 (14:53 -0800)]
notmuch.el: Insert a newline if the last line of a part is missing one.

I think there's a GMime bug that we're getting parts decoded without a
final newline (the encoded parts seem to have them just fine). We can
workaround the bug easily enough by finding a part-closing delimiter
that is not at the beginning of a line, and if so, just insert a
newline.

Without this, the one-line-summary of the next message would continue
on the same line as the last line of the previous message, (and this
would often happen for mailing-list messages where mailman would add
an extra part for its signature block).

14 years agonotmuch restore was skipping entries with no new tags
Keith Packard [Mon, 16 Nov 2009 19:53:35 +0000 (11:53 -0800)]
notmuch restore was skipping entries with no new tags

notmuch restore used to only add tags; now that it clears existing
tags, it needs to operate on messages even if the new tag list is empty.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Carl Worth <cworth@cworth.org>:
I fixed up the indentation here, (someday we might switch to 8-space
indents, but we haven't yet).

14 years agonotmuch.el: Display authors in a column separate from subject.
Carl Worth [Mon, 16 Nov 2009 19:57:05 +0000 (11:57 -0800)]
notmuch.el: Display authors in a column separate from subject.

This makes it much easier to actually read the subject lines.

The user can set notmuch-search-authors-width to control the width of
the column.

Two possible ideas for improving this support further:

  1. Make the excess authors invisible instead of removing them from
     the buffer, (which means that isearch could still find them).

  2. Have the user variable control a percentage of the window width
  rather than being a fixed number of columns.

14 years agonotmuch.el: Indent messages to show nested structure of thread.
Carl Worth [Mon, 16 Nov 2009 18:45:10 +0000 (10:45 -0800)]
notmuch.el: Indent messages to show nested structure of thread.

Now that we're actually adding text to the buffer for the indentation,
our old aproach of using positions to record regions to manipulate is
now longer correct. Fortunately, it's easy to switch from positions to
markers which are robust, (just call point-marker instead of point and
all relevant functions accept markers as well as points).

I also finally fixed the bug where the text "[6 line signature]" we
display was causing the one-line-summary of the next message to be on
its same line rather than at the beginning of the next line where it
belongs.

14 years agonotmuch show: Implement proper thread ordering/nesting of messages.
Carl Worth [Mon, 16 Nov 2009 04:39:25 +0000 (20:39 -0800)]
notmuch show: Implement proper thread ordering/nesting of messages.

We now properly analyze the in-reply-to headers to create a proper
tree representing the actual thread and present the messages in this
correct thread order. Also, there's a new "depth:" value added to the
"message{" header so that clients can format the thread as desired,
(such as by indenting replies).

14 years agoMinor whitespace touchup.
Carl Worth [Mon, 16 Nov 2009 04:38:16 +0000 (20:38 -0800)]
Minor whitespace touchup.

It's funny that I picked up the habit of always including a space
before a left parenthesis from Keith, and now he's in the habit of
contributing code without it.

14 years agoAdd _notmuch_message_get_in_reply_to.
Carl Worth [Mon, 16 Nov 2009 04:36:51 +0000 (20:36 -0800)]
Add _notmuch_message_get_in_reply_to.

The existing notmuch_message_get_header is *almost* good enough for
this, except that we also need to remove the '<' and '>'
delimiters. We'll probably want to implement this function with
database storage in the future rather than loading the email message.

14 years agoRemove obsolete notmuch_message_get_subject prototype.
Carl Worth [Mon, 16 Nov 2009 04:34:24 +0000 (20:34 -0800)]
Remove obsolete notmuch_message_get_subject prototype.

This prototype has been sitting around for a while with no function
implementing it. I wonder if there's a compiler warning I could turn
on to catch these things.

14 years agolib/messages: Add new notmuch_message_list_t to internal interface.
Carl Worth [Mon, 16 Nov 2009 04:29:13 +0000 (20:29 -0800)]
lib/messages: Add new notmuch_message_list_t to internal interface.

Previously, the notmuch_messages_t object was a linked list built on
top of a linked-list node with the odd name of notmuch_message_list_t.

Now, we've got much more sane naming with notmuch_message_list_t being
a list built on a linked-list node named notmuch_message_node_t. And
now the public notmuch_messages_t object is a separate iterator based
on notmuch_message_node_t. This means the interfaces for the new
notmuch_message_list_t object are now made available to the library
internals.

14 years agodatabase: Fix a typo in a commit.
Carl Worth [Mon, 16 Nov 2009 04:23:27 +0000 (20:23 -0800)]
database: Fix a typo in a commit.

Nothing significant here, but we might as well not keep things
misspelled when we notice.

14 years agoExport _parse_message_id to the library implementation.
Carl Worth [Mon, 16 Nov 2009 04:21:43 +0000 (20:21 -0800)]
Export _parse_message_id to the library implementation.

Not exported through the public interface, but the thread code is
going to want to be able to parse In-Reply-To headers so needs access
to this code.

14 years ago_thread_add_messages: Remove unused variable.
Carl Worth [Mon, 16 Nov 2009 04:21:12 +0000 (20:21 -0800)]
_thread_add_messages: Remove unused variable.

I'm not sure how I let this warning go by unfixed for a while. Fix
it now.

14 years agolib: Move notmuch_messages_t code from query.cc to new messages.c
Carl Worth [Sun, 15 Nov 2009 07:05:17 +0000 (23:05 -0800)]
lib: Move notmuch_messages_t code from query.cc to new messages.c

The new object is simply a linked-list of notmuch_message_t objects,
(unlike the old object which contained a couple of Xapian iterators).
This works now by the query code immediately iterator over all results
and creating notmuch_message_t objects for them, (rather than waiting
to create the objects until the notmuch_messages_get call as we did
earlier).

The point of this change is to allow other instances of lists of
messages, (such as in notmuch_thread_t), that are not directly related
to Xapian search results.

14 years agonotmuch_tags_advance: Make safe against excessive calls.
Carl Worth [Sun, 15 Nov 2009 07:02:55 +0000 (23:02 -0800)]
notmuch_tags_advance: Make safe against excessive calls.

Previously, an excess call would have caused a crash. Now it simply
does nothing. Also, make notmuch_tags_get use a similar, consistent
early return for a NULL iterator.

14 years agonotmuch.el: Add support for viewing MIME-encoded parts (with 'v').
Carl Worth [Sat, 14 Nov 2009 16:57:38 +0000 (08:57 -0800)]
notmuch.el: Add support for viewing MIME-encoded parts (with 'v').

Currently just supports viewing all MIME parts in the message. There's
not yet support for selecting and viewing individual parts, but that
should be easy to add from here, (now that we've found
mm-display-parts to do all the heavy lifting).

14 years agonotmuch.el: Add an 'm' binding to start composing a new mail.
Carl Worth [Fri, 13 Nov 2009 23:53:58 +0000 (15:53 -0800)]
notmuch.el: Add an 'm' binding to start composing a new mail.

Available from either the "search" or the "show" view.

14 years agonotmuch.el: Use require instead of load to get the cl functions.
Carl Worth [Fri, 13 Nov 2009 23:49:43 +0000 (15:49 -0800)]
notmuch.el: Use require instead of load to get the cl functions.

Not only is "load" probably the wrong thing, but loading cl-seq befoe
cl can cause complaints anyway.

14 years agonotmuch reply: Prefer "Reply-To" header over "From" for choosing recipient.
Carl Worth [Fri, 13 Nov 2009 18:50:52 +0000 (10:50 -0800)]
notmuch reply: Prefer "Reply-To" header over "From" for choosing recipient.

There are still open questions about how to correctly compute the
intended list of recipients. We'll probably need separate "reply to
sender" and "reply to all" commands at some point (unfortunately).

14 years agonotmuch new/tag: Flush all changes to database when interrupted.
Keith Packard [Fri, 13 Nov 2009 17:05:13 +0000 (09:05 -0800)]
notmuch new/tag: Flush all changes to database when interrupted.

By installing a signal handler for SIGINT we can ensure that no work
that is already complete will be lost if the user interrupts a
"notmuch new" run with Control-C.

14 years agonotmuch.el: Add a binding ('o') and command to toggle current search order.
Carl Worth [Fri, 13 Nov 2009 07:16:19 +0000 (23:16 -0800)]
notmuch.el: Add a binding ('o') and command to toggle current search order.

This ended up being a bit easier than I thought. Just flip the controlling
variable and then run `notmuch-search-refresh-view'.

14 years agonotmuch search: Fix thread dates to come only from matched messages.
Carl Worth [Fri, 13 Nov 2009 07:10:04 +0000 (23:10 -0800)]
notmuch search: Fix thread dates to come only from matched messages.

We were properly sorting the threads based only on matched messages,
but we were displaying the date based on the total messages in the
thread, which led to inconsistent and very confusing results.

14 years agonotmuch.el: Hook up support for different search orders.
Carl Worth [Fri, 13 Nov 2009 06:58:51 +0000 (22:58 -0800)]
notmuch.el: Hook up support for different search orders.

This gives us two different default search orders: The inbox view that
comes up from "M-x notmuch" is sorted in chronological order (oldest
threads first). A new global search "M-x notmuch-search" will instead
be in reverse chronological order (newest threads first).

Any filtered searches retain the sort order of the search being
filtered.

There's not yet any interface for changing the sort order of a search
after it is constructed.

14 years agonotmuch search: Add support for a --reverse option to reverse sort order.
Carl Worth [Fri, 13 Nov 2009 06:35:16 +0000 (22:35 -0800)]
notmuch search: Add support for a --reverse option to reverse sort order.

Note that the difference between thread results in date order and
thread results in reverse-date order is not simply a matter of
reversing the final results. When sorting in date order, the threads
are sorted by the oldest message in the thread. When sorting in
reverse-date order, the threads are sorted by the newest message in
the thread.

This difference means that we might want an explicit option in the
interface to reverse the order, (even though the default will be to
display the inbox in date order and global searches in reverse-date
order).

14 years agoMakefile: Fix dependency generation for files in sub-directories.
Carl Worth [Fri, 13 Nov 2009 06:24:55 +0000 (22:24 -0800)]
Makefile: Fix dependency generation for files in sub-directories.

Otherwise, things in the lib sub-directory weren't getting recompiled
even when lib/notmuch.h was changed.

The original rule we were using came from the GNU Makefile manual, but
only handled files in the current directory, not file in
sub-directories as we use here with our non-recursive Makefile.

So the .deps files being created were being put in the right place,
(such as .deps/lib/database.d), but the compiler was generating a
dependency for "database.o" rather than "lib/database.o" like we
want. We were already trying to do a sed job on that name to add a
dependency for the .d file as well. But the sed job was failing since
the expected pattern wasn't there, (the directory name was missing).

So the fix is simply to use basename to construct the search pattern,
and then use the name with the directory in the replacement (rather
than the back-reference).

14 years agonotmuch search: Print the number of matched/total messages for each thread.
Carl Worth [Fri, 13 Nov 2009 06:01:44 +0000 (22:01 -0800)]
notmuch search: Print the number of matched/total messages for each thread.

Note that we don't print the number of *unread* messages, but instead
the number of messages that matched the search terms. This is in
keeping with our philosophy that the inbox is nothing more than a
search view. If we search for messages with an inbox tag, then that's
what we'll get a count of. (And if somebody does want to see unread
counts, then they can search for the "unread" tag.)

Getting the number of matched messages is really nice when doing
historical searches. For example in a search like:

notmuch search tag:sent

(where the "sent" tag has been applied to all messages originating
from the user's email address)---here it's really nice to be able to
see a thread where the user just mentioned one point [1/13] vs. really
getting involved in the discussion [10/29].

14 years agoUse $(MAKE) when invoking make from make.
Carl Worth [Fri, 13 Nov 2009 06:00:51 +0000 (22:00 -0800)]
Use $(MAKE) when invoking make from make.

Without this, things like MAKEFLAGS=-j4 can't work.

14 years agonotmuch search: Avoid printing duplicate author names.
Carl Worth [Fri, 13 Nov 2009 05:19:42 +0000 (21:19 -0800)]
notmuch search: Avoid printing duplicate author names.

We add a hash to the thread object so that we can detect author names
that have already been added to the list, and avoid adding them
redundantly. This avoids the giant chain of "bugzilla-daemon,
bugzilla-daemon, bugzilla-daemon, bugzilla-daemon, ..." author lists
that we would get otherwise, for example.

14 years agonotmuch search: Print all authors contributing to a thread.
Carl Worth [Fri, 13 Nov 2009 05:09:54 +0000 (21:09 -0800)]
notmuch search: Print all authors contributing to a thread.

We've now expanded the notmuch_thread_create function to fire off a
secondary database query to find all the messages that belong to this
particular thread. This allows us to now have the complete authors'
list for the thread, and will also make it trivial to print accurate
message counts for threads in the future.

14 years agonotmuch search: Add --first and --max-threads options for incremental search.
Carl Worth [Fri, 13 Nov 2009 04:47:12 +0000 (20:47 -0800)]
notmuch search: Add --first and --max-threads options for incremental search.

This time, things are actually tested. The current results aren't
exactly the same as previous results since the incremental search
doesn't necessarily see all the new messages that pertain to the
thread. This means that some author names are missing.

I plan to fix this by doing an additional database search for all
messages in each thread. Of course, this will also be different than
before since now the result will display *all* authors in the thread
(rather than only those that matched the search) but that's probably
what we really want to display anyway.

14 years agonotmuch_query_search_threads: Avoid returning more threads than asked for.
Carl Worth [Fri, 13 Nov 2009 04:31:22 +0000 (20:31 -0800)]
notmuch_query_search_threads: Avoid returning more threads than asked for.

I thought it would be safe enough to return a few extra threads,
(since we happened to already get the relevant messages out of the
database). The problem is that then requires the caller to carefully
read the number of threads returned and adjust its next "first" value
accordingly. The interface is much simpler to use if we simply return
exactly what is asked for and no more.

14 years agonotmuch search: Fix a second bug in the change to support incremental searches.
Carl Worth [Fri, 13 Nov 2009 04:12:16 +0000 (20:12 -0800)]
notmuch search: Fix a second bug in the change to support incremental searches.

The search was dropping the first thread from the results.

When am I going to break down and write a test suite? It's long
overdue now.

14 years agonotmuch search: Fix to actually return something.
Carl Worth [Fri, 13 Nov 2009 04:09:12 +0000 (20:09 -0800)]
notmuch search: Fix to actually return something.

This serves me right for committing untested code. The
notmuch_query_search_threads was totally broken, (it didn't properly
treat -1 as being unlimited and instead returned no threads in that
case).

14 years agolibnotmuch: Underlying support for doing partial-results searches.
Carl Worth [Fri, 13 Nov 2009 00:47:27 +0000 (16:47 -0800)]
libnotmuch: Underlying support for doing partial-results searches.

The library interface now allows the caller to do incremental searches,
(such as one page of results at a time). Next we'll just need to hook
this up to "notmuch search" and the emacs interface.

14 years agonotmuch.el: Remove functions to show/hide thread IDs.
Carl Worth [Thu, 12 Nov 2009 22:35:41 +0000 (14:35 -0800)]
notmuch.el: Remove functions to show/hide thread IDs.

I wrote these originally jsut for debugging. They've never been hooked
up to any keybinding and the existing "M-x visible-mode" does what's
needed anyway.

14 years agonotmuch reply: Add Bcc to the user's primary email address.
Carl Worth [Thu, 12 Nov 2009 19:08:36 +0000 (11:08 -0800)]
notmuch reply: Add Bcc to the user's primary email address.

The user really wants a copy of all outbound messages to come back
in.

14 years agonotmuch show: Display "Subject: " before the subject.
Carl Worth [Thu, 12 Nov 2009 18:22:55 +0000 (10:22 -0800)]
notmuch show: Display "Subject: " before the subject.

I think I was being uselessly terse when I dropped that. Put it back.

14 years agonotmuch search: Print the names of author of matched emails.
Carl Worth [Thu, 12 Nov 2009 17:59:47 +0000 (09:59 -0800)]
notmuch search: Print the names of author of matched emails.

It's important to have the names present for determining whether a
thread is worth reading or not. We may want to think about
abbreviating the list somehow if it is excessively long (or redundant
as in bugzilla-daemon, bugzilla-daemon, bugzilla-daemon, etc.).

14 years agoDon't create "contact" terms in the database.
Carl Worth [Thu, 12 Nov 2009 17:38:24 +0000 (09:38 -0800)]
Don't create "contact" terms in the database.

We never did export any interface to get at these, and when I went to
use these, I found them inadequate, (because I wanted to distinguish
address found in from: from those found in To:). Meanwhile, it was
easy enough to extract addresses with a search like:

notmuch show tag:sent | grep ^To:

so the storage of contact terms was just wasting space. Stop that.

14 years agoTODO: Add note on making "notmuch new" interruptible.
Carl Worth [Thu, 12 Nov 2009 15:05:43 +0000 (07:05 -0800)]
TODO: Add note on making "notmuch new" interruptible.

This note was described in the previous commit message, but mistakenly
not committed:

The note about making "notmuch setup" faster is now rewritten to apply
to "notmuch new" since "notmuch setup" no longer does any mail
indexing.

14 years agoTODO: Update based on recent additions.
Carl Worth [Thu, 12 Nov 2009 15:05:43 +0000 (07:05 -0800)]
TODO: Update based on recent additions.

We recently added support for "notmuch reply" and also made (most of)
the hidden components self documenting.

The note about making "notmuch setup" faster is now rewritten to apply
to "notmuch new" since "notmuch setup" no longer does any mail
indexing.

14 years agonotmuch new: Don't ignore files with mtime of 0.
Carl Worth [Thu, 12 Nov 2009 15:02:13 +0000 (07:02 -0800)]
notmuch new: Don't ignore files with mtime of 0.

I recently discovered that mb2md has the annoying bug of creating
files with mtime of 0, and notmuch then promptly ignored them,
(thinking that its timestamps initialized to 0 were just as new).

We fix notmuch to not exclude messages based on a database timestamp
of 0.

14 years agonotmuch show: Avoid segmentation for message with no subject.
Carl Worth [Thu, 12 Nov 2009 07:00:58 +0000 (23:00 -0800)]
notmuch show: Avoid segmentation for message with no subject.

It's safer to return an empty string rather than NULL for missing
header values.

14 years agoInitialize count of new files to zero.
Keith Packard [Thu, 12 Nov 2009 06:33:48 +0000 (22:33 -0800)]
Initialize count of new files to zero.

Leaving this variable uninitialized caused notmuch to display a random
number while counting files for the new database.

Signed-off-by: Keith Packard <keithp@keithp.com>
14 years agonotmuch.el: Switch to using "notmuch reply" rather than message-reply.
Carl Worth [Thu, 12 Nov 2009 05:37:35 +0000 (21:37 -0800)]
notmuch.el: Switch to using "notmuch reply" rather than message-reply.

This way we get to take advantage of the configuration of the user's
email addresses in notmuch, (rather than expecting the user to
configure all of their email addresses in message mode as well).

14 years agonotmuch reply: Fish out user's address from recipient list to use as From.
Carl Worth [Thu, 12 Nov 2009 05:29:04 +0000 (21:29 -0800)]
notmuch reply: Fish out user's address from recipient list to use as From.

That is, if mail was addresses to one of the "other" addresses in the
configuration file, then the reply will have its "From" header set to
that same address rather than the primary address.

14 years agonotmuch reply: Don't reply to address belonging to the user.
Carl Worth [Thu, 12 Nov 2009 05:18:15 +0000 (21:18 -0800)]
notmuch reply: Don't reply to address belonging to the user.

Here's our first real advantage of having a configuration system.
We get to omit our own addresses from the recipient list of any
replies.

14 years agoUnbreak several notmuch commands after the addition of configuration.
Carl Worth [Thu, 12 Nov 2009 04:29:30 +0000 (20:29 -0800)]
Unbreak several notmuch commands after the addition of configuration.

All of the following commands:

notmuch dump
notmuch reply
notmuch restore
notmuch search
notmuch show
notmuch tag

were calling notmuch_database_open with an argument of NULL. This was
a legitimate call until the recent addition of configuration, after
which it is expected that all commands will lookup the correct path in
the configuration file. So fix all these commands to do that.

Also, while touching all of these commands, we fix them to use the
talloc context that is passed in rather than creating a local talloc
context. We also switch from using goto for return values, to doing
direct returns as soon as an error is detected, (which can be leak
free thanks to talloc).

14 years agonotmuch new: Unbreak after the addition of notmuch-config.
Carl Worth [Thu, 12 Nov 2009 03:50:15 +0000 (19:50 -0800)]
notmuch new: Unbreak after the addition of notmuch-config.

Pull in the code from add-files.c now that notmuch_new_command is
the only user, (we no longer have notmuch_setup_command adding any
messages).

14 years agonotmuch: Make the command of "notmuch" walk the user through the next step.
Carl Worth [Thu, 12 Nov 2009 01:56:59 +0000 (17:56 -0800)]
notmuch: Make the command of "notmuch" walk the user through the next step.

If this is run first, it will run "notmuch setup" directly. After that
is successful, it will look for a databae and tell the user to run
"notmuch new" if the database doesn't exist yet. Finally, if the
database is present, it will provide some example "notmuch search"
commands for the user to try.

14 years agonotmuch: Move welcome messages from "notmuch" to "notmuch setup".
Carl Worth [Thu, 12 Nov 2009 01:33:31 +0000 (17:33 -0800)]
notmuch: Move welcome messages from "notmuch" to "notmuch setup".

It's quite possible for someone to read the documentation and run
"notmuch setup" rather than just "notmuch". In that case, we don't
want to be any less welcoming.

14 years agonotmuch setup: Add some comments when creating a .notmuch-config file.
Carl Worth [Thu, 12 Nov 2009 01:25:42 +0000 (17:25 -0800)]
notmuch setup: Add some comments when creating a .notmuch-config file.

The "notmuch setup" command is nice and all, but we also want to allow
users to conveniently edit the configuration file directly.

14 years agonotmuch: Add a configuration system.
Carl Worth [Thu, 12 Nov 2009 01:01:55 +0000 (17:01 -0800)]
notmuch: Add a configuration system.

This will allow for things like the database path to be specified
without any cheesy NOTMUCH_BASE environment variable. It also will
allow "notmuch reply" to recognize the user's email address when
constructing a reply in order to do the right thing, (that is, to use
the user's address to which mail was sent as From:, and not to reply
to the user's own addresses).

With this change, the "notmuch setup" command is now strictly for
changing the configuration of notmuch. It no longer creates the
database, but instead instructs the user to call "notmuch new" to do
that.

14 years agonotmuch setup: Break the implementation up into manageable functions.
Carl Worth [Wed, 11 Nov 2009 19:23:55 +0000 (11:23 -0800)]
notmuch setup: Break the implementation up into manageable functions.

The notmuch_setup_command function was getting entirely unwieldy.
Break it up into smaller functions for better maintainability.

14 years agonotmuch reply: Use GMime to construct the header for the reply.
Carl Worth [Wed, 11 Nov 2009 18:54:12 +0000 (10:54 -0800)]
notmuch reply: Use GMime to construct the header for the reply.

The advantage here is that we actually get the necessary folding of
long headers, (particularly the References header, but also things
like Subject). This also gives us parsed recipient addresses so that
we can easily elide the sender's address(es) from the recipient list
(just as soon as we have a configured value for the recipient's
address(es)).

14 years agonotmuch.el: Add a binding ('r') to reply to the current message.
Carl Worth [Wed, 11 Nov 2009 02:47:53 +0000 (18:47 -0800)]
notmuch.el: Add a binding ('r') to reply to the current message.

We were just starting to get "notmuch reply" into shape in order to
provide the needed functionality here, but then I realized that the
message-reply function built into emacs is already more functional,
(at least for the case of replying to a single message).

14 years agonotmuch reply: Process headers a bit more accurately.
Carl Worth [Wed, 11 Nov 2009 02:46:26 +0000 (18:46 -0800)]
notmuch reply: Process headers a bit more accurately.

We know take the original From: and all recipients and put them on the
To: line. We also add a "Re: " to the subject, and we add In-Reply-To:
and References: headers.

14 years agonotmuch.el: Simplify get-message-id
Carl Worth [Wed, 11 Nov 2009 02:45:30 +0000 (18:45 -0800)]
notmuch.el: Simplify get-message-id

We were stripping off the "id:" portion of the identifier, only to
put it back on again in all cases. Stop this madness.

14 years agonotmuch reply: Add (incomplete) reply command
Keith Packard [Fri, 6 Nov 2009 18:00:38 +0000 (10:00 -0800)]
notmuch reply: Add (incomplete) reply command

Reviewed-by: Carl Worth <cworth@cworth.org>
Keith wrote all the code here against notmuch before notmuch.c was
split up into multiple files. So I've pushed the code around in
various ways to match the new code structure, but have generally tried
to avoid making any changes to the behavior of the code.

I did fix one bug---a missing call to g_mime_stream_file_set_owner in
show_part which would cause "notmuch show" to go off into the weeds
when trying to show multiple messages, (since the first stream would
fclose stdout).

14 years agonotmuch: Break notmuch.c up into several smaller files.
Carl Worth [Tue, 10 Nov 2009 20:03:05 +0000 (12:03 -0800)]
notmuch: Break notmuch.c up into several smaller files.

Now that the client sources are alone here in their own directory,
(with all the library sources down inside the lib directory), we can
break the client up into multiple files without mixing the files up.
The hope is that these smaller files will be easier to manage and
maintain.

14 years ago.gitignore: Ignore .deps directory.
Carl Worth [Tue, 10 Nov 2009 18:49:44 +0000 (10:49 -0800)]
.gitignore: Ignore .deps directory.

We recently moved dependencies from a single .depends file to a directory
named .deps with many files, but neglected to update our .gitignore rules.

14 years agoMakefile: Change default flags to -O2.
Carl Worth [Tue, 10 Nov 2009 16:36:41 +0000 (08:36 -0800)]
Makefile: Change default flags to -O2.

We've now verified that it's reliable for the user to override CFLAGS
on the command line, so just make the user do to get a debug build.