emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master bd8b5ac: epg: Automatically start pinentry server


From: Daiki Ueno
Subject: [Emacs-diffs] master bd8b5ac: epg: Automatically start pinentry server
Date: Thu, 16 Jul 2015 06:45:14 +0000

branch: master
commit bd8b5ac77250d9fe0634d58a30a3bf6d2497725a
Author: Daiki Ueno <address@hidden>
Commit: Daiki Ueno <address@hidden>

    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.
---
 lisp/epg-config.el |    5 +++++
 lisp/epg.el        |   10 ++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index 10f0dd3..db29513 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -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
diff --git a/lisp/epg.el b/lisp/epg.el
index b3d39bb..4ba9627 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]