Carl Worth [Tue, 1 Dec 2009 23:52:44 +0000 (15:52 -0800)]
configure: Fix valgrind check to take effect, and to work.
We were missing an "override" directive in the assignment of CFLAGS
within Makefile.config so it was actually having no effect. Then, we
were also failing to get the proper include path for valgrind.h so
it wouldn't have worked even it were having effect. Fix both problems.
Carl Worth [Tue, 1 Dec 2009 20:51:39 +0000 (12:51 -0800)]
xutil: Implement xstrndup without relying on strndup.
Since we need to do this for portability, (some systems don't have a
strndup function), we might as well do it unconditionally. There's
almost no disadvantage to doing so, and this has the advantages of not
requiring a configure-time check nor having two different
implementations, one of which would often be less tested.
Carl Worth [Tue, 1 Dec 2009 20:40:13 +0000 (12:40 -0800)]
lib/index: Fix memory leak for email addresses without names.
We carefully noted the fact that we had locally allocated the string
here, but then we neglected to free it. Switch to talloc instead
which makes it easier to get the behavior we want. It's simpler since
we can just call talloc_free unconditionally, without having to track
the state of whether we allocated the storage for name or not.
Carl Worth [Tue, 1 Dec 2009 19:39:30 +0000 (11:39 -0800)]
configure: Use printf to achieve result of "echo -n".
We had avoided using "echo -n" originally for portability concerns,
and instead just printed the same string in both conditions, (and
also printed the string late if any check took long). The word is
that printf is quite portable, so we use that instead.
Carl Worth [Tue, 1 Dec 2009 18:14:00 +0000 (10:14 -0800)]
Makefile: Add new "install-bash" target for bash completion support
It was problematic to have this in "make install" since it would
unconditionally try to install to /etc, (even if a non-privileged user
was attempting an install to a prefix in the user's home directory,
for example).
Carl Worth [Tue, 1 Dec 2009 16:06:09 +0000 (08:06 -0800)]
notmuch setup: Exit if EOF is encountered at any prompt.
If the user is explicitly providing EOF, then terminating the program
is the most likely desired thing to do. This also avoids undefined
behavior from continuing with an uninitialized response after ignoring
the return value of getline().
Avoid compiler warnings due to ignored write return values
Glibc (at least) provides the warn_unused_result attribute on write,
(if optimizing and _FORTIFY_SOURCE is defined). So we explicitly
ignore the return value in our signal handler, where we couldn't do
anything anyway.
Carl Worth [Tue, 1 Dec 2009 07:21:04 +0000 (23:21 -0800)]
notmuch.el: Make 'x' and 'X' in show-mode archive the current thread.
This makes these keys different than 'q' in this mode, (where 'x'
and 'q' are identical in all of the other modes currently).
The idea here is to make it easier to do non-linear reading of messages,
(such as when poking in to read just one or two threads from a search
result that returned many threads).
Carl Worth [Tue, 1 Dec 2009 07:14:11 +0000 (23:14 -0800)]
notmuch.el: Use let to avoid assigning to a free variable.
The dynamic scoping of emacs lisp is such that we never want to assign
to any variable unless it's something we've defined with `defvar' or
else something we're using locally via `let'.
Carl Worth [Tue, 1 Dec 2009 07:02:10 +0000 (23:02 -0800)]
notmuch.el: Make notmuch-help use a full-screen window.
Our documentation is long enough that I think it will be more useful
to use an entire window for it (which is easily dismissed with 'q').
This is also kinder for a user not well-initiated with emacs, for
whom the multi-window help can be confusing.
Carl Worth [Tue, 1 Dec 2009 06:47:10 +0000 (22:47 -0800)]
notmuch.el: Make documentation of notmuch-search-mode dynamic.
Previously, we had some hard-coded keybindings mentioned in the
introductory paragraphs of the documentation for notmuch-search-mode.
Now, we take advantage of the substitute-command-keys functionality to
produce the same text by default, but to dynamically generate the
correct text in the face of the user customizing the keybindings.
Carl Worth [Tue, 1 Dec 2009 06:24:05 +0000 (22:24 -0800)]
notmuch.el: Clean up documentation of notmuch-show-mode-map commands.
As we did recently for notmuch-search-mode-map, ensure that the first
line of docuemntation for each command stands alone.
We also take advantage of the substitute-command-keys functionality
within notmuch-help so that the introductory paragraphs can talk
about key bindings by key (rather than function name) in a way that
will always be current even in the face of the user rebinding keys.
Carl Worth [Tue, 1 Dec 2009 05:46:55 +0000 (21:46 -0800)]
notmuch.el: Fix notmuch-help to properly display prefixed bindings.
Previously, we would do only a single-level traverse of the keymap.
That meant that for a keybinding such as "M-TAB" we would just see
the prefix key ("ESC") and print that it was a keymap---never printing
the TAB nor the documentation for the command it is bound to.
Now, we do the full walk, constructing a proper description of the
full keybdinding with prefix characters, (and converting "ESC" to
"M-" for legibility).
Carl Worth [Tue, 1 Dec 2009 00:52:31 +0000 (16:52 -0800)]
notmuch.el: Clean up documentation of notmuch-search-mode-map commands.
Since notmuch-help now displays a single line of documentation from
each of these commands we ensure that the first line stands alone for
each command.
We also override some builtin commands with new commands that don't
behave any differently, but have our own notmuch-specific
documentation, (such as "select next thread" rather than "move point
to next line").
Carl Worth [Tue, 1 Dec 2009 00:50:52 +0000 (16:50 -0800)]
notmuch.el: Fix notmuch-search-goto-last-thread.
This broke when we switched to filter-based processing of search
results and added the "End of search results" line onto the end. Fix
to skip ignore that line when moving to the last thread.
Carl Worth [Tue, 1 Dec 2009 00:48:19 +0000 (16:48 -0800)]
notmuch.el: Fix notmuch-search-scroll-down to go to first thread.
When there's no more to scroll, we want to select the first thread.
This used to work, and I'm not sure when it broke, (perhaps when we
switched from post-process decorating of the search results to
filtering). Fix the calculation to work again.
Carl Worth [Tue, 1 Dec 2009 00:44:05 +0000 (16:44 -0800)]
notmuch.el: Don't document mouse actions in notmuch-help.
The concept behind direct manipulation with mouse clicks is that
documentation shouldn't be necessary, (though my original motivation
here was simply that "<mouse-1>" was exceeding my TAB width.
This does cause a blank line to be added for the mouse binding. This
isn't directly desired, but as long as it's there we put it at a
natural place for a separator.
I had originally created this keymap in order from most important to
least important commands. But our new notmuch-help command is
presented with the list in the reverse order. So we reverse the input
so that the user sees the most important commands first.
Carl Worth [Mon, 30 Nov 2009 17:53:38 +0000 (09:53 -0800)]
notmuch.el: Implement our own notmuch-help instead of describe-mode.
This gives somewhat friendlier output for the '?' binding than we had
previously with `describe-mode'. First, we no longer have the various
minor modes cluttering up the output. Second the display of the
binding table uses the first line of documentation for the bound
function rather than the function name.
Carl Worth [Mon, 30 Nov 2009 17:48:15 +0000 (09:48 -0800)]
notmuch.el: Don't use beginning-of-buffer from elisp program.
This silences a warning when compiling notmuch.el. The documentation
of beginning-of-buffer does say (rather emphatically) that it's not
to be used from lisp programs.
This error was tirggered with a debugging build via:
make CXXFLAGS="-DDEBUG"
and reported by David Bremner. The actual error is that I'm an
idiot that doesn't know how to use strcmp's return value. Of
course, the strcmp interface scores a negative 7 on Rusty Russell
ranking of bad interfaces:
Keith Amidon [Fri, 27 Nov 2009 13:30:08 +0000 (05:30 -0800)]
Adjust autoload comments
The previous location of autoload comments didn't seem to correspond
with the functions most likely to be the entry points for using
notmuch. This change adjusts them to match those likely entry points.
Chris Wilson [Fri, 27 Nov 2009 13:50:11 +0000 (13:50 +0000)]
notmuch-new: Check for non-fatal errors from stat()
Currently we assume that all errors on stat() a dname is fatal (but
continue anyway and report the error at the end). However, some errors
reported by stat() such as a missing file or insufficient privilege,
we can simply ignore and skip the file. For the others, such as a fault
(unlikely!) or out-of-memory, we handle like the other fatal errors by
jumping to the end.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Keith Amidon [Fri, 27 Nov 2009 13:30:15 +0000 (05:30 -0800)]
Key binding rearrangement for save attachments in show mode
The most obvious bindings for save attachments are already taken. The
existing 'w' binding was bound to view the raw message. This commit
moves it to 'V' which still seems somewhat mnemonic and uses 'w' for
save (write) attachments.
Keith Amidon [Fri, 27 Nov 2009 13:30:11 +0000 (05:30 -0800)]
Forward individual messages using message-forward
Sometimes forwarding a message is preferable to replying and modifying
the set of recipients. This commit provides that ability using the
message-forward function.
Keith Amidon [Fri, 27 Nov 2009 13:30:10 +0000 (05:30 -0800)]
Factor out message buffer mgmt from notmuch-show-view-all-mime-parts
The ability to temporarily create a buffer containing only the
contents of the currently selected message in notmuch show mode is
generally useful. This commit factors the majority of the code
required to do so out of notmuch-show-view-all-mime-parts into a macro
called with-current-notmuch-show-message and rewrites the original
function in terms of the macro.
A future set of commits will provide additional functionality using
the macro as well.
Jan Janak [Wed, 25 Nov 2009 21:11:45 +0000 (22:11 +0100)]
notmuch-new: Test if directory looks like Maildir before skipping tmp.
'notmuch new' skips directory entries with the name 'tmp'. This is to
prevent notmuch from processing possibly incomplete Maildir messages
stored in that directory.
This patch attempts to refine the feature. If "tmp" entry is found,
it first checks if the containing directory looks like a Maildir
directory. This is done by searching for other common Maildir
subdirectories. If they exist and if the entry "tmp" is a directory
then it is skipped.
Files and subdirectories with the name "tmp" that do not look like
Maildir will still be processed by 'notmuch new'.
notmuch-new: Fix notmuch new to look at files within symbolic links
We look at the modified time of the database and the directory
to decide whether we need to look at only the subdirectories.
ie, if directory modified time is < database modified time
then we have already looking at all the files withing the
directory. So we just need to iterate through the subdirectories
But with symlinks we need to make sure we follow them even if
the directory modified time is less than database modified time
Bart Trojanowski [Wed, 25 Nov 2009 04:54:35 +0000 (23:54 -0500)]
notmuch-show: identify which messages printed matched the query string
The show command outputs all messages in the threads that match the
search-terms. This patch introduces a 'match:[01]' entry to the 'message{'
line output by the show command. Value of 1 indicates that the message is
matching the search expression.
Bart Trojanowski [Wed, 25 Nov 2009 04:54:34 +0000 (23:54 -0500)]
have _notmuch_thread_create mark which messages matched the query
When _notmuch_thread_create() is given a query string, it can return more
messages than just those matching the query. To distinguish those that
matched the query expression, the MATCHING_SEARCH flag is set
appropriately.
Bart Trojanowski [Wed, 25 Nov 2009 04:54:33 +0000 (23:54 -0500)]
message: add flags to notmuch_message_t
This patch allows for different flags, internal to notmuch, to be set on a
message object. The patch does not define any such flags, just the
facilities to manage these flags.
Jed Brown [Wed, 25 Nov 2009 01:35:13 +0000 (02:35 +0100)]
notmuch-reply.c: accept the --format=default default option.
This factors actual generation of the reply out of notmuch_reply_command
into notmuch_reply_format_default(), in preparation for other --format=
options.
Bart Trojanowski [Fri, 27 Nov 2009 23:02:05 +0000 (18:02 -0500)]
vim: use <Space> more consistently in search view
In search view <Space> will show the thead, but folding messages that
don't match the current search expression. Conversly, <Enter> always
shows all messages in the thread.
Jed Brown [Thu, 26 Nov 2009 21:36:50 +0000 (22:36 +0100)]
notmuch-search-add/remove-tag: restrict to messages in current query
Rather than tagging the everything in the thread. This is arguably more
desirable behavior and is consistent with clearly desirably behavior of
notmuch-search-operate-all.
Note that this change applies indirectly to
notmuch-search-archive-thread (which is actually equivalent behavior
since this function is primarily used when browsing an inbox).
Jed Brown [Thu, 26 Nov 2009 21:36:49 +0000 (22:36 +0100)]
New function notmuch-search-operate-all: operate on all messages in the current query.
It is often convenient to change tags on several messages at once. This
function applies any number of tag whitespace-delimited tag
modifications to all messages matching the current query.
notmuch.el: Use variable notmuch-search-oldest-first to decide the search order
Make sure we use notmuch-search-oldest-first to decide the how
the search result should be displayed. This helps to set the
value to nil and have latest mail shown first
Jan Janak [Wed, 25 Nov 2009 03:30:22 +0000 (04:30 +0100)]
search-tags: Add support for search-terms.
This patch adds support for search-terms to 'notmuch search-tags'. If
no search-term is provided then the command returns a list of all tags
from the database.
If the user provides one or more search-terms as arguments then the
command collects tags from matching messages only.
This could be used by functions in the Emacs mode to further limit the
list of tags offered for completion. For example, functions that remove
tags from message(s) could offer only tags present in the message(s).
Jan Janak [Wed, 25 Nov 2009 03:30:21 +0000 (04:30 +0100)]
lib: New function to collect tags from a list of messages.
This patch adds a new function that can be used to collect a list of
unique tags from a list of messages. 'notmuch search-tags' uses the
function to get a list of tags from messages matching a search-term,
but it has the potential to be used elsewhere so we put it in the lib.