* epg.el (epg-reset): Don't reset result.
[elisp/epg.git] / epg.el
diff --git a/epg.el b/epg.el
index 32ba4a6..662ffe9 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -290,8 +290,7 @@ This function is for internal use only."
       (kill-buffer (process-buffer (epg-context-process context))))
   (epg-context-set-process context nil)
   (if (file-exists-p (epg-context-output-file context))
-      (delete-file (epg-context-output-file context)))
-  (aset context 9 nil))
+      (delete-file (epg-context-output-file context))))
 
 (defun epg-status-USERID_HINT (process string)
   (if (string-match "\\`\\([^ ]+\\) \\(.*\\)" string)
@@ -580,6 +579,7 @@ If you use this function, you will need to wait for the completion of
 `epg-reset' to clear a temporaly output file.
 If you are unsure, use synchronous version of this function
 `epg-decrypt-string' instead."
+  (epg-context-set-result context nil)
   (epg-context-set-output-file context (epg-make-temp-file "epg-output"))
   (epg-start context
             (list "--decrypt" input-file))
@@ -621,6 +621,7 @@ If you use this function, you will need to wait for the completion of
 `epg-reset' to clear a temporaly output file.
 If you are unsure, use synchronous version of this function
 `epg-verify-string' instead."
+  (epg-context-set-result context nil)
   (epg-context-set-output-file context (epg-make-temp-file "epg-output"))
   (if string
       ;; Detached signature.
@@ -636,6 +637,19 @@ If you are unsure, use synchronous version of this function
        (process-send-string (epg-context-process context) signature))))
 
 ;;;###autoload
+(defun epg-verify-file (context input-file &optional string)
+  "Verify INPUT-FILE.
+
+For a detached signature, both INPUT-FILE and STRING should be string.
+For a normal or a clear text signature, STRING should be nil."
+  (unwind-protect
+      (progn
+       (epg-start-verify context input-file string)
+       (epg-wait-for-completion context)
+       (epg-context-result-for context 'verify))
+    (epg-reset context)))
+
+;;;###autoload
 (defun epg-verify-string (context signature &optional string)
   "Verify SIGNATURE.
 
@@ -652,19 +666,6 @@ For a normal or a clear text signature, STRING should be nil."
          (delete-file input-file)))))
 
 ;;;###autoload
-(defun epg-verify-file (context input-file &optional string)
-  "Verify INPUT-FILE.
-
-For a detached signature, both INPUT-FILE and STRING should be string.
-For a normal or a clear text signature, STRING should be nil."
-  (unwind-protect
-      (progn
-       (epg-start-verify context input-file string)
-       (epg-wait-for-completion context)
-       (epg-context-result-for context 'verify))
-    (epg-reset context)))
-
-;;;###autoload
 (defun epg-start-sign (context string &optional mode)
   "Initiate a sign operation on STRING.
 
@@ -677,6 +678,7 @@ If you use this function, you will need to wait for the completion of
 `epg-reset' to clear a temporaly output file.
 If you are unsure, use synchronous version of this function
 `epg-sign-string' instead."
+  (epg-context-set-result context nil)
   (epg-context-set-output-file context (epg-make-temp-file "epg-output"))
   (epg-start context
             (append (list (if (eq mode 'clearsign)
@@ -718,6 +720,7 @@ If you use this function, you will need to wait for the completion of
 `epg-reset' to clear a temporaly output file.
 If you are unsure, use synchronous version of this function
 `epg-encrypt-string' instead."
+  (epg-context-set-result context nil)
   (epg-context-set-output-file context (epg-make-temp-file "epg-output"))
   (epg-start context
             (append (if always-trust '("--always-trust"))
@@ -762,6 +765,7 @@ If you use this function, you will need to wait for the completion of
 `epg-reset' to clear a temporaly output file.
 If you are unsure, use synchronous version of this function
 `epg-export-keys' instead."
+  (epg-context-set-result context nil)
   (epg-context-set-output-file context (epg-make-temp-file "epg-output"))
   (epg-start context (list "--export" pattern)))
 
@@ -786,6 +790,7 @@ If you use this function, you will need to wait for the completion of
 `epg-reset' to clear a temporaly output file.
 If you are unsure, use synchronous version of this function
 `epg-import-keys' instead."
+  (epg-context-set-result context nil)
   (epg-context-set-output-file context (epg-make-temp-file "epg-output"))
   (epg-start context (list "--import"))
   (if (eq (process-status (epg-context-process context)) 'run)