[notmuch] gpg decryption
Sebastian at SSpaeth.de
Mon Mar 8 03:49:54 PST 2010
My bank frequently sends me transactions as an inline-armored gpg
encrypted text. So I added the below 2 lines in my .emacs and added this
function to the list of notmuch-show-hook functions:
(defun spaetz/decrypt ()
(epa-decrypt-armor-in-region (point-min) (point-max)))
Despite warning in the docs that this function should not be called from
elisp programs directly, it works just fine for me. The only annoyance
is that the function asks "Should I replace the current text (y/n)" in
the status bar whenever it detects gpg text.
It works for me and is a nice proof-of-concept which happens to solve my bank
account itch, but definitely needs improvement:
- We just feed it the whole notmuch-show buffer, it would be nicer to
hand it the just the region of the message body/mime part. I wonder, if
things like this should not better be done with dme's message-washing
hooks rather than a notmuch-show hook?
- The annoying "should I replace the current text" question should not
appear, ie we need to use some more low-level functionality and
implement mime part "cleaning".
- This will not handle encrypted text as an mime attachment, I guess.
No clue, just tossing this out for now.
More information about the notmuch