From 0de7a51e4689b24d27a8fc325bb32c439b6039bb Mon Sep 17 00:00:00 2001 From: rekado Date: Mon, 4 Jul 2016 23:29:51 +0200 Subject: email: Decrypt inline PGP messages automatically. --- lisp/email.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lisp') 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)))))))) + -- cgit v1.2.3