~pkal/public-inbox

1

[PATCH 1/3] Save autocrypt accounts data uniformly

Details
Message ID
<20201229002924.10117-2-swflint@flintfam.org>
DKIM signature
missing
Download raw message
Patch: +2 -5
---
 autocrypt.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/autocrypt.el b/autocrypt.el
index 965f661..5fd6b6f 100644
--- a/autocrypt.el
+++ b/autocrypt.el
@@ -510,11 +510,8 @@ Will handle and remove \"Do-(Discourage-)Autocrypt\" if found."
    (let ((res (epg-context-result-for ctx 'generate-key)))
      (unless res
        (error "Could not determine fingerprint"))
      (customize-save-variable
       'autocrypt-accounts
       (cons (list email (cdr (assq 'fingerprint (car res))) 'none)
             autocrypt-accounts)
       "Customized by autocrypt.el"))
      (push (list email (cdr (assq 'fingerprint (car res))) 'none) autocrypt-accounts)
      (autocrypt-save-data))
    (message "Successfully generated key for %s, and added to key chain."
             email)))

-- 
2.29.2
Details
Message ID
<87pn2svq43.fsf@posteo.net>
In-Reply-To
<20201229002924.10117-2-swflint@flintfam.org> (view parent)
DKIM signature
missing
Download raw message
"Samuel W. Flint" <swflint@flintfam.org> writes:

> ---
>  autocrypt.el | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/autocrypt.el b/autocrypt.el
> index 965f661..5fd6b6f 100644
> --- a/autocrypt.el
> +++ b/autocrypt.el
> @@ -510,11 +510,8 @@ Will handle and remove \"Do-(Discourage-)Autocrypt\" if found."
>      (let ((res (epg-context-result-for ctx 'generate-key)))
>        (unless res
>          (error "Could not determine fingerprint"))
> -      (customize-save-variable
> -       'autocrypt-accounts
> -       (cons (list email (cdr (assq 'fingerprint (car res))) 'none)
> -             autocrypt-accounts)
> -       "Customized by autocrypt.el"))
> +      (push (list email (cdr (assq 'fingerprint (car res))) 'none) autocrypt-accounts)

This is a good point. autocrypt-accounts was until recently a custom
option, but shouldn't has been recently changed.

> +      (autocrypt-save-data))

If we always save the data after modifying something, I don't think it's
necessary to call autocrypt-save-data in emacs-kill-hook and when
deactivating autocrypt-mode.

>      (message "Successfully generated key for %s, and added to key chain."
>               email)))

-- 
	Philip K.
Reply to thread Export thread (mbox)