From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Koppelman Newsgroups: gmane.emacs.bugs Subject: bug#51101: 29.0.50; read-char-from-minibuffer accepts Enter even when not a choice. Date: Sat, 09 Oct 2021 10:02:38 -0500 Message-ID: References: <877demny4b.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9535"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 51101@debbugs.gnu.org, Juri Linkov To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 09 17:03:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mZDsV-0002Hs-G1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Oct 2021 17:03:11 +0200 Original-Received: from localhost ([::1]:35800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZDsU-0002Ae-2d for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Oct 2021 11:03:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZDsM-0002AV-KO for bug-gnu-emacs@gnu.org; Sat, 09 Oct 2021 11:03:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZDsM-0007lF-Bz for bug-gnu-emacs@gnu.org; Sat, 09 Oct 2021 11:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mZDsM-00088y-8x for bug-gnu-emacs@gnu.org; Sat, 09 Oct 2021 11:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Koppelman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Oct 2021 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51101 X-GNU-PR-Package: emacs Original-Received: via spool by 51101-submit@debbugs.gnu.org id=B51101.163379176931285 (code B ref 51101); Sat, 09 Oct 2021 15:03:02 +0000 Original-Received: (at 51101) by debbugs.gnu.org; 9 Oct 2021 15:02:49 +0000 Original-Received: from localhost ([127.0.0.1]:53948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZDs9-00088X-Ey for submit@debbugs.gnu.org; Sat, 09 Oct 2021 11:02:49 -0400 Original-Received: from relay001.lsu.edu ([130.39.6.46]:48816 helo=relay.lsu.edu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZDs6-00088H-SJ for 51101@debbugs.gnu.org; Sat, 09 Oct 2021 11:02:47 -0400 Original-Received: from cyc.ece.lsu.edu (cyc.ece.lsu.edu [96.125.115.182]) by relay.lsu.edu (Postfix) with ESMTPS id BADCB219CB4F; Sat, 9 Oct 2021 10:02:38 -0500 (CDT) In-Reply-To: <877demny4b.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 09 Oct 2021 15:09:24 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:216774 Archived-At: > But I think ask-user-about-supersession-threat is working correctly here > already (almost by chance). RET means "yes" in functions like > `y-or-n-p', which this is basically an extended version of, so it should > work as "yes" here, too. That might make sense if someone were expecting a prompt, but this prompt appears totally unexpectedly when one tries to enter text into a buffer, often that text includes enter. It would be easy to overlook the prompt and so suffer dataloss. David Lars Ingebrigtsen writes: > "David M. Koppelman" writes: > >> Execute: >> >> (read-char-from-minibuffer "Answer y or n" '(?y ?n)) >> >> and press Enter. The form returns Enter (13) rather than re-prompting >> for a y or n. > > It seems undocumented what RET is supposed to do in this function -- > I've added Juri to the CCs, perhaps he has some comments. > >> This causes a dataloss threat due to read-char-from-minibuffer being >> called through ask-user-about-supersession-threat. >> >> Even if the read-char-from-minibuffer bug is quickly fixed, I'd >> sleep better if the following patch were applied to userlock.el: >> >> @@ -194,7 +194,9 @@ ask-user-about-supersession-threat >> (list "File reverted" filename))) >> ((eq answer ?n) >> (signal 'file-supersession >> - (list "File changed on disk" filename))))) >> + (list "File changed on disk" filename))) >> + ((eq answer ?y)) >> + (t (setq answer nil)))) > > But I think ask-user-about-supersession-threat is working correctly here > already (almost by chance). RET means "yes" in functions like > `y-or-n-p', which this is basically an extended version of, so it should > work as "yes" here, too.