notmuch
11 years agoAdd a --libdir option to ./configure
Ingmar Vanhassel [Fri, 12 Mar 2010 13:47:36 +0000 (14:47 +0100)]
Add a --libdir option to ./configure

This allows packagers to specify to which directory libraries should be
installed.

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
11 years agoFix target dependencies for multiple jobs
Saleem Abdulrasool [Fri, 12 Mar 2010 13:47:35 +0000 (14:47 +0100)]
Fix target dependencies for multiple jobs

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
11 years agoBuild and link against notmuch shared library, install notmuch.h
Ben Gamari [Fri, 12 Mar 2010 13:47:34 +0000 (14:47 +0100)]
Build and link against notmuch shared library, install notmuch.h

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
11 years agoemacs: Fix the notmuch-search-authors-width variable.
Carl Worth [Thu, 11 Mar 2010 23:04:17 +0000 (15:04 -0800)]
emacs: Fix the notmuch-search-authors-width variable.

This variable existed previously, but wasn't actually used for anything.

11 years agoClarify documentation of notmuch_database_add_message.
Carl Worth [Wed, 31 Mar 2010 20:28:45 +0000 (13:28 -0700)]
Clarify documentation of notmuch_database_add_message.

For the case of adding a file that already exist, (with the same
filename). In this case, nothing will happen to the database, but
that wasn't clear before.

11 years agoTODO: Note that '=' should sometimes count from the end of the buffer.
Carl Worth [Wed, 31 Mar 2010 20:27:16 +0000 (13:27 -0700)]
TODO: Note that '=' should sometimes count from the end of the buffer.

When trying to restore the current position, if the "current" thread
no longer appears in the buffer, then '=' moves to the current line
instead. When near the end of the buffer, the "current" line should
be counted as the number of lines from the end.

11 years agoTODO: Add a todo item for adding a message as a blob, rather than a filename.
Carl Worth [Thu, 11 Mar 2010 20:49:56 +0000 (12:49 -0800)]
TODO: Add a todo item for adding a message as a blob, rather than a filename.

This was suggested by Srinivasa and is intended to make it easier to
integrate notmuch into an mbox-loving mail client.

11 years agoTODO: Add some new items about improving the test suite.
Carl Worth [Thu, 11 Mar 2010 18:35:05 +0000 (10:35 -0800)]
TODO: Add some new items about improving the test suite.

I just tried (and failed) to write a test for the recent magic
inference of phrase searches. That's a feature that makes me *really*
uncomfortable to not have an automated test. But I believe the
proposed modularization of the test suite should reduce some quoting
nightmares, so will hopefully make this easier.

11 years agotest: Fix phrase-search tests.
Carl Worth [Thu, 11 Mar 2010 17:55:06 +0000 (09:55 -0800)]
test: Fix phrase-search tests.

With some extra qutotation marks, we are now doing actual phrase
searches so these tests pass.

11 years agotest: Add some negative results for the phrase searches.
Carl Worth [Thu, 11 Mar 2010 17:52:08 +0000 (09:52 -0800)]
test: Add some negative results for the phrase searches.

These results have all the same terms as the target phrase, but
not in the expected order. They are designed to ensure that we
actually test phrase searches.

And as it turns out, we're not currently quoting the search terms
properly, so the phrase-search tests now fail with this commit.

11 years agonotmuch-show: add tags to json output
Sebastian Spaeth [Thu, 11 Mar 2010 12:11:43 +0000 (13:11 +0100)]
notmuch-show: add tags to json output

The previous json patches forgot to add the notmuch tags to the json
output. This is inconsistent to the text output so here they are. We
just output a 'tags' field that sends notmuch tags as a json array.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoemacs: Fix search refresh when on the last line of a search buffer.
Carl Worth [Wed, 10 Mar 2010 19:07:58 +0000 (11:07 -0800)]
emacs: Fix search refresh when on the last line of a search buffer.

We currently allow the cursor to be positioned on the "End of search
results" line after the last thread in a search buffer. When
refreshing on this line, there's no thread ID to be used as the
target.

Previously, a refresh from this case would result in a nil thread
target, but we were also using nil to indicate that the target thread
had been found. This caused the position to be lost during refresh,
(the cursor would move from the last line in the buffer to the first).

We fix this by using a magic string of "found" rather than nil to
clearly indicate whether the target thread has actually been found.

11 years agoemacs: Adjust search refresh to use a target line not a target position.
Carl Worth [Wed, 10 Mar 2010 19:05:33 +0000 (11:05 -0800)]
emacs: Adjust search refresh to use a target line not a target position.

It doesn't make sense to move the cursor to some random point in the
middle of a line. We always want the refresh to leave the cursor at
the beginning of some line instead.

11 years agoMakefile: Fix Makefiles to depend on all child Makefile fragments.
Carl Worth [Wed, 10 Mar 2010 18:59:57 +0000 (10:59 -0800)]
Makefile: Fix Makefiles to depend on all child Makefile fragments.

We were previously maintaining two lists of the child Makefile
fragments---one for the includes and another for the dependencies. So,
of course, they drifted and the dependency list wasn't up to date.

We fix this by adding a single subdirs variable, and then using GNU
Makefile substitution to generate both the include and the dependency
lists.

Some side effect of this change caused the '=' assignment of the dir
variable to not work anymore. I'm not sure why that is, but using ':='
makes sense here and fixes the problem.

11 years agoMakefile: Use 'emacs --quick' for a less noisy build of "make install-emacs".
Carl Worth [Wed, 10 Mar 2010 18:58:46 +0000 (10:58 -0800)]
Makefile: Use 'emacs --quick' for a less noisy build of "make install-emacs".

I don't really notice if it goes any quicker, but it's sure nice to have
less spew now.

11 years agoMakefile: Add a message after "make install-emacs"
Carl Worth [Wed, 10 Mar 2010 18:50:20 +0000 (10:50 -0800)]
Makefile: Add a message after "make install-emacs"

More help to guide the new user here. Tell the user how to actually
invoke the emacs client now that it's installed.

11 years agoMakefile: Conditionalize the "make install" message.
Carl Worth [Wed, 10 Mar 2010 18:48:47 +0000 (10:48 -0800)]
Makefile: Conditionalize the "make install" message.

This is the same approach as with the 'all' target previously.

11 years agoMakefile: Simplify the conditional message of the all target.
Carl Worth [Wed, 10 Mar 2010 18:44:44 +0000 (10:44 -0800)]
Makefile: Simplify the conditional message of the all target.

We wamt a simple "make" to call the 'all' target and then print a
message when done, but we don't want "make install" which depends on
that same 'all' target to print the message.

We previously did this with a separate 'all-without-message' target,
which was inelegant because it caused all users of the target to
carefully depend on 'all-without-message' rather than 'all'.

Instead, we now use a single 'all' target but with a Makefile
conditional that examines the MAKECMDGOALS variable to determine
whether to print the message.

11 years agoMakefile: Add message to make install listing the other install targets.
Carl Worth [Wed, 10 Mar 2010 18:07:34 +0000 (10:07 -0800)]
Makefile: Add message to make install listing the other install targets.

Otherwise, it's hard for the user to know that things like install-emacs,
install-bash, and install-zsh even exist.

11 years agoMakefile: Add a meesage after "make" telling the user to run "make install"
Carl Worth [Wed, 10 Mar 2010 01:03:11 +0000 (17:03 -0800)]
Makefile: Add a meesage after "make" telling the user to run "make install"

As one command completes, it's kind of the tool to indicate which
command the user should execute next.

11 years agoMakefile: Rename all_deps to global_deps
Carl Worth [Wed, 10 Mar 2010 01:01:55 +0000 (17:01 -0800)]
Makefile: Rename all_deps to global_deps

The "all" inside this variable name was easy to confuse with the
separate "all" target. This variable specifies dependencies that apply
to every target, so use "global" instead.

11 years agoAdd is:<tag> as a synonym for tag:<tag> in search terms.
Carl Worth [Wed, 10 Mar 2010 00:03:58 +0000 (16:03 -0800)]
Add is:<tag> as a synonym for tag:<tag> in search terms.

I like the readability of this, it provides compatibility with people
trained in this syntax by sup, and it even saves one character.

11 years agoemacs: Move emacs UI (currently just one file) to subdirectory.
David Bremner [Wed, 10 Feb 2010 03:45:28 +0000 (23:45 -0400)]
emacs: Move emacs UI (currently just one file) to subdirectory.

Add emacs/Makefile.local and emacs/Makefile. Move emacs targets into
emacs/Makefile.local, but leave the byte compilation rule in the top
level Makefile.

11 years agoINSTALL: Include Fedora command for installing dependencies of notmuch.
Carl Worth [Tue, 9 Mar 2010 20:12:32 +0000 (12:12 -0800)]
INSTALL: Include Fedora command for installing dependencies of notmuch.

We already had this command in the error message from the configure script,
so we should include it here as well.

11 years agoINSTALL: Add a pointer to ./configure --help
Carl Worth [Tue, 9 Mar 2010 20:11:47 +0000 (12:11 -0800)]
INSTALL: Add a pointer to ./configure --help

We have some good documentation in ./configure --help, so we should
direct users to it.

11 years agolib: Silence a compiler warning.
Carl Worth [Tue, 9 Mar 2010 20:05:43 +0000 (12:05 -0800)]
lib: Silence a compiler warning.

The original code was harmless, but apparently some compilers aren't
able to think deep enough to catch that.

11 years agoemacs: Fix refresh of search results to leave cursor on current thread.
Carl Worth [Tue, 9 Mar 2010 19:36:08 +0000 (11:36 -0800)]
emacs: Fix refresh of search results to leave cursor on current thread.

This has been broken since the addition of support for streaming
search results to the emacs interface. With the old apparoach it was
easy to simply wait for all search results to land in the buffer and
then search for the desired line. With streaming results, we have to
save the target off to the side and allow the process filter and
sentinel functions to correctly respond when the target thread
appears.

11 years agoFix a few documentation typos in notmuch.h
Fernando Carrijo [Sat, 5 Dec 2009 19:32:34 +0000 (17:32 -0200)]
Fix a few documentation typos in notmuch.h

Fix a few documentation typos in notmuch.h

Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
11 years agoUpdate documentation of notmuch_query_create
Fernando Carrijo [Sat, 5 Dec 2009 14:22:05 +0000 (12:22 -0200)]
Update documentation of notmuch_query_create

Commit cd467caf renamed notmuch_query_search to notmuch_query_search_messages.
Commit 1ba3d46f created notmuch_query_search_threads. We better keep the docs
of notmuch_query_create consistent with those changes.

Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Edited-by: Carl Worth to explicitly list the full name of each
function being referenced.

11 years agonotmuch show: Don't show empty headers.
Carl Worth [Tue, 9 Mar 2010 18:12:58 +0000 (10:12 -0800)]
notmuch show: Don't show empty headers.

This is a fairly old regression. There has always been code to avoid
printing empty headers (such as Cc or Bcc with no values), but it has
been broken since notmuch_message_get_header was changed to return
an empty string rather than a NULL pointer for these fields.

11 years agoTODO: Add proposal for a saved-search interface.
Carl Worth [Tue, 9 Mar 2010 18:09:40 +0000 (10:09 -0800)]
TODO: Add proposal for a saved-search interface.

Adding this to our TODO list so that it doesn't get forgotten.

11 years agoTODO: Remove many items that have been completed recently.
Carl Worth [Tue, 9 Mar 2010 18:06:37 +0000 (10:06 -0800)]
TODO: Remove many items that have been completed recently.

There's been a lot of good work done, and we've been doing a generally
poor job of noticing when some of the tasks we've completed were
already on our TODO list.

So here's a careful scan, removing all items I could find that have
already been done.

11 years agoemacs: Fix documentation of notmuch-search-remove-tag.
Carl Worth [Tue, 9 Mar 2010 17:54:53 +0000 (09:54 -0800)]
emacs: Fix documentation of notmuch-search-remove-tag.

The behavior was changed in commit 4aff2ca55bfe285ced36e9fe02c907d8b4120672
to affect all messages in the thread (and not only those matching
the current search) but the documentation was not updated (until
now).

11 years agolib: Document what move_to_next does at the end of the list.
Carl Worth [Tue, 9 Mar 2010 17:24:45 +0000 (09:24 -0800)]
lib: Document what move_to_next does at the end of the list.

Explicitly mention that there's an invalid position after the last
item in the list.

11 years agolib: Rename iterator functions to prepare for reverse iteration.
Carl Worth [Tue, 9 Mar 2010 17:22:29 +0000 (09:22 -0800)]
lib: Rename iterator functions to prepare for reverse iteration.

We rename 'has_more' to 'valid' so that it can function whether
iterating in a forward or reverse direction. We also rename
'advance' to 'move_to_next' to setup parallel naming with
the proposed functions 'move_to_first', 'move_to_last', and
'move_to_previous'.

11 years agoemacs: Fix backspace to not scroll more than the previous message
Carl Worth [Tue, 9 Mar 2010 16:11:45 +0000 (08:11 -0800)]
emacs: Fix backspace to not scroll more than the previous message

The bug was occuring due to counting invisible lines, but then
scrolling past them since they are invisible.

11 years agoemacs: Unbreak notmuch-show-rewind (the function to which Backspace is bound)
Carl Worth [Tue, 9 Mar 2010 01:24:34 +0000 (17:24 -0800)]
emacs:  Unbreak notmuch-show-rewind (the function to which Backspace is bound)

Commit 095a02211e696434e5b41a85ab516b3a639f9a9b broke the backspace
key by trying to execute nil as a function, (which obviously won't
work), when it was intended as a return value. Fix this now, (and pine
for a test suite that exercises the emacs user-interface of notmuch).

11 years agoemacs: Make 'n' and 'p' navigate only open messages.
Carl Worth [Fri, 26 Feb 2010 19:30:12 +0000 (11:30 -0800)]
emacs: Make 'n' and 'p' navigate only open messages.

And add new 'N' and 'P' keybindings for navigating through messages
that are open or closed.

11 years agoemacs: Don't open unread messages by default.
Carl Worth [Fri, 26 Feb 2010 18:40:23 +0000 (10:40 -0800)]
emacs: Don't open unread messages by default.

When searching for an individual message, (by message id, say), it's
really annoying to have the entire thread open just because the thread
was archived without ever having been read.

This means that the "unread" tag is a lot less special, and it really
just exists as a mild cue for the user.

11 years agoREADME: Mention that notmuch only supports maildir or mh format.
Carl Worth [Thu, 25 Feb 2010 19:03:56 +0000 (11:03 -0800)]
README: Mention that notmuch only supports maildir or mh format.

Justin B Rye pointed out (in Debian bug #566282) that a user with mail
in mbox format can spend a lot of time investigating notmuch before
realizing that mbox is not supported. Head that off with a more
detailed mention in the README blurb.

11 years agoemacs: Avoid removing the unread tag due to internal navigation
Carl Worth [Thu, 25 Feb 2010 01:02:31 +0000 (17:02 -0800)]
emacs: Avoid removing the unread tag due to internal navigation

Sometimes the internals of the implementation navigate among messages,
(as opposed to the user explicitly requesting the next message to be
shown). In these cases we don't want to remove the unread tag from the
message navigated to.

This fixes a bug where invocation of notmuch-show-next-unread-message
would clear the unread tag from all messages in a thread.

11 years agoSimplify "unread" tag handling in emacs UI.
Jameson Rollins [Tue, 19 Jan 2010 22:54:16 +0000 (17:54 -0500)]
Simplify "unread" tag handling in emacs UI.

This patch is intended to greatly simplify the handling of the
"unread" tag in the emacs UI.  This patch adds a new function
'notmuch-show-mark-read', that removes the "unread" tag in
notmuch-show-mode.  This function is then executed as a
notmuch-show-hook, and by notmuch-show-next-message.  All of the
functions that explicitly marked messages as unread are removed or
renamed.

The idea here is that the user should never have to worry about
manipulating the "unread" tag.  The tag should persist until the user
actually views a message, at which point it should be automatically
removed.  This patch simplifies the notmuch.el quite a bit, removing a
lot of somewhat redundant functions, and reducing clutter in the name
and key-mapping space.

11 years agoTODO: We should fix the --format=json option to not imply --entire-thread.
Carl Worth [Tue, 23 Feb 2010 20:51:23 +0000 (12:51 -0800)]
TODO: We should fix the --format=json option to not imply --entire-thread.

What we print and how we print it are orthogonal options, so --format
shouldn't change what messages are printed.

11 years agonotmuch search: Use "thread" rather than "id" when formatting with JSON
Carl Worth [Tue, 23 Feb 2010 20:41:59 +0000 (12:41 -0800)]
notmuch search: Use "thread" rather than "id" when formatting with JSON

The text output uses thread:<foo>, (which is a syntax directly supported
by "notmuch show"), so make the json output be "thread", "<foo>" rather
than "id", "<foo>". This should help avoid confusion of thread IDs with
message IDs, (which do use the "id" prefix in searches).

11 years agojson: Add copy of MIT license text from cJSON
Carl Worth [Tue, 23 Feb 2010 20:49:33 +0000 (12:49 -0800)]
json: Add copy of MIT license text from cJSON

When we incorporate external code, we should include its license,
(particularly when one of the terms of the license is to include it in
copies).

11 years agoAdd an "--format=(json|text)" command-line option to both notmuch-search and notmuch...
Scott Robinson [Thu, 31 Dec 2009 15:17:40 +0000 (11:17 -0400)]
Add an "--format=(json|text)" command-line option to both notmuch-search and notmuch-show.

In the case of notmuch-show, "--format=json" also implies
"--entire-thread" as the thread structure is implicit in the emitted
document tree.

As a coincidence to the implementation, multipart message ID numbers are
now incremented with each part printed. This changes the previous
semantics, which were unclear and not necessary related to the actual
ordering of the message parts.

11 years agoTODO: Rename the proposed --for option to --output
Carl Worth [Tue, 23 Feb 2010 19:27:43 +0000 (11:27 -0800)]
TODO: Rename the proposed --for option to --output

We've been using --output in IRC and on the mailing list for a while,
(someone had the good sense to point out that --for would defeat
command-line completion since it's a prefix of the proposed --format).

11 years agonotmuch.1: Use bold and indentation for the NOTMUCH_CONFIG variable.
Carl Worth [Tue, 23 Feb 2010 19:21:41 +0000 (11:21 -0800)]
notmuch.1: Use bold and indentation for the NOTMUCH_CONFIG variable.

This seems to be the standard method of formatting an environment
variable section within a man page.

11 years agoAdd ENVIRONMENT VARIABLES section to the man page
James Westby [Sat, 19 Dec 2009 13:12:15 +0000 (13:12 +0000)]
Add ENVIRONMENT VARIABLES section to the man page

Briefly describe the NOTMUCH_CONFIG variable there.

11 years agonotmuch.el: Emphasize the 'i' of 'ID' in the documentation for 'c i'.
Carl Worth [Sat, 20 Feb 2010 20:27:37 +0000 (12:27 -0800)]
notmuch.el: Emphasize the 'i' of 'ID' in the documentation for 'c i'.

We're using 'i' in the keybinding, so it helps to have a capital
'I' in the help string to empahsize the point.

11 years agoChange the stash keybinding from 'z' to 'c'. And use 'i' for message ID.
Carl Worth [Sat, 20 Feb 2010 20:23:13 +0000 (12:23 -0800)]
Change the stash keybinding from 'z' to 'c'. And use 'i' for message ID.

In spite of being implemented with the word "stash" in the function
names, the documentation (and hence help strings) for each function
already use the word "Copy" to describe the action. So 'c' is a much
more natural key-binding, (particularly since 'z' didn't map to any
real word anyway).

We also use 'i' for the message ID copying of the submap. This is
intended to align mnemonically with the "id:" prefix already used
for message IDs.

11 years agonotmuch.el: add a submap (on "z" for "ztash") to stash things.
David Bremner [Fri, 12 Feb 2010 03:01:08 +0000 (23:01 -0400)]
notmuch.el: add a submap (on "z" for "ztash") to stash things.

Provide key bindings for stuffing various RFC822 header fields and other metadata
into the emacs kill-ring as text. The bindings are as follows:

z F notmuch-show-stash-filename
z T notmuch-show-stash-tags
z c notmuch-show-stash-cc
z d notmuch-show-stash-date
z f notmuch-show-stash-from
z m notmuch-show-stash-message-id
z s notmuch-show-stash-subject
z t notmuch-show-stash-to

11 years agonotmuch.el: convert sparse keymap to a list in notmuch-substitute-one-command-key...
David Bremner [Fri, 12 Feb 2010 03:01:07 +0000 (23:01 -0400)]
notmuch.el: convert sparse keymap to a list in notmuch-substitute-one-command-key-with-prefix

The previous version would crash when a key was bound to a sparse
keymap, since apparently these are not straightforward lists.  The
usage of map-keymap is a bit obscure: it only has side-effects, no
return value.

11 years agoAdd functions notmuch-show-get-(bcc, cc, date, from, subject, to).
David Bremner [Fri, 12 Feb 2010 02:44:10 +0000 (22:44 -0400)]
Add functions notmuch-show-get-(bcc, cc, date, from, subject, to).

Return the corresponding header field for the current message as a
string.  These are thin wrappers around notmuch-show-get-header, which
means they each cause a full parse of the RFC822 header. The main idea
is to fix an api.

11 years agonotmuch-show-get-header: new function; return alist of parsed header fields.
David Bremner [Fri, 12 Feb 2010 02:34:31 +0000 (22:34 -0400)]
notmuch-show-get-header: new function; return alist of parsed header fields.

This function parses the displayed message to recover header
fields. It uses mailheader.el to do the actual header parsing, after
preprocessing to remove indentation.  It relies on the variables
notmuch-show-message-begin-regexp, notmuch-show-header-begin-regexp,
and notmuch-show-message-end-regexp.

11 years agonotmuch.el: Delete some trailing whitespace.
Carl Worth [Sat, 20 Feb 2010 20:11:31 +0000 (12:11 -0800)]
notmuch.el: Delete some trailing whitespace.

I'm not sure when this managed to creep in, but we don't want it.

11 years agonotmuch.el: Fix bug from message with ':' in the From address.
Carl Worth [Fri, 12 Feb 2010 00:19:37 +0000 (16:19 -0800)]
notmuch.el: Fix bug from message with ':' in the From address.

Eric reported that a particular thread was non-functional in the
notmuch-search mode in the emacs client. It was easy enough to trace
the bug down to a broken regular expression (using ':' instead of
';'). The bug would be triggered by a message with ':' in the
From address.

This is something I hope to add to the test suite as soon as we have
support for testing the emacs interface there.

11 years agonotmuch.el: Handle attached images via an external viewer.
Carl Worth [Wed, 10 Feb 2010 20:40:47 +0000 (12:40 -0800)]
notmuch.el: Handle attached images via an external viewer.

We temporarily override the mm-inline-media-tests variable so that the
only parts inserted into the temporary buffer (and lost) are those
parts that the user has already seen in the notmuch-show buffer.

Anything else, (such as images), will now be left to be handled via
mailcap, just like other attachment types.

11 years agonotmuch.el: Fix indentation.
Carl Worth [Wed, 10 Feb 2010 20:40:18 +0000 (12:40 -0800)]
notmuch.el: Fix indentation.

This line was indented incorrectly which can be confusing.

11 years agonotmuch.el: Avoid infinite loop marking up message with no parts.
Carl Worth [Wed, 10 Feb 2010 19:40:56 +0000 (11:40 -0800)]
notmuch.el: Avoid infinite loop marking up message with no parts.

The infinite loop was triggered by a message consisting of a single
attachment within the body, (and no "part") tags.

We need to do things in response to this bug (beyond this specific
fix):

1. Create a test suite that exercises our emacs frontend so that bugs
   like this do not come back to haunt us after we fix them once.

2. Switch from our ad-hoc regexp based search of message-part delimeters
   to known-good code for parsing a structured document, (for example,
   the outstanding JSON patches).

11 years agoReintroduce HTML inlining, with a much needed optimization
Alexander Botero-Lowry [Wed, 10 Feb 2010 01:55:21 +0000 (17:55 -0800)]
Reintroduce HTML inlining, with a much needed optimization

Now instead of requiring every single message be parsed, we now check
the Content-type in the parsed headers and only do HTML inlining if it's
text/html

11 years agoFix printf for when uint64_t != unsigned long long int
Carl Worth [Tue, 9 Feb 2010 19:09:30 +0000 (11:09 -0800)]
Fix printf for when uint64_t != unsigned long long int

Thanks to Michal Sojka <sojkam1@fel.cvut.cz> for pointing out the
correct fix, which I verified in the freely-available WG14/N1124 draft
(from the C99 working group) which is available here:

http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf

11 years agoSwitch from random to sequential thread identifiers.
Carl Worth [Mon, 8 Feb 2010 19:33:33 +0000 (11:33 -0800)]
Switch from random to sequential thread identifiers.

The sequential identifiers have the advantage of being guaranteed to
be unique (until we overflow a 64-bit unsigned integer), and also take
up half as much space in the "notmuch search" output (16 columns
rather than 32).

This change also has the side effect of fixing a bug where notmuch
could block on /dev/random at startup (waiting for some entropy to
appear). This bug was hit hard by the test suite, (which could easily
exhaust the available entropy on common systems---resulting in large
delays of the test suite).

11 years agoTODO: Add some recently discussed items.
Carl Worth [Tue, 9 Feb 2010 19:02:18 +0000 (11:02 -0800)]
TODO: Add some recently discussed items.

These were collected either from the mailing list of from IRC
conversations. The good ideas probably aren't mine, and the mistakes
probably are.

11 years agoAllow folders with no messages to be elided from list
Keith Packard [Sun, 27 Dec 2009 00:34:18 +0000 (16:34 -0800)]
Allow folders with no messages to be elided from list

This makes it easier to see folders with messages.
Eliding empty folders is togged with the 'e' binding.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoLook at whitespace to separate folder name from count
Keith Packard [Sun, 27 Dec 2009 00:34:17 +0000 (16:34 -0800)]
Look at whitespace to separate folder name from count

This allows folder names to contain any non-blank characters

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoAdd 'm' and ' ' bindings to notmuch-folder view
Keith Packard [Sun, 27 Dec 2009 00:34:16 +0000 (16:34 -0800)]
Add 'm' and ' ' bindings to notmuch-folder view

This allows the user to compose new mail from the folder view, and
also to use <space> to show the current folder.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoemacs: Use font-lock-comment-face to highlight citation button
Kan-Ru Chen [Mon, 14 Dec 2009 05:41:35 +0000 (13:41 +0800)]
emacs: Use font-lock-comment-face to highlight citation button

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
11 years agonotmuch.el: show some of citation even when hiding.
David Bremner [Fri, 25 Dec 2009 20:09:08 +0000 (16:09 -0400)]
notmuch.el: show some of citation even when hiding.

- rename notmuch-show-citation-lines-min to n-s-c-l-prefix
- call forward-line with the appropriate parameter to adjust
  region to be hidden.
- change citation button text so that it makes (some) sense when citation is shown

Reviewed-by: Kan-Ru Chen <kanru@kanru.info>
11 years agonotmuch.el: Refactor citation markup. Variables for minimum size, button text.
David Bremner [Fri, 25 Dec 2009 20:09:07 +0000 (16:09 -0400)]
notmuch.el: Refactor citation markup. Variables for minimum size, button text.

This is a fairly intrusive rewrite.

- I pulled the common code for the signature and citation case out
  into a separate function. This is not so much shorter, but I think it
  will be easier to maintain.

- I replaced the sequence of (looking-at blah) (forward-line)  with a single
  re-search-forward per citation.

New variables

- notmuch-show-signature-button-format, notmuch-show-citation-button-format
  Allow customization of button text.

- notmuch-show-citation-lines-min
  Do not buttonize citations below the given threshold.

Reviewed-by: Kan-Ru Chen <kanru@kanru.info>
11 years agonotmuch.h: Fix a couple of typos in the documentation.
Carl Worth [Sat, 6 Feb 2010 01:31:40 +0000 (17:31 -0800)]
notmuch.h: Fix a couple of typos in the documentation.

Obviously, the spell-checker isn't able to catch every mistake
I make.

11 years agonotmuch restore: Don't waste time with messages with unchanged tags.
Carl Worth [Sat, 6 Feb 2010 01:29:56 +0000 (17:29 -0800)]
notmuch restore: Don't waste time with messages with unchanged tags.

It's a simple optimization to look at a message and check that the
existing tags are actually different than the tags we are setting
before we do anything.

For my mail store this takes a "notmuch restore" that does nothing
from about 10 minutes down to 1 minute, so there's a significant
speedup here.

11 years agonotmuch-test: Add basic tests for "notmuch dump" and "notmuch restore"
Carl Worth [Sat, 6 Feb 2010 01:28:25 +0000 (17:28 -0800)]
notmuch-test: Add basic tests for "notmuch dump" and "notmuch restore"

Our test-suite coverage keeps improving, (slowly).

11 years agonotmuch-test: Fix misalignment in output.
Carl Worth [Sat, 6 Feb 2010 01:27:22 +0000 (17:27 -0800)]
notmuch-test: Fix misalignment in output.

Clean output is just so much easier to read (and validate).

11 years agonotmuch.el: Use emacs built-in forward-button and backward-button
Kan-Ru Chen [Tue, 1 Dec 2009 06:13:53 +0000 (14:13 +0800)]
notmuch.el: Use emacs built-in forward-button and backward-button

There are built-ins, so why not use them?

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
11 years agoUse forward-line instead of next-line
Carl Worth [Fri, 5 Feb 2010 19:14:25 +0000 (11:14 -0800)]
Use forward-line instead of next-line

We do this all the time, but at least emacs is kind enough to remind us,
(when compiling), that next-line is only intended for interactive use,
and we should use forward-line inside of lisp code.

11 years agonotmuch.el: Add missing documentation for the new 'h' keybinding.
Carl Worth [Fri, 5 Feb 2010 19:30:35 +0000 (11:30 -0800)]
notmuch.el: Add missing documentation for the new 'h' keybinding.

Without this, our help screen displayed 'h' with no description of
what it does.

11 years agonotmuch.el: Add keybinding to toggle display of message body and headers.
Kan-Ru Chen [Tue, 1 Dec 2009 06:13:51 +0000 (14:13 +0800)]
notmuch.el: Add keybinding to toggle display of message body and headers.

I really missed this feature. Added notmuch-show-toggle-current-body and
notmuch-show-toggle-current-header and bind them to 'b' and 'h'.

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
11 years agonotmuch-test: Add test to verify that uuencoded data is not indexed.
Carl Worth [Fri, 5 Feb 2010 18:24:51 +0000 (10:24 -0800)]
notmuch-test: Add test to verify that uuencoded data is not indexed.

As recently promised, no new features are being accepted to notmuch
without corresponding new tests for the test suite.

11 years agonotmuch-test: Add several tests of "notmuch search"
Carl Worth [Fri, 5 Feb 2010 18:00:04 +0000 (10:00 -0800)]
notmuch-test: Add several tests of "notmuch search"

These tests were surprisingly simple to write---not much code at all
and most of them worked the first time even with hand-prepared
versions of the expected output.

11 years agonotmuch-test: Add a new add_message function.
Carl Worth [Fri, 5 Feb 2010 01:34:48 +0000 (17:34 -0800)]
notmuch-test: Add a new add_message function.

The previous generate_message function is what's needed when testing
"notmuch new". But after that, we never want to generate a message
without also adding it to the index. So create a new add_message
function with this convenience.

11 years agoEliminate some useless gobject boilerplate.
Carl Worth [Fri, 5 Feb 2010 01:26:00 +0000 (17:26 -0800)]
Eliminate some useless gobject boilerplate.

If we had external users of this filter then they might expect some of
these macros to exist. But since this is just internal, that's just
unneeded noise.

11 years agonotmuch new: Don't index uuencoded data.
Carl Worth [Fri, 5 Feb 2010 01:08:11 +0000 (17:08 -0800)]
notmuch new: Don't index uuencoded data.

With modern MIME attachments, we're already avoiding indexing the
attachments. But for old-school uuencoded data in the mail, we have
been directly indexing the encoded data as terms, (which is not useful
at all---nobody will ever ytry to search based on the seemingly random
uuencoded data).

Additionally, indexing a modestly large uuencoded file seems to make
Xapian go insane, (consuming *lots* of memory).

We fix both problems by detecting uuencoded content and not performing
any indexing of it.

11 years agonotmuch reply: Rename the mailing_list_munged_reply_to function
Carl Worth [Thu, 4 Feb 2010 20:39:11 +0000 (12:39 -0800)]
notmuch reply: Rename the mailing_list_munged_reply_to function

This function detects whether the address in the Reply-To header
already appears in either To or Cc. So give it a name that reflects
what it does (reply_to_header_is_redundant) rather than the old name
which described one possible use of the function, (as a simple
heuristic for detecting whether a mailing list had applied reply-to
munging).

11 years agonotmuch reply: Prevent GMIME assertion complaints for empty Reply-to header.
Carl Worth [Thu, 4 Feb 2010 20:32:28 +0000 (12:32 -0800)]
notmuch reply: Prevent GMIME assertion complaints for empty Reply-to header.

Apparently, GMime doesn't want to create a valid address list object
for an empty string. That's annoying, but it's easy enough to test for
the empty string and avoid the problem.

11 years agonotmuch reply: Use strstr instead of strcasestr for portability.
Carl Worth [Thu, 4 Feb 2010 20:29:04 +0000 (12:29 -0800)]
notmuch reply: Use strstr instead of strcasestr for portability.

This change was already recommended in a comment in the original
implementation of this patch. If someone really wants to support
un-munging in the case of To: and Reply-To: having the same address
but different case, then they can provide a portable approach for
that.

11 years agonotmuch reply: Fix the support for reply-to un-munging.
Carl Worth [Thu, 4 Feb 2010 20:27:42 +0000 (12:27 -0800)]
notmuch reply: Fix the support for reply-to un-munging.

The condition was using a reversed sense for the test of the return
value of strcasestr, (perhaps confusing it with the usage of strcmp?).

11 years agonotmuch-reply: Add missing whitespace.
Carl Worth [Thu, 4 Feb 2010 20:12:01 +0000 (12:12 -0800)]
notmuch-reply: Add missing whitespace.

Some recently-added functions were to hard for me to read without
the expected whitespace. Fix these.

11 years agonotmuch-test: Test "notmuch reply" with a reply-to-munged mail
Carl Worth [Thu, 4 Feb 2010 20:08:13 +0000 (12:08 -0800)]
notmuch-test: Test "notmuch reply" with a reply-to-munged mail

This is a test for the recently added feature where we detect that the
reply-to address already exists in the To: or Cc: header so will
already be replied to. In this case we want to include the From:
address in our reply, (where, otherwise we would use the Reply-To
address *instead* of the address in the From header).

11 years agonotmuch-reply.c: Handle munged `Reply-To' headers.
Jed Brown [Sat, 28 Nov 2009 23:19:36 +0000 (00:19 +0100)]
notmuch-reply.c: Handle munged `Reply-To' headers.

Some mailing lists engage in the evil practice of changing the Reply-To
header so that replies from all mailers go to the list by default, at
the expense of not responding to the person who actually sent the
message.  When this is detected, we reply to `From' and remove the
duplicate response to the mailing list.  Consider a reply to the
following message.

  From: Some User <some.user@example.com>
  To: Sample users list <sample-users@sample.org>
Reply-To: Sample users list <sample-users@sample.org>
Prior to this patch, `notmuch reply' produces

  To: Sample users list <sample-users@sample.org>,
      Sample users list <sample-users@sample.org>

and after the patch,

  To: Some User <some.user@example.com>,
      Sample users list <sample-users@sample.org>

Signed-off-by: Jed Brown <jed@59A2.org>
11 years agonotmuch-reply.c: Factor adding recipients into common function
Jed Brown [Sat, 28 Nov 2009 23:19:35 +0000 (00:19 +0100)]
notmuch-reply.c: Factor adding recipients into common function

This code was already duplicated. We move it to a new, shared
add_recipients_from_message function, in preparation for more
sophisticated mailing list logic.

Signed-off-by: Jed Brown <jed@59A2.org>
11 years agonotmuch-test: Test "notmuch reply" with multiple recipients
Carl Worth [Thu, 4 Feb 2010 20:03:30 +0000 (12:03 -0800)]
notmuch-test: Test "notmuch reply" with multiple recipients

The feature tested here is that we reply to both the sender and to
others addresses on the To: line of the original message, but that we
don't reply to our own address.

11 years agonotmuch-test: Add test for "notmuch reply" with a CC header.
Carl Worth [Thu, 4 Feb 2010 19:55:57 +0000 (11:55 -0800)]
notmuch-test: Add test for "notmuch reply" with a CC header.

A simple test to help round out the set of tested features.

11 years agonotmuch-test: Add "notmuch reply" test for reply-to support.
Carl Worth [Thu, 4 Feb 2010 19:52:08 +0000 (11:52 -0800)]
notmuch-test: Add "notmuch reply" test for reply-to support.

This is the standard support of reply-to, (replying to that address
rather than the from address). It has nothing to do with the proposed
feature for extra-clever handling of a mail from a mailing-list that
has munged the reply-to header.

11 years agonotmuch-test: Test "notmuch reply" from alternate address.
Carl Worth [Thu, 4 Feb 2010 19:39:31 +0000 (11:39 -0800)]
notmuch-test: Test "notmuch reply" from alternate address.

When reply to a message addresses to an address configured in the
other_email setting in the configuration file, the reply should use
that address in the From header. Test this.

11 years agonotmuch-test: Add a basic test of "notmuch reply"
Carl Worth [Thu, 4 Feb 2010 19:33:56 +0000 (11:33 -0800)]
notmuch-test: Add a basic test of "notmuch reply"

Simply ensuring that the reply template is formatted as expected.

11 years agonotmuch-test: Eliminate sleeps to speed up test suite run
Carl Worth [Thu, 4 Feb 2010 19:31:01 +0000 (11:31 -0800)]
notmuch-test: Eliminate sleeps to speed up test suite run

We were sleeping merely to ensure that our updates to the mail store
would result in the mtime of the appropriate directories being
updated. We make the test suite run faster by not sleeping, but
instead explicitly updating the mtime of the directory to a future
time with touch.

We're careful to ensure that the time is not merely in the future
compared to the current time, but also later than any previous update
to the same directory mtime.

11 years agonotmuch-test: Allow custom headers when generating messages
Carl Worth [Thu, 4 Feb 2010 16:39:23 +0000 (08:39 -0800)]
notmuch-test: Allow custom headers when generating messages

This provides the control that future tests will need, (for example,
adding a CC field to ensure proper handling with "notmuch reply",
etc.)

11 years agonotmuch-test: Use named-parameters for generate_message function
Carl Worth [Thu, 4 Feb 2010 01:24:01 +0000 (17:24 -0800)]
notmuch-test: Use named-parameters for generate_message function

This makes the test suite bash-specific, but that's not much of
an issue for me, (if somebody else would prefer some other language
then they can rewrite the test suite and maintain it).

The advantage here is that we'll now be able to easily generate
custom messages for testing operations that depend on the message
content, (such as "notmuch reply", etc.).

11 years agoAdd actual testing to notmuch-test
Carl Worth [Wed, 3 Feb 2010 00:24:53 +0000 (16:24 -0800)]
Add actual testing to notmuch-test

We verify that each command creates output exactly as expected (after
ignoring variable output such as the report of how long an operation
took).