* Re: Disable text conversion in map-ynp @ 2024-05-06 12:06 Eli Zaretskii 2024-05-06 12:46 ` Po Lu 0 siblings, 1 reply; 6+ messages in thread From: Eli Zaretskii @ 2024-05-06 12:06 UTC (permalink / raw) To: Po Lu; +Cc: emacs-devel I reverted the commit which replaced read-event with read-key in map-y-or-n-p. Bitter experience has taught us that such replacements cause trouble, so we should not make them without a thorough discussion, including a good understanding of the issues and the alternative solution. Feel free to continue this thread with an explanation of the problem, and why using read-key instead of read-event solves it. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Disable text conversion in map-ynp 2024-05-06 12:06 Disable text conversion in map-ynp Eli Zaretskii @ 2024-05-06 12:46 ` Po Lu 2024-05-06 13:41 ` Eli Zaretskii 0 siblings, 1 reply; 6+ messages in thread From: Po Lu @ 2024-05-06 12:46 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel Eli Zaretskii <eliz@gnu.org> writes: > I reverted the commit which replaced read-event with read-key in > map-y-or-n-p. Bitter experience has taught us that such replacements > cause trouble, so we should not make them without a thorough > discussion, including a good understanding of the issues and the > alternative solution. > > Feel free to continue this thread with an explanation of the problem, > and why using read-key instead of read-event solves it. read-event is supposed to signal to GUI input methods that they should not attempt to insert typed text directly into the current buffer, in the process called text conversion. Some user reported that map-ynp was not functional with read-key on Android and other systems where input methods are installed, and that substituting read-event sufficed, though read-key is meant to disable text conversion as well. (I had not the time to verify either theory for myself but I've also never had any occasion to doubt his feedback.) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Disable text conversion in map-ynp 2024-05-06 12:46 ` Po Lu @ 2024-05-06 13:41 ` Eli Zaretskii 2024-05-06 14:14 ` Po Lu 0 siblings, 1 reply; 6+ messages in thread From: Eli Zaretskii @ 2024-05-06 13:41 UTC (permalink / raw) To: Po Lu; +Cc: emacs-devel > From: Po Lu <luangruo@yahoo.com> > Cc: emacs-devel@gnu.org > Date: Mon, 06 May 2024 20:46:16 +0800 > > Eli Zaretskii <eliz@gnu.org> writes: > > > I reverted the commit which replaced read-event with read-key in > > map-y-or-n-p. Bitter experience has taught us that such replacements > > cause trouble, so we should not make them without a thorough > > discussion, including a good understanding of the issues and the > > alternative solution. > > > > Feel free to continue this thread with an explanation of the problem, > > and why using read-key instead of read-event solves it. > > read-event is supposed to signal to GUI input methods that they should > not attempt to insert typed text directly into the current buffer, in > the process called text conversion. Some user reported that map-ynp was > not functional with read-key on Android and other systems where input > methods are installed, and that substituting read-event sufficed, though > read-key is meant to disable text conversion as well. (I had not the > time to verify either theory for myself but I've also never had any > occasion to doubt his feedback.) Thanks, but I don't think I understand the issue, given the above description. For starters, you changed read-event to read-key, not the other way around. So does it mean it's read-key that is supposed to prevent text conversion, while read-event does not? Also, read-event disables input methods if its 2nd argument is nil (which it is in this case) -- does this mean that fact does not affect the Android input methods? and if so, is there a way to suppress input methods on Android while still calling read-event? IOW, I'd like to keep using read-event, but make sure text-conversion doesn't happen, instead of switching to read-key. And if that's impossible for some reason, how about using read-key only on Android? In any case, I feel that we should have a better understanding of the underlying issues before we decide how to solve them. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Disable text conversion in map-ynp 2024-05-06 13:41 ` Eli Zaretskii @ 2024-05-06 14:14 ` Po Lu 2024-05-06 14:56 ` Eli Zaretskii 0 siblings, 1 reply; 6+ messages in thread From: Po Lu @ 2024-05-06 14:14 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel Eli Zaretskii <eliz@gnu.org> writes: > Thanks, but I don't think I understand the issue, given the above > description. For starters, you changed read-event to read-key, not > the other way around. So does it mean it's read-key that is supposed > to prevent text conversion, while read-event does not? Yes, sorry. See the doc string of read-key: Also in contrast to `read-event', input method text conversion will be disabled while the key sequence is read, so that character input events will always be generated for keyboard input. > Also, read-event disables input methods if its 2nd argument is nil > (which it is in this case) -- does this mean that fact does not affect > the Android input methods? INHERIT-INPUT-METHOD only affects Emacs input methods, yes. > and if so, is there a way to suppress input methods on Android while > still calling read-event? There could be, but it would entail calling read-char rather than read-event, or introducing a new parameter to read-event. I'm not sure the former is any more correct than calling read-key. > IOW, I'd like to keep using read-event, but make sure text-conversion > doesn't happen, instead of switching to read-key. And if that's > impossible for some reason, how about using read-key only on Android? I think an informed conclusion would be easier to draw if you directed me to previous occasions where issues arose from switching from read-key to read-event in similar contexts. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Disable text conversion in map-ynp 2024-05-06 14:14 ` Po Lu @ 2024-05-06 14:56 ` Eli Zaretskii 2024-05-07 0:48 ` Po Lu 0 siblings, 1 reply; 6+ messages in thread From: Eli Zaretskii @ 2024-05-06 14:56 UTC (permalink / raw) To: Po Lu; +Cc: emacs-devel > From: Po Lu <luangruo@yahoo.com> > Cc: emacs-devel@gnu.org > Date: Mon, 06 May 2024 22:14:28 +0800 > > > and if so, is there a way to suppress input methods on Android while > > still calling read-event? > > There could be, but it would entail calling read-char rather than > read-event, or introducing a new parameter to read-event. Don't we have some variable that could be bound around the call to read-event to suppress text-conversion? If not, we should, because this is definitely not the last situation where it could get in the way. > > IOW, I'd like to keep using read-event, but make sure text-conversion > > doesn't happen, instead of switching to read-key. And if that's > > impossible for some reason, how about using read-key only on Android? > > I think an informed conclusion would be easier to draw if you directed > me to previous occasions where issues arose from switching from read-key > to read-event in similar contexts. I don't have it ready. But I'm not sure how would that help. If you look at what read-key does and compare that to read-event, you will see that the differences are so significant as to thwart any attempt to figure out when and how these two will behave differently. But okay, see these: bug#24635 bug#29150 https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00601.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Disable text conversion in map-ynp 2024-05-06 14:56 ` Eli Zaretskii @ 2024-05-07 0:48 ` Po Lu 0 siblings, 0 replies; 6+ messages in thread From: Po Lu @ 2024-05-07 0:48 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel Eli Zaretskii <eliz@gnu.org> writes: > Don't we have some variable that could be bound around the call to > read-event to suppress text-conversion? If not, we should, because > this is definitely not the last situation where it could get in the > way. overriding-text-conversion-style, but it is rather unwieldy when functions that read events or from the minibuffer are involved, as its users must reset the input method before changes to its value take effect, which process is far less involved in C. At all events, I'll install a change implemented around overriding-text-conversion-style shortly. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-07 0:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-05-06 12:06 Disable text conversion in map-ynp Eli Zaretskii 2024-05-06 12:46 ` Po Lu 2024-05-06 13:41 ` Eli Zaretskii 2024-05-06 14:14 ` Po Lu 2024-05-06 14:56 ` Eli Zaretskii 2024-05-07 0:48 ` Po Lu
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).