summaryrefslogtreecommitdiff
path: root/lisp/epg.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2015-07-16 15:43:03 +0900
committerDaiki Ueno <ueno@gnu.org>2015-07-16 15:43:03 +0900
commitbd8b5ac77250d9fe0634d58a30a3bf6d2497725a (patch)
tree9c881465e410f599cefc34a1574a384319ed89fa /lisp/epg.el
parentf90fe8e76fd3ee8115db8b2ddc7b820267bf1bf9 (diff)
downloademacs-bd8b5ac77250d9fe0634d58a30a3bf6d2497725a.tar.gz
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.
Diffstat (limited to 'lisp/epg.el')
-rw-r--r--lisp/epg.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/epg.el b/lisp/epg.el
index b3d39bb8505..4ba96272aae 100644
--- a/lisp/epg.el
+++ b/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))