mu4e: compose: auto-crypt/sign crypto replies
When replying to an encrypted message, sign/encrypt by default; see mu4e-compose-crypto-reply-policy. (Issue #865)
This commit is contained in:
@ -143,6 +143,23 @@ Also see `mu4e-context-policy'."
|
|||||||
:safe 'symbolp
|
:safe 'symbolp
|
||||||
:group 'mu4e-compose))
|
:group 'mu4e-compose))
|
||||||
|
|
||||||
|
|
||||||
|
(defcustom mu4e-compose-crypto-reply-policy 'sign-and-encrypt
|
||||||
|
"Policy for signing/encrypting replies to encrypted messages.
|
||||||
|
We have the following choices:
|
||||||
|
|
||||||
|
- `sign': sign the reply
|
||||||
|
- `sign-and-encrypt': sign and encrypt the repy
|
||||||
|
- `encrypt': encrypt the reply, but don't sign it.
|
||||||
|
- anything else: do nothing."
|
||||||
|
:type '(choice
|
||||||
|
(const :tag "Sign the reply" 'sign)
|
||||||
|
(const :tag "Sign and encrypt the reply" 'sign-and-encrypt)
|
||||||
|
(const :tag "Encrypt the reply" 'encrypt)
|
||||||
|
(const :tag "Don't do anything" nil)
|
||||||
|
:safe 'symbolp
|
||||||
|
:group 'mu4e-compose))
|
||||||
|
|
||||||
(defcustom mu4e-compose-format-flowed nil
|
(defcustom mu4e-compose-format-flowed nil
|
||||||
"Whether to compose messages to be sent as format=flowed (or
|
"Whether to compose messages to be sent as format=flowed (or
|
||||||
with long lines if `use-hard-newlines' is set to nil). The
|
with long lines if `use-hard-newlines' is set to nil). The
|
||||||
@ -165,6 +182,7 @@ it has been constructed, `mu4e-compose-mode-hook' would be the
|
|||||||
place to do that."
|
place to do that."
|
||||||
:type 'hook
|
:type 'hook
|
||||||
:group 'mu4e-compose)
|
:group 'mu4e-compose)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
@ -480,6 +498,21 @@ buffers; lets remap its faces so it uses the ones for mu4e."
|
|||||||
mu4e~compose-buffer-max-name-length
|
mu4e~compose-buffer-max-name-length
|
||||||
nil nil t)))))
|
nil nil t)))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun mu4e~compose-crypto-reply (parent compose-type)
|
||||||
|
"When composing a reply to an encrypted message, we can
|
||||||
|
automatically encrypt that reply."
|
||||||
|
(message "%S %S" parent compose-type)
|
||||||
|
(when (and (eq compose-type 'reply)
|
||||||
|
(and parent (member 'encrypted (mu4e-message-field parent :flags))))
|
||||||
|
(case mu4e-compose-crypto-reply-policy
|
||||||
|
(sign (mml-secure-message-sign))
|
||||||
|
(encrypt (mml-secure-message-encrypt))
|
||||||
|
(sign-and-encrypt (mml-secure-message-sign-encrypt))
|
||||||
|
(message "Do nothing"))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun* mu4e~compose-handler (compose-type &optional original-msg includes)
|
(defun* mu4e~compose-handler (compose-type &optional original-msg includes)
|
||||||
"Create a new draft message, or open an existing one.
|
"Create a new draft message, or open an existing one.
|
||||||
|
|
||||||
@ -518,6 +551,8 @@ tempfile)."
|
|||||||
;; insert mail-header-separator, which is needed by message mode to separate
|
;; insert mail-header-separator, which is needed by message mode to separate
|
||||||
;; headers and body. will be removed before saving to disk
|
;; headers and body. will be removed before saving to disk
|
||||||
(mu4e~draft-insert-mail-header-separator)
|
(mu4e~draft-insert-mail-header-separator)
|
||||||
|
;; maybe encrypt/sign replies
|
||||||
|
(mu4e~compose-crypto-reply original-msg compose-type)
|
||||||
;; include files -- e.g. when forwarding a message with attachments,
|
;; include files -- e.g. when forwarding a message with attachments,
|
||||||
;; we take those from the original.
|
;; we take those from the original.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
|||||||
Reference in New Issue
Block a user