From 47f8d950c58949733862813f29856480a9e232c7 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 6 Sep 2022 20:50:35 +0200 Subject: emacs: Add command password-store-generate-no-symbols This command generates a new password not including symbols. Suggested by Aner Zakobar : https://lists.zx2c4.com/pipermail/password-store/2022-August/004638.html --- contrib/emacs/CHANGELOG.md | 4 ++++ contrib/emacs/README.md | 8 ++++++++ contrib/emacs/password-store.el | 27 +++++++++++++++++++++++---- 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 -- cgit v1.2.3-54-g00ecf