emacs-devel
[Top][All Lists]
Advanced

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

RE: delete-selection-mode as default (WAS: Some developement questions)


From: Drew Adams
Subject: RE: delete-selection-mode as default (WAS: Some developement questions)
Date: Mon, 10 Sep 2018 13:36:29 -0700 (PDT)

> Actually, I'm not sure what the use of d-s-mode actually is.  I don't
> recall anyone here advocating it on some intrinsic merits, only "because
> everybody else does it", which I've never found a convincing argument for
> anything in Emacs.

Minor convenience. If the region is active then typing or
yanking replaces it - no need to use `C-w' first. That's all.
Not a big deal either way, IMO (as Stefan has said).

When the region is active you can do things to it or with it.
Otherwise, there is _no reason to activate it_.

If it is active, one of the things you often want to do with
it is delete it or replace it. We tend to do that often, and
d-s-m mode makes that easier/quicker. Nothing more.

Think of overwrite mode (bound to <insert>) versus inserting
and having to use `C-d' before or after each char you type.

No, of course you wouldn't use `C-d' for each char, but
that's the idea. The more often you had to compensate for
insertion by deleting what was there beforehand, the more
you might find overwrite mode handy.

If you often replace selected text then not bothering to use
`C-w' first can be handy. Select some text, then type or yank
to replace it.

> That was me, the complete phrase was "irretrievably lost" and I carefully
> outlined what was being lost and where.  In summary, it was a carefully
> and painstakingly constructed region, and what was being lost by a
> careless movement key without <shift> was the point and mark of the
> highlighted region, not its contents.  Furthermore it was in programs
> which aren't Emacs.

I see. I never use shift-selection. Dunno whether that's relevant -
probably not.

> It enables you to type onto the end of a (highlighted) region
> without being distracted by first having to do something to remove the
> highlighting, 

Yes. If someone doesn't want to do something to/with the
active region then it shouldn't be active. `C-g' deactivates it.

In a way, d-s-m or not d-s-m is a bit about C-g versus C-w.
Which do you need to use more often, C-w (without d-s-m)
or C-g (with d-s-m). That might be one way of looking at
the choice people make.

> or more likely without first having to use `undo' to get
> your region back again, followed by unhighlighting it followed by typing
> the character you want to append.

You shouldn't be losing the region in the first place. You
shouldn't need to undo or unhighlight. If you accidentally
activated the region, and you want to deactivate it, C-g
should take care of that.

I'm guessing this comes back to the `C-x C-x' activation
of the region. With that turned off, i.e., with `C-x C-x' just
swapping point and mark like it did in the old days, I'm
guessing you will never have an active region that bothers
you - with or without d-s-m. But that's just a guess.

Users should not get an active region when they don't
want it, i.e., when they don't want to act on the region.
And they should be able to easily get an active region
when they do want to act on the region.

If we're not yet supporting that well then that's where
the improvement should come first, I think.

The only time I get an active region when I don't want it
is if I activated it thinking I was going to do something
with it, and then I changed my mind (so I use C-g).

I suspect that things are very different for you, and I
suspect it is because of `C-x C-x' activating the region
even though you have no intention of acting on it.

An active region is perhaps more of a bother than an aid,
for someone who never (or rarely) wants to act on it.

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. If so, they've probably been silently
tolerating it all these years. And yes, I can see why, if that's
the case, they might dread moving to d-s-m.

I think we've finally identified the real problem underlying
such anxiety as being region activation by `C-x C-x'. Take that
away and I think folks who don't want to use d-s-m will be fine.

For folks who do want to use d-s-m, region activation
by `C-x C-x' is handy. But it's not necessary. In any case,
region activation has nothing inherently to do with
swapping point and mark.

Maybe someone who detests d-s-m could spend a few minutes
with it turned on but with `C-x C-x' bound to a command that
just swaps point and mark without activating the region. My
guess is that if that were the default behavior it might be OK
for most people.

D-s-m, but without Emacs activating the region each time you
use `C-x C-x'. No undesired region activation, so no unexpected
d-s-m action.

And of course, for someone who really wants to take advantage
of d-s-m we still would offer the current, region-activating
`C-x C-x' command. But we should also offer a command that
just activates the region, nothing more. By default that would be
unbound (or at most bound to something other than `C-x C-x').

> Personally, it scarcely affects me because I run with transient-mark-mode
> disabled, 

There you go. That's probably the right thing to do for
someone who doesn't want d-s-m behavior. But then
do you have to monkey around with temporary t-m-m,
or do you just not bother, ever, with having an active
region? I'm guessing the latter.

> but I still occasionally get unwanted highlighting of regions
> for some reason.

Probably from accidental temporary t-m-m, would be
my guess. (That's something else I never use.)

Or maybe from some other commands that activate the
region? I think that if t-m-m is off then most commands
(e.g. query-replace) do not try to activate the region
(which is correct behavior - an active region makes
sense only for t-m-m/d-s-m).

In sum, having d-s-m + t-m-m both on is good for folks
like me. Having them both off is maybe good for folks
like you.

Having t-m-m on and d-s-m off might not be the best
thing. But that's the default behavior.



reply via email to

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