Commit graph

4027 commits

Author SHA1 Message Date
Carl Worth
3474263823 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.
2010-02-24 17:02:31 -08:00
Jameson Rollins
4b9d2e3a4d 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.
2010-02-24 16:40:52 -08:00
Carl Worth
a7afcee50c 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.
2010-02-23 12:51:23 -08:00
Carl Worth
5171831813 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).
2010-02-23 12:50:46 -08:00
Carl Worth
cfa95eec27 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).
2010-02-23 12:50:46 -08:00
Scott Robinson
6ce2bf68f5 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.
2010-02-23 12:01:12 -08:00
Carl Worth
3ca7a4fbcc 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).
2010-02-23 11:27:43 -08:00
Carl Worth
6365f156c8 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.
2010-02-23 11:21:41 -08:00
James Westby
a696119756 Add ENVIRONMENT VARIABLES section to the man page
Briefly describe the NOTMUCH_CONFIG variable there.
2010-02-23 11:14:09 -08:00
Carl Worth
3910000fe8 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.
2010-02-20 12:27:37 -08:00
Carl Worth
4e76865c0d 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.
2010-02-20 12:23:13 -08:00
David Bremner
1631c713d9 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
2010-02-20 12:21:14 -08:00
David Bremner
b20bc7028d 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.
2010-02-20 12:20:54 -08:00
David Bremner
1137ce11e1 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.
2010-02-20 12:17:13 -08:00
David Bremner
e6c6bf3250 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.
2010-02-20 12:12:09 -08:00
Carl Worth
becdb42b1f notmuch.el: Delete some trailing whitespace.
I'm not sure when this managed to creep in, but we don't want it.
2010-02-20 12:12:09 -08:00
Carl Worth
7e3b416153 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.
2010-02-11 16:19:37 -08:00
Carl Worth
2174adf374 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.
2010-02-10 12:40:47 -08:00
Carl Worth
5dbe1c0307 notmuch.el: Fix indentation.
This line was indented incorrectly which can be confusing.
2010-02-10 12:40:18 -08:00
Carl Worth
ca16b2225d 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).
2010-02-10 11:44:15 -08:00
Alexander Botero-Lowry
b611cc2319 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
2010-02-09 18:16:23 -08:00
Carl Worth
e0a8dee8bc 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
2010-02-09 11:14:16 -08:00
Carl Worth
9439b217c3 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).
2010-02-09 11:14:11 -08:00
Carl Worth
0d58d46f7a 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.
2010-02-09 11:02:18 -08:00
Keith Packard
79d3f9773c 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>
2010-02-08 14:40:25 -08:00
Keith Packard
b16a767f51 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>
2010-02-08 14:35:29 -08:00
Keith Packard
b58dcfb702 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>
2010-02-08 14:35:08 -08:00
Kan-Ru Chen
0a1e37a8c9 emacs: Use font-lock-comment-face to highlight citation button
Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
2010-02-08 14:29:29 -08:00
David Bremner
9b93717a6d 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>
2010-02-08 14:24:34 -08:00
David Bremner
24b2f7699f 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>
2010-02-08 14:24:11 -08:00
Carl Worth
7a9bacac67 notmuch.h: Fix a couple of typos in the documentation.
Obviously, the spell-checker isn't able to catch every mistake
I make.
2010-02-05 17:31:40 -08:00
Carl Worth
069cb5a73a 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.
2010-02-05 17:29:56 -08:00
Carl Worth
ef8a74944c notmuch-test: Add basic tests for "notmuch dump" and "notmuch restore"
Our test-suite coverage keeps improving, (slowly).
2010-02-05 17:28:25 -08:00
Carl Worth
b918e04ee8 notmuch-test: Fix misalignment in output.
Clean output is just so much easier to read (and validate).
2010-02-05 17:27:22 -08:00
Kan-Ru Chen
d9c9e56912 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>
2010-02-05 11:31:38 -08:00
Carl Worth
78c85f053b 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.
2010-02-05 11:31:38 -08:00
Carl Worth
ee3e7416f0 notmuch.el: Add missing documentation for the new 'h' keybinding.
Without this, our help screen displayed 'h' with no description of
what it does.
2010-02-05 11:31:38 -08:00
Kan-Ru Chen
b0ccc88146 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>
2010-02-05 11:10:13 -08:00
Carl Worth
a47bf6e7dc 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.
2010-02-05 10:33:11 -08:00
Carl Worth
bc79dc9d6c 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.
2010-02-05 10:33:06 -08:00
Carl Worth
5c938e51b2 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.
2010-02-04 17:34:48 -08:00
Carl Worth
2bc0af15aa 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.
2010-02-04 17:26:00 -08:00
Carl Worth
3767c6f9f9 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.
2010-02-04 17:08:11 -08:00
Carl Worth
d111c720ba 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).
2010-02-04 12:42:09 -08:00
Carl Worth
62379f3dee 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.
2010-02-04 12:42:09 -08:00
Carl Worth
82e47ec92b 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.
2010-02-04 12:42:09 -08:00
Carl Worth
aea35aa5c6 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?).
2010-02-04 12:42:09 -08:00
Carl Worth
9953e9a5a8 notmuch-reply: Add missing whitespace.
Some recently-added functions were to hard for me to read without
the expected whitespace. Fix these.
2010-02-04 12:42:09 -08:00
Carl Worth
9041c1389c 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).
2010-02-04 12:42:03 -08:00
Jed Brown
fddd3d831b 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>
2010-02-04 12:10:43 -08:00