Commit graph

342 commits

Author SHA1 Message Date
Carl Worth
294b6a67c1 emacs: Use copy-sequence instead of copy-seq.
I don't see copy-seq documented within emacs at all, and some users
have encountered failures of the form:

notmuch-show-del-tags-worker: Symbol's function definition is void: copy-seq

This should eliminate that problem.
2010-10-28 11:35:58 -07:00
David Edmondson
c506e1034b emacs: Avoid runtime use of `cl'.
The GNU Emacs Lisp Reference Manual section D.1 says:

> *  Please don't require the cl package of Common Lisp extensions at
>    run time. Use of this package is optional, and it is not part of
>    the standard Emacs namespace. If your package loads cl at run time,
>    that could cause name clashes for users who don't use that package.
>
>    However, there is no problem with using the cl package at compile
>    time, with (eval-when-compile (require 'cl)). That's sufficient for
>    using the macros in the cl package, because the compiler expands
>    them before generating the byte-code.

Follow this advice, requiring the following changes where `cl' was
used at runtime:

- replace `rassoc-if' in `notmuch-search-buffer-title' with the `loop'
  macro and inline code. At the same time find the longest prefix
  which matches the query rather than simply the last,
- replace `union', `intersection' and `set-difference' in
  `notmuch-show-add-tag' and `notmuch-show-remove-tag' with local code
  to calculate the result of adding and removing a list of tags from
  another list of tags.
2010-10-27 17:41:50 -07:00
Carl Worth
4606ea60a7 emacs: Fix quoting of Message-Id to fix test case of Id containing ".."
If Xapian sees unquoted ".." as in id:123..456 then it thinks that's a
range specification. We avoid this problem by instead passing
id:"123..456" to Xapian.
2010-10-22 17:41:40 -07:00
Carl Worth
4e77148a4b emacs: Allow '|' to operate on multiple messages (by means of prefix argument).
We extend the '|' command so that passing a prefix argument, (for
example, "C-u |"), causes it to pipe all open messages in the current
thread rather than just the single, current message.
2010-09-16 15:52:12 -07:00
Carl Worth
c8da979352 emacs: Fix line-wrapping for help message of notmuch-show mode.
This was previously wrapped for unsubtituted command names. It looks
much better in the notmuch-help (available with '?') if wrapped
according to the length of the substituted command names.
2010-08-19 15:09:55 -07:00
Carl Worth
42e146a3a2 Add C-tab binding in notmuch-search mode as well.
We recently added this to notmuch-hello mode so we might as well
support it in this mode as well for consistency.
2010-06-04 17:16:53 -07:00
David Edmondson
0109f67e38 emacs: Tags should be shown with `notmuch-tag-face'.
Use the same face for tags in `notmuch-show' mode as that used in
`notmuch-search' mode.
2010-06-03 19:13:23 -07:00
David Edmondson
fc37771a71 emacs: Allow the display of absolute dates in the header line.
Add `notmuch-show-relative-dates' to control whether the summary line
in `notmuch-show' mode displays relative dates (e.g. '26 mins. ago') or
the full date string from the message. Default to `t' for
compatibility with the previous behaviour.
2010-06-03 19:09:18 -07:00
Nelson Elhage
35343710a2 emacs: Bind <backtab> (shift-TAB) to notmuch-show-previous-button
Shift-TAB is standard "opposite" of TAB -- in GUI interfaces they
typically cycle through input elements in opposite orders -- so it
makes sense to behave the same way.

Signed-off-by: Nelson Elhage <nelhage@ksplice.com>
2010-06-03 18:17:03 -07:00
David Edmondson
43423e9c88 emacs/notmuch-wash.el: Add `notmuch-wash-convert-inline-patch-to-part'.
Detect inline patches and convert them to fake attachments, in order
that `diff-mode' highlighting can be applied to the patch. This can be
enabled by customising `notmuch-show-insert-text/plain-hook'.
2010-04-27 08:22:40 -07:00
David Edmondson
159b05fcaa emacs: Fix `notmuch-show-rewind' in the presence of invisible text
When determining whether or not to re-align the head of the current
message with the top of the window, use `count-screen-lines' rather
than `count-lines' to allow for invisible text in the preceding
message. When comparing that number of lines against
`next-screen-context-lines', realign if the number of lines of the
previous message visible is 'smaller than or equal to' rather than
just 'smaller than' to improve usability.
2010-04-26 10:33:38 -07:00
David Edmondson
01ec4d3bcb emacs: Add more functions to clean up text/plain parts
Add:
- notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
  the current window whilst maintaining any citation prefix.
- notmuch-wash-tidy-citations: Tidy up citations by:
  - compress repeated otherwise blank citation lines,
  - remove otherwise blank citation lines at the head and tail of a
    citation,
- notmuch-wash-elide-blank-lines: Compress repeated blank lines and
  remove leading and trailing blank lines.

None of these is enabled by default - add them to
`notmuch-show-insert-text/plain-hook' to use.

Reviewed-by: Carl Worth <cworth@cworth.org>: I previously committed a
stale version of this patch.
2010-04-26 10:05:46 -07:00
Carl Worth
6408270512 Revert "emacs: Add more functions to clean up text/plain parts"
This reverts commit 97570954cb.
2010-04-26 10:05:29 -07:00
David Edmondson
75b9b028ea emacs: Correct message/header/citation/signature hiding
Set `buffer-invisibility-spec' to `nil' (a list) if it is just `t'
before inserting any body parts, otherwise removing items from
`buffer-invisibility-spec' (which is what
`notmuch-show-headers-visible' and `notmuch-show-message-visible' do)
is a no-op and has no effect. This caused threads with only matching
messages to have those messages hidden initially because
`buffer-invisibility-spec' stayed `t'.
2010-04-26 08:07:17 -07:00
David Edmondson
97570954cb emacs: Add more functions to clean up text/plain parts
Add:
- notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
  the current window whilst maintaining any citation prefix.
- notmuch-wash-tidy-citations: Tidy up citations by:
  - compress repeated otherwise blank citation lines,
  - remove otherwise blank citation lines at the head and tail of a
    citation and remove blank lines between attribution statements and
    the citation,
- notmuch-wash-compress-blanks: Compress repeated blank lines and
  remove leading and trailing blank lines.

Enable `notmuch-wash-tidy-citations' and
`notmuch-wash-compress-blanks' by default by adding them to
`notmuch-show-insert-text/plain-hook'. `notmuch-wash-wrap-long-lines'
is not enabled by default.

If `notmuch-wash-wrap-long-lines' is enabled, word wrapping of the
buffer leads to an unappealing display of text, so provide a function
to disable it and add it to the list of `notmuch-show-mode' hook
functions.
2010-04-24 07:52:37 -07:00
Carl Worth
a88d1d277b emacs: Rename notmuch-show-headers to notmuch-message-headers
And similarly for notmuch-show-headers-visible to
notmuch-message-headers-visible.

I've never liked notmuch-show as a namespace prefix, but it looks
especially bad when it appears as "Notmuch Show Headers Visible" in
the customize buffer. Give nicer names to these variables which are
exported for user manipulation.
2010-04-24 06:11:57 -07:00
Carl Worth
54ec603bb4 emacs: Don't display From header by default.
This header is redundant with the summary-line of each message which
contains the same information.
2010-04-24 06:06:12 -07:00
Carl Worth
4d2acc3eca emacs: Allow user to customize which headers are visible.
Continuing our tradition of making more and more of the notmuch
functionality configurable fromt eh customize interface.
2010-04-24 06:04:59 -07:00
Carl Worth
ed93a5a19f emacs: Change message headers (To, CC, From, and Date) to be visible by default
Users can still toggle these to be hidden by default, and can still
toggle visibility of headers for a single message with the 'h'
command.
2010-04-24 05:48:04 -07:00
David Edmondson
63b8a2b9af emacs: Allow headers to be shown by default in show mode
Add `notmuch-show-headers-visible' which, when set `t', causes headers
to be shown by default.
2010-04-24 05:47:06 -07:00
Carl Worth
1291d1dcb1 emacs: Rename notmuch-show-toggle-all to notmuch-show-open-or-close-all
The function was named and documented incorrectly before, saying that
it would "change the visibility of all messages". Instead it only
opens the messages that are closed---it doesn't simultanesously close
the messages that are open. (Granted, nobody would *want* that
behavior I don't think, but the naming was confusing before.)
2010-04-23 17:27:14 -07:00
David Edmondson
e6bc99f31f emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET
`notmuch-show-toggle-all' changes the visibility all of the messages
in the current thread. By default it makes all of the messages
visible. With a prefix argument, it makes them all not visible.
2010-04-23 17:24:01 -07:00
Carl Worth
b57d9635f5 emacs: Use single-quote not double-quote when constructing search
Commit 44982ab332 added some extra
quoting when constructing a search. A previous version of this patch
had used single-quotation marks (') while this version used
double-quotation marks (").

The intent of the extra quoting was to allow notmuch-command to be set
to a script invoking ssh.

What actually happens, however is that the extra quotation marks make
it all the way into the query string seen by Xapian. And the double
quotes trigger phrase searching, (which isn't desired here). The
side-effect of that is that the emacs code would fallback to an
unqalified query and display all threads with all messages open.

We fix that side-effect now by using single-quote characters, but
we'll want a better fix in the future to avoid Xapian seeing these
characters at all I think.
2010-04-23 16:39:18 -07:00
David Edmondson
7135a8bcbf emacs: Push the cursor to point-max on n' or N' at the end of a thread
Sebastian pointed out that the pre-JSON UI would move the cursor to
the end of the buffer if `n' or `N' is hit when on the last (unread)
message. Mimic that behaviour in the new UI.
2010-04-23 13:26:32 -07:00
Jesse Rosenthal
44982ab332 Reintroduce patch to quote args in notmuch-show to facilitate remote use
This reintroduces the patch committed in 9193455fa1, which was
reverted during the upgrade to the JSON emacs UI.
2010-04-23 11:59:47 -07:00
Carl Worth
6157fe0bfd emacs/notmuch-show.el: Part headers are real buttons that save the part
Convert the part headers into buttons that save the part when
activated.
2010-04-21 13:19:19 -07:00
David Edmondson
c579c8201f emacs: Display all body parts using `notmuch part --part=<n>'
Use the `notmuch part' command to access body parts not currently
included in the JSON output and display those body parts
appropriately.
2010-04-21 13:14:46 -07:00
David Edmondson
6c0621962a emacs: Use mailcap.el to guess the type of application/octet-stream parts
Use the mailcap functionality to guess a MIME type for attachments of
type application/octet-stream and, presuming successful, feed the
attachment back into the display code with the determine type.

This is mostly useless at the moment, as the JSON output from notmuch
does not include the content of application/octet-stream parts, so
they cannot be displayed even if the guess is a good one.
2010-04-21 13:14:39 -07:00
David Edmondson
4488cf30f6 emacs: Use `mm-display-part' when possible
For parts that the mm-decode/mm-view functions can inline and we have
the content, use `mm-display-part' to insert the part in the
buffer.
2010-04-21 13:10:51 -07:00
David Edmondson
b93c5749fd emacs/notmuch-show.el: Improved part labelling
If a text/plain part is not the first part in a message, add a label
in order that a user can see that multiple parts are present.

If a part has a 'filename' attribute, include it in any label
describing the part.
2010-04-21 13:05:39 -07:00
David Edmondson
3b3da097d8 emacs: Move body markup to a separate file
Move the citation and signature markup for text/plain parts to a new
file (notmuch-wash.el) and call it using a hook mechanism rather than
directly.
2010-04-21 12:55:46 -07:00
Carl Worth
aab9fa307b emacs: Rename body-invis-spec to message-invis-spec
This is more consistent with the related names (toggle-message,
:message-visible, etc.)
2010-04-21 12:52:38 -07:00
Carl Worth
b825204f0d emacs: Remove the notmuch-show-toggle-body command (with "b" binding)
In the recent switch to a JSON-based emacs interface, RET now toggles
message visibility anywhere in the message, (rather than only on the
summary line). So we no longer need this separate "b" binding for this.

Additionally, the body toggle was implemented independently from RET,
so after hiding a message with "b" one could not make it visible with
RET. This confusing state is now no longer possible, (since the
:body-visible property is removed entirely).
2010-04-21 12:52:38 -07:00
David Edmondson
e26d767897 emacs: JSON based implementation
Re-implement notmuch-show.el using the JSON output format of the
notmuch command. Most functionality is retained - HTML display is
noticeably missing.
2010-04-21 12:12:02 -07:00
David Edmondson
f920ff59b9 emacs/notmuch-show.el: Avoid passing unintended format strings to `message'
If the text being stashed included %, `message' was unhappy and
complained.
2010-04-19 10:15:09 -07:00
Jesse Rosenthal
9193455fa1 notmuch.el: quote args in notmuch-show to facilitate remote use
Put single-quotes around the argument of the `show --entire-thread' command
in notmuch-show. This change should have no effect on normal usage.
However, it allows us to use the notmuch.el client with a remote notmuch
binary and database over ssh (by, e.g., setting `notmuch-command' to a
simple shell script). Without the quotes, ssh will not send the command
properly.

One very simple example script is as follows. (Note that it requires
keypair login to the ssh server.)

        #!/bin/sh

        SSH_BIN="/path/to/local/ssh"
        NOTMUCH_HOST="my.remote.server"
        NOTMUCH_REMOTE_PATH="/path/to/remote/notmuch"

        $SSH_BIN $NOTMUCH_HOST $NOTMUCH_REMOTE_PATH $@
2010-04-13 09:14:03 -07:00
Carl Worth
d5f5b38339 Display the last few lines of a citation by default.
As put forth in the commit that enabled this functionality, the last
few lines of a citation are often much more important. In that case,
let's actually do the useful thing by default.
2010-04-07 12:15:08 -07:00
David Edmondson
c44ce805de notmuch.el: Allow citation suffixes to be shown as well as prefixes.
In many conversations the last few lines of a citation are more
interesting than the first few lines, hence allow those to be shown if
desired.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-07 12:10:36 -07:00
David Edmondson
e95dac86f5 notmuch.el: Colour cited regions and signatures with message-cited-text-face
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> (with fixup to
               avoid over-eager coloring of signatures).
2010-04-07 12:02:35 -07:00
Carl Worth
8364c2f36e emacs: Fix typo in line-wrapping in documentation of notmuch-show.
Just trying to keep things neat.
2010-04-07 10:40:29 -07:00
Jesse Rosenthal
9bee20aed3 notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id (supersedes V1--3)
Change the buffer name to a uniquified subject of the thread (i.e. the
subject of the first message in the thread) instead of the thread-id. This
is more meaningful to the user, and will make it easier to scroll through
numerous open buffers.

Note that this patch adds an optional `buffer-name' argument to notmuch
show.

Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-07 10:40:06 -07:00
David Edmondson
e8414a72d4 emacs: Move notmuch-show functionality to notmuch-show.el
To ease the transition to a JSON based implementation of
`notmuch-show', move the current implementation into a separate file.

Create `notmuch-lib.el' to hold common variables.
2010-04-05 09:25:56 -07:00