2006-04-16 Daiki Ueno <ueno@unixuser.org>
+ * epa.el (epa-select-keys): Renamed from epa-ask-keys; use
+ recursive-edit.
+ * epa-dired.el (epa-dired-encrypt-file): Use epa-select-keys.
+
+2006-04-16 Daiki Ueno <ueno@unixuser.org>
+
* epa-setup.el: New file.
* epa-dired.el: New file.
(setq file-list (cdr file-list)))
(revert-buffer)))
-(defun epa-dired-encrypt-file (keys file)
+(defun epa-dired-encrypt-file (file)
(let ((cipher (concat file ".gpg"))
- (context (epg-make-context)))
+ (context (epg-make-context))
+ (keys (epa-select-keys "Select recipents for encryption.
+If no one is selected, symmetric encryption will be performed. ")))
(message "Encrypting %s..." (file-name-nondirectory file))
(epg-encrypt-file context
file
(interactive)
(let ((file-list (dired-get-marked-files)))
(while file-list
- (epa-ask-keys "Select recipents for encryption.
-If no one is selected, symmetric encryption will be performed. "
- #'epa-dired-encrypt-file nil
- (expand-file-name (car file-list)))
+ (epa-dired-encrypt-file (car file-list))
(setq file-list (cdr file-list)))))
(provide 'epa-dired)
"Faces for epa-mode."
:group 'epa)
-(defvar epa-buffer nil)
-
(defface epa-validity-high-face
'((((class color) (background dark))
(:foreground "PaleTurquoise" :bold t))
(put-text-property point (point) 'epa-key (car keys))
(setq keys (cdr keys)))))
-(defun epa-ask-keys (prompt function &optional names &rest args)
+(defun epa-select-keys (prompt &optional names)
(unless (and epa-keys-buffer
(buffer-live-p epa-keys-buffer))
(setq epa-keys-buffer (generate-new-buffer "*Keys*")))
- (let ((buffer (current-buffer))
- (inhibit-read-only t)
+ (let ((inhibit-read-only t)
buffer-read-only)
(set-buffer epa-keys-buffer)
(erase-buffer)
- (insert prompt)
- (widget-create 'push-button
- :tag "Done"
- :notify (lambda (widget &rest ignore)
- (let ((callback (widget-value widget))
- keys key)
- (while (re-search-forward "^\\*" nil t)
- (if (setq key (get-text-property (point)
- 'epa-key))
- (setq keys (cons key keys))))
- (set-buffer (car callback))
- (apply (car (cdr callback)) keys
- (cdr (cdr callback)))))
- (cons buffer (cons function args)))
- (insert "\n\n")
+ (insert prompt "\n\n"
+ (substitute-command-keys "\\[exit-recursive-edit] to exit.")
+ "\n\n")
(if names
(while names
(epa-list-keys-1 (car names))
(epa-list-keys-1 nil))
(epa-keys-mode)
(goto-char (point-min))
- (pop-to-buffer (current-buffer))))
+ (pop-to-buffer (current-buffer))
+ (unwind-protect
+ (progn
+ (recursive-edit)
+ (save-excursion
+ (set-buffer epa-keys-buffer)
+ (goto-char (point-min))
+ (let (keys key)
+ (while (re-search-forward "^\\*" nil t)
+ (if (setq key (get-text-property (match-beginning 0) 'epa-key))
+ (setq keys (cons key keys))))
+ (nreverse keys))))
+ (if (get-buffer-window epa-keys-buffer)
+ (delete-window (get-buffer-window epa-keys-buffer))))))
(defun epa-show-key (key)
(let* ((primary-sub-key (car (epg-key-sub-key-list key)))