Fix default encryption recipient detection
This commit is contained in:
parent
453e20534f
commit
bee7798a50
1 changed files with 17 additions and 10 deletions
|
@ -29,16 +29,23 @@
|
||||||
|
|
||||||
|
|
||||||
(after! epa
|
(after! epa
|
||||||
(setq epa-file-encrypt-to
|
;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt
|
||||||
(or epa-file-encrypt-to
|
;; for the key passphrase.
|
||||||
;; Collect all public key IDs with your username
|
(setq epa-pinentry-mode 'loopback)
|
||||||
|
;; Default to the first secret key available in your keyring.
|
||||||
|
(setq-default
|
||||||
|
epa-file-encrypt-to
|
||||||
|
(or (default-value 'epa-file-encrypt-to)
|
||||||
(unless (string-empty-p user-full-name)
|
(unless (string-empty-p user-full-name)
|
||||||
(cl-loop for key in (ignore-errors (epg-list-keys (epg-make-context) user-full-name))
|
(cl-loop for key in (ignore-errors (epg-list-keys (epg-make-context) user-full-name))
|
||||||
collect (epg-sub-key-id (car (epg-key-sub-key-list key)))))
|
collect (epg-sub-key-id (car (epg-key-sub-key-list key)))))
|
||||||
user-mail-address)
|
user-mail-address))
|
||||||
;; With GPG 2.1, this forces gpg-agent to use the Emacs minibuffer to
|
;; And suppress prompts if epa-file-encrypt-to has a default value (without
|
||||||
;; prompt for the key passphrase.
|
;; overwriting file-local values).
|
||||||
epa-pinentry-mode 'loopback))
|
(defadvice! +default--dont-prompt-for-keys-a (&rest _)
|
||||||
|
:before #'epa-file-write-region
|
||||||
|
(unless (local-variable-p 'epa-file-encrypt-to)
|
||||||
|
(setq-local epa-file-encrypt-to (default-value 'epa-file-encrypt-to)))))
|
||||||
|
|
||||||
|
|
||||||
(use-package! drag-stuff
|
(use-package! drag-stuff
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue