Configuring Autocrypt in Emacs/Gnus

I was asked about this on Lemmy, but there's a bit more to it than a short message.

A Federated Social Network

After learning several "standard" UIs that subsequently disappeared, I try to do client-side things in Emacs if it seems sensible. Reading email is one such task, since I personally rarely need anything other than plain text support. Here I describe my general Gnus configuration, and later the parts relevant to autocrypt.

If the previous paragraph bamboozled you, here is a quick glossary:





Emacs home page

Autocrypt home page

I don't *think* it's very important for the contents of this post, but I do use emacs-bedrock as a starter kit for configuring Emacs.

Emacs Bedrock starter kit

Having written this, it really is a path for lazy people who can't be bothered learning a new interaction style or email package every few years. I suspect Emacs will be able to do almost anything you want, no matter how many years into the future, with some minor customization. One exception I think is graphics-heavy work, which is better in a Web browser but browsers are many times more heavyweight.

Gnus

I use Posteo as an email provider. Translation to Google or someone else should be straightforward. Add the following to ~/.emacs.d/init.el:

(setq gnus-select-method '(nnimap "posteo.de"))
(setq user-mail-address "nobody@example.com") ;; Obviously change this

Now you'll have to customize some variables, e.g. using `M-x customize-variable`:





This should take care of basic IMAP & SMTP.

Autocrypt

This requires packages that are *not* part of core Emacs. In particular, you'll need autocrypt and pinentry. I use MELPA and `M-x list-packages `to install packages like this. You'll also need to install GnuPG outside Emacs in your OS, I used the Homebrew package manage to do this on macOS. Then you'll need to add the following to your init.el:

(pinentry-start)
(add-hook 'gnus-mode-hook #'autocrypt-mode)
(add-hook 'message-mode-hook #'autocrypt-mode)

MELPA Emacs package archive

and the following variables must be customized:





Now I only did it once so I'm not 100% sure, but I think you don't need to create a GnuPG key from the command line as usual. Instead, autocrypt can do it using `M-x autocrypt-create-account`, and this will also add an autocrypt-accounts custom variable.

That's it, from then on you can just run `M-x gnus` and read the comprehensive Info-format documentation for this package. Seems like a bit of work, but as I said at the start, this is likely to work until you retire or die and you won't have to learn a different way.

Gnus user manual

Back to my gemlog


Source