---
autocrypt.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/autocrypt.el b/autocrypt.el
index a3f215f..1cccfa5 100644
--- a/autocrypt.el
+++ b/autocrypt.el
@@ -527,7 +527,8 @@ PREFERENCE is one of 'mutual, 'no-preference, 'none, or nil."
(if (string-empty-p value)
nil
(intern value)))))
- (push (list email fingerprint preference) autocrypt-accounts)
+ (pushnew (list email fingerprint preference) autocrypt-accounts
+ :key #'first :test #'string=)
(autocrypt-save-data))
--
2.29.2
Thierry Volpiatto <thievol@posteo.net> writes:
> Samuel W. Flint <swflint@flintfam.org> writes:
>
>> + (pushnew (list email fingerprint preference) autocrypt-accounts
>> + :key #'first :test #'string=)
>
> Use `cl-pushnew` instead part of cl-lib.el.
And setting that aside, (cl-)pushnew will silently "fail" if in this
case the alist already contains `email'. I think it would be a better
idea to do something like
(when (assoc email autocrypt-accounts)
(user-error "There is already an account for this address"))
--
Philip K.