Subject: Re: bug#10195: 24.0.92; M-w may no longer provide visual feedback

From: Chong Yidong <[email-masked]>
Date: Sun, 04 Dec 2011 23:59:15 +0800

Eli Zaretskii <[email-masked]> writes:

>> It's an X selection request event.  I'm not sure where the request is
>> coming from---Gnome's clipboard manager, maybe.
>
> Looks like readable_events should filter out a few more event types,
> when passed READABLE_EVENTS_FILTER_EVENTS in `flags'?  I could think
> of additional events that should not end sit-for, e.g. keyboard
> language switch... selection requests shouldn't interrupt sit-for
> regardless, since (AFAIR) they can come in out of Emacs's control.

I don't think sit-for should ignore selection requests.  If so, doing
(sit-for 10) would cause Emacs to stop responding to selection requests
from other applications for 10 seconds.  That doesn't sound right.

The workaround of putting the (redisplay t) in kill-ring-save works
because Fredisplay calls swallow_events(), which has code in it to
process selection request events.

I think the right fix is for input-pending-p to call swallow_events(),
as below.  Thoughts?

*** src/keyboard.c	2011-12-01 18:27:52 +0000
--- src/keyboard.c	2011-12-04 15:58:03 +0000
***************
*** 10522,10527 ****
--- 10522,10528 ----
        || !NILP (Vunread_input_method_events))
      return (Qt);
  
+   swallow_events (0);
    get_input_pending (&input_pending,
  		     READABLE_EVENTS_DO_TIMERS_NOW
  		     | READABLE_EVENTS_FILTER_EVENTS);