[PATCH v3 1/4] emacs: Asynchronous retrieval of GPG keys
David Bremner
david at tethera.net
Mon Jan 14 18:08:14 PST 2019
David Edmondson <dme at dme.org> writes:
> Rather than blocking emacs while gpg does its' thing, by default run
> key retrieval asynchronously, possibly updating the display of the
> message on successful completion.
> ---
> emacs/notmuch-crypto.el | 85 +++++++++++++++++++++++++++++++++++------
> 1 file changed, 74 insertions(+), 11 deletions(-)
>
> diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
> index fc2b5301..c20fd4f8 100644
> --- a/emacs/notmuch-crypto.el
> +++ b/emacs/notmuch-crypto.el
> @@ -43,6 +43,11 @@ mode."
> :package-version '(notmuch . "0.25")
> :group 'notmuch-crypto)
>
> +(defcustom notmuch-crypto-get-keys-asynchronously t
> + "Retrieve gpg keys asynchronously."
> + :type 'boolean
> + :group 'notmuch-crypto)
> +
Sorry for the long delay. Should this have a :package-version key like
the defcustom right about it?
> + (buffer (get-buffer-create "*notmuch-crypto-gpg-out*")))
> + (if notmuch-crypto-get-keys-asynchronously
> + (progn
> + (notmuch-crypto--set-button-label
> + button (format "Retrieving key %s asynchronously..." keyid))
> + (let ((p (make-process :name "notmuch GPG key retrieval"
> + :buffer buffer
> + :command (list epg-gpg-program "--recv-keys" keyid)
> + :connection-type 'pipe
> + :sentinel #'notmuch-crypto--async-key-sentinel
> + ;; Create the process stopped so that
> + ;; we have time to store the key id,
> + ;; etc. on it.
> + :stop t)))
Using make-process unconditionally seems to require emacs 25. I think
we're still trying to support Emacs 24. That can always change, but I
still haven't merged Tomi's patch officially deprecating emacs 23.
More information about the notmuch
mailing list