emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recent change to yanking behavior of the clipboard


From: Po Lu
Subject: Re: recent change to yanking behavior of the clipboard
Date: Sun, 06 Feb 2022 15:37:53 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Noah Friedman <noah@splode.com> writes:

> This change in master:
>
>       2022-02-01 10:13:15 +0800  Po Lu  <luangruo@yahoo.com>  99c637499e
>
>         Only apply last change to the clipboard
>
>         * lisp/select.el (gui--selection-value-internal): Only return
>         nil if we own the clipboard.
>
> Means that yanking never pastes the clipboard if I've programmatically set
> the clipboard selection (which I do for both emacs and the sake of other
> program windows that use it)

If you assert ownership of CLIPBOARD from another program, then
`gui-selection-value' (which is the interprogram-paste-function) will
not return nil.  If not, that program is buggy and should be fixed.

Unless you are setting the clipboard inside Emacs via `x-set-selection',
in which case see below:

> But, curiously, you didn't make this change for the primary selection.

Because, typically, Emacs does not keep a local ring for text stored
into the primary selection.  `select-enable-primary' is a violation of
the XDG clipboard spec, and is unlikely to be used by many people, so I
didn't enable that code there.

> That means when I yank, I don't get the thing I've most recently copied to
> the clipboard.  I get some old thing from the primary selection.
>
> I don't understand how this new behavior is meant to be useful.

It is meant to be useful by providing a visible performance improvement
when Emacs is run over a network with moderate latency, by not querying
the X server for the value of CLIPBOARD when text was last killed inside
Emacs.  And yes, that is what motivated me to install that change.

> It's broken, and I am not exaggerating, somewhere around 30 years of
> muscle reflexes.

Why can't you save the clipboard contents into the kill ring as well?

> Please revert this.

We can provide a knob to turn that new behaviour off, but I'm not giving
up such a visible performance increase in yanking text when Emacs is
forwarded over a remote connection.

> Not every item that goes to the clipboard comes from a buffer kill or
> copy action. Not everything emacs "owns" is already in the kill-ring.

No, and neither should C-y yank any text not in the kill ring (or from
an interprogram paste, and text Lisp code saves into the kill ring is
not "interprogram".)

Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]