[PATCH] Emacs - Interactive function for generating w/o symbols

Aner Zakobar aner at zakobar.com
Sat Aug 27 20:14:45 UTC 2022

Thank you so much for replying!

In general, I'm torn. I, like, you, would rather not add yet another

The reason I am not sure adding a variable would be good is because this
isn't some configuration that one would like to set ahead of time,
rather, a choice to make when generating each password individually.

In my use case, for instance, I would much rather generate with
symbols. The problem is, certain websites do not allow entering special
characters as their passwords (I know, right??)

So what I'll do is generate non-symbol passwords only for relevant
websites. By default, I will generate with symbols, and otherwise, I
will generate without.

Adding a variable would make sense if this is a one-time choice, but I
think it's a choice to make with each password.

I could be wrong though, this is just a reflection of my workflow. If
most people usually just do either/or, this seems like a good patch.

I would have just added a prefix argument, but there already is one
(password length). That's the reason I went with a new function. Is
there a better way to avoid adding a new function?

Thank you for taking time to address this!


Tino Calancha <tino.calancha at gmail.com> writes:

> On Wed, 24 Aug 2022, Aner Zakobar wrote:
>> Hi! First timer here.
> Welcome!
>> For your consideration, patch to add support for no-symbols password
>> generation to Emacs. This currently is supported, but is not reflected
>> in an interactive call, so I tended to do this through terminal.
> Thanks. Your patch looks good.
> I am just wondering if adding a new option is better than adding the
> new command.
> What do you think about the following patch?
> From d2165e27a946bed12a531897c5cf72c2f97b94b3 Mon Sep 17 00:00:00 2001
> From: Tino Calancha <tino.calancha at gmail.com>
> Date: Sat, 27 Aug 2022 20:59:44 +0200
> Subject: [PATCH] emacs: Add option password-store-exclude-symbols
> When non-nil, exclude symbols when creating a new password.
> Default value is nil, i.e., symbols included.
> ---
>   contrib/emacs/password-store.el | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
> index 1d23090..5bafcef 100644
> --- a/contrib/emacs/password-store.el
> +++ b/contrib/emacs/password-store.el
> @@ -46,6 +46,11 @@
>     :group 'password-store
>     :type 'number)
> +(defcustom password-store-exclude-symbols nil
> +  "Exclude symbols when creating a new password."
> +  :group 'password-store
> +  :type 'boolean)
> +
>   (defcustom password-store-time-before-clipboard-restore
>     (if (getenv "PASSWORD_STORE_CLIP_TIME")
>         (string-to-number (getenv "PASSWORD_STORE_CLIP_TIME"))
> @@ -344,10 +349,12 @@ 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))
>     ;; 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 password-store-exclude-symbols)
>     nil)
>   ;;;###autoload
> -- 
> 2.30.2

More information about the Password-Store mailing list