Subject: Patch for this bug

From: Reuben Thomas <[email-masked]>
Date: Tue, 8 Nov 2016 18:28:28 +0000

I attach a patch for this bug that takes the simple approach of adding
SELECTION_REQUEST_EVENT to the list of events to ignore in
kbd_buffer_store_buffered_event.

This seems simple and safe (it's not something one would normally consider
an input event).

Further, at present it would not help helm to implement Eli's suggestion of
a list of events for input-pending-p to ignore, as Helm currently does not
use that (it has a custom version of while-no-input that does not call
input-pending-p).

As a helm user with an external clipboard manager, I was experiencing this
bug. I'm using Emacs with this patch currently; it seems fine, and I don't
have the Helm problem any more.

-- 
http://rrt.sc3d.org
From 640dfc4b6165b5b1968b3b84f1c99cc7351377a3 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Tue, 8 Nov 2016 18:01:37 +0000
Subject: [PATCH] Ignore SELECTION_REQUEST_EVENT in while-no-input

* src/keyboard.c (kbd_buffer_store_buffered_event): Do not treat
SELECTION_REQUEST_EVENT as an input event (Bug#19547).
---
 src/keyboard.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/keyboard.c b/src/keyboard.c
index f24d86e..a1cf677 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3559,7 +3559,8 @@ kbd_buffer_store_buffered_event (union buffered_input_event *event,
       && event->kind != FOCUS_OUT_EVENT
       && event->kind != HELP_EVENT
       && event->kind != ICONIFY_EVENT
-      && event->kind != DEICONIFY_EVENT)
+      && event->kind != DEICONIFY_EVENT
+      && event->kind != SELECTION_REQUEST_EVENT)
     {
       Vquit_flag = Vthrow_on_input;
       /* If we're inside a function that wants immediate quits,
-- 
2.7.4