summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authoribizaman <ibizapeanut@gmail.com>2019-06-28 10:35:28 -0700
committerSvend Sorensen <svend@svends.net>2019-08-04 13:04:46 -0700
commite93e03705fb5b81f3af85f04c07ad0ee2190b6aa (patch)
treee2fd35beac49e104b65662214ce859d0ff27a0c1 /contrib
parentc22cdbd4674a25dec71fe42ec1ef0b4829b6c7f3 (diff)
downloadpass-e93e03705fb5b81f3af85f04c07ad0ee2190b6aa.tar.gz
pass-e93e03705fb5b81f3af85f04c07ad0ee2190b6aa.tar.bz2
pass-e93e03705fb5b81f3af85f04c07ad0ee2190b6aa.zip
emacs: require matching password for completion
Diffstat (limited to '')
-rw-r--r--contrib/emacs/password-store.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index fe9271d..a08fec9 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -177,9 +177,11 @@ Nil arguments are ignored. Output is discarded."
"Return entry name corresponding to FILE."
(f-no-ext (f-relative file (password-store-dir))))
-(defun password-store--completing-read ()
- "Read a password entry in the minibuffer, with completion."
- (completing-read "Password entry: " (password-store-list)))
+(defun password-store--completing-read (&optional require-match)
+ "Read a password entry in the minibuffer, with completion.
+
+Require a matching password if `REQUIRE-MATCH' is 't'."
+ (completing-read "Password entry: " (password-store-list) nil require-match))
(defun password-store-list (&optional subdir)
"List password entries under SUBDIR."
@@ -193,7 +195,7 @@ Nil arguments are ignored. Output is discarded."
;;;###autoload
(defun password-store-edit (entry)
"Edit password for ENTRY."
- (interactive (list (password-store--completing-read)))
+ (interactive (list (password-store--completing-read t)))
(password-store--run-edit entry))
;;;###autoload
@@ -228,7 +230,7 @@ When CALLBACK is non-`NIL', call CALLBACK with the first line instead."
Clear previous password from kill ring. Pointer to kill ring is
stored in `password-store-kill-ring-pointer'. Password is cleared
after `password-store-timeout' seconds."
- (interactive (list (password-store--completing-read)))
+ (interactive (list (password-store--completing-read t)))
(password-store-get
entry
(lambda (password)
@@ -275,13 +277,13 @@ Default PASSWORD-LENGTH is `password-store-password-length'."
;;;###autoload
(defun password-store-remove (entry)
"Remove existing password for ENTRY."
- (interactive (list (password-store--completing-read)))
+ (interactive (list (password-store--completing-read t)))
(message "%s" (password-store--run-remove entry t)))
;;;###autoload
(defun password-store-rename (entry new-entry)
"Rename ENTRY to NEW-ENTRY."
- (interactive (list (password-store--completing-read)
+ (interactive (list (password-store--completing-read t)
(read-string "Rename entry to: ")))
(message "%s" (password-store--run-rename entry new-entry t)))
@@ -297,7 +299,7 @@ Default PASSWORD-LENGTH is `password-store-password-length'."
This will only browse URLs that start with http:// or https:// to
avoid sending a password to the browser."
- (interactive (list (password-store--completing-read)))
+ (interactive (list (password-store--completing-read t)))
(let ((url (password-store-get entry)))
(if (or (string-prefix-p "http://" url)
(string-prefix-p "https://" url))