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: Thu, 13 Sep 2018 04:58:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Drew Adams <address@hidden> writes:

>> Highlighting regions should be separated from whether they are active or
>> not, and I don't want hidden regions, either.
>
> There are ways to highlight the region without activating it.
> You can use one of those (preferably with a different face,
> if you also sometimes use an active region)..

I'm not sure if that is very useful unless there are multiple regions.

> But it's important to highlight the active region.

yes

>> Currently even when a region is not active (it is a hidden region
>> because it is not highlighted), you can do something with it, so users
>> always get an "active" region even when they don't want one.  It's only
>> a bit less active than it is when it is highlighted.
>
> The "active region" has a well-defined meaning in Emacs.
> Don't confuse things by talking about how you can act on
> the region when it is not active in the usual sense.

That the meaning of "active region" is well defined doesn't seem to
prevent inconsistency and confusion.

Are there multiple senses in which a region can be active? ;)

>> > I feel like region activation by `C-x C-x' was maybe foisted
>> > on people who never wanted or expected to do anything
>> > with an active region.
>> 
>> Do you mean they would rather do things with hidden regions?  I never
>> want to do that.
>
> Not clear, but it sounds like you do want an active region, in the usual
> sense, but you want it to be active for only some things, none of which
> are type/paste to replace/delete.

What I usually do with a region is stuff with it ... i. e. cut/copy and
paste it, and I use it to limit (not extend) the effect of functions
like query-replace.  I also use indent-region, but that always works
with a region --- you could see some inconsistency here, too, because
with an active region, only indent would be needed which is limited to a
region that is active and otherwise work with the whole buffer.
Sometimes I use it for whitespace-cleanup, which is also limited to an
active region --- another inconsistency is whitespace-cleanup-region.

There may be other things I use regions for that doesn't come to mind
atm.  It might be wrong to call them regions because it's no more than a
selection to me.

I select a region when I want one and expect it to be forgotten once I
did something with it.  I do not want hidden regions lurking invisibly
in the background, waiting for me to make a mistake so they can suddenly
come out of hiding and bite me.

Regions do not have anything to do with navigation, and I don't use them
for that.

I would prefer consistency and selections to act like I want them to,
like no delete-selection-mode, no shift-selection, no deletion of
regions by arbitrary keystrokes, no de-activating regions by arbitrary
keystrokes ...

I don't really care about transient-mark-mode.  I enabled it a long time
ago because with it enabled, selections get finally highlighted like
they should be.  When I made a selection, it is only logical that
functions are limited to the selection, so this special feature of t-m-m
isn't a special feature to me.  And how would you limit functions to
selections otherwise?

Whether functions are limited to a selection doesn't have anything to do
with how the selection has been made, i. e. whether with t-m-m enabled
or disabled.  It also doesn't have anything to do with whether a
selection is highlighted or not, but when something is selected, it
should be highlighted, and when something isn't highlighted, it
shouldn't be selected.

There are so things entirely unrelated of each other that I now have
lost count.  Only Emacs makes a mess of them and even throws navigation
into the mess.

Extending functions to a selection is yet an entirely different
issue. You can only limit functions that otherwise work with the whole
buffer to a region, and you can only extend functions that do not work
with a whole buffer to a region.  Transient-mark-mode is supposed to
limit functions, not to extend them.  To extend functions, a separate
mode may be helpful (like you already have d-s-m).

>> Use point and mark purely for navigation, set a selection-start-marker
>> with C-spc and a selection-end-marker with another C-spc (or whatever
>> key binding is appropriate for it).  The region is between these
>> markers, and you can have multiple regions in the same buffer.  Do
>> something with a region, and its markers are forgotten unless you use a
>> prefix.  Have a key binding to jump around between the regions in a
>> buffer, and you can tell Emacs with which of them you want to do
>> something by moving point into it.  If you want to do the same thing
>> with multiple regions, move point into one after another and make them
>> "sticky" for operation, or mark them right after selecting them.
>
> Much of what you describe is available with various libraries, including
> `zones.el' (https://www.emacswiki.org/emacs/Zones).

... like you describe in your other post, thanks!  I need to look into
that.



reply via email to

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