Subject: bug#73768: 'read-passwd-mode' can clobber user defined mode lines

From: Michael Albinus <[email-masked]>
Date: Sat, 12 Oct 2024 12:36:26 +0200

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

Hi Martin,

> After reading a password here I sometimes end up with seeing one or two
> eye icons in mode lines of buffers.  Other buffers may get a blank mode
> line.  I suppose the culprit is
>
>     (with-current-buffer read-passwd--mode-line-buffer
>       ;; Remove `read-passwd--mode-line-icon'.
>       (when (listp mode-line-format)
>         (setq mode-line-format (cdr mode-line-format)))))
>
> which can do something arbitrary to user defined mode lines which I use.
> Eventually, I have to kill or revert all involved buffers every time
> I've read a password.
>
> At the very least the code should try to identify the item it added
> earlier, remove the car only if it matches that item and restore the
> previous mode line format in case the items don't match.  Also it should
> check whether 'read-passwd--mode-line-buffer' still exists.

Could you please provide a short recipe I could play with?

> In either case, it would be nice to make showing the eye icon
> customizable by the user.  I found no way to do that.

I'll see what's possible. FTR, non-graphical alternatives are already
defined in read-passwd--show-password-icon and
read-passwd--hide-password-icon.

Could you pls give an example what you would like as replacement?

> Thanks, martin

Best regards, Michael.