Commit graph

752 commits

Author SHA1 Message Date
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
Matt Armstrong
2a7b11b064 emacs: express n-search-line-faces in terms of two new faces
The two new faces (notmuch-search-flagged-face and
notmuch-search-unread-face) make it easier to find the relevant face by
customizing notmuch-faces.  I plan to do the same to the other alists of
faces found elsewhere.
2016-08-02 13:40:44 +09: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
David Edmondson
64b0d21da0 emacs: Tell `message-mode' that outgoing messages are email.
When composing messages (including replies, etc.), indicate to
`message-mode' definitively that the message is email (as opposed to
Usenet news) rather than having it attempt to determine this for itself.

This causes `message-mode' to observe such variables as
`message-default-mail-headers', which previously happened haphazardly.
2016-05-01 08:06:24 -03:00
David Edmondson
fdce7eb545 emacs: Observe the charset of MIME parts when reading them.
`notmuch--get-bodypart-raw' previously assumed that all non-binary MIME
parts could be successfully read by assuming that they were UTF-8
encoded. This was demonstrated to be wrong, specifically when a part was
marked as ISO8859-1 and included accented characters (which were
incorrectly rendered as a result).

Rather than assuming UTF-8, attempt to use the part's declared charset
when reading it, falling back to US-ASCII if the declared charset is
unknown, unsupported or invalid.
2016-05-01 08:04:07 -03:00
David Edmondson
bfd8100cff emacs: Don't indent multipart sub-parts during reply.
When generating cited messages for replay, override any existing
setting for `notmuch-show-indent-multipart' to ensure that no
indentation occurs.
2016-04-16 09:40:14 -03:00
Chunyang Xu
e5548d52b9 emacs: Add notmuch homepage to package header
So user can find out notmuch's homepage with:

  C-h P ('describe-package') notmuch
2016-04-16 08:25:10 -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
aeuii@posteo.de
fd6f65f241 emacs: make use of `message-make-from'
Please put my address in CC when replying.  Thanks!

From 4b9ab261a0ea8a31065e310c5150f522be86d37b Mon Sep 17 00:00:00 2001
From: stefan <aeuii@posteo.de>
Date: Fri, 8 Apr 2016 22:47:06 +0200
Subject: [PATCH] emacs: make use of `message-make-from'

Will respect `mail-from-style'.
2016-04-10 20:53:48 -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
c41d0db077 emacs: Improve the acquisition of text parts.
`notmuch-get-bodypart-text' assumed that it is always possible to
acquire text/* parts via the sexp output format. This is not true if the
part in question has a content type of application/octet-stream but is
being interpreted as text/* based on the extension of the part filename.

Rework `notmuch-get-bodypart-text' to use the raw output format to
address this and make the implementation common with that of
`notmuch-get-bodypart-binary'.
2016-03-27 17:44:24 -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
3b63856568 emacs: Improve crypto button labels.
Make the labels for both encryption and signature buttons share a common
format, in which both report the status if it is not one of those known.
2016-03-24 07:58:52 -03:00
Nicolas Petton
e253c94888 emacs: Change the default notmuch-mua-reply-insert-header-p-function
Set notmuch-show-reply-insert-header-p-never as the default value for
notmuch-mua-reply-insert-header-p-function.
2016-03-19 11:18:03 -03:00
Jani Nikula
b8a136187a emacs: hello: promote '?' as the universal help key
Move the brief help text at the bottom of the hello screen to the
notmuch-hello-mode help, and promote '?' as the universal help key
across Notmuch. This unclutters the hello screen, and allows for a
more verbose description in the mode help. Hopefully, this change is
useful for both experienced and new users alike.

While at it, improve the links to Notmuch and hello screen
customization.
2016-03-14 19:54:32 -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
e103f0a971 emacs/mua: Generate improved cited text for replies
Use the message display code to generate message text to cite in
replies.

For now we set insert-headers-p function to
notmuch-show-reply-insert-header-p-never so that, as before, we don't
insert part buttons.

With that choice of insert-headers-p function there is only one
failing test: this test has a text part (an email message) listed as
application/octet-stream. Notmuch show displays this part, but the
reply code omitted it as it had type application/octet-stream. The new
code correctly includes it. Thus update the expected output to match.
2016-02-21 08:37:26 -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
Mark Walters
7edba1d17d emacs: Bind filter in search to 'l'
Change the key binding for filter (or "limit") in search-mode. This
gives consistency with the new filter in show-mode, and frees 'f' for
forward-thread in the future.
2016-02-13 12:40:01 -04:00
David Edmondson
8d3d92bd8e emacs: Fix compiler warnings.
notmuch-mua.el should declare functions that it uses from
notmuch-maildir-fcc.el.
2016-02-13 12:31:42 -04:00
Michal Sojka
10f4724a8d emacs: Don't use nconc on quoted list
As pointed out by David Bremner, Elisp manual says "A common pitfall
is to use a quoted constant list as a non-last argument to ‘nconc’."
Since this was the case in recently added code, we fix it here.
2016-01-08 08:32:49 -04:00
Michal Sojka
1de4d5bb0d emacs: Handle switch-function argument of notmuch-mua-mail
notmuch-mua-mail ignored the switch-function argument and always used
the function returned by notmuch-mua-get-switch-function instead. In
order to support standard emacs interfaces (compose-mail in this
case), this commit changes notmuch-mua-mail to use the switch-function
argument if it is non-nil and notmuch-mua-get-switch-function
otherwise.
2016-01-08 08:32:48 -04:00
Michal Sojka
332b593775 emacs: Refactor notmuch-mua-mail
This should be more readable.
2016-01-08 08:32:48 -04:00
Michal Sojka
7e20d26480 emacs: Fix mail composition under Emacs 23
Commit 570c0aeb40 reworked
notmuch-mua-mail function in a way that worked only under Emacs 24.
The reason was that message-setup-1 took one argument less in Emacs
23.

We fix this by only supplying the return-action argument when it is
actually set by the caller.
2016-01-08 08:32:48 -04:00
Michal Sojka
570c0aeb40 emacs: Improve notmuch-message-mode initialization
Recent addition of notmuch-message-mode introduced several problems:

1. When message-setup-hook is used to set buffer local variables,
   these settings are not effective, because all buffer local
   variables are immediately erased by notmuch-message-mode
   initialization.

2. message-mode-hook gets invoked twice - first when message-mail
   invokes message-mode and second when notmuch-mua-mail invokes
   notmuch-message-mode.

This commit fixes these problems by replacing a call to message-mail
with notmuch-specific code that is (hopefully) equivalent to
message-mail functionality before introduction of
notmuch-message-mode.

We first initialize notmuch-message-mode with
notmuch-mua-pop-to-buffer, which is a modified version of
message-pop-to-buffer and then call message-setup-1, which is the only
functionality of message-mail that is needed for notmuch.
2016-01-01 10:58:19 -04:00
David Bremner
bceb6516ce Merge branch 'release'
Merge bugfixes applied directly to release
2015-11-23 08:40:40 -04:00
Mark Walters
4c7a592d49 emacs: poll: return useful errors when poll fails.
Previously poll called from emacs would fail silently. This makes it
return a useful error message.

In the non-deprecated case of notmuch new and appropriate hooks, it
uses notmuch-call-notmuch-process which gives an error and
additionally puts the stdout/stderr etc in the *Notmuch errors*
buffer.

In the deprecated case of a custom poll script it only returns an
error message.

Commit based on a bug report, and a potential fix, by Ketil Malde.
2015-11-23 08:37:19 -04:00
Mark Walters
3270eea39f emacs: hello: fix accidental modification of widget-keymap
In emacs24 we use make-composed-keymap. It seems that if only a single
map is specified then emacs just resuses it rather than creating a
copy of it. Thus use make-sparse-keymap to force a copy.
2015-11-23 08:36:52 -04:00