]> code.delx.au - gnu-emacs/commitdiff
epg: don't start pinentry if it is useless
authorDaiki Ueno <ueno@gnu.org>
Thu, 9 Jun 2016 08:23:38 +0000 (17:23 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 9 Jun 2016 08:26:56 +0000 (17:26 +0900)
* lisp/epg.el (epg--start): Don't start pinentry server if the
session is non-interactive or pinentry-mode is set.

lisp/epg.el

index f4058ed35a496e59a39ab5dd8a8492f32d25a86f..d37db110be67304295a2f0e4132e7068d3f3b694 100644 (file)
@@ -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