summaryrefslogtreecommitdiff
path: root/mu4e
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@sergiodj.net>2026-03-25 19:34:14 -0400
committerSergio Durigan Junior <sergiodj@sergiodj.net>2026-03-25 19:37:58 -0400
commit48ba3c9d4b5bb9035cd05a7650f85f14c3aed033 (patch)
tree09e39fe1f2632e5233ffe24eed4ae3ab5da58c6e /mu4e
parenta8620c728ad2d21fbc760867dc38789f17230562 (diff)
mu4e-draft: add "{sign,encrypt}-signed-replies" to crypto options
This scratches an itch of mine: being able to sign messages when they're replies to signed messages. Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
Diffstat (limited to 'mu4e')
-rw-r--r--mu4e/mu4e-draft.el23
1 files changed, 18 insertions, 5 deletions
diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el
index 90c15dd..03ad5ed 100644
--- a/mu4e/mu4e-draft.el
+++ b/mu4e/mu4e-draft.el
@@ -41,7 +41,7 @@
(declare-function mu4e "mu4e")
(defcustom mu4e-compose-crypto-policy
- '(encrypt-encrypted-replies sign-encrypted-replies)
+ '(encrypt-encrypted-replies sign-encrypted-replies sign-signed-replies)
"Policy to control when messages will be signed/encrypted.
The value is a list which influence the way draft messages are
@@ -59,6 +59,8 @@ created. Specifically, it might contain:
non-encrypted messages.
- `sign-encrypted-replies': Add a signature when responding
to encrypted messages.
+- `sign-signed-replies': Add a signature when responding to
+ signed messages.
It should be noted that certain symbols have priorities over one
another. So `sign-all-messages' implies `sign-all-replies', which
@@ -84,7 +86,11 @@ All `sign-*' options have a `encrypt-*' analogue."
(const :tag "Sign replies to encrypted messages"
sign-encrypted-replies)
(const :tag "Encrypt replies to encrypted messages"
- encrypt-encrypted-replies))
+ encrypt-encrypted-replies)
+ (const :tag "Sign replies to signed messages"
+ sign-signed-replies)
+ (const :tag "Encrypt replies to signed messages"
+ encrypt-signed-replies))
:group 'mu4e-compose)
;;; Crypto
@@ -93,6 +99,8 @@ All `sign-*' options have a `encrypt-*' analogue."
See `mu4e-compose-crypto-policy' for more details."
(let* ((encrypted-p
(and parent (memq 'encrypted (mu4e-message-field parent :flags))))
+ (signed-p
+ (and parent (memq 'signed (mu4e-message-field parent :flags))))
(encrypt
(or (memq 'encrypt-all-messages mu4e-compose-crypto-policy)
(and (memq 'encrypt-new-messages mu4e-compose-crypto-policy)
@@ -105,9 +113,12 @@ See `mu4e-compose-crypto-policy' for more details."
(memq 'encrypt-all-replies mu4e-compose-crypto-policy))
(and (eq compose-type 'reply) (not encrypted-p) ;; plain replies
(memq 'encrypt-plain-replies mu4e-compose-crypto-policy))
- (and (eq compose-type 'reply) encrypted-p
+ (and (eq compose-type 'reply) encrypted-p ;; encrypted replies
(memq 'encrypt-encrypted-replies
- mu4e-compose-crypto-policy)))) ;; encrypted replies
+ mu4e-compose-crypto-policy))
+ (and (eq compose-type 'reply) signed-p ;; signed replies
+ (memq 'encrypt-signed-replies
+ mu4e-compose-crypto-policy))))
(sign
(or (memq 'sign-all-messages mu4e-compose-crypto-policy)
(and (eq compose-type 'new) ;; new messages
@@ -121,7 +132,9 @@ See `mu4e-compose-crypto-policy' for more details."
(and (eq compose-type 'reply) (not encrypted-p) ;; plain replies
(memq 'sign-plain-replies mu4e-compose-crypto-policy))
(and (eq compose-type 'reply) encrypted-p ;; encrypted replies
- (memq 'sign-encrypted-replies mu4e-compose-crypto-policy)))))
+ (memq 'sign-encrypted-replies mu4e-compose-crypto-policy))
+ (and (eq compose-type 'reply) signed-p ;; signed replies
+ (memq 'sign-signed-replies mu4e-compose-crypto-policy)))))
(cond ((and sign encrypt) (mml-secure-message-sign-encrypt))
(sign (mml-secure-message-sign))
(encrypt (mml-secure-message-encrypt)))))