[Top][All Lists]

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

bug#27530: patch to cut and copy secondary

From: Drew Adams
Subject: bug#27530: patch to cut and copy secondary
Date: Tue, 5 Sep 2017 06:53:48 -0700 (PDT)

> The function exchanges point and mark.
> When there is region, this also creates secondary.

Why?  What if I want to just exchange point and mark,
and not also copy the region to the secondary?

> When there is secondary, this converts secondary
> to primary in advance.

What if I don't want to do that?

I don't like the sound of this.  The point of having a
secondary selection is to keep it separate from the
region or primary selection.  `C-x C-x' should affect
only the region, not the secondary selection.

There is nothing wrong with having commands that do
the kinds of things you describe - I've long had similar,
as you know. What is not good, I think, is to confuse the
two wrt key bindings.  Please choose different bindings.

> As a consequence, an user sees the function exchanges
>  - `point' and `mark'
>  - `point and mark' (= primary) and secondary
> at the same time.

My suggestion is to please keep such functionality separate.


FWIW, I've been using secondary, swapping it with primary,
etc. for a long time.  I make sure, in second-sel.el, to
suggest key bindings that keep things separate.

(global-set-key (kbd "C-M-y") 'secondary-yank|select|move|swap)
(define-key esc-map "y" 'yank-pop-commands)
(global-set-key (kbd "C-x C-M-SPC") 'set-secondary-start)
(global-set-key (kbd "C-x C-M-<return>") 'secondary-save-then-kill)
(define-key isearch-mode-map (kbd "C-M-y") 'isearch-yank-secondary)

The single key `C-M-y' (just suggested, not done by second-sel.el)
does all of this:

Yank the secondary selection.  With a prefix arg, interact with

 Prefix arg:

  None: Yank secondary.
  Zero: Select secondary as region.
  > 0:  Move secondary to region.
  < 0:  Swap region and secondary.


 No prefix arg: Yank the secondary selection at point.  Move point
 to the end of the inserted text.  Leave mark where it was.

 Zero arg: Select the secondary selection and pop to its buffer.

 Non-zero arg: Move the secondary selection to this buffer's region.

 Negative arg: Also go to where the secondary selection was and
 select it as the region.  That is, swap the region and the
 secondary selection.

Yes, the command mixes behavior for the region and the secondary
selection.  But it does so only when you use a prefix arg.  And
it does so only on a new key binding (`C-M-y'), not on a binding
long associated with the mark and the region (`C-x C-x').  The
command and key are specifically for the secondary selection.

reply via email to

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