From: ueno Date: Tue, 20 Mar 2007 22:56:59 +0000 (+0000) Subject: (epa--list-keys): New function. X-Git-Tag: epg-0_0_11~49 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac151e07ccf9c70f1d9dd4fc721b3ba4547e8b32;p=elisp%2Fepg.git (epa--list-keys): New function. (epa-list-keys): Use it. (epa-list-secret-keys): New command. --- diff --git a/ChangeLog b/ChangeLog index a2a5b48..42600fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-03-21 Daiki Ueno + + * epa.el (epa--list-keys): New function. + (epa-list-keys): Use it. + (epa-list-secret-keys): New command. + 2007-03-20 Daiki Ueno * epa.el (epa-display-info): Generate new *Info* buffer if buffer diff --git a/epa.el b/epa.el index 66e0d3a..bc9cf4f 100644 --- a/epa.el +++ b/epa.el @@ -330,43 +330,6 @@ If ARG is non-nil, mark the current line." (interactive) (funcall epa-exit-buffer-function)) -;;;###autoload -(defun epa-list-keys (&optional name mode) - "List all keys matched with NAME from the keyring. -If MODE is non-nil, it reads the private keyring. Otherwise, it -reads the public keyring." - (interactive - (if current-prefix-arg - (let ((name (read-string "Pattern: " - (if epa-list-keys-arguments - (car epa-list-keys-arguments))))) - (list (if (equal name "") nil name) - (y-or-n-p "Secret keys? "))) - (or epa-list-keys-arguments (list nil nil)))) - (unless (and epa-keys-buffer - (buffer-live-p epa-keys-buffer)) - (setq epa-keys-buffer (generate-new-buffer "*Keys*"))) - (set-buffer epa-keys-buffer) - (epa-key-list-mode) - (let ((inhibit-read-only t) - buffer-read-only - (point (point-min)) - (context (epg-make-context epa-protocol))) - (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--insert-keys context name mode) - (widget-setup) - (set-keymap-parent (current-local-map) widget-keymap)) - (make-local-variable 'epa-list-keys-arguments) - (setq epa-list-keys-arguments (list name mode)) - (goto-char (point-min)) - (pop-to-buffer (current-buffer))) - (defun epa--insert-keys (context name mode) (save-excursion (save-restriction @@ -392,6 +355,55 @@ reads the public keyring." 'start-open t 'end-open t))))) +(defun epa--list-keys (name secret) + (unless (and epa-keys-buffer + (buffer-live-p epa-keys-buffer)) + (setq epa-keys-buffer (generate-new-buffer "*Keys*"))) + (set-buffer epa-keys-buffer) + (epa-key-list-mode) + (let ((inhibit-read-only t) + buffer-read-only + (point (point-min)) + (context (epg-make-context epa-protocol))) + (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--insert-keys context name secret) + (widget-setup) + (set-keymap-parent (current-local-map) widget-keymap)) + (make-local-variable 'epa-list-keys-arguments) + (setq epa-list-keys-arguments (list name mode)) + (goto-char (point-min)) + (pop-to-buffer (current-buffer))) + +;;;###autoload +(defun epa-list-keys (&optional name) + "List all keys matched with NAME from the public keyring." + (interactive + (if current-prefix-arg + (let ((name (read-string "Pattern: " + (if epa-list-keys-arguments + (car epa-list-keys-arguments))))) + (list (if (equal name "") nil name))) + (or epa-list-keys-arguments (list nil nil)))) + (epa--list-keys name nil)) + +;;;###autoload +(defun epa-list-secret-keys (&optional name) + "List all keys matched with NAME from the private keyring." + (interactive + (if current-prefix-arg + (let ((name (read-string "Pattern: " + (if epa-list-keys-arguments + (car epa-list-keys-arguments))))) + (list (if (equal name "") nil name))) + (or epa-list-keys-arguments (list nil nil)))) + (epa--list-keys name t)) + (defun epa--marked-keys () (or (save-excursion (set-buffer epa-keys-buffer)