Function: read-passwd-toggle-visibility

read-passwd-toggle-visibility is an interactive and byte-compiled function defined in auth-source.el.gz.

Signature

(read-passwd-toggle-visibility)

Documentation

Toggle minibuffer contents visibility.

Adapt also mode line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/auth-source.el.gz
(defun read-passwd-toggle-visibility ()
  "Toggle minibuffer contents visibility.
Adapt also mode line."
  (interactive)
  (let ((win (active-minibuffer-window)))
    (unless win (error "No active minibuffer"))
    ;; FIXME: In case of a recursive minibuffer, this may select the wrong
    ;; mini-buffer.
    (with-current-buffer (window-buffer win)
      (when (memq 'read-passwd-mode local-minor-modes)
        (setq read-passwd--hide-password (not read-passwd--hide-password))
        (setq read-passwd--mode-line-icon
              `(:propertize
                ,(if icon-preference
                     (icon-string
                      (if read-passwd--hide-password
                          'read-passwd--show-password-icon
                        'read-passwd--hide-password-icon))
                   "")
                mouse-face mode-line-highlight
                keymap
                ,(eval-when-compile
                   (let ((map (make-sparse-keymap)))
                     (define-key map [mode-line mouse-1]
                                 #'read-passwd-toggle-visibility)
                     map))))
        (force-mode-line-update 'all)
        (read-passwd--hide-password)))))