unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* recent change to yanking behavior of the clipboard
@ 2022-02-06  3:39 Noah Friedman
  2022-02-06  7:37 ` Po Lu
  2022-02-06  9:17 ` Eli Zaretskii
  0 siblings, 2 replies; 55+ messages in thread
From: Noah Friedman @ 2022-02-06  3:39 UTC (permalink / raw)
  To: luangruo; +Cc: emacs-devel

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)

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

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's
broken, and I am not exaggerating, somewhere around 30 years of muscle
reflexes.

Please revert this.

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.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  3:39 Noah Friedman
@ 2022-02-06  7:37 ` Po Lu
  2022-02-06  9:20   ` Eli Zaretskii
                     ` (4 more replies)
  2022-02-06  9:17 ` Eli Zaretskii
  1 sibling, 5 replies; 55+ messages in thread
From: Po Lu @ 2022-02-06  7:37 UTC (permalink / raw)
  To: Noah Friedman; +Cc: emacs-devel

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.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  3:39 Noah Friedman
  2022-02-06  7:37 ` Po Lu
@ 2022-02-06  9:17 ` Eli Zaretskii
  1 sibling, 0 replies; 55+ messages in thread
From: Eli Zaretskii @ 2022-02-06  9:17 UTC (permalink / raw)
  To: Noah Friedman; +Cc: luangruo, emacs-devel

> From: Noah Friedman <noah@splode.com>
> Date: Sat, 05 Feb 2022 19:39:44 -0800 (PST)
> Cc: emacs-devel@gnu.org
> 
> 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)

Can you show the code that you use to set the clipboard data
programmatically?



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  7:37 ` Po Lu
@ 2022-02-06  9:20   ` Eli Zaretskii
  2022-02-06  9:34     ` Po Lu
  2022-02-06 10:18   ` Po Lu
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2022-02-06  9:20 UTC (permalink / raw)
  To: Po Lu; +Cc: noah, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 06 Feb 2022 15:37:53 +0800
> 
> > 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.

How about enabling it for primary selections when
select-enable-primary is non-nil?



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  9:20   ` Eli Zaretskii
@ 2022-02-06  9:34     ` Po Lu
  0 siblings, 0 replies; 55+ messages in thread
From: Po Lu @ 2022-02-06  9:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: noah, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Po Lu <luangruo@yahoo.com>
>> Cc: emacs-devel@gnu.org
>> Date: Sun, 06 Feb 2022 15:37:53 +0800
>> 
>> > 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.
>
> How about enabling it for primary selections when
> select-enable-primary is non-nil?

That could work too.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  7:37 ` Po Lu
  2022-02-06  9:20   ` Eli Zaretskii
@ 2022-02-06 10:18   ` Po Lu
  2022-02-06 16:09   ` Óscar Fuentes
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 55+ messages in thread
From: Po Lu @ 2022-02-06 10:18 UTC (permalink / raw)
  To: Noah Friedman; +Cc: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> an interprogram paste, and text Lisp code saves into the kill ring is
                                                       ^^^^^^^^^^^^^

I meant to say "CLIPBOARD".



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
@ 2022-02-06 11:07 xenodasein--- via Emacs development discussions.
  2022-02-06 11:21 ` Po Lu
  2022-02-06 15:17 ` Stefan Monnier
  0 siblings, 2 replies; 55+ messages in thread
From: xenodasein--- via Emacs development discussions. @ 2022-02-06 11:07 UTC (permalink / raw)
  To: luangruo; +Cc: emacs-devel

Interesting to see how quick old behavior preservation gets disregarded when it
suits you.  Way to go champ.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:07 recent change to yanking behavior of the clipboard xenodasein--- via Emacs development discussions.
@ 2022-02-06 11:21 ` Po Lu
  2022-02-06 11:37   ` xenodasein--- via Emacs development discussions.
  2022-02-06 15:20   ` Stefan Monnier
  2022-02-06 15:17 ` Stefan Monnier
  1 sibling, 2 replies; 55+ messages in thread
From: Po Lu @ 2022-02-06 11:21 UTC (permalink / raw)
  To: xenodasein--- via Emacs development discussions.; +Cc: xenodasein

xenodasein--- via "Emacs development discussions." <emacs-devel@gnu.org>
writes:

> Interesting to see how quick old behavior preservation gets
> disregarded when it suits you.  Way to go champ.

The behaviour in question was never guaranteed.  Indeed, Emacs has
already seen many changes in this area to better comply with the
established understanding of which X11 selection to use as the
"clipboard".

See the doc string of `interprogram-paste-function'.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:21 ` Po Lu
@ 2022-02-06 11:37   ` xenodasein--- via Emacs development discussions.
  2022-02-06 11:47     ` Po Lu
  2022-02-06 15:20   ` Stefan Monnier
  1 sibling, 1 reply; 55+ messages in thread
From: xenodasein--- via Emacs development discussions. @ 2022-02-06 11:37 UTC (permalink / raw)
  To: luangruo; +Cc: emacs-devel

So?  Emacs is not and hopefully will never be a dedicated X11 "app."



Feb 6, 2022, 14:21 by luangruo@yahoo.com:

> xenodasein--- via "Emacs development discussions." <emacs-devel@gnu.org>
> writes:
>
>> Interesting to see how quick old behavior preservation gets
>> disregarded when it suits you.  Way to go champ.
>>
>
> The behaviour in question was never guaranteed.  Indeed, Emacs has
> already seen many changes in this area to better comply with the
> established understanding of which X11 selection to use as the
> "clipboard".
>
> See the doc string of `interprogram-paste-function'.
>




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:37   ` xenodasein--- via Emacs development discussions.
@ 2022-02-06 11:47     ` Po Lu
  2022-02-06 11:55       ` xenodasein--- via Emacs development discussions.
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-06 11:47 UTC (permalink / raw)
  To: xenodasein; +Cc: emacs-devel

xenodasein@tutanota.de writes:

> So?  Emacs is not and hopefully will never be a dedicated X11 "app."

On the contrary, the system we want to support best is the GNU system,
of which X11 is an important component.  Certainly more important than
Wayland, which after 10 years continues to be immature and annoy users
(see bug#53793 for a recent example.)



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:47     ` Po Lu
@ 2022-02-06 11:55       ` xenodasein--- via Emacs development discussions.
  2022-02-06 12:01         ` Po Lu
                           ` (2 more replies)
  0 siblings, 3 replies; 55+ messages in thread
From: xenodasein--- via Emacs development discussions. @ 2022-02-06 11:55 UTC (permalink / raw)
  To: luangruo; +Cc: emacs-devel

Thing is, this time you seem to think that you are "fixing" things,
and someone else thinks it breaks 30 year old behavior.  See some
pattern here?  I'd focus on that instead of the "see this see that"
smarty-pants-ery.



Feb 6, 2022, 14:47 by luangruo@yahoo.com:

> xenodasein@tutanota.de writes:
>
>> So?  Emacs is not and hopefully will never be a dedicated X11 "app."
>>
>
> On the contrary, the system we want to support best is the GNU system,
> of which X11 is an important component.  Certainly more important than
> Wayland, which after 10 years continues to be immature and annoy users
> (see bug#53793 for a recent example.)
>




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:55       ` xenodasein--- via Emacs development discussions.
@ 2022-02-06 12:01         ` Po Lu
  2022-02-06 12:06           ` xenodasein--- via Emacs development discussions.
  2022-02-06 12:08         ` Eli Zaretskii
  2022-02-06 12:15         ` tomas
  2 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-06 12:01 UTC (permalink / raw)
  To: xenodasein; +Cc: emacs-devel

xenodasein@tutanota.de writes:

> Thing is, this time you seem to think that you are "fixing" things,
> and someone else thinks it breaks 30 year old behavior.

Indeed, and I didn't outright dismiss his statement.  If there is
nothing wrong with his program, then I will implement a flag in
x-set-selection that makes gui-selection-value revert to the old
behaviour if it was not called by gui-select-text.

But there has to be a very good reason to break an equally long-lasting
assumption about the conditions under which x-selection-value is
expected to behave.

> See some pattern here?

No.

> I'd focus on that instead of the "see this see that" smarty-pants-ery.

Watch your language, that tone is not welcome anywhere.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 12:01         ` Po Lu
@ 2022-02-06 12:06           ` xenodasein--- via Emacs development discussions.
  0 siblings, 0 replies; 55+ messages in thread
From: xenodasein--- via Emacs development discussions. @ 2022-02-06 12:06 UTC (permalink / raw)
  To: luangruo; +Cc: emacs-devel

Feb 6, 2022, 15:01 by luangruo@yahoo.com:

> xenodasein@tutanota.de writes:
>
>> See some pattern here?
>>
>
> No.
>
>> I'd focus on that instead of the "see this see that" smarty-pants-ery.
>>
>
> Watch your language, that tone is not welcome anywhere.
>

And this one is?




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:55       ` xenodasein--- via Emacs development discussions.
  2022-02-06 12:01         ` Po Lu
@ 2022-02-06 12:08         ` Eli Zaretskii
  2022-02-06 12:15           ` xenodasein--- via Emacs development discussions.
  2022-02-06 12:15         ` tomas
  2 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2022-02-06 12:08 UTC (permalink / raw)
  To: xenodasein; +Cc: luangruo, emacs-devel

> Date: Sun, 6 Feb 2022 12:55:00 +0100 (CET)
> Cc: emacs-devel@gnu.org
> From: xenodasein--- via "Emacs development discussions." <emacs-devel@gnu.org>
> 
> Thing is, this time you seem to think that you are "fixing" things,
> and someone else thinks it breaks 30 year old behavior.  See some
> pattern here?  I'd focus on that instead of the "see this see that"
> smarty-pants-ery.

Please watch your language when you post here.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 12:08         ` Eli Zaretskii
@ 2022-02-06 12:15           ` xenodasein--- via Emacs development discussions.
  2022-02-06 12:30             ` Eli Zaretskii
  0 siblings, 1 reply; 55+ messages in thread
From: xenodasein--- via Emacs development discussions. @ 2022-02-06 12:15 UTC (permalink / raw)
  To: eliz; +Cc: luangruo, emacs-devel

Feb 6, 2022, 15:08 by eliz@gnu.org:

>> Date: Sun, 6 Feb 2022 12:55:00 +0100 (CET)
>> Cc: emacs-devel@gnu.org
>> From: xenodasein--- via "Emacs development discussions." <emacs-devel@gnu.org>
>>
>> Thing is, this time you seem to think that you are "fixing" things,
>> and someone else thinks it breaks 30 year old behavior.  See some
>> pattern here?  I'd focus on that instead of the "see this see that"
>> smarty-pants-ery.
>>
>
> Please watch your language when you post here.
>

Sure, but what is a an even softer idiom to describe such behavior?




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:55       ` xenodasein--- via Emacs development discussions.
  2022-02-06 12:01         ` Po Lu
  2022-02-06 12:08         ` Eli Zaretskii
@ 2022-02-06 12:15         ` tomas
  2022-02-06 12:20           ` xenodasein--- via Emacs development discussions.
  2 siblings, 1 reply; 55+ messages in thread
From: tomas @ 2022-02-06 12:15 UTC (permalink / raw)
  To: xenodasein; +Cc: luangruo, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

On Sun, Feb 06, 2022 at 12:55:00PM +0100, xenodasein--- via Emacs development discussions. wrote:
> Thing is, this time you seem to think that you are "fixing" things,
> and someone else thinks it breaks 30 year old behavior.  See some
> pattern here?  I'd focus on that instead of the "see this see that"
> smarty-pants-ery.

xenodasein: even if you think I'm censoring you (how could I? but hey):
please, pretty please. Do something constructive instead of attacking
people who are actually doing work.

You may disagree with what (or how) Po Lu is doing things. Bravo. Stick
to the matter, try to convince people. But don't /attack/ them. This
doesn't help anyone here.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 12:15         ` tomas
@ 2022-02-06 12:20           ` xenodasein--- via Emacs development discussions.
  0 siblings, 0 replies; 55+ messages in thread
From: xenodasein--- via Emacs development discussions. @ 2022-02-06 12:20 UTC (permalink / raw)
  To: tomas; +Cc: luangruo, emacs-devel

Fair enough.  However, by your logic you also need to do a lot more
real work before taking on the task of policing you seem to love.



Feb 6, 2022, 15:15 by tomas@tuxteam.de:

> On Sun, Feb 06, 2022 at 12:55:00PM +0100, xenodasein--- via Emacs development discussions. wrote:
>
>> Thing is, this time you seem to think that you are "fixing" things,
>> and someone else thinks it breaks 30 year old behavior.  See some
>> pattern here?  I'd focus on that instead of the "see this see that"
>> smarty-pants-ery.
>>
>
> xenodasein: even if you think I'm censoring you (how could I? but hey):
> please, pretty please. Do something constructive instead of attacking
> people who are actually doing work.
>
> You may disagree with what (or how) Po Lu is doing things. Bravo. Stick
> to the matter, try to convince people. But don't /attack/ them. This
> doesn't help anyone here.
>
> Cheers
> -- 
> t
>




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 12:15           ` xenodasein--- via Emacs development discussions.
@ 2022-02-06 12:30             ` Eli Zaretskii
  0 siblings, 0 replies; 55+ messages in thread
From: Eli Zaretskii @ 2022-02-06 12:30 UTC (permalink / raw)
  To: xenodasein; +Cc: luangruo, emacs-devel

> Date: Sun, 6 Feb 2022 13:15:37 +0100 (CET)
> From: xenodasein@tutanota.de
> Cc: luangruo@yahoo.com, emacs-devel@gnu.org
> 
> > Please watch your language when you post here.
> 
> Sure, but what is a an even softer idiom to describe such behavior?

It is best to refrain from trying to describe behavior of others.
This forum is not meant to analyze the behavior of the participants,
it is meant to discuss Emacs development.  Confine yourself to that,
and use civilized words, and you will be fine.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:07 recent change to yanking behavior of the clipboard xenodasein--- via Emacs development discussions.
  2022-02-06 11:21 ` Po Lu
@ 2022-02-06 15:17 ` Stefan Monnier
  1 sibling, 0 replies; 55+ messages in thread
From: Stefan Monnier @ 2022-02-06 15:17 UTC (permalink / raw)
  To: xenodasein--- via Emacs development discussions.; +Cc: luangruo, xenodasein

xenodasein--- via "Emacs development discussions." [2022-02-06 12:07:29] wrote:
> Interesting to see how quick old behavior preservation gets
> disregarded when it suits you.  Way to go champ.

Your actual point might be quite valid, but the way you write it is
offensive, almost calling Po Lu a hypocrite.  This actually weakens your
argument because people will tend to be put off by the way your
wrote it.


        Stefan




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 11:21 ` Po Lu
  2022-02-06 11:37   ` xenodasein--- via Emacs development discussions.
@ 2022-02-06 15:20   ` Stefan Monnier
  2022-02-07  1:18     ` Po Lu
  1 sibling, 1 reply; 55+ messages in thread
From: Stefan Monnier @ 2022-02-06 15:20 UTC (permalink / raw)
  To: Po Lu; +Cc: xenodasein--- via Emacs development discussions., xenodasein

> The behaviour in question was never guaranteed.  Indeed, Emacs has
> already seen many changes in this area to better comply with the
> established understanding of which X11 selection to use as the
> "clipboard".

FWIW, every one of those changes has generated friction, so it's not
like we should feel free to change it any way we like.

I don't understand the issue at hand well enough to have an opinion on
whether the change is on the right side of the tradeoff, but there is
clearly a tradeoff.


        Stefan




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  7:37 ` Po Lu
  2022-02-06  9:20   ` Eli Zaretskii
  2022-02-06 10:18   ` Po Lu
@ 2022-02-06 16:09   ` Óscar Fuentes
  2022-02-07  1:11     ` Po Lu
  2022-02-06 22:39   ` Lars Ingebrigtsen
  2022-02-07  1:11   ` Tim Cross
  4 siblings, 1 reply; 55+ messages in thread
From: Óscar Fuentes @ 2022-02-06 16:09 UTC (permalink / raw)
  To: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

>> 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.

I have many hours of experience using Emacs through ADSL, 3G and even
EGPRS links with the NX protocol.

Can you show some numbers to quantify that visible performance
improvement? And an step-by-step procedure to demonstrate the
before/after difference?




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  7:37 ` Po Lu
                     ` (2 preceding siblings ...)
  2022-02-06 16:09   ` Óscar Fuentes
@ 2022-02-06 22:39   ` Lars Ingebrigtsen
  2022-02-07  1:12     ` Po Lu
  2022-02-07  1:11   ` Tim Cross
  4 siblings, 1 reply; 55+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-06 22:39 UTC (permalink / raw)
  To: Po Lu; +Cc: Noah Friedman, emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> 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.

Enabling `select-enable-primary' is a common recommendation, so my guess
is that a lot of people have it enabled.  (I have it enabled myself.)

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



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 16:09   ` Óscar Fuentes
@ 2022-02-07  1:11     ` Po Lu
  2022-02-07  2:05       ` Óscar Fuentes
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07  1:11 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

Óscar Fuentes <ofv@wanadoo.es> writes:

> I have many hours of experience using Emacs through ADSL, 3G and even
> EGPRS links with the NX protocol.
>
> Can you show some numbers to quantify that visible performance
> improvement? And an step-by-step procedure to demonstrate the
> before/after difference?

Kill a large piece of text in Emacs 28, then C-y and enjoy the hang.

I didn't test with NX, just plain X11 over a network.  Thanks.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06  7:37 ` Po Lu
                     ` (3 preceding siblings ...)
  2022-02-06 22:39   ` Lars Ingebrigtsen
@ 2022-02-07  1:11   ` Tim Cross
  2022-02-07  2:31     ` Michael Welsh Duggan
  4 siblings, 1 reply; 55+ messages in thread
From: Tim Cross @ 2022-02-07  1:11 UTC (permalink / raw)
  To: emacs-devel


Po Lu <luangruo@yahoo.com> writes:

> 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.
>

Just a question. What about Wayland? I ask this because recently there
was a post on the orgmode list where someone was getting inconsistent
behaviour between Emacs, emacsclient and other applications running the
pgtk version of Emacs under Wayland.

Given that Fedora has moved to defaulting to Wayland, Debian is
beginning to support Wayland and Ubuntu are moving in that direction,
combined with Emacs supporting a pure GTK implementation which (I
assume) means you could run Wayland without the legacy X integration,
should any refactoring of Emacs interaction with the clipboard also be
factoring in Wayland as another 'platform'? 

Tim

P.S. Do many people still run Emacs remotely over X? I did this for a
long time (until things became very slow with font-locking). These days,
I find things like X2Go have become so good, I just use that and avoid
the performance hit of remote X and all that xauth merging etc.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 22:39   ` Lars Ingebrigtsen
@ 2022-02-07  1:12     ` Po Lu
  2022-02-07  2:53       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07  1:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Noah Friedman, emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> 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.

> Enabling `select-enable-primary' is a common recommendation, so my guess
> is that a lot of people have it enabled.  (I have it enabled myself.)

Doesn't that result in Emacs interfering with the primary selection of
other problems?  And also other programs refusing to paste text killed
by Emacs?

Thanks.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-06 15:20   ` Stefan Monnier
@ 2022-02-07  1:18     ` Po Lu
  2022-02-07 13:04       ` Stefan Monnier
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07  1:18 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: xenodasein--- via Emacs development discussions., xenodasein

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> FWIW, every one of those changes has generated friction, so it's not
> like we should feel free to change it any way we like.

I see no point in sticking to behaviour obsoleted by the operating
system, such as storing cut text in the primary selection.  On X, every
client has to cooperate with every other client in order to have working
cut and paste, and a single client deviating from that is sufficient to
bring down the entire deck-of-cards.

We do that for the same reason that we adapt Emacs to changes in glibc's
memory allocator: not doing it will result in Emacs and/or the user's
system not functioning correctly.

> I don't understand the issue at hand well enough to have an opinion on
> whether the change is on the right side of the tradeoff, but there is
> clearly a tradeoff.

I have a solution to Noah's problem while preserving the new
improvements, but I need to see Noah's code to decide if there's a valid
reason to install such a change.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  1:11     ` Po Lu
@ 2022-02-07  2:05       ` Óscar Fuentes
  2022-02-07  2:59         ` Po Lu
  0 siblings, 1 reply; 55+ messages in thread
From: Óscar Fuentes @ 2022-02-07  2:05 UTC (permalink / raw)
  To: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> Óscar Fuentes <ofv@wanadoo.es> writes:
>
>> I have many hours of experience using Emacs through ADSL, 3G and even
>> EGPRS links with the NX protocol.
>>
>> Can you show some numbers to quantify that visible performance
>> improvement? And an step-by-step procedure to demonstrate the
>> before/after difference?
>
> Kill a large piece of text in Emacs 28, then C-y and enjoy the hang.
>
> I didn't test with NX, just plain X11 over a network.  Thanks.

As a poor's man file synchronization system, I often copy entire buffer
contents (>1000 lines) from a remote session to a local Emacs, and
vice-versa. No problem.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  1:11   ` Tim Cross
@ 2022-02-07  2:31     ` Michael Welsh Duggan
  0 siblings, 0 replies; 55+ messages in thread
From: Michael Welsh Duggan @ 2022-02-07  2:31 UTC (permalink / raw)
  To: Tim Cross; +Cc: emacs-devel

Tim Cross <theophilusx@gmail.com> writes:

> P.S. Do many people still run Emacs remotely over X? I did this for a
> long time (until things became very slow with font-locking). These days,
> I find things like X2Go have become so good, I just use that and avoid
> the performance hit of remote X and all that xauth merging etc.

I don't know about many, but I still end up doing this while working
from home and working on a remote work machine, more days than most.

-- 
Michael Welsh Duggan
(md5i@md5i.com)



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  1:12     ` Po Lu
@ 2022-02-07  2:53       ` Lars Ingebrigtsen
  2022-02-07  3:11         ` Po Lu
  0 siblings, 1 reply; 55+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-07  2:53 UTC (permalink / raw)
  To: Po Lu; +Cc: Noah Friedman, emacs-devel

Po Lu <luangruo@yahoo.com> writes:

>> Enabling `select-enable-primary' is a common recommendation, so my guess
>> is that a lot of people have it enabled.  (I have it enabled myself.)
>
> Doesn't that result in Emacs interfering with the primary selection of
> other problems?  And also other programs refusing to paste text killed
> by Emacs?

I'm not sure what you mean.  When I kill text in Emacs (with `C-k' or
the like), I want to be able to paste it with mouse-2 in other programs,
if that's what you're getting at.

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



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  2:05       ` Óscar Fuentes
@ 2022-02-07  2:59         ` Po Lu
  2022-02-07  5:04           ` Óscar Fuentes
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07  2:59 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

Óscar Fuentes <ofv@wanadoo.es> writes:

> As a poor's man file synchronization system, I often copy entire buffer
> contents (>1000 lines) from a remote session to a local Emacs, and
> vice-versa. No problem.

Over plain X, or some compression protocol?



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  2:53       ` Lars Ingebrigtsen
@ 2022-02-07  3:11         ` Po Lu
  2022-02-07  3:41           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07  3:11 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Noah Friedman, emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> Doesn't that result in Emacs interfering with the primary selection of
>> other problems?  And also other programs refusing to paste text killed
>> by Emacs?

> I'm not sure what you mean.  When I kill text in Emacs (with `C-k' or
> the like), I want to be able to paste it with mouse-2 in other programs,
> if that's what you're getting at.

Text you cut from other programs will stop showing up in Emacs when you
press `C-y', since explicit paste commands are required to paste from
CLIPBOARD and not PRIMARY.

I think we save all text that gets killed into the primary selection
regardless of the value of `select-enable-primary'.  If not, that's a
bug.

IOW, when you press C-k at the beginning of a line, Emacs sets the
contents of CLIPBOARD and PRIMARY (what you paste with the middle mouse
button) to the contents of the line.

Then, when you press C-y, Emacs is supposed to look for the value in
CLIPBOARD (and never PRIMARY).

That means the only valid combination is the default, which is to have
`select-enable-clipboard' set to t and `select-enable-primary' set to
nil.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  3:11         ` Po Lu
@ 2022-02-07  3:41           ` Lars Ingebrigtsen
  2022-02-07  3:48             ` Po Lu
  0 siblings, 1 reply; 55+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-07  3:41 UTC (permalink / raw)
  To: Po Lu; +Cc: Noah Friedman, emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> Then, when you press C-y, Emacs is supposed to look for the value in
> CLIPBOARD (and never PRIMARY).
>
> That means the only valid combination is the default, which is to have
> `select-enable-clipboard' set to t and `select-enable-primary' set to
> nil.

Again, I don't understand what you mean.  I have
`select-enable-clipboard' set to nil and `select-enable-primary' and set
to t, and that's a valid combination -- it does what I want to, and has
done so for at least a decade.

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



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  3:41           ` Lars Ingebrigtsen
@ 2022-02-07  3:48             ` Po Lu
  2022-02-07  4:05               ` Lars Ingebrigtsen
                                 ` (2 more replies)
  0 siblings, 3 replies; 55+ messages in thread
From: Po Lu @ 2022-02-07  3:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Noah Friedman, emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> Then, when you press C-y, Emacs is supposed to look for the value in
>> CLIPBOARD (and never PRIMARY).
>>
>> That means the only valid combination is the default, which is to have
>> `select-enable-clipboard' set to t and `select-enable-primary' set to
>> nil.

> Again, I don't understand what you mean.
>
> I have `select-enable-clipboard' set to nil and
> `select-enable-primary' and set to t, and that's a valid combination
> -- it does what I want to, and has done so for at least a decade.

On X, every program is supposed to follow this:

  https://specifications.freedesktop.org/clipboards-spec/clipboards-spec.txt

In short:

 1. selecting but with no explicit copy should only set PRIMARY,
    never CLIPBOARD

 2. middle mouse button should paste PRIMARY, never CLIPBOARD

 3. explicit cut/copy commands (i.e. menu items, toolbar buttons) should
    always set CLIPBOARD to the currently-selected data (i.e.
    conceptually copy PRIMARY to CLIPBOARD)

 4. explicit cut/copy commands should always set both CLIPBOARD and
    PRIMARY, even when copying doesn't involve a selection (e.g. a "copy
    url" -option which explicitly copies an url without the url being
    selected first)

 5. explicit paste commands should paste CLIPBOARD, not PRIMARY

 6. a selection becoming unselected should never unset PRIMARY

 7. possibly contradicting the ICCCM, clients don't need to support
    SECONDARY, though if anyone can figure out what it's good for they
    should feel free to use it for that

 8. cut buffers are evil; they only support ASCII, they don't work with
    many clients, and they require data to be copied to the X
    server. Therefore clients should avoid using cut buffers and use
    only selections.

Setting `select-enable-clipboard' to nil violates 3, 4, and 5, while
setting `select-enable-primary' to t violates 5 and 4.

Thanks.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  3:48             ` Po Lu
@ 2022-02-07  4:05               ` Lars Ingebrigtsen
  2022-02-07  4:44                 ` Po Lu
  2022-02-07 12:49               ` Eli Zaretskii
  2022-02-07 13:14               ` Stefan Monnier
  2 siblings, 1 reply; 55+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-07  4:05 UTC (permalink / raw)
  To: Po Lu; +Cc: Noah Friedman, emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> On X, every program is supposed to follow this:
>
>   https://specifications.freedesktop.org/clipboards-spec/clipboards-spec.txt

I reject the premise that Emacs should be bound by design decisions made
by freedesktop.org.

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



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  4:05               ` Lars Ingebrigtsen
@ 2022-02-07  4:44                 ` Po Lu
  2022-02-07  4:57                   ` Corwin Brust
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07  4:44 UTC (permalink / raw)
  To: emacs-devel, Lars Ingebrigtsen; +Cc: Noah Friedman

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

Our tail is not strong enough to wag the dog
that is the X window system.  Other programs
have decided to follow the standardized behavior,
and the only result of us not following suit is that
we will no longer be able to run on the same X server
as any other modern client without causing problems.

[-- Attachment #2: Type: text/html, Size: 355 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  4:44                 ` Po Lu
@ 2022-02-07  4:57                   ` Corwin Brust
  2022-02-07  5:29                     ` Po Lu
  0 siblings, 1 reply; 55+ messages in thread
From: Corwin Brust @ 2022-02-07  4:57 UTC (permalink / raw)
  To: Po Lu; +Cc: Lars Ingebrigtsen, Noah Friedman, Emacs developers

On Sun, Feb 6, 2022 at 10:46 PM Po Lu <Luangruo@yahoo.com> wrote:
>
> Our tail is not strong enough to wag the dog
> that is the X window system. Other programs
> have decided to follow the standardized behavior,
> and the only result of us not following suit is that
> we will no longer be able to run on the same X server
> as any other modern client without causing problems.

FWIW, I don't think we are attempting to "wag the dog" here, in terms
of influencing the X foundation, so much as to prevent changes in the
behavior of Emacs that the users (at least, all who have chimed in
here excluding you who made this change and presumably like it)
prefer.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  2:59         ` Po Lu
@ 2022-02-07  5:04           ` Óscar Fuentes
  2022-02-07  5:17             ` Yuri Khan
  2022-02-07  5:31             ` Po Lu
  0 siblings, 2 replies; 55+ messages in thread
From: Óscar Fuentes @ 2022-02-07  5:04 UTC (permalink / raw)
  To: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> Óscar Fuentes <ofv@wanadoo.es> writes:
>
>> As a poor's man file synchronization system, I often copy entire buffer
>> contents (>1000 lines) from a remote session to a local Emacs, and
>> vice-versa. No problem.
>
> Over plain X, or some compression protocol?

Over NX, as mentioned previously.

BTW, if one feels that X is slow, using NX is a better course of action
than optimizing Emacs, IMAO. The difference is day and night.

X was not built for slow networks.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  5:04           ` Óscar Fuentes
@ 2022-02-07  5:17             ` Yuri Khan
  2022-02-07  5:23               ` Óscar Fuentes
  2022-02-07  5:31             ` Po Lu
  1 sibling, 1 reply; 55+ messages in thread
From: Yuri Khan @ 2022-02-07  5:17 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: Emacs developers

On Mon, 7 Feb 2022 at 12:08, Óscar Fuentes <ofv@wanadoo.es> wrote:

> >> As a poor's man file synchronization system, I often copy entire buffer
> >> contents (>1000 lines) from a remote session to a local Emacs, and
> >> vice-versa. No problem.
> >
> > Over plain X, or some compression protocol?
>
> Over NX, as mentioned previously.
>
> BTW, if one feels that X is slow, using NX is a better course of action
> than optimizing Emacs, IMAO. The difference is day and night.

Isn’t NX non-Free though?



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  5:17             ` Yuri Khan
@ 2022-02-07  5:23               ` Óscar Fuentes
  0 siblings, 0 replies; 55+ messages in thread
From: Óscar Fuentes @ 2022-02-07  5:23 UTC (permalink / raw)
  To: emacs-devel

Yuri Khan <yuri.v.khan@gmail.com> writes:

>> BTW, if one feels that X is slow, using NX is a better course of action
>> than optimizing Emacs, IMAO. The difference is day and night.
>
> Isn’t NX non-Free though?

There are Free implementations of the NX protocol. See x2go.org




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  4:57                   ` Corwin Brust
@ 2022-02-07  5:29                     ` Po Lu
  2022-02-07  5:47                       ` Corwin Brust
                                         ` (2 more replies)
  0 siblings, 3 replies; 55+ messages in thread
From: Po Lu @ 2022-02-07  5:29 UTC (permalink / raw)
  To: emacs-devel

>FWIW, I don't think we are attempting to "wag the dog" here, in terms
>of influencing the X foundation, so much as to prevent changes in the
>behavior of Emacs that the users (at least, all who have chimed in
>here excluding you who made this change and presumably like it)
>prefer.

FTR, I didn't make any change to which selection is used by default, and Noah is the only person who complained about the change that I did make.

I was trying to discourage users from enabling `select-enable-primary', which Lars disagreed with.  It was turned off by default in Emacs 21, where Emacs switched to the now-standard behaviour by default.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  5:04           ` Óscar Fuentes
  2022-02-07  5:17             ` Yuri Khan
@ 2022-02-07  5:31             ` Po Lu
  1 sibling, 0 replies; 55+ messages in thread
From: Po Lu @ 2022-02-07  5:31 UTC (permalink / raw)
  To: emacs-devel

I have heard good things about NX, and these days it is free software.  However, most people don't have a suitable client installed, while X comes with every desktop system in wide use today that can run the X version of Emacs.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  5:29                     ` Po Lu
@ 2022-02-07  5:47                       ` Corwin Brust
  2022-02-07  5:52                       ` tomas
  2022-02-07 13:17                       ` Eli Zaretskii
  2 siblings, 0 replies; 55+ messages in thread
From: Corwin Brust @ 2022-02-07  5:47 UTC (permalink / raw)
  To: Po Lu; +Cc: Emacs developers

On Sun, Feb 6, 2022 at 11:30 PM Po Lu <Luangruo@yahoo.com> wrote:
>
> >FWIW, I don't think we are attempting to "wag the dog" here, in terms
> >of influencing the X foundation, so much as to prevent changes in the
> >behavior of Emacs that the users (at least, all who have chimed in
> >here excluding you who made this change and presumably like it)
> >prefer.
>
> FTR, I didn't make any change to which selection is used by default, and Noah is the only person who complained about the change that I did make.
>
> I was trying to discourage users from enabling `select-enable-primary', which Lars disagreed with.  It was turned off by default in Emacs 21, where Emacs switched to the now-standard behaviour by default.

I appreciate the clarification.
Thank you Po



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  5:29                     ` Po Lu
  2022-02-07  5:47                       ` Corwin Brust
@ 2022-02-07  5:52                       ` tomas
  2022-02-07  6:43                         ` Po Lu
  2022-02-07 13:17                       ` Eli Zaretskii
  2 siblings, 1 reply; 55+ messages in thread
From: tomas @ 2022-02-07  5:52 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

On Mon, Feb 07, 2022 at 01:29:45PM +0800, Po Lu wrote:
> >FWIW, I don't think we are attempting to "wag the dog" here, in terms
> >of influencing the X foundation [...]

> FTR, I didn't make any change to which selection is used by default, and Noah is the only person who complained about the change that I did make.
> 
> I was trying to discourage users from enabling `select-enable-primary', which Lars disagreed with.  It was turned off by default in Emacs 21, where Emacs switched to the now-standard behaviour by default.

One of those default discussions, sigh :)

FWIW, I'm one of those having set `select-enable-primary' to t (after a
short period of swearing and trying to understand what happened).

I do understand the choice of the default. I'm happy and thankful that
there is a cop-out.

Psychologically it is extremely... challenging that something "stops
working" under you, and you don't even know how that something is
called. Perhaps that's part of the reason for the sometimes strong
reactions elicited by some changes.

I don't have a solution for that; IMHO Emacs is doing extremely well in
that department compared to other applications.

Thanks, folks.

Cheers
-- 
tomás

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  5:52                       ` tomas
@ 2022-02-07  6:43                         ` Po Lu
  2022-02-07  6:57                           ` tomas
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07  6:43 UTC (permalink / raw)
  To: tomas; +Cc: emacs-devel

<tomas@tuxteam.de> writes:

>> I was trying to discourage users from enabling
>> `select-enable-primary', which Lars disagreed with.  It was turned
>> off by default in Emacs 21, where Emacs switched to the now-standard
>> behaviour by default.

> One of those default discussions, sigh :)

None of us are questioning the default here, I was simply trying to
discourage people from doing that.

> FWIW, I'm one of those having set `select-enable-primary' to t (after a
> short period of swearing and trying to understand what happened).
>
> I do understand the choice of the default. I'm happy and thankful that
> there is a cop-out.

Now that the last holdouts (Qt) have dropped their options to even
revert to the old interpretation at all, I see no point in continuing to
set `select-enable-primary' to t, since all that accomplishes is to make
Emacs less interoperable with other programs.

If someone still wants to turn it on, nothing stops him from doing so.
However, the behaviour of his desktop will become undefined, and other
programs will stop working correctly.

Thanks.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  6:43                         ` Po Lu
@ 2022-02-07  6:57                           ` tomas
  0 siblings, 0 replies; 55+ messages in thread
From: tomas @ 2022-02-07  6:57 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

On Mon, Feb 07, 2022 at 02:43:43PM +0800, Po Lu wrote:
> <tomas@tuxteam.de> writes:
> 
> >> I was trying to discourage users from enabling
> >> `select-enable-primary', which Lars disagreed with.  It was turned
> >> off by default in Emacs 21, where Emacs switched to the now-standard
> >> behaviour by default.
> 
> > One of those default discussions, sigh :)
> 
> None of us are questioning the default here, I was simply trying to
> discourage people from doing that.

I see. I do understand your points, mind you. Still...

> If someone still wants to turn it on, nothing stops him from doing so.

... I'm glad I can do that.

> However, the behaviour of his desktop will become undefined, and other
> programs will stop working correctly.

I choose wisely. And hate those outliers I /have/ to use nevertheless.
Yes, I'm weird :-)

Thanks
-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  3:48             ` Po Lu
  2022-02-07  4:05               ` Lars Ingebrigtsen
@ 2022-02-07 12:49               ` Eli Zaretskii
  2022-02-07 12:56                 ` Po Lu
  2022-02-07 13:14               ` Stefan Monnier
  2 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2022-02-07 12:49 UTC (permalink / raw)
  To: Po Lu; +Cc: larsi, noah, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: Noah Friedman <noah@splode.com>,  emacs-devel@gnu.org
> Date: Mon, 07 Feb 2022 11:48:45 +0800
> 
> On X, every program is supposed to follow this:
> 
>   https://specifications.freedesktop.org/clipboards-spec/clipboards-spec.txt

These rules changed some time ago; previously, X applications behaved
differently (e.g., copy/paste used PRIMARY etc.).  Emacs originally
behaved like the other X apps before the change.  We then switched to
the new behavior in Emacs 24.1, to follow suit, but left behind user
options to allow users to get back the old behavior.

Since we didn't decide to drop the old behavior, I think we should
continue supporting it with the new features, at least as opt-in.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07 12:49               ` Eli Zaretskii
@ 2022-02-07 12:56                 ` Po Lu
  0 siblings, 0 replies; 55+ messages in thread
From: Po Lu @ 2022-02-07 12:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, noah, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> On X, every program is supposed to follow this:
>> 
>>   https://specifications.freedesktop.org/clipboards-spec/clipboards-spec.txt

> These rules changed some time ago; previously, X applications behaved
> differently (e.g., copy/paste used PRIMARY etc.).

The situation is more confusing than that; the previous X standards
document was ambiguously worded, so half the X applications interpreted
it as prefering the use of PRIMARY for copy/paste, and the other half
CLIPBOARD.

Eventually, people realized the former didn't make much sense, so most
of those programs adopted the latter interpretation.  By the 2000s, the
only program still defaulting to PRIMARY was Emacs, and even we followed
suit with 24.1.

> Emacs originally behaved like the other X apps before the change.  We
> then switched to the new behavior in Emacs 24.1, to follow suit, but
> left behind user options to allow users to get back the old behavior.

Yes.

> Since we didn't decide to drop the old behavior, I think we should
> continue supporting it with the new features, at least as opt-in.

It isn't really a new feature, just an optimization.  Anyway, it doesn't
work with the primary selection, as `mouse-yank-primary' still complains
that no selection exists.

Thanks.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  1:18     ` Po Lu
@ 2022-02-07 13:04       ` Stefan Monnier
  2022-02-07 13:15         ` Po Lu
  0 siblings, 1 reply; 55+ messages in thread
From: Stefan Monnier @ 2022-02-07 13:04 UTC (permalink / raw)
  To: Po Lu; +Cc: xenodasein--- via Emacs development discussions., xenodasein

Po Lu [2022-02-07 09:18:14] wrote:
> I see no point in sticking to behaviour obsoleted by the operating
> system, such as storing cut text in the primary selection.  On X, every
> client has to cooperate with every other client in order to have working
> cut and paste, and a single client deviating from that is sufficient to
> bring down the entire deck-of-cards.

Now I'm lost.  What you say here seems to claim that the change under
discussion brings Emacs in line with the official/standard protocol.
Yet that change is very specific to the `CLIPBOARD` whereas I'd expect
such an official protocol to behave the same for all types of selections.

Elsewhere you said that the motivation was one of optimization
of performance.  Yet Noah's original message points out a change in
actual behavior rather than mere performance.

I'm having difficulty reconciling those somewhat contradictory facts.

Could someone walk me through step-by-step what happens in one or two cases,
(e.g. Noah's case, or the "normal" case) explaining what Emacs does and
why, how the patch affects the outcome and what the ideal behavior would
be according to the standard protocol?


        Stefan




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  3:48             ` Po Lu
  2022-02-07  4:05               ` Lars Ingebrigtsen
  2022-02-07 12:49               ` Eli Zaretskii
@ 2022-02-07 13:14               ` Stefan Monnier
  2022-02-07 13:17                 ` Po Lu
  2 siblings, 1 reply; 55+ messages in thread
From: Stefan Monnier @ 2022-02-07 13:14 UTC (permalink / raw)
  To: Po Lu; +Cc: Lars Ingebrigtsen, Noah Friedman, emacs-devel

> On X, every program is supposed to follow this:
>
>   https://specifications.freedesktop.org/clipboards-spec/clipboards-spec.txt
>
> In short:

Some of those specs talk about interaction with other programs, in which
case we should arguably follow them to be good neighbors.  But other
parts talk about the UI and only affect the contract between the
application and the user.  We have no obligation to follow those parts,
tho of course it might make a lot of sense to make the default behavior
follow those specs to avoid surprising the user.

The change under discussion here was motivated by an optimization, so
presumably it should not affect the interface between the user and
Emacs, but only between Emacs and the system.  So IIUC this is a part
where the spec is indeed very relevant and we should strive to
follow it.  But I must say I don't know which part of the spec the
change is related to.  Could you clarify?

> Setting `select-enable-clipboard' to nil violates 3, 4, and 5, while
> setting `select-enable-primary' to t violates 5 and 4.

These seem to only affect the contract between the user and Emacs, so if
the users change them to their default, that can only hurt themselves.

And AFAICT our default settings don't violate those parts 3, 4, and 5,
so we're fine.

And of course I still can't see in which way this relates to
commit 99c637499e.


        Stefan




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07 13:04       ` Stefan Monnier
@ 2022-02-07 13:15         ` Po Lu
  2022-02-07 19:47           ` James Cloos
  0 siblings, 1 reply; 55+ messages in thread
From: Po Lu @ 2022-02-07 13:15 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: xenodasein--- via Emacs development discussions., xenodasein

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I see no point in sticking to behaviour obsoleted by the operating
>> system, such as storing cut text in the primary selection.  On X, every
>> client has to cooperate with every other client in order to have working
>> cut and paste, and a single client deviating from that is sufficient to
>> bring down the entire deck-of-cards.

> Now I'm lost.  What you say here seems to claim that the change under
> discussion brings Emacs in line with the official/standard protocol.
> Yet that change is very specific to the `CLIPBOARD` whereas I'd expect
> such an official protocol to behave the same for all types of selections.

No, this is something else unrelated to the original change: I'm trying
to coinvince people not to use `select-enable-primary', at least
lightly, and those prior changes you referred to changed the default
value of `select-enable-primary'.  Further down another thread someone
said that was common advice on the internet, which is shocking, since
that amounts to teaching people to break their systems.

> Elsewhere you said that the motivation was one of optimization
> of performance.  Yet Noah's original message points out a change in
> actual behavior rather than mere performance.
>
> I'm having difficulty reconciling those somewhat contradictory facts.
>
> Could someone walk me through step-by-step what happens in one or two cases,
> (e.g. Noah's case, or the "normal" case) explaining what Emacs does and
> why, how the patch affects the outcome and what the ideal behavior would
> be according to the standard protocol?

We don't know what happens in Noah case yet.  He hasn't replied to my
questions.

Thanks.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07  5:29                     ` Po Lu
  2022-02-07  5:47                       ` Corwin Brust
  2022-02-07  5:52                       ` tomas
@ 2022-02-07 13:17                       ` Eli Zaretskii
  2022-02-07 13:18                         ` Po Lu
  2 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2022-02-07 13:17 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> Date: Mon, 07 Feb 2022 13:29:45 +0800
> From: Po Lu <Luangruo@yahoo.com>
> 
> I was trying to discourage users from enabling `select-enable-primary', which Lars disagreed with.  It was turned off by default in Emacs 21, where Emacs switched to the now-standard behaviour by default.

Not in Emacs 21, but in Emacs 24.1.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07 13:14               ` Stefan Monnier
@ 2022-02-07 13:17                 ` Po Lu
  0 siblings, 0 replies; 55+ messages in thread
From: Po Lu @ 2022-02-07 13:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lars Ingebrigtsen, Noah Friedman, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Some of those specs talk about interaction with other programs, in
> which case we should arguably follow them to be good neighbors.  But
> other parts talk about the UI and only affect the contract between the
> application and the user.  We have no obligation to follow those
> parts, tho of course it might make a lot of sense to make the default
> behavior follow those specs to avoid surprising the user.
>
> The change under discussion here was motivated by an optimization, so
> presumably it should not affect the interface between the user and
> Emacs, but only between Emacs and the system.  So IIUC this is a part
> where the spec is indeed very relevant and we should strive to follow
> it.  But I must say I don't know which part of the spec the change is
> related to.  Could you clarify?

It's not related.  Here I'm trying to convince people to not enable
`select-enable-primary' lightly, since that breaks other programs.

There seems to be a lot of bad advice floating around, and that's one of
them.

> These seem to only affect the contract between the user and Emacs, so if
> the users change them to their default, that can only hurt themselves.
>
> And AFAICT our default settings don't violate those parts 3, 4, and 5,
> so we're fine.
>
> And of course I still can't see in which way this relates to
> commit 99c637499e.

It doesn't relate, but I thought you were referring to the choice of
selection in the message I replied to earlier.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07 13:17                       ` Eli Zaretskii
@ 2022-02-07 13:18                         ` Po Lu
  0 siblings, 0 replies; 55+ messages in thread
From: Po Lu @ 2022-02-07 13:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Mon, 07 Feb 2022 13:29:45 +0800
>> From: Po Lu <Luangruo@yahoo.com>
>> 
>> I was trying to discourage users from enabling
>> `select-enable-primary', which Lars disagreed with.  It was turned
>> off by default in Emacs 21, where Emacs switched to the now-standard
>> behaviour by default.
>
> Not in Emacs 21, but in Emacs 24.1.

That's a typo, I missed that.
Thanks.



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07 13:15         ` Po Lu
@ 2022-02-07 19:47           ` James Cloos
  2022-02-07 19:53             ` tomas
  0 siblings, 1 reply; 55+ messages in thread
From: James Cloos @ 2022-02-07 19:47 UTC (permalink / raw)
  To: Po Lu
  Cc: xenodasein, Stefan Monnier,
	xenodasein--- via Emacs development discussions.

PL> I'm trying to coinvince people not to use `select-enable-primary'

no-one should try to do that.

even the default ought to remain:

 (select-enable-clipboard nil) (select-enable-primary t)

any attempt to discourage locally fixing that regression should be reversed.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6



^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: recent change to yanking behavior of the clipboard
  2022-02-07 19:47           ` James Cloos
@ 2022-02-07 19:53             ` tomas
  0 siblings, 0 replies; 55+ messages in thread
From: tomas @ 2022-02-07 19:53 UTC (permalink / raw)
  To: James Cloos
  Cc: Po Lu, xenodasein, Stefan Monnier,
	xenodasein--- via Emacs development discussions.

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

On Mon, Feb 07, 2022 at 02:47:37PM -0500, James Cloos wrote:
> PL> I'm trying to coinvince people not to use `select-enable-primary'
> 
> no-one should try to do that.
> 
> even the default ought to remain:
> 
>  (select-enable-clipboard nil) (select-enable-primary t)
> 
> any attempt to discourage locally fixing that regression should be reversed.

I couldn't parse that sentence.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2022-02-07 19:53 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 11:07 recent change to yanking behavior of the clipboard xenodasein--- via Emacs development discussions.
2022-02-06 11:21 ` Po Lu
2022-02-06 11:37   ` xenodasein--- via Emacs development discussions.
2022-02-06 11:47     ` Po Lu
2022-02-06 11:55       ` xenodasein--- via Emacs development discussions.
2022-02-06 12:01         ` Po Lu
2022-02-06 12:06           ` xenodasein--- via Emacs development discussions.
2022-02-06 12:08         ` Eli Zaretskii
2022-02-06 12:15           ` xenodasein--- via Emacs development discussions.
2022-02-06 12:30             ` Eli Zaretskii
2022-02-06 12:15         ` tomas
2022-02-06 12:20           ` xenodasein--- via Emacs development discussions.
2022-02-06 15:20   ` Stefan Monnier
2022-02-07  1:18     ` Po Lu
2022-02-07 13:04       ` Stefan Monnier
2022-02-07 13:15         ` Po Lu
2022-02-07 19:47           ` James Cloos
2022-02-07 19:53             ` tomas
2022-02-06 15:17 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2022-02-06  3:39 Noah Friedman
2022-02-06  7:37 ` Po Lu
2022-02-06  9:20   ` Eli Zaretskii
2022-02-06  9:34     ` Po Lu
2022-02-06 10:18   ` Po Lu
2022-02-06 16:09   ` Óscar Fuentes
2022-02-07  1:11     ` Po Lu
2022-02-07  2:05       ` Óscar Fuentes
2022-02-07  2:59         ` Po Lu
2022-02-07  5:04           ` Óscar Fuentes
2022-02-07  5:17             ` Yuri Khan
2022-02-07  5:23               ` Óscar Fuentes
2022-02-07  5:31             ` Po Lu
2022-02-06 22:39   ` Lars Ingebrigtsen
2022-02-07  1:12     ` Po Lu
2022-02-07  2:53       ` Lars Ingebrigtsen
2022-02-07  3:11         ` Po Lu
2022-02-07  3:41           ` Lars Ingebrigtsen
2022-02-07  3:48             ` Po Lu
2022-02-07  4:05               ` Lars Ingebrigtsen
2022-02-07  4:44                 ` Po Lu
2022-02-07  4:57                   ` Corwin Brust
2022-02-07  5:29                     ` Po Lu
2022-02-07  5:47                       ` Corwin Brust
2022-02-07  5:52                       ` tomas
2022-02-07  6:43                         ` Po Lu
2022-02-07  6:57                           ` tomas
2022-02-07 13:17                       ` Eli Zaretskii
2022-02-07 13:18                         ` Po Lu
2022-02-07 12:49               ` Eli Zaretskii
2022-02-07 12:56                 ` Po Lu
2022-02-07 13:14               ` Stefan Monnier
2022-02-07 13:17                 ` Po Lu
2022-02-07  1:11   ` Tim Cross
2022-02-07  2:31     ` Michael Welsh Duggan
2022-02-06  9:17 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).