Commit b3f7e73f authored by Tino Calancha's avatar Tino Calancha

Prefer ?* to hide passwords

It might be argued that a hidden string is more legible when using
?* as the hidden character instead of ?.
For example, the following strings have the same length:
"......"

"******"

It's slighly easier to visually count the number of characters in the second
string (Bug#32220).

* lisp/subr.el (read-passwd): Prefer ?* as default char instead of ?.
* doc/lispref/minibuf.texi (Reading a Password): Update manual.
; * etc/NEWS (Changes in Emacs 27.1): Announce the change.
parent ea1cf096
......@@ -2199,7 +2199,7 @@ function @code{read-passwd}.
@defun read-passwd prompt &optional confirm default
This function reads a password, prompting with @var{prompt}. It does
not echo the password as the user types it; instead, it echoes
@samp{.} for each character in the password. If you want to apply
@samp{*} for each character in the password. If you want to apply
another character to hide the password, let-bind the variable
@code{read-hide-char} with that character.
......
......@@ -92,6 +92,9 @@ the new version of the file again.)
* Changes in Emacs 27.1
+++
** The function 'read-passwd' uses '*' as default character to hide passwords.
---
** New variable 'xft-ignore-color-fonts'.
Default t means don't try to load color fonts when using Xft, as they
......
......@@ -2299,7 +2299,7 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
If optional CONFIRM is non-nil, read the password twice to make sure.
Optional DEFAULT is a default password to use instead of empty input.
This function echoes `.' for each character that the user types.
This function echoes `*' for each character that the user types.
You could let-bind `read-hide-char' to another hiding character, though.
Once the caller uses the password, it can erase the password
......@@ -2325,7 +2325,7 @@ by doing (clear-string STRING)."
beg)))
(dotimes (i (- end beg))
(put-text-property (+ i beg) (+ 1 i beg)
'display (string (or read-hide-char ?.))))))
'display (string (or read-hide-char ?*))))))
minibuf)
(minibuffer-with-setup-hook
(lambda ()
......@@ -2340,7 +2340,7 @@ by doing (clear-string STRING)."
(add-hook 'after-change-functions hide-chars-fun nil 'local))
(unwind-protect
(let ((enable-recursive-minibuffers t)
(read-hide-char (or read-hide-char ?.)))
(read-hide-char (or read-hide-char ?*)))
(read-string prompt nil t default)) ; t = "no history"
(when (buffer-live-p minibuf)
(with-current-buffer minibuf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment