unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 32220@debbugs.gnu.org
Cc: tino.calancha@gmail.com,
	stefan monnier <monnier@iro.umontreal.ca>,
	noam postavsky <npostavs@gmail.com>
Subject: bug#32220: 27.0.50; Prefer ?* to hide passwords
Date: Fri, 20 Jul 2018 17:04:39 +0900	[thread overview]
Message-ID: <87bmb29vu0.fsf@calancha-pc.dy.bbexcite.jp> (raw)


X-Debbugs-Cc: Stefan Monnier <monnier@iro.umontreal.ca>,Noam Postavsky <npostavs@gmail.com>,Eli Zaretskii <eliz@gnu.org>,tino.calancha@gmail.com

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 <tino.calancha@gmail.com>
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
-@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.
 
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:
 \f
 * 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	other threads:[~2018-07-20  8:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20  8:04 Tino Calancha [this message]
2018-07-20 12:06 ` bug#32220: 27.0.50; Prefer ?* to hide passwords Stefan Monnier
2018-07-27  2:31 ` Tino Calancha
2018-07-27 12:34   ` Eli Zaretskii
2018-07-29 12:25     ` Tino Calancha

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=87bmb29vu0.fsf@calancha-pc.dy.bbexcite.jp \
    --to=tino.calancha@gmail.com \
    --cc=32220@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=npostavs@gmail.com \
    /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).