diff options
| author | Daiki Ueno | 2015-07-16 15:43:03 +0900 |
|---|---|---|
| committer | Daiki Ueno | 2015-07-16 15:43:03 +0900 |
| commit | bd8b5ac77250d9fe0634d58a30a3bf6d2497725a (patch) | |
| tree | 9c881465e410f599cefc34a1574a384319ed89fa | |
| parent | f90fe8e76fd3ee8115db8b2ddc7b820267bf1bf9 (diff) | |
| download | emacs-bd8b5ac77250d9fe0634d58a30a3bf6d2497725a.tar.gz emacs-bd8b5ac77250d9fe0634d58a30a3bf6d2497725a.zip | |
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.
| -rw-r--r-- | lisp/epg-config.el | 5 | ||||
| -rw-r--r-- | lisp/epg.el | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lisp/epg-config.el b/lisp/epg-config.el index 10f0dd3f4bf..db2951306d0 100644 --- a/lisp/epg-config.el +++ b/lisp/epg-config.el | |||
| @@ -51,6 +51,11 @@ | |||
| 51 | :group 'epg | 51 | :group 'epg |
| 52 | :type 'string) | 52 | :type 'string) |
| 53 | 53 | ||
| 54 | (defcustom epg-gpgconf-program "gpgconf" | ||
| 55 | "The `gpgconf' executable." | ||
| 56 | :group 'epg | ||
| 57 | :type 'string) | ||
| 58 | |||
| 54 | (defcustom epg-gpg-home-directory nil | 59 | (defcustom epg-gpg-home-directory nil |
| 55 | "The directory which contains the configuration files of `epg-gpg-program'." | 60 | "The directory which contains the configuration files of `epg-gpg-program'." |
| 56 | :group 'epg | 61 | :group 'epg |
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)." | |||
| 602 | (setq process-environment | 602 | (setq process-environment |
| 603 | (cons (concat "GPG_TTY=" terminal-name) | 603 | (cons (concat "GPG_TTY=" terminal-name) |
| 604 | (cons "TERM=xterm" process-environment)))) | 604 | (cons "TERM=xterm" process-environment)))) |
| 605 | ;; Start the Emacs Pinentry server if allow-emacs-pinentry is set | ||
| 606 | ;; in ~/.gnupg/gpg-agent.conf. | ||
| 607 | (when (and (fboundp 'pinentry-start) | ||
| 608 | (with-temp-buffer | ||
| 609 | (when (= (call-process epg-gpgconf-program nil t nil | ||
| 610 | "--list-options" "gpg-agent") | ||
| 611 | 0) | ||
| 612 | (goto-char (point-min)) | ||
| 613 | (re-search-forward "^allow-emacs-pinentry:.*:1$" nil t)))) | ||
| 614 | (pinentry-start)) | ||
| 605 | (setq process-environment | 615 | (setq process-environment |
| 606 | (cons (format "INSIDE_EMACS=%s,epg" emacs-version) | 616 | (cons (format "INSIDE_EMACS=%s,epg" emacs-version) |
| 607 | process-environment)) | 617 | process-environment)) |