unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David Koppelman <koppel@ece.lsu.edu>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 51101@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
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	[thread overview]
Message-ID: <yg5sfxansvl.fsf@cyc.ece.lsu.edu> (raw)
In-Reply-To: <877demny4b.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 09 Oct 2021 15:09:24 +0200")

> 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 <larsi@gnus.org> writes:

> "David M. Koppelman" <koppel@ece.lsu.edu> 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.





  reply	other threads:[~2021-10-09 15:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 20:19 bug#51101: 29.0.50; read-char-from-minibuffer accepts Enter even when not a choice David M. Koppelman
2021-10-09 13:09 ` Lars Ingebrigtsen
2021-10-09 15:02   ` David Koppelman [this message]
2021-10-10 17:31   ` Juri Linkov
2021-10-10 20:06     ` Lars Ingebrigtsen

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=yg5sfxansvl.fsf@cyc.ece.lsu.edu \
    --to=koppel@ece.lsu.edu \
    --cc=51101@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.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).