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: hw
Subject: Re: delete-selection-mode as default
Date: Sun, 16 Sep 2018 05:15:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Drew Adams <address@hidden> writes:

>> You don't need a region for commands to work on, a selection is enough.
>> 
>> That would allow to decouple navigation from (making) selections, and
>> the concept of a region becomes obsolete, removing all the entanglement
>> and greatly simplifying things.
>
> In case there are others who, like me, did not completely get this
> point from Hw, though he touched on it several times -

Imagine Emacs without a region.  Mark and point still exist, only there
is no region.

> [...]
> What is it about the secondary selection that makes me
> think that it is like what Hw describes? This: unlike the
> Emacs region, there is no requirement that either end
> of the selection be visible, i.e. on the screen, even when
> you act on it. By contrast, by design the Emacs region 
> always has the cursor end of the region, i.e., point, on
> the screen.

This would be relevant for multiple selections because some of them
might not be visible in a window/on screen.  That's something you can't
do with the secondary selection.

I wasn't even aware that this might be difficult to understand because
it is so fundamental with the Emacs region that one end of it is always
visible.

> [...]
> And maybe it helps Hw understand a bit more about the
> Emacs behavior, which absolutely requires that the cursor
> end of the region always be visible in the visible part of the
> screen.

I never thought about that before you mentioned it.  It seems quite
natural when there is only one selection because I have no desire to
scroll something off the screen I'm working with right now.


Did you ever try joe?  I haven't used it in years, but it usually comes
with the distribution, so you might be able to try it, too.  If you do,
C-k h shows help.

In joe, you make a selection by pressing C-k b to mark the beginning and
C-k k to mark the end of the selection.  The selection is called a block
in joe. It is highlighted.  You can change it any time by setting the
marks again.

Now you can copy the block with C-k c, meaning the whole block is
inserted at point, and the copy is the new selection.  The beginning and
the end of a block (selection) can both be off screen.

You can move around, and the block stays enabled and highlighted (Why
can't Emacs do that?).

When you delete the block, the block is gone and the start marker is
being remembered.  You can set a new end marker to create a new block
without setting a new start marker.

You can probably do more stuff with it, but it doesn't matter here.


So there are a few things to note:


+ start and end marker of a selection do not need to be visible

+ the selection is entirely independent from navigation

+ the selection is persistent

+ the start marker is being remembered after the selection has been used

+ I can move, type and edit normally without endangering the selection
  as if it wasn't there


And it is what I basically do with selections: I just make them when and
where I need them.  Only Emacs won't really let me do this because it
forces me to drag this dreadful useless region around all the time.  On
top of that, some functions work with the region by either being limited
to it or by being extended to it when it is highlighted while others
work with the region when it's not highlighted, and it all depends on
various modes and variables until nobody really knows anymore what it
all does under what circumstances.

Ok, Emacs is a bit more complicated than joe, but seriously?  It's not
all that different because you make a selection and then do stuff with
it.  Only Emacs makes this terrible with its inflexible and overloaded
paradigm of "the region" which can be hidden, active or both in various
ways, and is apparently important to some users even for navigation.

But it can't really get much simpler, more obvious, more efficient and
easier to use then in joe.  Joe also protects my by not having a hidden
region all the time, and I'm not going to loose the selection by
mistake.  Drew won't like it because there is no delete-selection-mode;
I like it because there is none (or maybe there is and I don't know
about it).

> And yes, perhaps that basic Emacs tenet of keeping the
> cursor visible is partly rooted in the emphasis Emacs gives
> to the keyboard, and in its origin before the widespread
> use of pointing devices (mouse).
>
> In that context you pretty much always want the insertion
> point (aka text cursor) to be visible. You are not typically
> selecting text with a mouse and then acting on it.

The cursor is always visible in joe.  That doesn't mean that a selection
can not be persistent or that its end must always be visible.  This is
an Emacs problem because sticking to "the region" makes Emacs
inflexible.

I can imagine that this inflexibility may have been a reason for abusing
the mark for navigation: What else can you do when you have no choice
but to always stick to a fake selection ("the region") and aren't free
to move around?  Later the inflexibility brought someone to create
transient-mark-mode, and it couldn't go all the way because Emacs
remained tied up by its region.  After some more evolution, Emacs is
still being held back by its region ...


I really hope you have a chance to try out joe, it might make what I'm
trying to say much easier to understand.  I'm not saying Emacs should be
entirely the same as joe, they are too different for that --- only that
this is an example of what I'm trying to say which you can try out ---
and having it like that in Emacs in an Emacs-compatible way would be
really cool.



reply via email to

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