* epa.el (epa-import-keys-region): New command.
authorueno <ueno>
Tue, 19 Dec 2006 08:48:35 +0000 (08:48 +0000)
committerueno <ueno>
Tue, 19 Dec 2006 08:48:35 +0000 (08:48 +0000)
ChangeLog
epa.el

index dc1ff3e..6ec0cba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
 
        * epa.el (epa-sign-region): --armor & --textmode.
        (epa-encrypt-region): Ditto.
+       (epa-import-keys-region): New command.
        (epa-insert-keys): New command.
        (epa--insert-keys): Renamed from epa-insert-keys.
 
diff --git a/epa.el b/epa.el
index c59706b..b9c55d2 100644 (file)
--- a/epa.el
+++ b/epa.el
@@ -897,6 +897,24 @@ Don't use this command in Lisp programs!"
        (apply #'epa-list-keys epa-list-keys-arguments))))
 
 ;;;###autoload
+(defun epa-import-keys-region (start end)
+  "Import keys from the region.
+
+Don't use this command in Lisp programs!"
+  (interactive "r")
+  (let ((context (epg-make-context)))
+    (message "Importing...")
+    (condition-case nil
+       (progn
+         (epg-import-keys-from-string context (buffer-substring start end))
+         (message "Importing...done"))
+      (error
+       (message "Importing...failed")))
+    (if (epg-context-result-for context 'import)
+       (epa-display-info (epg-import-result-to-string
+                          (epg-context-result-for context 'import))))))
+
+;;;###autoload
 (defun epa-export-keys (keys file)
   "Export selected KEYS to FILE.