Re: [PATCH v3 1/4] emacs: Asynchronous retrieval of GPG keys

2019-01-19 Thread David Bremner
David Edmondson  writes:

> Would you accept something like:
>
> (defcustom notmuch-crypto-get-keys-asynchronously (functionp 'make-process)
> ...)
>

Yes, assuming it means what I think, namely turn off
notmuch-crypto-get-keys-asynchronously if make-process is not
present. It would be good to have (part of) a docstring explaining that
the feature is only available in emacs >= 25.1 (according to NEWS.25).

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3 1/4] emacs: Asynchronous retrieval of GPG keys

2019-01-19 Thread David Edmondson
On Monday, 2019-01-14 at 22:08:14 -04, David Bremner wrote:

> David Edmondson  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.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3 1/4] emacs: Asynchronous retrieval of GPG keys

2019-01-14 Thread David Bremner
David Edmondson  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.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch