Subject: bug#16315: Slow paste

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 06 Dec 2020 16:11:54 +0100

Perry Smith <[email-masked]> writes:

> When I copy from a Mac window and paste into emacs (yank), there is a
> long delay.  When I started seriously testing, it was always 5 seconds
> but I have memories that sometimes it was much longer.  I'm calling
> these memories "false" at this point.

[...]

> and then I see the text show up in the emacs window.  I *think* what
> is "wrong" here is in this case, get_input_pending is actually pulling
> the text out and via the SelectionNotify handler placing the text into
> reading_selection_reply but then returns zero because, at that point
> in time, there is no input to be read.  Thus this if test, is not
> true:
>
>      if ((read_kbd || !NILP (wait_for_cell))
> 	  && detect_input_pending ())
>
> I'm thinking that after detect_input_pending is called in
> wait_reading_process_output, another two lines like this:
>
>      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
> 	break;
>
> should be added before the if (!no_avail) line (around line 4612 in
> the copy I am looking at.
>
> I made this change in my copy and so far, it seems to work.

(This bug report unfortunately got no response at the time.)

The wait_reading_process_output function has changed a bit over the
years since this was first reported.  Are you still seeing this issue in
more recent Emacs versions?

If so, could you include a proposed patch?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no