[Top][All Lists]

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

Re: Improving X selection?

From: Stefan Monnier
Subject: Re: Improving X selection?
Date: Thu, 07 Feb 2008 14:45:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> Would be nice to find one that didn't induce an extra hyphen is all -
> interprogram-cut-function
> interprogram-paste-function
> interprogram-highlight-function
> interprogram-highlight-insert-function

The name "interprogram-highlight-function" sounds wrong: the user does
not highlight the text, she selects it (the highlighting is done by the
application to help the user figure out what is selected).  So I suggest
`interprogram-select-function' for it.  For the last one, I suggest we
use `interprogram-insert-function', tho I'm not completely sure
I understand what it's intended to do.

The following is some random analysis of the situation, for my
own good.

>From what I can tell, there are 4 kinds of selections:
- C-SPC + mouse movement.  I.e. select-only.
- same plus C-w.
- selection with the mouse.
- one of the above plus "copy" from the menu.

No 4 should always use the CLIPBOARD.
No 3 should always use the PRIMARY (plus optionally CLIPBOARD)
No 2 may optionally use PRIMARY (plus optionally CLIPBOARD)
No 1 should use neither or at most PRIMARY.

I believe that currently No 2 and No 3 are always handled in the same
way, and I don't know if we want to bother separating them.
I also believe that the use of CLIPBOARD for 2 and 3 depends on

You're suggesting to allow PRIMARY for No 1 via `select-active-regions'?
Oh, I see it already exists, so you're just trying to fix it so it
works more reliably, is that right?

Why do you need `interprogram-highlight-function'?  Can't you just use

   (let ((x-select-enable-clipboard nil))
     (kill-ring-save beg end))

like clipboard-kill-ring-save does?

On the lighins side, I understand even less why there's a need for
interprogram-highlight-insert-function.  We have 3 different situations:
- C-y
- mouse-2
- "Paste" from the menu

For all three cases, the first question is "where does the text come from":
No 3 should always use the CLIPBOARD then PRIMARY then kill ring.
No 2 should use the CLIPBOARD only if x-select-enable-clipboard is set.
No 1 is identical except it may also not check PRIMARY either.

In all 3 cases a further question is: if the yanked text comes from the
CLIPBOARD or the PRIMARY, should the text be added to the kill-ring?

This last question is the one you seem to want to address, but I don't
see why you need interprogram-highlight-insert-function for it, instead
of just a boolean config var.  And to be honest: I doubt that there's
enough of a need for this level of control to justify its introduction;
it's easy enough to use M-y to get back to the previous item.
This said, if we introduce such a "copy-interprogram-text-to-kill-ring"
config var, we could give it 3 values: either the kill-ring is never
affected, or the kill-ring is filled from CLIPBOARD/PRIMARY upon yank,
or the kill-ring is not only filled upon yank but also upon kill
(that's a patch I suggested a few months back: before pushing something
to the CLIPBOARD/PRIMARY, check the previous value, and if it's not
ours, stash it in kill-ring, thus integrating the kill-ring with the
PRIMARY/CLIPBOARD even more tightly).


reply via email to

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