emacs-devel
[Top][All Lists]
Advanced

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

RE: delete-selection-mode as default


From: Drew Adams
Subject: RE: delete-selection-mode as default
Date: Sun, 16 Sep 2018 09:30:08 -0700 (PDT)

> > I meant that Emacs always has point as one end of the region,
> > and because (like editors typically) the cursor is always visible
> > on the screen, so the point end of the region is always on
> > screen.
> >
> > There is no association between the secondary selection and
> > point, so the entire sec. sel. can move off screen. And it is
> > "persistent" in the sense I think you mean (as opposed persisting
> > across Emacs sessions).
> 
> Oh, I see what you mean!
> 
> Emacs has point and (the end of) the region (selection) always entangled
> with no way to separate them or to disable the region.  That is what I
> dislike so much, and it causes all kinds of issues.
> 
> The secondary selection doesn't have all these problems, so it's a good
> example.
> 
> Can we have a mode or something in which there is no association between
> point and the end of the region?  Or can I just configure that association 
> away?

See Yuri's reply about this question. But no, not the region. That's
how the Emacs region is defined.

If someone wants to implement such behavior, I'd add, to what Yuri
said, that you likely do not want to change all current commands
that use the region to use such a selection that is free from point.
That likely would not make sense for some such commands.

What he describes as a possible approach for adapting the spec
(interactive "r"), for instance, might be better handled by using
a new interactive code instead.

For a different start, I'd suggest maybe starting with the secondary
selection. Much of what would be needed is already in `second-sel.el',
including being able to (1) set the sec. sel. from the Emacs region (as
one way of creating/resetting it) and (2) set the primary selection
from the secondary. And you should be able to pretty easily adapt
this to just use the primary selection, if needed.

`second-sel.el' also includes multiple selections, in this sense: it gives
you a ring of secondary selections that works like the `kill-ring'. Yes,
you meant also being able to use multiple selections _together_, at
once, which is not how the `kill-ring' and `secondary-selection-ring'
are used. They're designed for the standard use of `M-y': retrieving
a past selection.

Though using multiple selections together is not in `second-sel.el',
it too should be easy to realize (and the same thing applies to using
multiple entries of the `kill-ring' together).

You would still want to also implement easily defining multiple
selections in the way you describe for MS Windows. In Emacs
the thing to be aware of in this context is the use of `C-M-w M-w'
to append the selected text to the previous kill, instead of
creating a new kill (i.e., a new `kill-ring' entry). There is currently
nothing in `second-sel.el' that provides similar behavior for
`secondary-selection-ring', but that could easily be added.

Also, together with `second-sel.el', library `browse-kill-ring+.el',
which extends library `browse-kill-ring.el', lets you use `M-y' at
the top level to browse either the  `secondary-selection-ring' or
the ` kill-ring', or both, to choose a selection to yank. And `M-y'
following a yank from either of these rings replaces that yank
with the next (or the prefix-argth) ring entry.  IOW, it does a
`yank-pop' or a `yank-pop-secondary', as appropriate.

Actually, `browse-kill-ring+.el' allows for any number of such
rings of selections. And they could be adapted for use as
sources for commands that use multiple selections together.



reply via email to

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