summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2016-07-04 23:29:51 +0200
committerrekado <rekado@elephly.net>2016-07-04 23:29:51 +0200
commit0de7a51e4689b24d27a8fc325bb32c439b6039bb (patch)
treed9edbb36b3b5e1401ab3ccb070ca28294ccd4ea5 /lisp
parentc67cefe2f5f92a144d6dc612d27c797676b6db03 (diff)
email: Decrypt inline PGP messages automatically.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/email.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/email.el b/lisp/email.el
index 73aa22b..8b0f483 100644
--- a/lisp/email.el
+++ b/lisp/email.el
@@ -94,3 +94,16 @@
(let ((msg mu4e-compose-parent-message))
(when (and msg (member 'encrypted (mu4e-message-field msg :flags)))
(mml-secure-message-sign-encrypt)))))
+
+(add-hook 'mu4e-view-mode-hook
+ (defun my/maybe-decrypt-inline ()
+ "Attempt to decrypt inline PGP messages automatically."
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
+ (let ((armor-start (match-beginning 0)))
+ (when armor-start
+ (let ((armor-end (re-search-forward "^-----END PGP MESSAGE-----$" nil t)))
+ (when armor-end
+ (epa-decrypt-armor-in-region armor-start armor-end))))))))
+