Subject: bug#15045: Point jumps inappropriately around time of Semantic lexing

From: Barry OReilly <[email-masked]>
Date: Mon, 14 Oct 2013 15:32:40 -0400

> >> >> That sounds wrong.
> >> > Are you saying that using the READABLE_EVENTS_DO_TIMERS_NOW flag
above
> >> > is wrong?
> >> I think so: input-pending-p is not expected to wait, so I don't see any
> >> reason to run timers.
> > I think the only reason, as with all the other places where we run
> > timers, is to make Emacs look appear more responsive, notwithstanding
> > the on-going processing.
>
> I suspect that the users of input-pending-p which care about running
> timers would be better served by (sit-for 0 t).  Currently, it's 100%
> equivalent, but the intention is a lot more clear.

Given this has come up again separately in bug 15567, may I make the
change to input-pending-p?

diff --git a/src/keyboard.c b/src/keyboard.c
index e0cd4d4..fdb7c7d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -9962,8 +9962,7 @@ if there is a doubt, the value is t.  */)
   /* Process non-user-visible events (Bug#10195).  */
   process_special_events ();

-  return (get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW
-                            | READABLE_EVENTS_FILTER_EVENTS)
+  return (get_input_pending (READABLE_EVENTS_FILTER_EVENTS)
          ? Qt : Qnil);
 }

'make check' passes.

Eli Zaretskii:
> What if input arrives because of a timer?

If this is an issue, I propose input-pending-p return t if a timer is
ready to run. Then the long running task would exit, unwind its
save-excursion, then allow the timer to run. Perhaps this contorts the
meaning of "input", but OTOH the documentation for input-pending-p
already states that a false positive return can happen:

  Return t if command input is currently available with no wait.
  Actually, the value is nil only if we can be sure that no input is
  available; if there is a doubt, the value is t.

Would you want this in the same changeset as the patch above? Or not
worry about it until "someone screams"?