unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: better than read-hide-char
Date: Tue, 31 Jul 2018 12:10:46 -0400	[thread overview]
Message-ID: <b64c2adb-0647-3f06-e525-9ecf637a6916@gmail.com> (raw)
In-Reply-To: <E1fkKLW-0002D2-Ep@fencepost.gnu.org>

On 2018-07-30 22:25, Richard Stallman wrote:
> How about a feature whereby instead of ******************* or .............
> the password echoes as 012345678901234567890123456789...
> That way, you could tell how many characters you have successfully typed
> even when they are 20, 30, 40, 50, 60 or 70 characters.
> That would help people notice some mistakes in long passwords.

This sounds like a good idea, but I think it'd be even better to put that information in the modeline of the window above the minibuffer, rather than in the minibuffer itself. Something like this, partly copied from eldoc:

(progn
  (defvar passwd-mode-line nil)
  (put 'passwd-mode-line 'risky-local-variable t)

  (minibuffer-with-setup-hook
      (lambda ()
        (add-hook 'minibuffer-exit-hook (lambda () (setq passwd-mode-line nil)) nil t)
        (let ((prefix-len (buffer-size)))
          (with-current-buffer
              (window-buffer
               (or (window-in-direction 'above (minibuffer-window))
	           (minibuffer-selected-window)
	           (get-largest-window)))
            (when mode-line-format
              (unless (and (listp mode-line-format)
		           (assq 'passwd-mode-line mode-line-format))
	        (setq mode-line-format
	              `("" (passwd-mode-line passwd-mode-line) ,mode-line-format))))
            (setq passwd-mode-line
                  (concat (make-string (1+ prefix-len) ?\s)
                          "0123456789012345678901234567890"))
            (force-mode-line-update))))
    (read-passwd "Test: ")))

Clément.



  parent reply	other threads:[~2018-07-31 16:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  2:25 better than read-hide-char Richard Stallman
2018-07-31  7:18 ` Andreas Schwab
2018-07-31 15:08   ` Drew Adams
2018-07-31 15:15     ` Andreas Schwab
2018-07-31 15:41       ` Drew Adams
2018-08-01  4:31   ` Richard Stallman
2018-07-31  9:25 ` Simon Leinen
2018-07-31 13:47 ` Stefan Monnier
2018-08-01  4:29   ` Richard Stallman
2018-08-01 15:48   ` Davis Herring
2018-08-01 16:15     ` Stefan Monnier
2019-03-02 21:58   ` Juri Linkov
2018-07-31 16:10 ` Clément Pit-Claudel [this message]
2018-07-31 20:17   ` Stefan Monnier
2018-08-01 14:59     ` Clément Pit-Claudel
2018-08-01 15:21       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b64c2adb-0647-3f06-e525-9ecf637a6916@gmail.com \
    --to=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).