[PATCH v3 1/4] emacs: Asynchronous retrieval of GPG keys
David Edmondson
dme at dme.org
Sat Jan 19 03:15:11 PST 2019
On Monday, 2019-01-14 at 22:08:14 -04, David Bremner wrote:
> 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?
Okay.
>> + (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.
Would you accept something like:
(defcustom notmuch-crypto-get-keys-asynchronously (functionp 'make-process)
...)
?
dme.
--
I had my eyes closed in the dark.
More information about the notmuch
mailing list