Commit graph

3572 commits

Author SHA1 Message Date
Carl Worth
37bdd89870 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).
2009-11-11 19:50:15 -08:00
Carl Worth
8136e15229 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.
2009-11-11 17:56:59 -08:00
Carl Worth
6bd01e1b34 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.
2009-11-11 17:33:31 -08:00
Carl Worth
c884c30c30 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.
2009-11-11 17:25:42 -08:00
Carl Worth
305e76bc0a 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.
2009-11-11 17:01:55 -08:00
Carl Worth
69611e66a5 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.
2009-11-11 11:23:55 -08:00
Carl Worth
a9f3ad4fcb 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)).
2009-11-11 10:54:12 -08:00
Carl Worth
26bb521f52 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).
2009-11-10 18:47:53 -08:00
Carl Worth
dfc0780cba 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.
2009-11-10 18:46:26 -08:00
Carl Worth
54d79f60a1 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.
2009-11-10 18:45:30 -08:00
Keith Packard
357aba3ec8 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).
2009-11-10 13:32:02 -08:00
Carl Worth
50144f95ca 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.
2009-11-10 12:03:05 -08:00
Carl Worth
ce7c6f7585 .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.
2009-11-10 10:49:44 -08:00
Carl Worth
da5a2e2fe6 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.
2009-11-10 08:36:41 -08:00
Carl Worth
946c94b6a1 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
itself.
2009-11-10 08:34:54 -08:00
Carl Worth
1a6208bfbd 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.
2009-11-10 08:27:48 -08:00
Carl Worth
97c7cffdc6 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).
2009-11-10 08:04:54 -08:00
Carl Worth
c5dccd851a 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.
2009-11-10 07:24:10 -08:00
Carl Worth
3cdb24d38a 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).
2009-11-09 16:24:50 -08:00
Carl Worth
b2846c6a2a 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.
2009-11-09 16:24:09 -08:00
Carl Worth
1465493210 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.
2009-11-09 16:24:03 -08:00
Carl Worth
8ae1c3c6e1 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.
2009-11-09 13:48:58 -08:00
Carl Worth
97ef8a74c9 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.
2009-11-09 13:45:11 -08:00
Carl Worth
3942933962 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.
2009-11-09 13:43:59 -08:00
Carl Worth
436b8a2fda 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.
2009-11-09 13:42:30 -08:00
Carl Worth
59d82640dc notmuch setup: Remove a debugging print.
This was just some extra noise printed when requesting a non-default
mail directory itneractively.
2009-11-09 13:41:40 -08:00
Carl Worth
1eec45659b 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.
2009-11-06 09:34:21 -08:00
Carl Worth
73ee42be36 Makefile: Fix install target to depend on the all target.
Otherwise, it would just fail if you hadn't run "make" already.
2009-11-06 09:33:44 -08:00
Carl Worth
508d2d2ff7 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.
2009-11-06 09:32:24 -08:00
Carl Worth
98afc27957 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.
2009-11-06 09:31:03 -08:00
Carl Worth
306e19f5dd 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.
2009-11-05 15:02:20 -08:00
Carl Worth
afcd85ee71 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.
2009-11-05 14:18:44 -08:00
Carl Worth
51a68d4e01 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).
2009-11-05 11:25:02 -08:00
Carl Worth
ab68891bec 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.
2009-11-05 11:22:20 -08:00
Carl Worth
db81b31c56 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.
2009-11-05 10:45:40 -08:00
Carl Worth
d1b06f159c 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.
2009-11-05 10:33:37 -08:00
Carl Worth
494c74229b 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.
2009-11-05 10:23:04 -08:00
Carl Worth
2b576c62be 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.
2009-11-05 04:55:51 -08:00
Carl Worth
22adeeaab7 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
full.

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.
2009-11-04 17:42:01 -08:00
Carl Worth
19993ea33b notmuch.el: Add a simple command to pipe a message to a process.
With the obvious keybinding.
2009-11-04 16:54:09 -08:00
Carl Worth
3a330cb84a 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).
2009-11-04 16:22:42 -08:00
Carl Worth
b7366f8052 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).
2009-11-04 16:15:56 -08:00
Carl Worth
988320ad74 notmuch.el: Add 'w' binding to view raW email message.
This takes advantage of the new filename output just added to "notmuch
show".
2009-11-04 15:53:41 -08:00
Carl Worth
b1baaab2d5 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.
2009-11-04 15:53:07 -08:00
Carl Worth
9f668b3d56 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.
2009-11-04 15:45:33 -08:00
Carl Worth
97b5f81533 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).
2009-11-04 15:44:11 -08:00
Carl Worth
3604a19beb notmuch.el: Fix to claim correct number of lines for hidden signature.
Previously, it was reporting that all signatures were 0 lines.
2009-11-04 15:19:08 -08:00
Carl Worth
a1f631ab6b 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
lines.
2009-11-04 15:05:44 -08:00
Carl Worth
2aa6c2d9a1 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.
2009-11-04 15:01:37 -08:00
Carl Worth
c6aae1561a 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.
2009-11-04 14:38:49 -08:00