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.
(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)
(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)
(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
(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)