Commit graph

790 commits

Author SHA1 Message Date
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
Mark Walters
cf59859b20 Modify our local copy of message-do-fcc
Since we also need to use this code for the draft handling we split
message-do-fcc into convenient sub-chunks (functions or macros as
appropriate).
2016-09-04 08:23:04 -03:00
Mark Walters
aa1e8352de emacs: simplify our local copy of message-do-fcc
message-do-fcc has lots of functionality we don't need, so remove it.
2016-09-04 08:22:56 -03:00
Mark Walters
967bbc0792 emacs: maildir import message-do-fcc
We will need our own local copy of message-do-fcc so this commit just
copies the code straight from message.el so that it is easier to see
our local changes coming in the next commit.
2016-09-04 08:22:48 -03:00
Mark Walters
37859d1fcb emacs: maildir-fcc: prepare for use of notmuch insert
We move some code around in preparation for the use of notmuch
insert. In particular, we move the check for a valid maildir for the
fcc to when the message is sent rather than when the fcc header is
inserted. The main motivation is consistency with the insert version
(coming later) where we cannot check the validity until send.

We allow the user some chance to correct the header; the choice here
is intended to be consistent with the insert version to come.
2016-09-04 08:22:39 -03:00
Mark Walters
74b54fb0fa emacs: notmuch-check-exit-status bugfix
This function prints diagnostic information in the event of an
error. However, one of the callers has an optional :stdin-string
keyword argument. This causes the error printing routine to error
itself.

Rather than reach notmuch-check-exit-status about the possible keyword
arguments (currently only one but could be more in the future) this
commit just tells notmuch-check-exit-status how to print non-string arguments.
2016-09-04 08:22:30 -03:00
Mark Walters
827c28a04e emacs: address: allow internal completion on an individual basis
This commit makes two changes. The first allows the user to override
an external completion method with the internal notmuch address based
completion for an individual buffer.

Secondly, if the user has company-mode enabled then it sets up company
mode (based on internal completion) but disables the automatic timeout
completion -- the user can still activate it in when desired with
standard company commands such as company-complete.
2016-09-04 08:07:59 -03:00
Mark Walters
2cf0ef3998 emacs: address completion, allow sender/recipient and filters
This commit lets the user customize the address completion. It makes
two changes.

The first change controls whether to build the address completion list
based on messages you have sent or you have received (the latter is
much faster).

The second change add a possible filter query to limit the messages
used -- for example, setting this to date:1y..  would limit the
address completions to addresses used in the last year. This speeds up
the address harvest and may also make the search less cluttered as old
addresses may well no longer be valid.
2016-09-04 08:07:46 -03:00
Daniel Kahn Gillmor
1ba73d1437 Omit User-Agent: header by default
The User-Agent: header can be fun and interesting, but it also leaks
quite a bit of information about the user and their software stack.

This represents a potential security risk (attackers can target the
particular stack) and also an anonymity risk (a user trying to
preserve their anonymity by sending mail from a non-associated account
might reveal quite a lot of information if their choice of mail user
agent is exposed).

This change also avoids hiding the User-Agent header by default, so
that people who decide they want to send it will at least see it (and
can edit it if they want to) before sending.

It makes sense to have safer defaults.
2016-08-11 20:16:00 +09:00
Mark Walters
999d473299 emacs: wash: word-wrap bugfix
Previously notmuch-wash made the width of the text (approximately) the
window-width minus the depth in thread. This is correct for the
default indentation of 1 per message depth, but is incorrect for any
other setting of notmuch-show-indent-messages-width.

As notmuch-show-indent-messages-width is customisable, and notmuch-tree
sets it to zero to avoid indenting messages in the message pane, this
bug can show up in real use.

Two of the tests had to be updated: when
notmuch-show-indent-messages-width is 0, then the new (correct) word
wrapping happens later, when notmuch-show-indent-messages-width is 4,
then the new word wrapping happens sooner.
2016-08-09 09:34:25 +09:00