12 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.

12 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.

12 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

12 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.

12 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.).

12 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.

12 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

12 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

12 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.

12 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.

12 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 <>
12 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).

12 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.

12 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

12 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).

12 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

12 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.

12 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.

12 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.

12 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

12 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.

12 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

12 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).

12 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.

12 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.

12 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 <>
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).

12 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

12 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.

12 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.

12 years agoMakefile: Make the top-level Makefile a little more independent.
Carl Worth [Tue, 10 Nov 2009 16:34:54 +0000 (08:34 -0800)]
Makefile: Make the top-level Makefile a little more independent.

Previously, the top-level Makefile was explicitly adding -I./lib to
the compiler flags. However, that's something that's much better done
from within the Makefile.local fragment within the lib directory

12 years agoMakefile: Simplify setting of CFLAGS, etc.
Carl Worth [Tue, 10 Nov 2009 16:27:48 +0000 (08:27 -0800)]
Makefile: Simplify setting of CFLAGS, etc.

We were previously using separate CFLAGS and NOTMUCH_CFLAGS variables
in an attempt to allow the user to specify CFLAGS on the command-line.

However, that's just a lot of extra noise in the Makefile when we can
instead let the user specify what is desired for CFLAGS and then use
an override to append the things we require. So our Makefile is much
neater now.

12 years agoMakefile: Fix dependency generation to make .d files themselves dependent.
Carl Worth [Tue, 10 Nov 2009 16:04:54 +0000 (08:04 -0800)]
Makefile: Fix dependency generation to make .d files themselves dependent.

I saw this recommendation in the implementation notes for "Recursive
Make Considered Harmful" and then the further recommendation for
implementing the idea in the GNU make manual.

The idea is that if any of the files change then we need to regenerate
the dependency file before we regenerate any targets.

The approach from the GNU make manual is simpler in that it just uses
a sed script to fix up the output of an extra invocation of the
compiler, (as opposed to the approach in the implementation notes from
the paper's author which use a wrapper script for the compiler that's
always invoked rather than the compiler itself).

12 years agoImplement a non-recursive make.
Carl Worth [Tue, 10 Nov 2009 15:14:49 +0000 (07:14 -0800)]
Implement a non-recursive make.

The idea here is that every Makefile at each lower level will be an
identical, tiny file that simply defers to a top-level make.

Meanwhile, the Makefile.local file at each level is a Makefile snippet
to be included at the top-level into a large, flat Makefile. As such,
it needs to define its rules with the entire relative directory to
each file, (typically in $(dir)). The local files can also append to
variables such as SRCS and CLEAN for files to be analyzed for
dependencies and to be cleaned.

12 years agoMakefile: Hide away auto-generated dependency file as .depends.
Carl Worth [Tue, 10 Nov 2009 00:24:50 +0000 (16:24 -0800)]
Makefile: Hide away auto-generated dependency file as .depends.

Instead of the old name of Makefile.dep. The idea being that the
user really doesn't need to see this by default, (and if debugging
the Makefile, the rules will make the name obvious).

12 years agoRemove obsolete message.h.
Carl Worth [Tue, 10 Nov 2009 00:13:59 +0000 (16:13 -0800)]
Remove obsolete message.h.

This has been around but never used, and only became apparent now
that the other sources moved down into the lib sub-directory.

12 years agolibify: Move library sources down into lib directory.
Carl Worth [Tue, 10 Nov 2009 00:12:28 +0000 (16:12 -0800)]
libify: Move library sources down into lib directory.

A "make" invocation still works from the top-level, but not from
down inside the lib directory yet.

12 years agonotmuch.el: Don't advance line in search buffer before showing thread.
Carl Worth [Mon, 9 Nov 2009 21:48:58 +0000 (13:48 -0800)]
notmuch.el: Don't advance line in search buffer before showing thread.

Previously, when selecting a thread to view from the search buffer, we
would advance the point by one line before showing the thread, (so
that it would be ready to show the next thread once the user was done
with the current thread). This was annoying when the user temporarily
exited the thread view, (because the "wrong" thread was then selected
in the search view).

We get a more consistent experience by waiting to advance until the
user has finished viewing one thread and is ready to view the next.

12 years agonotmuch.el: Fix add/remove tag from search buffers.
Carl Worth [Mon, 9 Nov 2009 21:45:11 +0000 (13:45 -0800)]
notmuch.el: Fix add/remove tag from search buffers.

These were recently broken with the change of "notmuch search" to
prefix thread IDs with "thread:" rather than printing them raw.

12 years agoadd_message: Fix crash for file recognized as not email.
Carl Worth [Mon, 9 Nov 2009 21:43:59 +0000 (13:43 -0800)]
add_message: Fix crash for file recognized as not email.

This crash was introduced sometime recently, as previously things
worked fine when notmuch detected that a file is not an email.
We're definitely overdue for that test suite.

12 years agoTODO: Note that notmuch restore needs some progress indication.
Carl Worth [Mon, 9 Nov 2009 21:42:30 +0000 (13:42 -0800)]
TODO: Note that notmuch restore needs some progress indication.

A recent "notmuch restore" command took *forever* for me. Obviously,
we need to fix the underlying performance bug in Xapian, but in the
meantime, a progress indicator would help.

12 years agonotmuch setup: Remove a debugging print.
Carl Worth [Mon, 9 Nov 2009 21:41:40 +0000 (13:41 -0800)]
notmuch setup: Remove a debugging print.

This was just some extra noise printed when requesting a non-default
mail directory itneractively.

12 years agoadd_message: Start storing In-Reply-To information in the database.
Carl Worth [Fri, 6 Nov 2009 17:34:21 +0000 (09:34 -0800)]
add_message: Start storing In-Reply-To information in the database.

We'll use this eventually for properly nesting messages in the output
of "notmuch show", etc.

12 years agoMakefile: Fix install target to depend on the all target.
Carl Worth [Fri, 6 Nov 2009 17:33:44 +0000 (09:33 -0800)]
Makefile: Fix install target to depend on the all target.

Otherwise, it would just fail if you hadn't run "make" already.

12 years agonotmuch show: Don't show the subject line twice.
Carl Worth [Fri, 6 Nov 2009 17:32:24 +0000 (09:32 -0800)]
notmuch show: Don't show the subject line twice.

I recently added a print of the subject line for use as part of a
two-line summary in the emacs client. But of course, the subject was
already being printed on the next line. So I didn't really need to add
anything, I could have just stopped hiding what was already
printed. Anyway, we now avoid printing it twice in a row.

12 years agoadd_message: Fix segfault for message with no Date header.
Carl Worth [Fri, 6 Nov 2009 17:31:03 +0000 (09:31 -0800)]
add_message: Fix segfault for message with no Date header.

I'd fixed this earlier when I had a private copy of GMime's
date-parsing code, but I lost the fix when I recently switched to
calling the GMime function.

12 years agonotmuch show: Move subject from one-line summary down to its own line.
Carl Worth [Thu, 5 Nov 2009 23:02:20 +0000 (15:02 -0800)]
notmuch show: Move subject from one-line summary down to its own line.

And change the display code in emacs to display the one-line summary
in inverse video.

12 years agonotmuch.el: Bring back the "End of search results." message.
Carl Worth [Thu, 5 Nov 2009 22:18:44 +0000 (14:18 -0800)]
notmuch.el: Bring back the "End of search results." message.

The recent change of the hidden thread-ID syntax caused this message
to instead be replaced with a cryptic "search failed" error and an
internal regular expression. Put our nice message back.

12 years agonotmuch.el: Make hidden parts advertise how to unhide them.
Carl Worth [Thu, 5 Nov 2009 19:25:02 +0000 (11:25 -0800)]
notmuch.el: Make hidden parts advertise how to unhide them.

This is in place now citations and signatures. We'll still need to
add something else for hidden messages (those that are already
read and hidden away).

12 years agonotmuch.el: Add 'A' binding to archive thread after removing all "unread" tags.
Carl Worth [Thu, 5 Nov 2009 19:15:56 +0000 (11:15 -0800)]
notmuch.el: Add 'A' binding to archive thread after removing all "unread" tags.

This is useful for when the rest of the thread is visible on screen so
the user really has read the rest of it.

12 years agoUpdate notmuch man page with recently-added documentation.
Carl Worth [Thu, 5 Nov 2009 18:45:40 +0000 (10:45 -0800)]
Update notmuch man page with recently-added documentation.

It would be nice to have this documentation live in a single place,
but for now, this is what we get.

12 years agonotmuch search: Document the from, to, and subject prefixes.
Carl Worth [Thu, 5 Nov 2009 18:33:37 +0000 (10:33 -0800)]
notmuch search: Document the from, to, and subject prefixes.

I've been using these for a long time, but I had neglected to document
them until now.

12 years agonotmuch show: Fix to work with any search string rather than just a thread ID.
Carl Worth [Thu, 5 Nov 2009 18:23:04 +0000 (10:23 -0800)]
notmuch show: Fix to work with any search string rather than just a thread ID.

The more general command is more consistent, and more useful.

We also fix "notmuch search" to output copy-and-pasteable search terms
for the thread with "thread:" prepended already. Similarly, the
message-ID in the output of "notmuch show" is also now printed as a
valid search term, ("id:<message-id>" rather than "ID: <message-id>").

Naturally, the emacs code is also changed to track these changes.

12 years agonotmuch.el: Add 'N' binding to mark message read and go to next.
Carl Worth [Thu, 5 Nov 2009 12:55:51 +0000 (04:55 -0800)]
notmuch.el: Add 'N' binding to mark message read and go to next.

The magic space bar is nice, but sometimes there's a message with a
long attachment that I just want to skip, but still consider the
message marked as read.

12 years agonotmuch.el: Don't require an extra press of space bar before archiving.
Carl Worth [Thu, 5 Nov 2009 01:42:01 +0000 (17:42 -0800)]
notmuch.el: Don't require an extra press of space bar before archiving.

I had implemented this intentionally originally, thinking that it
would be important to see the last message scroll all the way off
screen before the next press of the magic space bar would go and
archive away the whole thread.

But in practice, that just turns out to be annoying, (especially for a
long sequence of single-message threads where the space bar has to be
pressed twice for every one). It's actually quite easy to know if it's
"safe" to press the space bar expecting just a scroll instead of an
archive by simply looking down and seeing if the current window is

And as for the total lack of undo with all of this, I'm getting by by
simply using x to get back to the search view, and then going back
into the thread of interest.

12 years agonotmuch.el: Add a simple command to pipe a message to a process.
Carl Worth [Thu, 5 Nov 2009 00:54:09 +0000 (16:54 -0800)]
notmuch.el: Add a simple command to pipe a message to a process.

With the obvious keybinding.

12 years agonotmuch.el: Don't skip read messages when they are open.
Carl Worth [Thu, 5 Nov 2009 00:22:42 +0000 (16:22 -0800)]
notmuch.el: Don't skip read messages when they are open.

More magic for the magic space bar: If a thread is entirely open,
(such as when viewing an old thread where every message is read), the
space bar now visits each message in turn (rather than skipping all of
the unread messages).

12 years agonotmuch.el: Allow for scrolling backwards through thread with DEL
Carl Worth [Thu, 5 Nov 2009 00:15:56 +0000 (16:15 -0800)]
notmuch.el: Allow for scrolling backwards through thread with DEL

Otherwise known as "Backspace" on keyboards in the real, (rather than
emacs), world. This will go by screenfuls for long messages, and
message by message for short messages. So it does the reverse of the
magic space bar, (but without reversing any tag-changing magic that
the magic space bar might have done).

12 years agonotmuch.el: Add 'w' binding to view raW email message.
Carl Worth [Wed, 4 Nov 2009 23:53:41 +0000 (15:53 -0800)]
notmuch.el: Add 'w' binding to view raW email message.

This takes advantage of the new filename output just added to "notmuch

12 years agonotmuch show: Add filename to output (next to message ID).
Carl Worth [Wed, 4 Nov 2009 23:53:07 +0000 (15:53 -0800)]
notmuch show: Add filename to output (next to message ID).

This will allow a client using "notmuch show" to directly open the
filename and do whatever it wants with it.

12 years agonotmuch.el: Don't use defvar for undocumented variables.
Carl Worth [Wed, 4 Nov 2009 23:45:33 +0000 (15:45 -0800)]
notmuch.el: Don't use defvar for undocumented variables.

Make at least some attempt to distinguish internal variables from
those that the user is expected to fiddle with.

12 years agonotmuch.el: Don't hide long signatures.
Carl Worth [Wed, 4 Nov 2009 23:42:12 +0000 (15:42 -0800)]
notmuch.el: Don't hide long signatures.

Chances are, a signature above a certain threshold isn't just a
signature, (for example, it could be an encrypted messages tacked onto
the end of the file, or could be any sort of PS.)

We add a new variable, notmuch-show-signature-lines-max that can be
used to configure the threshold, (set to 6 by default for now).

12 years agonotmuch.el: Fix to claim correct number of lines for hidden signature.
Carl Worth [Wed, 4 Nov 2009 23:19:08 +0000 (15:19 -0800)]
notmuch.el: Fix to claim correct number of lines for hidden signature.

Previously, it was reporting that all signatures were 0 lines.

12 years agonotmuch.el: Don't hide message bodies when all messages are read.
Carl Worth [Wed, 4 Nov 2009 23:05:44 +0000 (15:05 -0800)]
notmuch.el: Don't hide message bodies when all messages are read.

Presumably the user is trying to view this thread for a reason, so
it's better to actually show *something* rather than just the summary

12 years agonotmuch show: Fix misplaced g_object_unref leading to error message.
Carl Worth [Wed, 4 Nov 2009 23:01:11 +0000 (15:01 -0800)]
notmuch show: Fix misplaced g_object_unref leading to error message.

We were inadvertently calling g_object_unref on a wild pointer leading
to the following error message:

GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed

Now, why glib doesn't abort on critical errors, I'll never understand.

12 years agonotmuch.el: Make notmuch-search scroll commands move to first/last message.
Carl Worth [Wed, 4 Nov 2009 22:38:49 +0000 (14:38 -0800)]
notmuch.el: Make notmuch-search scroll commands move to first/last message.

If there's nothing to scroll but we're not yet on the first or last
message then move point to that message.

12 years agonotmuch.el: Override next-line and previous-line to make them reliable.
Carl Worth [Wed, 4 Nov 2009 21:39:26 +0000 (13:39 -0800)]
notmuch.el: Override next-line and previous-line to make them reliable.

I noticed that these functions would sometimes leave point on an
invisible character[*]. The problem would be that point would appear
to be on a particular message, but adding or removing a tag would
actually add/remove a tag from the *previous* message.

Fix the C-n and C-p keybindings at least to call the underlying
command and then advance to a visible character. We set this-command
in our overrides so that the temporary-goal-column feature still

[*] The documentation says that command loop is supposed to move point
outside of any invisible region when a command exits. But apparently

12 years agonotmuch.el: Un-break the magic space bar to scroll a long, single message.
Carl Worth [Wed, 4 Nov 2009 21:16:33 +0000 (13:16 -0800)]
notmuch.el: Un-break the magic space bar to scroll a long, single message.

Clearly some recent code was very fragile, which I noticed in that the
space bar would no longer scroll a long message if it was the only
message in a thread.

This resulted in a lot of churn, but hopefully things are more robust
now, (for example by using new predicates like
notmuch-show-last-message-p rather than doing heuristics based on
(eobp) or (window-end)).

As usual, the presence of invisible characters complicates the task of
making this stuff robust.

12 years agonotmuch.el: Fix to show *something* when all messages are already read.
Carl Worth [Wed, 4 Nov 2009 19:30:15 +0000 (11:30 -0800)]
notmuch.el: Fix to show *something* when all messages are already read.

With the recent change of showing the first unread message, we would
scroll down to the end of the buffer if all messages were already
read. This would confusingly show nothing visible in the window.

Instead, detect this case and move to the beginning of the buffer.

12 years agonotmuch.el: Make magic space bar advance to next unread messages.
Carl Worth [Wed, 4 Nov 2009 19:23:44 +0000 (11:23 -0800)]
notmuch.el: Make magic space bar advance to next unread messages.

The magic of the space bar is all about unread messages, so there's no
reason for it to advance to messages that have already been read.

Similarly, we now remove any magic from (n)ext so that it simply
advances to the next message without marking anything read, (which
makes it symmetrical with (p)revious).

12 years agonotmuch.el: Move to first unread message on notmuch-show.
Carl Worth [Wed, 4 Nov 2009 19:19:50 +0000 (11:19 -0800)]
notmuch.el: Move to first unread message on notmuch-show.

This is important for when a new message is delivered to an existing
enormous thread.

12 years agonotmuch.el: Make next-message move to end of buffer after last message.
Carl Worth [Wed, 4 Nov 2009 19:03:07 +0000 (11:03 -0800)]
notmuch.el: Make next-message move to end of buffer after last message.

We need an easier way to detect when we're done with the last message
so taking advantage of the end-of-buffer position helps here.

12 years agonotmuch.el: Leave a blank line after last thread in search.
Carl Worth [Wed, 4 Nov 2009 18:43:07 +0000 (10:43 -0800)]
notmuch.el: Leave a blank line after last thread in search.

This allows for pleasant termination of the "show next thread" magic
in notmuch-show mode. Now, it will terminate and show the
notmuch-search results rather than continually displaying the last
thread over and over.

12 years agonotmuch.el: Move "show next thread" from magic-space-bar to archive-thread
Carl Worth [Wed, 4 Nov 2009 18:32:44 +0000 (10:32 -0800)]
notmuch.el: Move "show next thread" from magic-space-bar to archive-thread

If I explicitly hit the 'a' key before reading the whole thread, I
still want to advance to the next thread in my search.

12 years agonotmuch.el: More magic for magic space bar: Show next thread from search.
Carl Worth [Wed, 4 Nov 2009 18:25:04 +0000 (10:25 -0800)]
notmuch.el: More magic for magic space bar: Show next thread from search.

This is implemented by stashing away the parent notmuch-search buffer
into a variable within the notmuch-show buffer. Then, when magic space
bar triggers an archive of the current thread, it switches to the parent
search buffer and shows the next thread.

12 years agonotmuch.el: notmuch-search: Advance to next line before showing thread.
Carl Worth [Wed, 4 Nov 2009 17:32:47 +0000 (09:32 -0800)]
notmuch.el: notmuch-search: Advance to next line before showing thread.

The idea here is that after viewing the thread, when we come back to
this buffer we'll be all ready to view the next thread.

12 years agonotmuch.el: Make archive-thread more efficient for already archived messages.
Carl Worth [Wed, 4 Nov 2009 17:26:50 +0000 (09:26 -0800)]
notmuch.el: Make archive-thread more efficient for already archived messages.

The approach here is to move the optimization from mark-read to the
more general remove-tag. Namely, don't call out to a "notmuch tag"
command to remove a tag that's not there already.

12 years agonotmuch.el: Make the magic spacebar archive a thread in the end.
Carl Worth [Wed, 4 Nov 2009 17:21:09 +0000 (09:21 -0800)]
notmuch.el: Make the magic spacebar archive a thread in the end.

Next all it needs to do is kill the buffer and show the next thread.

12 years agonotmuch.el: Start implementing the magic space bar.
Carl Worth [Wed, 4 Nov 2009 16:42:38 +0000 (08:42 -0800)]
notmuch.el: Start implementing the magic space bar.

Currently this will either advance by screenfuls, or to the next
message if it's already within a screenful, and will mark each message
read as it is left.

It doesn't yet complete the magic by archiving the messages nor by
advancing to the next thread in the search.

12 years agonotmuch.el: Fix to hide citations in body of read messages.
Carl Worth [Wed, 4 Nov 2009 16:38:49 +0000 (08:38 -0800)]
notmuch.el: Fix to hide citations in body of read messages.

Previously, unhinding a read message would still show all the citations
in that message without an explicit command to make them visible. Fix.

12 years agonotmuch.el: Redefine behavior of notmuch-show-previous-message
Carl Worth [Wed, 4 Nov 2009 16:48:57 +0000 (08:48 -0800)]
notmuch.el: Redefine behavior of notmuch-show-previous-message

Now, if the user has manually moved point to somewhere within a
message, executing the previous-message command onece will rewind
point only to the beginning of the current message. Previously this
would go back to the previous message, (which the user can now do
easily and naturally by simply executing the command one more time).

12 years agonotmuch.el: Fix notmuch-snow-next-message when on the last message.
Carl Worth [Wed, 4 Nov 2009 03:32:56 +0000 (19:32 -0800)]
notmuch.el: Fix notmuch-snow-next-message when on the last message.

Before this just brought the current line to the top of the
window. Now it actually moves to the beginning of the current message.

This is built on a much more solid foundation now with a function to
move to the summary-line of the current message, and then moving from

12 years agonotmuch.el: Add more complete documentation to the major modes.
Carl Worth [Wed, 4 Nov 2009 02:24:13 +0000 (18:24 -0800)]
notmuch.el: Add more complete documentation to the major modes.

These now provide a summary of the most useful features/bindings
as well as a complete printout of the relevant mode maps to show
all available keybindings.

12 years agonotmuch.el: Make archive-thread advance to next line.
Carl Worth [Wed, 4 Nov 2009 01:18:04 +0000 (17:18 -0800)]
notmuch.el: Make archive-thread advance to next line.

This is the command in notmuch-search mode and it's cer convenient
for it to advance to the next line there. (It would be even more
convenient if it didn't also take forever, but as mentioned before
that's an issue we'll need to fix in Xapian.)

12 years agonotmuch.el: Add 't' binding to filter results to a specific tag.
Carl Worth [Wed, 4 Nov 2009 01:01:07 +0000 (17:01 -0800)]
notmuch.el: Add 't' binding to filter results to a specific tag.

This is a convenience function to avoid having to type "tag:" with
the (f)ilter command.

12 years agonotmuch.el: Add bindings for scrolling to notmuch-search mode.
Carl Worth [Wed, 4 Nov 2009 00:55:20 +0000 (16:55 -0800)]
notmuch.el: Add bindings for scrolling to notmuch-search mode.

We turn on the scroll-preserve-screen-position option which seems
like what's desired here, (though that's not what I normally use
when editing files---but I think scrolling through a list of email
threads is different).

12 years agoDrop inapplicable copyright statements.
Carl Worth [Wed, 4 Nov 2009 00:47:34 +0000 (16:47 -0800)]
Drop inapplicable copyright statements.

I had put these in here since I had originally planned to copy
liberally from the body of the implementation of 'compile in order
to get process output into a buffer. But once I found call-process
in the documentation of emacs, that was all I needed.

And all the code I've written since has been entirely my own with
just the help of emacs documentation.

12 years agonotmuch-el: Fix implementation of show/hide-thread-ids.
Carl Worth [Wed, 4 Nov 2009 00:46:27 +0000 (16:46 -0800)]
notmuch-el: Fix implementation of show/hide-thread-ids.

I'm definitely more comfortable with the add-to-invisibility-spec
now than I was when I first wrote these functions, (which weren't
working at all).

12 years agonotmuch.el: Add command to (a)rchive a thread from notmuch-show mode.
Carl Worth [Tue, 3 Nov 2009 21:34:05 +0000 (13:34 -0800)]
notmuch.el: Add command to (a)rchive a thread from notmuch-show mode.

This is our first race-free implementation of archive-thread! It
acts only on the messages explcitly contained in the buffer, not
on an entire thread ID, so it's safe in the face of new messages
have been delivered for this thread since the view was made.

12 years agonotmuch.el: Don't try to remove an "unread" tag that's not there.
Carl Worth [Tue, 3 Nov 2009 21:16:40 +0000 (13:16 -0800)]
notmuch.el: Don't try to remove an "unread" tag that's not there.

This optimization wouldn't be necessary if we had a nice fast "notmuch
tag" command. But since it's currently fairly slow, (see Xapian defect
250:, we're willing to take some
extra care to avoid calling "notmuch tag" unnecessarily.

12 years agonotmuch show: Remove custom "unread" hack, (printing tag in two locations).
Carl Worth [Tue, 3 Nov 2009 21:13:50 +0000 (13:13 -0800)]
notmuch show: Remove custom "unread" hack, (printing tag in two locations).

I previously had a hack that special-cased the "unread" tag and
printed it on the same line as the message ID. But now that we are
printing all tags at the end of the one-line summary we don't need
this anymore. Get rid of it, and just read "unread" from the list of
tags just like any other tag.

12 years agonotmuch.el: Add + and - bindings to add/remove tags from messages.
Carl Worth [Tue, 3 Nov 2009 20:54:10 +0000 (12:54 -0800)]
notmuch.el: Add + and - bindings to add/remove tags from messages.

This is in notmuch-show mode rather than in notmuch-search mode,
(where we had + and - working already). This gives the same visual
feedback as in notmuch-search-mode, (the tags are manipulated first in
the database and then the list of tags in the buffer is updated).

12 years agonotmuch show: Print tags for each message.
Carl Worth [Tue, 3 Nov 2009 20:29:07 +0000 (12:29 -0800)]
notmuch show: Print tags for each message.

This is in the one-line summary so should always be visible even
in our emacs client that's so eager to make things invisible.

12 years agonotmuch.el: Preserve current thread when refreshing search results.
Carl Worth [Tue, 3 Nov 2009 19:54:34 +0000 (11:54 -0800)]
notmuch.el: Preserve current thread when refreshing search results.

Otherwise, try to keep point in the same place, (such as when the
current thread has been archived away).

12 years agonotmuch.el: Add an '=' key to refresh the current view.
Carl Worth [Tue, 3 Nov 2009 19:47:48 +0000 (11:47 -0800)]
notmuch.el: Add an '=' key to refresh the current view.

This will allow for updates when a separate process (say, a notmuch-
show buffer), has archived messages.

12 years agonotmuch.el: Mark messages read when the (n)ext keybinding is pressed
Carl Worth [Tue, 3 Nov 2009 19:42:04 +0000 (11:42 -0800)]
notmuch.el: Mark messages read when the (n)ext keybinding is pressed

Of course, technically, we're removing the "unread" tag, but you
get the idea. :-)

12 years agonotmuch.el: Hide citations and signatures.
Carl Worth [Tue, 3 Nov 2009 19:14:52 +0000 (11:14 -0800)]
notmuch.el: Hide citations and signatures.

The user can make these visible again by pressing 'c' or 's',
(though we'd like to move to direct manipulation instead soon).

12 years agoHide bodies of message that have already been read.
Carl Worth [Tue, 3 Nov 2009 18:32:42 +0000 (10:32 -0800)]
Hide bodies of message that have already been read.

Also hide all markers.

From here, all we really need for legibility is the following:

  * Hide away citations and signatures

  * Call out the one-line summary some way, (larger font size?)

  * Add nesting for replies

12 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.

12 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.

12 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.