* epg.el (epg--check-error-for-decrypt): Renamed from epg--check-decrypt.
authorueno <ueno>
Sun, 12 Nov 2006 22:08:02 +0000 (22:08 +0000)
committerueno <ueno>
Sun, 12 Nov 2006 22:08:02 +0000 (22:08 +0000)
(epg--start): Added a very basic test to check whether to specify
--use-agent.

ChangeLog
epg.el

index 371e7cb..d7167de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,11 @@
 2006-11-12  Daiki Ueno  <ueno@unixuser.org>
 
        * epg.el (epg-error): New error.
-       (epg--check-decrypt): New function.
+       (epg--check-error-for-decrypt): New function.
        (epg-decrypt-file): Use it.
        (epg-decrypt-string): Use it.
+       (epg--start): Added a very basic test to check whether to specify
+       --use-agent.
 
        * epa.el (epa-decrypt-file): Expand file name.
        (epa-verify-file): Ditto.
diff --git a/epg.el b/epg.el
index c092e92..2a54aeb 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -1043,12 +1043,14 @@ This function is for internal use only."
   (let* ((args (append (list "--no-tty"
                             "--status-fd" "1"
                             "--yes")
+                      (if (string-match ":" (or (getenv "GPG_AGENT_INFO") ""))
+                          '("--use-agent"))
                       (if (epg-context-progress-callback context)
-                          (list "--enable-progress-filter"))
+                          '("--enable-progress-filter"))
                       (if epg-gpg-home-directory
                           (list "--homedir" epg-gpg-home-directory))
                       (unless (eq (epg-context-protocol context) 'CMS)
-                        (list "--command-fd" "0"))
+                        '("--command-fd" "0"))
                       (if (epg-context-armor context) '("--armor"))
                       (if (epg-context-textmode context) '("--textmode"))
                       (if (epg-context-output-file context)
@@ -1839,7 +1841,7 @@ If you are unsure, use synchronous version of this function
   (unless (eq (epg-context-protocol context) 'CMS)
     (epg-wait-for-status context '("BEGIN_DECRYPTION"))))
 
-(defun epg--check-decrypt (context)
+(defun epg--check-error-for-decrypt (context)
   (if (epg-context-result-for context 'decryption-failed)
       (signal 'epg-error (list "Decryption failed")))
   (if (epg-context-result-for context 'no-secret-key)
@@ -1864,7 +1866,7 @@ If PLAIN is nil, it returns the result as a string."
                                       (epg--make-temp-file "epg-output")))
        (epg-start-decrypt context (epg-make-data-from-file cipher))
        (epg-wait-for-completion context)
-       (epg--check-decrypt context)
+       (epg--check-error-for-decrypt context)
        (unless plain
          (epg-read-output context)))
     (unless plain
@@ -1883,7 +1885,7 @@ If PLAIN is nil, it returns the result as a string."
                                       (epg--make-temp-file "epg-output"))
          (epg-start-decrypt context (epg-make-data-from-file input-file))
          (epg-wait-for-completion context)
-         (epg--check-decrypt context)
+         (epg--check-error-for-decrypt context)
          (epg-read-output context))
       (epg-delete-output-file context)
       (if (file-exists-p input-file)