(epa-insert-keys): Renamed from epa-list-keys-1; don't
[elisp/epg.git] / epa.el
diff --git a/epa.el b/epa.el
index 6425d19..b9eb487 100644 (file)
--- a/epa.el
+++ b/epa.el
                     (or (next-single-property-change point 'epa-list-keys)
                         (point-max)))
       (goto-char point))
-    (epa-list-keys-1 context name mode)
+    (epa-insert-keys context name mode)
     (epa-keys-mode))
   (make-local-variable 'epa-list-keys-arguments)
   (setq epa-list-keys-arguments (list name mode protocol))
   (goto-char (point-min))
   (pop-to-buffer (current-buffer)))
 
-(defun epa-list-keys-1 (context name mode)
-  (save-restriction
-    (narrow-to-region (point) (point))
-    (let ((inhibit-read-only t)
-         buffer-read-only
-         (keys (epg-list-keys context name mode))
-         point)
-      (while keys
-       (setq point (point))
-       (insert "  ")
-       (put-text-property point (point) 'epa-key (car keys))
-       (widget-create 'epa-key :value (car keys))
-       (insert "\n")
-       (setq keys (cdr keys))))      
-    (put-text-property (point-min) (point-max) 'epa-list-keys t)))
+(defun epa-insert-keys (context name mode)
+  (save-excursion
+    (save-restriction
+      (narrow-to-region (point) (point))
+      (let ((keys (epg-list-keys context name mode))
+           point)
+       (while keys
+         (setq point (point))
+         (insert "  ")
+         (add-text-properties point (point)
+                              (list 'epa-key (car keys)
+                                    'front-sticky nil
+                                    'rear-nonsticky t
+                                    'start-open t
+                                    'end-open t))
+         (widget-create 'epa-key :value (car keys))
+         (insert "\n")
+         (setq keys (cdr keys))))      
+      (add-text-properties (point-min) (point-max)
+                          (list 'epa-list-keys t
+                                'front-sticky nil
+                                'rear-nonsticky t
+                                'start-open t
+                                'end-open t)))))
 
 (defun epa-marked-keys ()
   (or (save-excursion
@@ -357,12 +366,12 @@ If SECRET is non-nil, list secret keys instead of public keys."
       (if names
          (while names
            (setq point (point))
-           (epa-list-keys-1 context (car names) secret)
+           (epa-insert-keys context (car names) secret)
            (goto-char point)
            (epa-mark)
            (goto-char (point-max))
            (setq names (cdr names)))
-       (epa-list-keys-1 context nil secret))
+       (epa-insert-keys context nil secret))
       (epa-keys-mode)
       (setq epa-exit-buffer-function #'abort-recursive-edit)
       (goto-char (point-min))
@@ -549,11 +558,13 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-decrypt-region (start end)
-  "Decrypt the current region between START and END."
+  "Decrypt the current region between START and END.
+
+Don't use this command in Lisp programs!"
   (interactive "r")
   (save-excursion
     (let ((context (epg-make-context))
-         charset plain coding-system)
+         plain)
       (message "Decrypting...")
       (setq plain (epg-decrypt-string context (buffer-substring start end)))
       (message "Decrypting...done")
@@ -567,13 +578,15 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-decrypt-armor-in-region (start end)
-  "Decrypt OpenPGP armors in the current region between START and END."
+  "Decrypt OpenPGP armors in the current region between START and END.
+
+Don't use this command in Lisp programs!"
   (interactive "r")
   (save-excursion
     (save-restriction
       (narrow-to-region start end)
       (goto-char start)
-      (let (armor-start armor-end charset plain coding-system)
+      (let (armor-start armor-end charset coding-system)
        (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
          (setq armor-start (match-beginning 0)
                armor-end (re-search-forward "^-----END PGP MESSAGE-----$"
@@ -593,7 +606,9 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-verify-region (start end)
-  "Verify the current region between START and END."
+  "Verify the current region between START and END.
+
+Don't use this command in Lisp programs!"
   (interactive "r")
   (let ((context (epg-make-context)))
     (epg-verify-string context
@@ -606,7 +621,9 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-verify-armor-in-region (start end)
-  "Verify OpenPGP armors in the current region between START and END."
+  "Verify OpenPGP armors in the current region between START and END.
+
+Don't use this command in Lisp programs!"
   (interactive "r")
   (save-excursion
     (save-restriction
@@ -633,7 +650,9 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-sign-region (start end signers mode)
-  "Sign the current region between START and END by SIGNERS keys selected."
+  "Sign the current region between START and END by SIGNERS keys selected.
+
+Don't use this command in Lisp programs!"
   (interactive
    (list (region-beginning) (region-end)
         (epa-select-keys (epg-make-context) "Select keys for signing.
@@ -661,7 +680,9 @@ If no one is selected, default secret key is used.  "
 
 ;;;###autoload
 (defun epa-encrypt-region (start end recipients)
-  "Encrypt the current region between START and END for RECIPIENTS."
+  "Encrypt the current region between START and END for RECIPIENTS.
+
+Don't use this command in Lisp programs!"
   (interactive
    (list (region-beginning) (region-end)
         (epa-select-keys (epg-make-context) "Select recipents for encryption.