(epa-last-coding-system-specified): New variable.
[elisp/epg.git] / epg.el
diff --git a/epg.el b/epg.el
index 1ae12b5..e445aec 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -1222,9 +1222,10 @@ This function is for internal use only."
                  (if epg-passphrase-coding-system
                      (progn
                        (setq encoded-passphrase-with-new-line
-                             (encode-coding-string
+                             (epg--encode-coding-string
                               passphrase-with-new-line
-                              epg-passphrase-coding-system))
+                              (coding-system-change-eol-conversion
+                               epg-passphrase-coding-system 'unix)))
                        (epg--clear-string passphrase-with-new-line)
                        (setq passphrase-with-new-line nil))
                    (setq encoded-passphrase-with-new-line
@@ -1799,6 +1800,10 @@ You can then use `write-region' to write new data into the file."
   (defun epg--clear-string (string)
     (fillarray string 0)))
 
+(if (fboundp 'encode-coding-string)
+    (defalias 'epg--encode-coding-string 'encode-coding-string)
+  (defalias 'epg--encode-coding-string 'identity))
+
 (defun epg--args-from-sig-notations (notations)
   (apply #'nconc
         (mapcar
@@ -2219,7 +2224,7 @@ If you are unsure, use synchronous version of this function
   "Extract public KEYS."
   (unwind-protect
       (progn
-       (if keys
+       (if file
            (epg-context-set-output-file context file)
          (epg-context-set-output-file context
                                       (epg--make-temp-file "epg-output")))
@@ -2343,8 +2348,8 @@ If you are unsure, use synchronous version of this function
          (if entry
              (if (setq entry (assq (cdr entry)
                                    epg-delete-problem-reason-alist))
-                 (error "Delete keys failed: %s" (cdr entry)))
-           (error "Delete keys failed" (cdr entry)))))
+                 (error "Delete keys failed: %s" (cdr entry))
+               (error "Delete keys failed")))))
     (epg-reset context)))
 
 ;;;###autoload