Commit graph

799 commits

Author SHA1 Message Date
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
David Bremner
90248f862b emacs: check drafts for encryption tags before saving
In general the user may not want to save plaintext copies of messages
that they are sending encrypted, so give them a chance to abort.
2016-11-13 13:15:31 -04:00
Mark Walters
d820b97477 emacs: postpone a message
This provides initial support for postponing in the emacs frontend;
resuming will follow in a later commit. On saving/postponing it uses
notmuch insert to put the message in the notmuch database

Current bindings are C-x C-s to save a draft, C-c C-p to postpone a
draft (save and exit compose buffer).

Previous drafts get tagged deleted on subsequent saves, or on the
message being sent.

Each draft gets its own message-id, and we use the namespace
draft-.... for draft message ids (so, at least for most people, drafts
are easily distinguisable).
2016-11-13 12:55:24 -04:00
Mark Walters
f8bdba37d3 emacs: tree: remove binding for pressing button in message pane
We want to use "e" for editting postponed messages in show, and in
tree view, so remove the binding for the function which does

     (In message pane) Activate BUTTON or button at point
2016-11-13 12:55:16 -04:00
David Bremner
4817005bfc emacs: rename notmuch-address-completion-hook to notmuch-address-post-completion-functions
Apparently it is a (not completely adhered to) emacs convention [1] that
only hooks that don't take arguments end in 'hook'

[1]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks.html
2016-11-13 08:52:17 -04:00
David Bremner
343534d82d emacs: add notmuch-address-post-completion-hook
This hook can be used to update the message based on the results of
address completion. For example using message-templ or gnus-alias to set
the From address based on the To address just completed.

The post-completion command is added to the notmuch-company backend to
ensure that the hook is also called company completion is started
without going through notmuch-address-expand-name. See the docstring of
`company-backends' for more information.
2016-11-04 12:51:50 -03:00
Mark Walters
e5786283e7 emacs: tree: use message pane decryption state for replies
This makes replying to a message in tree view, use the decrypted state
from the message pane if it is open. Previously it just used the
global decryption state from notmuch-crypto-process-mime.

In particular if notmuch-crypto-process-mime is nil, and the user
views the messages (which doesn't decrypt), toggles decryption in the
message pane, and then replies, the reply will be decrypted.
2016-11-02 07:45:28 -03:00
Mark Walters
8a20400490 emacs: tree: allow the user to decrypt the message pane
This makes $ in the tree pane toggle decryption in the message
pane. Without this the user can only decrypt the message pane by
switching to it, or by setting decryption on globally by setting
notmuch-crypto-process-mime to t.
2016-11-02 07:45:18 -03:00
Matt Armstrong
d62f9dbfc0 emacs: make faces readable on dark backgrounds.
The notmuch-tag-flagged, notmuch-search-flagged-face and
notmuch-crypto-part-header faces defaulted to "blue", which is nearly
unreadable when a dark background is in use.  This is addressed by using
"LightBlue1" for dark backgrounds.

As a side effect, these faces are now no-op definitions for grayscale or
mono displays.
2016-11-02 07:40:20 -03:00
Mark Walters
b810e64242 emacs: make notmuch-search-tag tag the region when called non-interactively.
The normal tag commands in search mode tag the all threads meeting the
region when called interactively. This makes them do the same when
called non-interactively. This is a change in the api.
2016-10-31 08:10:27 -03:00
David Bremner
608a3cb231 Merge branch 'release'
merge interesting buffers bugfix from release
2016-10-25 21:57:23 -03:00
Mark Walters
8128c7b5aa emacs: tree: make tag updates show in the message pane
This makes tag changes appear in the message pane as well as in the
tree window.

Note that the message pane is reloaded each time a message is viewed
so the tags shown in the message pane can still be different from
those in the tree window. Usually this will just be that the tag
change is still shown as a change (strikethough underline etc) in the
tree window, and are shown after the change in the message
pane. However, if something else updates the database then the tags
shown can be genuinely different.
2016-10-25 18:13:16 -03:00
Mark Walters
09caa0fce7 emacs: interesting-buffer bugfixes/updates
The command notmuch-interesting-buffer has got out of date -- it
doesn't mention notmuch-tree, and it still refers to message-mode not
notmuch-message-mode. Update both of these.

This fixes the bug that notmuch-cycle-notmuch-buffers does not include
notmuch-tree or notmuch-message-mode buffers in its cycling.
2016-10-25 18:12:12 -03: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
David Bremner
d93e9cee13 Merge in test-suite, docstring fixes, release prep 2016-10-22 12:44:39 -03:00
Keith Amidon
4bf3bb31dd Expand docstrings about fcc using notmuch-insert
This commit expands docstrings for notmuch-fcc-dirs and
notmuch-maildir-fcc-with-notmuch-insert to describe how quoted strings
are processed and make the ability to configure sent folders containing
whitespace more discoverable.
2016-10-22 12:28:13 -03:00
David Bremner
9dea5b8804 Merge emacs face fixes and NEWS 2016-10-19 08:44:35 -03:00
Mark Walters
4c822aecc7 emacs: search face bugfix
In commit 2a7b11b064 the default faces
for unread and flagged were accidentally swapped. This swaps them back.
2016-10-19 08:39:58 -03:00
Mark Walters
a4331bf138 emacs: fix notmuch-search-line-faces defcustom
In commit 2a7b11b064 the default value
for notmuch-search-line-faces was changed so that it didn't match the
specification in the corresponding defcustom. This meant that it was
difficult for the user to customize this variable as they got a type
mismatch error.

Note anyone who had already customised this variable would not see
this bug as their customisation would match the defcustom.
2016-10-19 08:39:36 -03:00
Mark Walters
2f643ac763 emacs: add global keybinding M-= for refresh all buffers
We can't use c-u = as some of the notmuch-show refresh function
already uses that. This is a global keybinding for a relatively
infrequent function but M-= seems unlikely to cause conflicts.
2016-10-17 09:07:54 -03:00
Ioan-Adrian Ratiu
02d3c76102 emacs: notmuch-lib: add refresh all buffers function
notmuch-refresh-all-buffers calls each buffer's major mode specific
refresh function using the generic notmuch-refresh-this-buffer function.

Since the earlier changesets have stopped the refresh functions from
forcing the buffers to be redisplayed this can refresh buffers that
are not currently displayed without disturbing the user.  This is very
useful for silent async background updating the emacs display when new
mail is fetched.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
2016-10-17 09:07:32 -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
Ioan-Adrian Ratiu
fae3d361f2 emacs: notmuch-search-refresh-view: reuse buffer
There's no reason to completely kill a buffer while refreshing its
search results because the buffer name is constant between refreshes
(based on the search query), only its contents may change and notmuch
search kills all local variables, so it's safe to reuse.

Reusing the same buffer also makes it possible to do things like
refreshing a buffer which is not focused or even not shown in any
window - this will be used in the next commits to add auto-refresh
capabilities to all existing notmuch buffers + a function to call
after syncing mail to refresh everything.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
2016-10-17 09:05:05 -03:00
Ioan-Adrian Ratiu
e37a64da7a emacs: notmuch-search: add no-display functionality
If no-display is non-nil when calling notmuch-search then do not force
the search buffer to be displayed.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
2016-10-17 09:04:53 -03:00
Mark Walters
a9ab5e42af emacs: hello: stop update from forcing the buffer to be displayed
Make the notmuch-hello refresh function (notmuch-hello-update) not
force the buffer to be displayed. All the callers call it when the
buffer is already displayed so it will only affect non-interactive
callers. Since it is just a trivial wrapper of notmuch-hello anyone
who wants to force the buffer to be displayed should just call
notmuch-hello.
2016-10-17 09:04:38 -03:00
Mark Walters
5e83fe979d emacs: make the refresh functions more consistent
The different refreshed functions were called differently: some were
called interactively and some were not. Make them all interactive.
2016-10-17 09:01:52 -03:00
Mark Walters
cd7e497d07 emacs: tree: make refresh use generic binding
Not using the generic binding is an anomaly from when tree was in
contrib (as pick).
2016-10-17 09:01:40 -03:00
Matthew Lear
0301055f07 Fix reply to encrypted mail when discouraging plain text.
If an encrypted multipart message is received which contains html and
notmuch-multipart/alternative-discouraged is set to discourage "text/plain",
any encrypted parts are not decrypted during generation of the reply
text. This fixes that problem by making sure notmuch-mua-reply does
that.
2016-10-17 08:55:04 -03:00
Mark Walters
fae577cc48 emacs: jump: make multilevel keys do multilevel jump
notmuch jump allows the user to specify a key sequence rather than
just a single key for its bindings. However, it doesn't show what has
already been typed so it can be difficult to see what has
happened. This makes each key press appear, and the jump menu reduce
to the possible follow up keys.

We also bind backspace (emacs symbol DEL) to go back up a level in the
subjumpmaps, and to exit from the top level.
2016-10-15 21:51:17 -03:00
Mark Walters
190a30b263 emacs: tag-jump: docstring fix
In commit 297d091e1c the key for
switching to the reverse keymap was changed from r to k but the
docstring for the defcustom was not updated. This changeset updates
the documentation to match.
2016-10-15 21:49:48 -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
9259c7971d emacs: mua: check for misplaced secure mml tags
Emacs message-send seems to ignore a secure mml tag anywhere except at
the start of the body, and it must be followed by a newline. Since
this is almost certainly not desired we check for it, and require user
confirmation before sending.

As the setup before message-send or message-send-and-exit is getting
more complicated it is convenient to unify the two correspoinding
notmuch functions.
2016-10-09 08:53:14 -03:00
Mark Walters
025bf3cd4a emacs: mua: extract a common message-send function.
This commit adds a common message-send function for message-send and
message-send-and-exit. At the moment the overlap is small, but the
message-send function will get more complex.
2016-10-09 08:53:01 -03:00
Mark Walters
0c52b5d3b2 emacs: include first match in address completion
The current code for address completion takes the list of possible
completions (whether generated internally or externally), makes the
first match the initial value for the completion, and puts all the
others (but not the first match) into the possible completions.

This has the nice effect that the <down> key takes you immediately to
the next completion (whereas if the first match were included in the
possible completions it would take you to the first match
again).

However, it has two side effects. First, once you have completed to
the full match you find it says and try completing again you get told
"no match" not "sole completion". Secondly, if you delete some of the
text and try completing you don't get the first match as an option.

This tries to get round most of these problems by including the full
list of possible completions, but with the first match moved to the
very end of the list.
2016-10-09 08:50:32 -03:00
Mark Walters
385413e059 emacs: add mimetype completions to searches 2016-10-09 08:50:02 -03:00
Mark Walters
297d091e1c emacs: tag-jump: make k binding for the reverse tag change map
Currently, by default k invokes the tag-jump menu, and following it by
r invokes the reverse tag change jump menu. This is awkward to type
(e.g. k r u for undoing a -unread change). This changes it so that k
followed by k invokes the reverse menu. We make the key for the
reverse map a variable as that makes it possible for a user to
change it by editing their .emacs file.
2016-10-07 22:35:42 -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
0b138c2686 emacs: fcc: say we are doing Fcc
Since doing the Fcc with notmuch insert could be slow (if the indexing
takes some time) add a message saying we are doing it.
2016-09-30 07:13:54 -03:00
Mark Walters
4266e76eed emacs: document notmuch-fcc-dirs
This updates the docstring for the variable notmuch-fcc-dirs to match
the new insert code.
2016-09-29 08:07:38 -03:00
Mark Walters
9966720453 emacs: tree: make b bounce a message and backspace scroll message pane up
This tweaks the keybindings in tree-mode. It make b do bounce/resend
matching show-mode. Since b was already bound to scroll message pane
back, we now use backspace for that.

This means space/backspace scroll the message pane forwards/backwards,
and page-up/page-down scrolls the tree pane forwards/backwards.
2016-09-26 13:01:31 -03:00
Mark Walters
51d27e0855 emacs: tag deleted face bugfix
Commit d25d33ff cleaned up some of the tag face code. However, for the
face notmuch-tag-deleted it used the test

((class color) (supports :strike-through))

to decide whether to use red strikethrough or inverse-video (emacs in
a terminal typically doesn't support red strikethrough, but in X it does).

However, it seems that test often returns true even though red
strikethrough is not supported. This breaks the tag update code -- the
wrong thing is displayed to the user.

Thus we make the test explicitly more specific, changing the test to

((class color) (supports :strike-through "red"))
2016-09-25 07:42:01 -03:00
Mark Walters
7b2d7d6512 emacs: tree: make jump close message pane
j is in the global notmuch keymap bound to notmuch jump. In tree-mode
it makes sense to close the message pane first (otherwise the new
search runs in the small top pane of tree-mode).
2016-09-24 10:08:24 -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
Matt Armstrong
d25d33ff2d emacs: make the remaining faces configurable.
I believe this moves all "anonymous" face specifications in notmuch
code into a configurable defface.
2016-09-12 08:12:10 -03:00
Matt Armstrong
3856286e21 emacs: implement notmuch-search-color-line with dolist.
While passing a lambda to mapc is idiomatic elisp, dolist is easier
to understand, and there are a few other calls to it in this file.
2016-09-12 08:08:45 -03:00
Mark Walters
7b7960ea22 emacs: wash: make word-wrap bound message width
Previously if notmuch-wash-wrap-lines-length was set then all messages
would be wrapped at this value (or window-width if that is
smaller). This was done regardless of the message's depth in a thread --
for example, if the n.w.w.l.l is 80 and the messages depth is 20
(so indented 20 by default) the messages text only got 60 characters
of space.

This commit changes that so a message always gets the full n.w.w.l.l
of width regardless of its indentation (unless that goes over
window-width of course).
2016-09-12 08:06:00 -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
fce8146a8b emacs: maildir: add the actual insert code
With all the preparation it is now simple to add the actual insert
code. Since insert can fail for many reasons we let the user decide
interactively deal with it.

We modify test-lib.el to set file fcc, so that all the old tests and
emacs_fcc_message from test-lib.sh still work
2016-09-04 08:23:14 -03:00