Subject: bug#69237: 30.0.50; Toggle password visibility

From: Kévin Le Gouguec <[email-masked]>
Date: Thu, 22 Feb 2024 22:30:48 +0000

Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

> We have `read-passwd', which reads a password in the minibuffer, hiding
> the input. However, modern password input boxes outside Emacs allow to
> show/hide the input while typing.
>
> The appended patch tries to implement this feature. The minibuffer in
> `read-passwd' has bound TAB to a function, which toggles visibility of
> the typed input.
>
> On graphic displays, the mode-line has an additional indicator for
> whowing/hiding the typed password. Clicking on this indicator with
> mouse-1 toggles the password visibility.
>
> Comments?

Thank you so much for working on this!  I've had my own half-baked
implementation of this for months; never took the time to polish it up
and submit.

No strong feelings re. keybindings; I've been using C-c C-c because I
wanted something easy to mash, but TAB fits that criterion as well.  Not
sure we can leverage any well-established mnemonic from other keymaps;
FWIW…

* TAB could be familiar to some outline users, but they'll probably
associate that binding to (un)folding, not necessarily hiding/revealing;

* hideshow has multiple bindings for "toggle-hiding", so not sure we can
count on any single one having enough "mindshare".

(Not too worried about needing to input TAB verbatim - I tend to
naturally reach for C-q TAB when I need to do that, since in most
contexts Emacs has a useful command bound to TAB instead of
self-insert-command)

Other than the keybinding, the only other musing I have is regarding the
indicator: wondering if icons.el could help trim some of the boilerplate
down.  In any case, it would give the user some degree of control over
how the indicator is shown (via the icon-preference option) even if we
don't provide 'emoji nor 'symbol variants.

Not overly familiar with that library though - if that's something you
think might be worth looking into, the define-icon forms in outline.el
might help you assess how helpful the library would actually be.