Subject: Re: bug#27442: Un-obsolete x-clipboard-yank, or provide analogous functional

From: Constantine Kharlamov <[email-masked]>
Date: Wed, 21 Jun 2017 22:55:58 +0300

On 21.06.2017 22:10, Eli Zaretskii wrote:
>> From: Constantine Kharlamov <[email-masked]>
>> Date: Wed, 21 Jun 2017 17:29:40 +0300
>>
>> x-clipboard-yank always uses clipboard content, which is exactly what I need. I.e. if I set (setq select-enable-clipboard nil) to not clutter my clipboard with kills, I only get content from the clipboard. (don't get me wrong, kill-ring is very cool, and I extensively use it in evil-mode. But I prefer to explicitly point when I want a content in the clipboard, which happens an order of magnitude rarer than usage of kill-ring).
>>
>> clipboard-yank uses a kill-ring instead.
> 
> I see the same call to 'yank' in both clipboard-yank and
> x-clipboard-yank, so I'm not sure I understand what difference in
> behavior you see (you also didn't say which version of Emacs did you
> use).

Sorry. It's 26.0.50, Archlinux, emacs-gitᴬᵁᴿ. However the first time I saw the problem at least 1.5 year ago on Ubuntu. It's just that I never reported, but today I started worrying.

> Can you show a reproducible recipe starting from "emacs -Q"
> which could be used to see the problem?
> 
> Thanks.

Well, for collecting the steps turned out `(clipboard-yank)` might have another subtle bug. But what I said still holds. Steps:

1. start `emacs -Q`
2. Press M-: to execute `(setq select-enable-clipboard nil)`
3. Copy a text in the system, i.e. outside of Emacs.
4. Press M-: to execute `(clipboard-yank)` (you'll get at the point a content from system clipboard)
5. Press M-< M-d (so now you have the word ";; This" in kill-ring)
6. Press M-: to execute `(clipboard-yank)`

	You will see ";; This" got pasted at point, not the value in the system clipboard.

7. Press M-: to execute `(x-clipboard-yank)`

	You will see content from the system clipboard got pasted at point.

The subtle bug I just found is an inconsistent behavior: if you skip the 4-th step, then at 6-th step you'll see the content from system clipboard. Which is actually what I'd want (i.e. the system clipboard content, not the inconsistent behavior, of course), but in long-term usage it pastes from kill-ring.