From cfacb7547d0f99c3c186a1c1ebb84ce42a04a428 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 9 Jun 2016 17:23:38 +0900 Subject: [PATCH] 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. --- lisp/epg.el | 8 ++++++-- 1 file 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 -- 2.39.2