From: ueno Date: Sun, 12 Nov 2006 22:08:02 +0000 (+0000) Subject: * epg.el (epg--check-error-for-decrypt): Renamed from epg--check-decrypt. X-Git-Tag: epg-0_0_8~15 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=58233b5691a062fd5cda30eb10ce62feb28b3738;p=elisp%2Fepg.git * epg.el (epg--check-error-for-decrypt): Renamed from epg--check-decrypt. (epg--start): Added a very basic test to check whether to specify --use-agent. --- diff --git a/ChangeLog b/ChangeLog index 371e7cb..d7167de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,11 @@ 2006-11-12 Daiki Ueno * 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 --- 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)