* epa.el (epa-list-keys-1): Add 'epa-list-keys property to keylist
authorueno <ueno>
Thu, 20 Apr 2006 09:47:29 +0000 (09:47 +0000)
committerueno <ueno>
Thu, 20 Apr 2006 09:47:29 +0000 (09:47 +0000)
region.

ChangeLog
epa.el

index 6bb926d..f0ee038 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2006-04-20  Daiki Ueno  <ueno@unixuser.org>
 
+       * epa.el (epa-list-keys-1): Add 'epa-list-keys property to keylist
+       region.
+
+2006-04-20  Daiki Ueno  <ueno@unixuser.org>
+
        * pgg-epg.el (pgg-epg-secret-key-id-list): New variable.
        (pgg-epg-passphrase-callback): New function.
 
diff --git a/epa.el b/epa.el
index c95480e..043ffd6 100644 (file)
--- a/epa.el
+++ b/epa.el
     (setq epa-keys-buffer (generate-new-buffer "*Keys*")))
   (set-buffer epa-keys-buffer)
   (let ((inhibit-read-only t)
-       buffer-read-only)
-    (erase-buffer)
+       buffer-read-only
+       (point (point-min)))
+    (unless (get-text-property point 'epa-list-keys)
+      (setq point (next-single-property-change point 'epa-list-keys)))
+    (when point
+      (delete-region point
+                    (or (next-single-property-change point 'epa-list-keys)
+                        (point-max)))
+      (goto-char point))
     (epa-list-keys-1 name mode)
     (epa-keys-mode))
   (make-local-variable 'epa-list-keys-arguments)
   (pop-to-buffer (current-buffer)))
 
 (defun epa-list-keys-1 (name mode)
-  (let ((inhibit-read-only t)
-       buffer-read-only
-       (keys (epg-list-keys 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)))))
+  (save-restriction
+    (narrow-to-region (point) (point))
+    (let ((inhibit-read-only t)
+         buffer-read-only
+         (keys (epg-list-keys 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-marked-keys ()
   (or (save-excursion
@@ -464,10 +474,7 @@ If no one is selected, symmetric encryption will be performed.  ")))
   (let ((cipher (concat file ".gpg"))
        (context (epg-make-context)))
     (message "Encrypting %s..." (file-name-nondirectory file))
-    (epg-encrypt-file context
-                     file
-                     recipients
-                     cipher)
+    (epg-encrypt-file context file recipients cipher)
     (message "Encrypting %s...done" (file-name-nondirectory file))))
 
 (defun epa-delete-keys (keys)