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

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

bug#5803: 23.1.94; Using tq-enqueue in timer messes with keystroke echoi


From: Eli Zaretskii
Subject: bug#5803: 23.1.94; Using tq-enqueue in timer messes with keystroke echoing
Date: Thu, 10 Dec 2020 17:41:51 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 5803@debbugs.gnu.org,  deng@randomsample.de
> Date: Wed, 09 Dec 2020 19:42:59 +0100
> 
> (setq proc (start-process "shell" (get-buffer-create "*process*") "/bin/sh"))
> (defun send-test ()
>   (process-send-string proc "ls /tmp\n"))
> (setq timer (run-with-timer 1 1 'send-test))
> 
> I then hit
> 
> C-x
> 
> and I don't get the "C-x-" prompt.

Thanks.

I found the discussion about a related issue we had in the past, it
starts here:

  https://lists.gnu.org/archive/html/emacs-devel/2018-09/msg00863.html

and the analysis is here:

  https://lists.gnu.org/archive/html/emacs-devel/2018-09/msg00899.html

That patch was installed, but it only fixes the while-no-input
problem.  It doesn't fix this problem, which has the same root cause:
the buffer-switch event we inject when output from a subprocess
arrives is considered valid input, and so when sit_for makes this
test:

  return detect_input_pending () ? Qnil : Qt;  <<<<<<<<<<<<<<<<<<<

it returns nil, and the keystroke echo is not displayed, because the
logic in keyboard.c assumes this means the user typed something.

So I think one way of fixing this is to make the test at the end of
sit_for smarter: if the only event in the input queue is the
buffer-change event, ignore it and return non-nil.  (Alternatively, we
could do this in read_char, where sit_for is called.)

As yet another alternative, we could ask Stefan whether the patch he
suggested back then is still being used, and if so, whether there were
any adverse effects.  He promised to report back in

  https://lists.gnu.org/archive/html/emacs-devel/2018-09/msg00914.html

but AFAIR never did...





reply via email to

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