all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 34535@debbugs.gnu.org
Subject: bug#34535: 27.0.50; emacs -nw: while-no-input + sit-for + <KEY> => Quit
Date: Fri, 22 Feb 2019 18:08:58 +0200	[thread overview]
Message-ID: <83k1hrrejp.fsf@gnu.org> (raw)
In-Reply-To: <87r2c4ennz.fsf@web.de> (message from Michael Heerdegen on Mon, 18 Feb 2019 23:29:04 +0100)

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Mon, 18 Feb 2019 23:29:04 +0100
> 
> in emacs -nw -Q eval in any way
> 
>   (while-no-input (sit-for 20))
> 
> and hit any key before the sit-for terminates.  This always gives me a
> Quit.  That should not happen.

On the emacs-26 branch, we have bug#31692, so this cannot work
correctly there.  That bug is fixed on master, though.

What happens on master is this: when sit-for is called inside
while-no-input on a TTY, it returns the cons cell (t . ?\C-g), which
then causes keyboard quit right after while-no-input returns.

The below seems to fix the problem, but I hope you also have a more
complex real-life use case, because I'm not really sure this solution
has no adverse effects elsewhere.

Stefan, any thoughts?

diff --git a/src/keyboard.c b/src/keyboard.c
index 1d67c3e..4448e2b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2551,7 +2551,10 @@ read_char (int commandflag, Lisp_Object map,
       restore_getcjmp (save_jump);
       pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
       unbind_to (jmpcount, Qnil);
-      XSETINT (c, quit_char);
+      /* If we are in while-no-input, don't trigger C-g, as that will
+	 quit instead of letting while-no-input do its thing.  */
+      if (!EQ (Vquit_flag, Vthrow_on_input))
+	XSETINT (c, quit_char);
       internal_last_event_frame = selected_frame;
       Vlast_event_frame = internal_last_event_frame;
       /* If we report the quit char as an event,





  reply	other threads:[~2019-02-22 16:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 22:29 bug#34535: 27.0.50; emacs -nw: while-no-input + sit-for + <KEY> => Quit Michael Heerdegen
2019-02-22 16:08 ` Eli Zaretskii [this message]
2019-02-22 20:09   ` Eli Zaretskii
2019-02-22 20:25     ` Eli Zaretskii
2019-02-23  4:27   ` Michael Heerdegen
2019-02-23  8:21     ` Eli Zaretskii
2019-02-23 15:13       ` Stefan Monnier
2019-02-23 16:54         ` Eli Zaretskii
2019-02-24  7:16       ` Michael Heerdegen
2019-02-24 16:06         ` Eli Zaretskii
2019-02-25  7:09       ` Michael Heerdegen
2019-02-25 15:33         ` Eli Zaretskii
2019-02-26  9:56           ` Michael Heerdegen
2019-02-26 15:26             ` Eli Zaretskii
2019-02-26 17:27             ` Michael Heerdegen
2019-02-26 18:27               ` Eli Zaretskii
2019-03-01 10:21                 ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83k1hrrejp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=34535@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.