emacs-devel
[Top][All Lists]
Advanced

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

Re: Improving X selection?


From: David De La Harpe Golden
Subject: Re: Improving X selection?
Date: Thu, 7 Feb 2008 20:39:22 +0000

On 07/02/2008, Stefan Monnier <address@hidden> wrote:
> 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.

I thought of that, but wanted to avoid "select" because of its X11
usage:  that which is cut is also a selection in X11 terms.  Still,
it's not terrible,
and fits in with select-active-regions.
N.B. interprogram-highlight-function is used only when
select-active-regions is active.

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

It  is intended to be for inserting texts retrieved from the window
system which are to be inserted without side-effecting the kill ring.
It is
only used in the very specific case of (the patched) mouse-yank-at-click with
mouse-yank-at-click set to lightins rather than yank.

Remember, the goal is allow a configuration where primary /never makes
its way into the kill ring/, while still allowing its insertion with
middle-click.  If you're a long-time emacs user used to (or given the
audience, partially responsible for!) existing behaviour, you're
probably now wondering why the heck you want that - fortunately for
you, patch defaults to existing behaviour.


> 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'm not 100% sure what you meant by "selection with mouse" there :
No 1 covers "selection [only] with mouse".

> I also believe that the use of CLIPBOARD for 2 and 3 depends on
> x-select-enable-clipboard.

Yes.

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

Yes (and making it not x-specific.).


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

No, that would affect the kill ring!

If mouse-drag-copy-region is on (the default), then mouse-selecting
uses the  the kill ring and side-effects the X11 selection via
interprogram-cut-function, so select-active-regions is not necessary.
But if mouse-drag-copy-region is off (so mouse-selecting doesn't
affect the kill ring, only mouse-selecting then killing...), then
select-active-regions is necessary (for mouse AND keyboard) to
propagate out to primary.

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

[I'd say it should always use CLIPBOARD then kill ring, never PRIMARY, it
should just do a yank, which via current-kill may pull in CLIPBOARD)

> No 2 should use the CLIPBOARD only if x-select-enable-clipboard is set.

... but *not* add to kill ring! (unless the user wants it to)

No 1 IS a yank, (which via current-kill/interprogram-paste-function)
may pull in CLIPBOARD.

>  thus integrating the kill-ring with the
> PRIMARY/CLIPBOARD even more tightly).

Hmm. May have to think through your last part more, but just to
stress, my goal is to allow at least one point in the customization
space that:

1. totally separates x11 primary and the kill-ring,
2. unifies x11 clipboard and kill-ring.
3  while still allowing get (by middlebutton-insert) and set (by
keyboard or mouse selection leading to highlight) of primary.




reply via email to

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