Subject: 'read-passwd-mode' can clobber user defined mode lines
From: martin rudalics <[email-masked]>
To: Bug-Gnu-Emacs <[email-masked]>
Date: Sat, 12 Oct 2024 11:26:31 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

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

Thanks, martin

In GNU Emacs 31.0.50 (build 13, x86_64-pc-linux-gnu, GTK+ Version
  3.24.38, cairo version 1.16.0) of 2024-10-12 built on restno
Repository revision: 6e80509099e27e237787186f4e8731bfdfb9b00d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
  'configure --with-gif=ifavailable --with-tiff=ifavailable
  --with-gnutls=no --without-pop 'CFLAGS=-O3 -g3 -no-pie''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GSETTINGS HARFBUZZ JPEG LIBSELINUX MODULES
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LANG: de_AT.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
   pop-up-mini-mode: t
   scroll-restore-mode: t
   regexp-lock-mode: t
   eldoc-tooltip-mode: t
   tooltip-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   context-menu-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   minibuffer-regexp-mode: t
   column-number-mode: t
   line-number-mode: t
   auto-fill-function: my-lisp-mode-auto-fill
   indent-tabs-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   temp-buffer-resize-mode: t

Load-path shadows:
None found.

Features:
(shadow mail-extr warnings emacsbug message mailcap yank-media puny
rfc822 mml mml-sec password-cache epa epg rfc6068 epg-config gnus-util
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs vc-git files-x
vc-dispatcher elp vc-hg diff-mode track-changes ediff-vers ediff
ediff-merg ediff-mult ediff-wind ediff-diff ediff-help ediff-init
ediff-util local-tags goto-last-change speck pop-up-mini info-look
find-func srt-mode derived elinfo-support elinfo texinfo
texinfo-loaddefs info shell pcomplete comint subr-x ansi-osc ansi-color
sidebar bookmark text-property-search sort m&d scroll-restore
regexp-lock time-stamp cl-macs eldoc-tooltip pcase easy-mmode etags
fileloop generator xref project byte-opt bytecomp byte-compile ring
find-dired dired dired-loaddefs cus-edit pp cus-load icons wid-edit
cl-loaddefs cl-lib jka-compr ls-lisp gv rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk x-toolkit xinput2 x multi-tty move-toolbar make-network-process
emacs)

Memory information:
((conses 16 271421 29959) (symbols 48 16095 0) (strings 32 44610 3502)
  (string-bytes 1 1330220) (vectors 16 24496)
  (vector-slots 8 277397 25280) (floats 8 109 1037)
  (intervals 56 9458 42) (buffers 984 34))