Commit graph

296 commits

Author SHA1 Message Date
David Bremner
b6f87c3085 emacs: convert to use format-version 3
Keeping the emacs interface running old format-versions makes it
impossible to test new format-versions or deprecate old ones.
2017-07-04 08:32:28 -03:00
Tom Hinton
d848d4040a Fix minor mistake where indentation width is ignored 2017-06-30 08:55:16 -03:00
Damien Cassou
3840b6b495 Add indentation to imenu in notmuch-show 2017-06-30 08:33:29 -03:00
Damien Cassou
a83ab29930 Add Emacs' imenu support in notmuch-show and notmuch-search
Emacs' major modes can facilitate navigation in their buffers by
supporting Imenu. In such major modes, launching Imenu (M-x imenu)
makes Emacs display a list of items (e.g., function definitions in a
code buffer). Selecting an item from this list moves point to this
item.

This patch adds Imenu support to both notmuch-show and notmuch-search
buffers:

* in notmuch-show, Imenu will present a list of all messages in the
  currently visible thread;

* in notmuch-search, Imenu will present a list of all messages in the
  search buffer.
2017-06-14 07:49:08 -03:00
Tomi Ollila
427fa5e6e6 emacs: with prefix argument, notmuch-show-stash-date stashes timestamp
Using timestamp of a message is useful in many Xapian queries.
2017-05-30 08:54:35 -03:00
Mark Walters
df483ed4bd emacs: show: stop display of application/* parts
Gnus seems to display application/zip and application/tar by
default. This doesn't seem desirable so we override it.

We only override if the user has not customized
mm-inline-override-types themselves.
2017-02-26 07:55:00 -04:00
David Bremner
2dd96d6bd6 emacs: resume messages
Provide functionality to resume editing a message previously saved with
notmuch-draft-save, including decoding the X-Notmuch-Emacs-Secure
header.

Resume gets the raw file from notmuch and using the emacs function
mime-to-mml reconstructs the message (including attachments).

'e' is bound to resume a draft from show or tree mode.
2016-11-13 13:15:31 -04:00
Matt Armstrong
c2d1984b02 Add notmuch-show--build-queries.
notmuch-show--build-buffer now queries a list of queries built by the
former.  This simplifies the logic.  It also provides an easy place to
experiment with alternate sets of queries for given notmuch-show-*
variables (e.g. users can use advice-add to do so in a surgical way).
2016-10-22 12:47:09 -03:00
Ioan-Adrian Ratiu
4954bc50e8 emacs: notmuch-show: refresh all windows displaying buffer
This updates all windows displaying a notmuch-show buffer when the
buffer refresh function is called.

Each window displaying a notmuch-show buffer has its own currently
displayed message based on the (point) location. We store the state
of all displayed windows when refreshing a notmuch-show buffer and
re-apply the current shown message (point) for all windows.

Implementation note: Each window has it's own (point) value, besides
the buffer's (point) value. Sometimes these values are identical like
in the case where a single window displays a buffer. When multiple
windows display a buffer, (point) returns each window's specific value.
What we are storing in this changeset is the window values not the
buffer point values. The buffer's point is returned only if no window
is displaying the buffer, a case we do not care about here.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
2016-10-17 09:05:22 -03:00
David Bremner
5d05523659 merge buttonise-links patch to master 2016-10-11 22:42:26 -03:00
David Bremner
f575a346df emacs/show: force notmuch-show-buttonise-links to act on lines
This seems to fix a problem with emacs 25 creating partial buttons by
calling n-s-b-l with a region that does not include the whole button.
I'm not 100% sure it's legit to act outside the region passed by
jit-lock, but goto-address-fontify-region (where I borrowed the code
from) already does this, so this patch to not make things worse.
2016-10-11 22:40:25 -03:00
Mark Walters
ae06fbfc76 emacs: add a tag jump menu
Add a customisable "jump" style menu for doing tagging operations.
2016-10-04 07:55:16 -03:00
Mark Walters
a448879e49 emacs: reply: remove wrong sig/enc status buttons
This stops the (usually incorrect) sigstatus and encstatus buttons
appearing when replying in emacs, and updates the test suite to match.

Overriding the status button functions is a little unusual but much
less intrusive than passing an argument all the way down the call
chain. It also makes it clear exactly what it does.

We also hide the application/pgp-encrypted part as it can only contain
"Version: 1". We do this in notmuch show, which means it also happens
when replying.
2016-09-18 10:57:27 -03:00
Mark Walters
f949215207 emacs: show: let the user override the mime-type of an attachment
This allows the user to override the mime-type of a part in the show
buffer. This takes the simple option of displaying the part with the
specified mime-type in its own buffer (in view mode). This avoids
further complicating the part handling code.

Bound to ". m" (i.e., m in the part map). Then the user can either
enter a mime-type (with completion to all mime types that mailcap (and
thus notmuch) knows about, or press return for the default choice of
text/plain.
2016-09-12 08:03:34 -03:00
Steven Allen
e954310d70 emacs: use define-derived-mode for defining modes.
This sets up and runs all the correct hooks and reduces some redundancy.
2016-09-10 13:07:54 -03:00
Mark Walters
dd5cd6964f emacs: show: improve handling of mark read tagging errors
Previously if a marking read tag change (i.e., removing the unread
tag) failed for some reason, such as a locked database, then no more
mark read tag changes would be attempted in that buffer.

This handles the error more gracefully. There is not much we can do
yet about dealing with the error itself, and marking read is probably
not important enough to warrant keeping a queue of pending changes or
anything.

However this commit changes it so that

- we do try and make future mark read tag changes.

- we display the tag state correctly: i.e. we don't display the tag as
  deleted (no strike through)

- and since we know the tag change failed we can try to mark this
  message read in the future. Indeed, since the code uses the
  post-command hook we will try again on the next keypress (unless the
  user has left the message).

We indicate to the user that these mark read tag changes may have
failed in the header-line.
2016-06-28 09:20:54 +02:00
Daniel Kahn Gillmor
6a833a6e83 Use https instead of http where possible
Many of the external links found in the notmuch source can be resolved
using https instead of http.  This changeset addresses as many as i
could find, without touching the e-mail corpus or expected outputs
found in tests.
2016-06-05 08:32:17 -03:00
Tomi Ollila
fd3503e99e emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode
This binding is similar to mutt's, which is

bind {mode} b   "bounce-message"    # remail a message to another user

where {mode} is 'index', 'pager' or 'attach'.
2016-05-19 07:53:51 -03:00
Tomi Ollila
c13ff402c4 emacs: add function to resend message to new recipients
The new function notmuch-show-message-resend re-sends
message to new recipients using #'message-resend.

Recipients are read from minibuffer as a comma-separated
string (with some keyboard support including tab completion).

Final confirmation before sending is asked.
2016-05-19 07:53:40 -03:00
Chunyang Xu
0cf457b73b emacs: Fix packaging
Refer to (info "(elisp) Library Headers") for package conventions.
2016-04-16 08:24:42 -03:00
David Edmondson
f8effea9a3 emacs: Always insert crypto buttons.
When no decryption or signature examination is
happening (i.e. `notmuch-crypto-process-mime' is `nil') insert buttons
that indicate this, rather than remaining silent.
2016-04-10 20:46:58 -03:00
David Edmondson
f0881394bd emacs: Allow part preferences to depend on message content.
Currently the preference for which sub-part of a multipart/alternative
part is shown is global. Allow to the user to override the settings on a
per-message basis by providing the ability to call a function that has
access to the message to return the discouraged type list.

The original approach is retained as the default.
2016-04-09 16:17:20 -03:00
David Edmondson
742b566cac emacs: Neaten `notmuch-show-insert-bodypart-internal'. 2016-03-27 17:42:31 -03:00
David Edmondson
cb4e90e476 emacs: `notmuch-show-insert-part-multipart/encrypted' should not assume the presence of a button.
Missed in c802d12a1e.
2016-03-27 17:42:06 -03:00
David Edmondson
dc13fcbf87 emacs: notmuch-show-forward-message' can use notmuch-mua-new-forward-messages'
Which allows `notmuch-mua-new-forward-message' to be removed.
2016-03-24 08:02:15 -03:00
David Edmondson
a982773dfb emacs: Add `notmuch-show-forward-open-messages'.
Add a function to forward all open messages in the current view of a
thread. Bind this to "F".
2016-03-24 08:01:50 -03:00
David Edmondson
d27d90875d emacs/mua: Let user specify which parts get a header in citations.
Add a customizable function specifying which parts get a header when
replying, and give some sensible possiblities. These are,

1) all parts except multipart/*. (Subparts of a multipart part do
receive a header button.)

2) only included text/* parts.

3) Exactly as in the show buffer.

4) None at all. This means the reply contains a mish-mash of all the
original message's parts.

In the test suite we set the choice to option 4 to match the
previous behaviour.
2016-02-21 08:37:48 -04:00
David Edmondson
adefa734e3 emacs/show: Remove the 'no-buttons option of `notmuch-show-insert-bodypart'
No code uses the 'no-buttons argument to
`notmuch-show-insert-bodypart', so remove it.
2016-02-21 08:37:39 -04:00
David Edmondson
c802d12a1e emacs/show: Accommodate the lack of part header buttons
Various pieces of code assumed (reasonably) that part header buttons
are present. Modify them to avoid problems if no part headers were
inserted.
2016-02-21 08:37:17 -04:00
David Edmondson
92a1f9ba17 emacs/show: Make the insertion of part headers overridable.
This allows callers of notmuch-show-insert-bodypart to use a `let'
binding to override the default function for specifying when part
headers should be inserted.

We also add an option to never show part buttons which will be used by
the test suites for the reply tests.
2016-02-21 08:37:08 -04:00
David Edmondson
65a2a58a81 emacs/show: Re-arrange determination if a part header is necessary
Move the determination of whether a part header is required to a
distinct function.
2016-02-21 08:37:00 -04:00
David Edmondson
c689d1ff13 emacs: Report a lack of matches when calling `notmuch-show'.
If the basic query passed to `notmuch-show' generates no results, ring
the bell and inform the user that no messages matched the query rather
than displaying an empty buffer and showing an obscure error.

Similarly when refreshing a `notmuch-show' buffer and no messages match.
2016-02-20 08:52:50 -04:00
Tomi Ollila
bfb7098514 emacs: notmuch-show-view-raw-message clears buffer, makes it read-only
notmuch-show-view-raw-message() re-uses buffer created with same
name (same Message-Id:) but it did not erase it before filling.
If this ever happened, there were duplicated (potentially overlapping)
content in the buffer. Now this is fixed.
Apparently since emacs 24.5 the (view-buffer) makes the buffer read-only;
so this problem would not have happened there, just that
notmuch-show-view-raw-message() failed. This is fixed by setting
inhibit-read-only t before erasing and filling the buffer. The emacs 24.5
feature having raw message buffer read-only is also now explicitly set to
the buffer so the same experience is available with emaces < 24.5.
2015-11-21 08:02:10 -04:00
H. J. Illikainen
cbf2448bb1 emacs: Fontify From with message-header-other
Commit e26d767897 changed the
fontification of the body associated with the From header to
message-header-from.  However, that face is non-existent, and in
message.el (message-font-lock-keywords) the From-header falls through
and is attributed the message-header-other face.

This commit removes the fontification of the [Ff]rom header in
notmuch-show-mode in order to fontify it using the message-header-other
face.

This only affects non-default configurations where
notmuch-message-headers is set to display From.
2015-11-09 22:25:05 -04:00
Mark Walters
ff1fb5027c emacs: show: increase default max-text-part-size
Currently notmuch-show-max-text-part-size is 10000 which means some
relatively normal messages have all parts hidden by default. Increase
this to 100000 by default.

The setting was introduced to alleviate problems with notmuch being
very slow on large threads. Users hitting these problems may wish to
customize this variable to something smaller (like 10000).
2015-10-17 09:07:36 -03:00
Mark Walters
2982d70ac6 emacs: add a filter option to show
Show the current thread with a different filter (i.e., open messages
in the thread matching the new query).

Bound to 'l' for "limit".

Note that it is not the same as filter in search mode as it replaces
the existing query rather than ANDing with it (but it does keep the
thread-id part of the query).
2015-08-04 09:15:23 +02:00
Mark Walters
d4053be21a emacs: split notmuch-show-apply-state
Separate out a notmuch-show-goto-msg-id sub-function from
notmuch-show-apply-state. There should be no functional change but the
next patch will call the new function.
2015-08-04 09:15:13 +02:00
Mark Walters
6518f0d2bc emacs: show: hide large text attachments by default
notmuch-show can be slow displaying large attachments so hide them by
default. The default maximum size is 10000 bytes/characters but it is
customizable.

Note that notmuch-show-insert-bodypart is also called from the reply
code so we need to be a little careful.
2015-04-03 09:29:05 +09:00
Jinwoo Lee
2049205e09 emacs: Add a defcustom that specifies regexp for blocked remote images.
It's default value is ".", meaning all remote images will be blocked
by default.
2015-02-02 23:07:01 +01:00
Austin Clements
b74ed1cfad emacs: Support cid: references with shr renderer
shr has really nice support for inline image rendering, but previously
we only had the hooks for w3m cid: references.
2015-01-25 18:39:13 +01:00
Austin Clements
f84cbb1d4d emacs: Rewrite content ID handling
Besides generally cleaning up the code and separating the general
content ID handling from the w3m-specific code, this fixes several
problems.

Foremost is that, previously, the code roughly assumed that referenced
parts would be in the same multipart/related as the reference.
According to RFC 2392, nothing could be further from the truth:
content IDs are supposed to be globally unique and globally
addressable.  This is nonsense, but this patch at least fixes things
so content IDs can be anywhere in the same message.

As a side-effect of the above, this handles multipart/alternate
content-IDs more in line with RFC 2046 section 5.1.2 (not that I've
ever seen this in the wild).  This also properly URL-decodes cid:
URLs, as per RFC 2392 (the previous code did not), and applies crypto
settings from the show buffer (the previous code used the global
crypto settings).
2015-01-25 18:39:13 +01:00
Austin Clements
b0b5ced82b emacs: Use generalized content caching in w3m CID code
Previously this did its own caching, but this is now supported by more
generally by `notmuch-get-bodypart-binary'.
2015-01-25 18:39:13 +01:00
Austin Clements
991efcded8 emacs: Remove broken `notmuch-get-bodypart-content' API
`notmuch-get-bodypart-content' could do two very different things,
depending on conditions: for text/* parts other than text/html, it
would return the part content as a multibyte Lisp string *after*
charset conversion, while for other parts (including text/html), it
would return binary part content without charset conversion.

This commit completes the split of `notmuch-get-bodypart-content' into
two different and explicit APIs: `notmuch-get-bodypart-binary' and
`notmuch-get-bodypart-text'.  It updates all callers to use one or the
other depending on what's appropriate.
2015-01-25 18:39:13 +01:00
Austin Clements
021906d6ec emacs: Create an API for fetching parts as undecoded binary
The new function, `notmuch-get-bodypart-binary', replaces
`notmuch-get-bodypart-internal'.  Whereas the old function was really
meant for internal use in `notmuch-get-bodypart-content', it was used
in a few other places.  Since the difference between
`notmuch-get-bodypart-content' and `notmuch-get-bodypart-internal' was
unclear, these other uses were always confusing and potentially
inconsistent.  The new call clearly requests the part as undecoded
binary.

This is step 1 of 2 in separating `notmuch-get-bodypart-content' into
two APIs for retrieving either undecoded binary or decoded text.
2015-01-25 18:39:13 +01:00
Austin Clements
c67a04de60 emacs: Track full message and part descriptor in w3m CID store
This will simplify later changes.
2015-01-25 18:39:12 +01:00
David Bremner
cc3d25dd34 emacs: escape % in header line format
We set header-line-format to the message subject, but if the subject
contains percents, the next character is interpreted as a formatting
control, which is not desired.
2015-01-24 09:38:46 +01:00
Jani Nikula
71fb37d482 emacs: add stash support for git send-email command line
Stash From/To/Cc as --to/--to/--cc, respectively, and Message-Id as
--in-reply-to, suitable for pasting to git send-email command line.
2015-01-17 11:35:01 +01:00
David Edmondson
7585e8c906 emacs: with-current-notmuch-show-message' should not leak coding-system-for-read'
`with-current-notmuch-show-message' applies a `no-conversion' coding
system when reading a raw message from notmuch. That coding system
should _not_ be applied when the body of the macro is evaluated, as it
can cause file operations used during that evaluation to incorrectly
apply the `no-conversion' coding system.

This was discovered when a user's .signature file contained non-ASCII
characters. When a message is forwarded, the `no-conversion' coding
system was applied to the reading of the .signature file, resulting in
raw rather than UTF-8 interpretation of the data.
2014-11-26 18:26:07 +01:00
Mark Walters
78a1575aa4 emacs: show: document the mark unread defcustom function 2014-11-09 16:08:58 +01:00
David Edmondson
30f1c43efe emacs: Improve the behaviour of the 'q' binding.
When a user hits 'q' in a notmuch buffer, kill the buffer only if
there are no other windows currently showing it.
2014-10-31 17:54:21 +01:00