unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* gpg decryption
@ 2010-03-08 11:49 Sebastian Spaeth
  2010-03-08 11:52 ` Sebastian Spaeth
  2010-03-08 16:47 ` Jameson Rollins
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Spaeth @ 2010-03-08 11:49 UTC (permalink / raw)
  To: Notmuch development list

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.

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gpg decryption
  2010-03-08 11:49 gpg decryption Sebastian Spaeth
@ 2010-03-08 11:52 ` Sebastian Spaeth
  2010-03-08 16:47 ` Jameson Rollins
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Spaeth @ 2010-03-08 11:52 UTC (permalink / raw)
  To: Notmuch development list

On 2010-03-08, Sebastian Spaeth wrote:
> 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)))

Uhh, and you will have to load somehow the "epa" library that comes with
emacs included. I use the below in my .emacs

;enable gpg integration for transparent .gpg file decryption
(require 'epa-file)
(epa-file-enable)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gpg decryption
  2010-03-08 11:49 gpg decryption Sebastian Spaeth
  2010-03-08 11:52 ` Sebastian Spaeth
@ 2010-03-08 16:47 ` Jameson Rollins
  2010-03-09 14:05   ` Sebastian Spaeth
  1 sibling, 1 reply; 4+ messages in thread
From: Jameson Rollins @ 2010-03-08 16:47 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch development list

[-- Attachment #1: Type: text/plain, Size: 1587 bytes --]

On Mon, 08 Mar 2010 12:49:54 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> My bank frequently sends me transactions as an inline-armored gpg
> encrypted text.

Wow!  That's incredible.  I assume this is a German Bank?  Only in my
wildest fantasies could I even conceive of such a thing possibly
happening, especially in the US.  I want to use your bank.

> 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:

Do I've had problems with notmuch if I answer "yes" to the replace
current text question.  It appears to actually modify the file being
decrypted, which in this case is the actual mail message, and that seems
to cause problems for notmuch.  I actually want the text to be replaced,
but just in the buffer, and not in the file.  I haven't looked into this
yet though.

We really need to get some better PGP/MIME support in the emacs UI.
Unfortunately I just haven't had the time to work on it.  I'm at least
glad that other are struggling with it as well, so it's not just me.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gpg decryption
  2010-03-08 16:47 ` Jameson Rollins
@ 2010-03-09 14:05   ` Sebastian Spaeth
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Spaeth @ 2010-03-09 14:05 UTC (permalink / raw)
  To: Jameson Rollins, Notmuch development list

On 2010-03-08, Sebastian Spaeth wrote:
> On Mon, 08 Mar 2010 12:49:54 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> > My bank frequently sends me transactions as an inline-armored gpg
> > encrypted text.
> 
> Wow!  That's incredible.  I assume this is a German Bank?  Only in my
> wildest fantasies could I even conceive of such a thing possibly
> happening, especially in the US.  I want to use your bank.

Yep, its a German bank (online branch of a state-owned bank, actually).
 
> Do I've had problems with notmuch if I answer "yes" to the replace
> current text question.  It appears to actually modify the file being
> decrypted, which in this case is the actual mail message, and that seems
> to cause problems for notmuch.  I actually want the text to be replaced,
> but just in the buffer, and not in the file.  I haven't looked into this
> yet though.

This is weird, as it seems to work fine for me. Answering 'yes' replaces
the text in the buffer with the unencrypted version, but it leaves the
mail file as it is. 

> We really need to get some better PGP/MIME support in the emacs UI.

I agree, having better GPG support would be a real killer feature.

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-09 21:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-08 11:49 gpg decryption Sebastian Spaeth
2010-03-08 11:52 ` Sebastian Spaeth
2010-03-08 16:47 ` Jameson Rollins
2010-03-09 14:05   ` Sebastian Spaeth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).