aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/emacs
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2022-09-06 20:50:35 +0200
committerTino Calancha <tino.calancha@gmail.com>2022-09-06 20:55:16 +0200
commit47f8d950c58949733862813f29856480a9e232c7 (patch)
tree8d213157956b22a5acb7a2b984250c4d6d1eba14 /contrib/emacs
parentemacs: Fix an infloop on Windows enviroments (diff)
downloadpassword-store-47f8d950c58949733862813f29856480a9e232c7.tar.xz
password-store-47f8d950c58949733862813f29856480a9e232c7.zip
emacs: Add command password-store-generate-no-symbols
This command generates a new password not including symbols. Suggested by Aner Zakobar <aner@zakobar.com>: https://lists.zx2c4.com/pipermail/password-store/2022-August/004638.html
Diffstat (limited to 'contrib/emacs')
-rw-r--r--contrib/emacs/CHANGELOG.md4
-rw-r--r--contrib/emacs/README.md8
-rw-r--r--contrib/emacs/password-store.el27
3 files changed, 35 insertions, 4 deletions
diff --git a/contrib/emacs/CHANGELOG.md b/contrib/emacs/CHANGELOG.md
index ed85577..0fa7cc4 100644
--- a/contrib/emacs/CHANGELOG.md
+++ b/contrib/emacs/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 2.2.0
+
+* (feature) Add command password-store-generate-no-symbols
+
# 2.1.5
* (bugfix) Fix an infloop on Windows enviroments.
diff --git a/contrib/emacs/README.md b/contrib/emacs/README.md
index d3679e9..8269c35 100644
--- a/contrib/emacs/README.md
+++ b/contrib/emacs/README.md
@@ -19,6 +19,14 @@ Interactive:
Password: ........
Confirm password: ........
+ ;; Generate a random password.
+ M-x password-store-generate
+ Password entry: bar-account
+
+ ;; Generate a random password without symbols.
+ M-x password-store-generate-no-symbols
+ Password entry: qux-account
+
M-x password-store-copy
Password entry: foo-account
Copied password for foo-account to the kill ring. Will clear in 45 seconds.
diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index 1d23090..6561eb1 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -342,12 +342,31 @@ Separate multiple IDs with spaces."
Default PASSWORD-LENGTH is `password-store-password-length'."
(interactive (list (password-store--completing-read)
- (when current-prefix-arg
- (abs (prefix-numeric-value current-prefix-arg)))))
- (unless password-length (setq password-length password-store-password-length))
+ (and current-prefix-arg
+ (abs (prefix-numeric-value current-prefix-arg)))))
;; A message with the output of the command is not printed because
;; the output contains the password.
- (password-store--run-generate entry password-length t)
+ (password-store--run-generate
+ entry
+ (or password-length password-store-password-length)
+ 'force)
+ nil)
+
+;;;###autoload
+(defun password-store-generate-no-symbols (entry &optional password-length)
+ "Generate a new password without symbols for ENTRY with PASSWORD-LENGTH.
+
+Default PASSWORD-LENGTH is `password-store-password-length'."
+ (interactive (list (password-store--completing-read)
+ (and current-prefix-arg
+ (abs (prefix-numeric-value current-prefix-arg)))))
+
+ ;; A message with the output of the command is not printed because
+ ;; the output contains the password.
+ (password-store--run-generate
+ entry
+ (or password-length password-store-password-length)
+ 'force 'no-symbols)
nil)
;;;###autoload