bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32220: 27.0.50; Prefer ?* to hide passwords


From: Tino Calancha
Subject: bug#32220: 27.0.50; Prefer ?* to hide passwords
Date: Fri, 20 Jul 2018 17:04:39 +0900

X-Debbugs-Cc: Stefan Monnier <address@hidden>,Noam Postavsky 
<address@hidden>,Eli Zaretskii <address@hidden>,address@hidden

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:
"......"

"******"

Following patch uses ?* as default character to hide passwords instead
of ?.

--8<-----------------------------cut here---------------start------------->8---
commit 6b5c3db59650590d9db24ef110b972019b24e03a
Author: Tino Calancha <address@hidden>
Date:   Fri Jul 20 16:58:33 2018 +0900

    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.

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 889b64af8a..d091787a68 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -2199,7 +2199,7 @@ Reading a Password
 @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
address@hidden  for each character in the password.  If you want to apply
address@hidden  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.
 
diff --git a/etc/NEWS b/etc/NEWS
index 8275cbb72c..f21da91a4b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -84,6 +84,9 @@ work right without some adjustment:
 
 * 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
diff --git a/lisp/subr.el b/lisp/subr.el
index 10343e69db..59a6209af3 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2305,7 +2305,7 @@ read-passwd
 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
@@ -2331,7 +2331,7 @@ read-passwd
                                      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 ()
@@ -2346,7 +2346,7 @@ read-passwd
             (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

--8<-----------------------------cut here---------------end--------------->8---

In GNU Emacs 27.0.50 (build 18, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2018-07-20
Repository revision: fb24ce37d1bc258cfc3884d9828aa0602fa06e1d
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]