* EasyPG: Version 0.0.12 released.
[elisp/epg.git] / epa-file.el
index 47b17f5..898a4e9 100644 (file)
@@ -84,13 +84,15 @@ May either be a string or a list of strings.")
 
 (defvar epa-file-passphrase-alist nil)
 
-(if (fboundp 'encode-coding-string)
-    (defalias 'epa-file--encode-coding-string 'encode-coding-string)
-  (defalias 'epa-file--encode-coding-string 'identity))
+(eval-and-compile
+  (if (fboundp 'encode-coding-string)
+      (defalias 'epa-file--encode-coding-string 'encode-coding-string)
+    (defalias 'epa-file--encode-coding-string 'identity)))
 
-(if (fboundp 'decode-coding-string)
-    (defalias 'epa-file--decode-coding-string 'decode-coding-string)
-  (defalias 'epa-file--decode-coding-string 'identity))
+(eval-and-compile
+  (if (fboundp 'decode-coding-string)
+      (defalias 'epa-file--decode-coding-string 'decode-coding-string)
+    (defalias 'epa-file--decode-coding-string 'identity)))
 
 (defun epa-file-name-regexp-update ()
   (interactive)
@@ -218,6 +220,8 @@ May either be a string or a list of strings.")
           file))
     (epg-context-set-progress-callback context
                                       #'epa-progress-callback-function)
+    (epg-context-set-armor context epa-armor)
+    (epg-context-set-textmode context epa-textmode)
     (condition-case error
        (setq string
              (epg-encrypt-string
@@ -264,6 +268,16 @@ If no one is selected, symmetric encryption will be performed.  "
           epa-file-inhibit-auto-save)
       (auto-save-mode 0)))
 
+(defun epa-file-select-keys ()
+  "Select recipients for encryption."
+  (interactive)
+  (make-local-variable 'epa-file-encrypt-to)
+  (setq epa-file-encrypt-to
+       (epa-select-keys
+        (epg-make-context)
+        "Select recipents for encryption.
+If no one is selected, symmetric encryption will be performed.  ")))
+
 ;;;###autoload
 (defun epa-file-enable ()
   (interactive)