summaryrefslogtreecommitdiff
path: root/lisp/epg.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2016-06-09 17:23:38 +0900
committerDaiki Ueno <ueno@gnu.org>2016-06-09 17:26:56 +0900
commitcfacb7547d0f99c3c186a1c1ebb84ce42a04a428 (patch)
tree5cf3b3329dc9592cc6114ec10a3298ac8a7eeb11 /lisp/epg.el
parent82f49c6a373f981a778f4d939ca2d47c031e0659 (diff)
downloademacs-cfacb7547d0f99c3c186a1c1ebb84ce42a04a428.tar.gz
epg: don't start pinentry if it is useless
* lisp/epg.el (epg--start): Don't start pinentry server if the session is non-interactive or pinentry-mode is set.
Diffstat (limited to 'lisp/epg.el')
-rw-r--r--lisp/epg.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/epg.el b/lisp/epg.el
index f4058ed35a4..d37db110be6 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -604,9 +604,13 @@ 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.
+ ;; Automatically start the Emacs Pinentry server if appropriate.
(when (and (fboundp 'pinentry-start)
+ ;; Emacs Pinentry is useless if Emacs has no interactive session.
+ (not noninteractive)
+ ;; Prefer pinentry-mode over Emacs Pinentry.
+ (null (epg-context-pinentry-mode context))
+ ;; Check if the allow-emacs-pinentry option is set.
(executable-find epg-gpgconf-program)
(with-temp-buffer
(when (= (call-process epg-gpgconf-program nil t nil