mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-27 10:54:40 +00:00
epg: Automatically start pinentry server
* epg-config.el (epg-gpgconf-program): New variable. * epg.el (epg--start): Call `pinentry-start' if allow-emacs-pinentry is set in ~/.gnupg/gpg-agent.conf.
This commit is contained in:
parent
f90fe8e76f
commit
bd8b5ac772
@ -51,6 +51,11 @@
|
||||
:group 'epg
|
||||
:type 'string)
|
||||
|
||||
(defcustom epg-gpgconf-program "gpgconf"
|
||||
"The `gpgconf' executable."
|
||||
:group 'epg
|
||||
:type 'string)
|
||||
|
||||
(defcustom epg-gpg-home-directory nil
|
||||
"The directory which contains the configuration files of `epg-gpg-program'."
|
||||
:group 'epg
|
||||
|
10
lisp/epg.el
10
lisp/epg.el
@ -602,6 +602,16 @@ callback data (if any)."
|
||||
(setq process-environment
|
||||
(cons (concat "GPG_TTY=" terminal-name)
|
||||
(cons "TERM=xterm" process-environment))))
|
||||
;; Start the Emacs Pinentry server if allow-emacs-pinentry is set
|
||||
;; in ~/.gnupg/gpg-agent.conf.
|
||||
(when (and (fboundp 'pinentry-start)
|
||||
(with-temp-buffer
|
||||
(when (= (call-process epg-gpgconf-program nil t nil
|
||||
"--list-options" "gpg-agent")
|
||||
0)
|
||||
(goto-char (point-min))
|
||||
(re-search-forward "^allow-emacs-pinentry:.*:1$" nil t))))
|
||||
(pinentry-start))
|
||||
(setq process-environment
|
||||
(cons (format "INSIDE_EMACS=%s,epg" emacs-version)
|
||||
process-environment))
|
||||
|
Loading…
Reference in New Issue
Block a user