emacs-devel
[Top][All Lists]
Advanced

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

RE: Why was `transient-mark-mode' turned off for `delete-selection-mode'


From: Drew Adams
Subject: RE: Why was `transient-mark-mode' turned off for `delete-selection-mode'?
Date: Fri, 5 Sep 2014 09:01:58 -0700 (PDT)

> > 2. There are now 4 possible behaviors that a user can choose:
> > a. d-s mode on  and t-m mode on
> > b. d-s mode off and t-m mode on
> > c. d-s mode off and t-m mode off
> > d. d-s mode on  and t-m mode off
> >
> > This is a good time to again consider the question of
> > what the default behavior should be.  It is currently (b).
> > I think it should be (a).
> >
> > (a) is the behavior most new users are used to.  It is the
> > behavior I have preferred for Emacs, ever since it was first
> > available, 20 or so years ago.
> > (b) is the behavior we have now.
> 
> I think it shouldn't.

OK.

> > I think (a) is the best choice for the default behavior,
> > and (d) is arguably the second best choice.
> 
> I find myself trying to figure out a good way to unhighlight a
> selection half of the time when I am trying to edit a link in a
> browser or something that pops up highlighted for some reason.
> It is total nuisance behavior without a generally available way
> to turn the unasked-for selection off.  The other half of the time
> I inadvertantly delete material.  Sometimes it can be recovered
> by C-z (depending on the application).  Sometimes not.

Clearly, d-s mode is not for you.  Fortunately, anyone can choose
the behavior (a-d) that s?he prefers.

But I wonder if your surprise and annoyance with such behavior
outside Emacs might have something to do with your not using d-s
mode inside Emacs.

I use d-s mode, and I am not surprised outside Emacs by a highlighted
selection or its deletion if I hit a deletion key or its replacement
if I type text.  And that's a point in favor of turning on d-s mode
by default: it is quite common UI outside Emacs.

> Your only argument so far has been "others do it".  But that's not,
> in itself, a good reason to let Emacs adopt default behavior that
> gets in the way of productive work.  

I agree 100% that how things work outside Emacs should not be the
*only* reason for how they should work inside Emacs.  I have opposed
turning on CUA mode by default, for instance.

Just as you find d-s mode off more natural and less conducive to
mistakes, so I find the opposite.  People are different, and they
have different habits and use cases.  Each of us probably thinks
that what seems natural for us personally makes for a good default
setting, at least in this case.

But the same thing was true for the discussion about t-m mode.
Plenty of people argued strongly about the annoying distraction of
highlighting; the naturalness of an invisible region and the absence
of any concept of "active" region; and so on.  It was a long
discussion, but we finally turned `transient-mark-mode' on.

I admit that I don't have a particular, killer argument in favor of
d-s by default.  Like you in the opposite direction, I can argue that
its particulars are helpful and say why, etc.  But in this case I'm
not sure that will get us far.  Everyone is likely already familiar
with the differences, which can be described either postively or
negatively without adding much light. The same was true for t-m mode.

A "user poll" might be useful in this case.

> "Now how do I undo that damage" _is_ a distraction from whatever
> you have been doing.  I do get this in Emacs when accidentally typing
> C-w (rather than C-e or something).  But typing C-w accidentally does
> not occur as frequently as, well, typing anything at all.

Which is a strong argument against having type-to-replace without
highlighting the text to be replaced/deleted.  (Which was what I
mistakenly thought the new d-s NEWS entry was announcing.)

I don't see accidentally deleting a highlighted region as a problem,
but if you say it happens to you (don't you see the highlighting?)
then, again, I would guess that maybe the problem is at least partly
that you are between two chairs: you are used to Emacs without d-s,
and then you encounter type-to-replace outside Emacs.

[FWIW, I bind `kill-region' & company (e.g. `clipboard-kill-region')
to a command that makes me `y-or-n-p' the killing if the region is
greater than a given size - 2000 chars by default.  Dunno whether
that would be useful for Emacs generally.  But it helps me,
especially since even though the region is highlighted, and the
highlighting is always visible (since point is on screen), the
extent of a large region is not so obvious.  I also show the
region size in the mode line in chars and lines, using face`region':
"2962 ch, 62 l".]

Similarly, I don't see things "popping up highlighted for some
reason" (either outside Emacs or with d-s mode) and having a need
to unhighlight them.  But if I did, it would not be a big deal to
unhighlight them (C-g in Emacs).

Well, OK, maybe I do see that sometimes.  E.g., if I click the URL
in the address field of a browser it typically becomes selected
and highlighted, so that I can quickly replace it.  What do I do
if I want to keep 95% of it?  I click mouse-1 where I want to
change it, or I use a cursor key, and the highlighting disappears.
Poof!  No swearing.  But I am used to the behavior.

Now of course, if for some reason you don't notice that the text
is selected - you don't notice the highlighting, then perhaps
you will be in for some swearing.  But as you say, `C-z' (undo)
usually reverts any deletion or replacement.  Again, a problem
for you and some others, no doubt, but not for yet others.

> > But even then many of them interact with programs (e.g.
> > web browsers) that have the behavior of (a).
> 
> In my case, that interaction involves a lot of swearing.

See above.  My guess is that that is a consequence mainly of
not being used to the behavior, due to not using the same
behavior within Emacs.  Precisely the argument I was making.

Some people are very used to the type-to-replace behavior
outside Emacs, and they no doubt engage in similar swearing
when they step inside Emacs.  Others, like you, though not
used to it, might benefit from the behavior being the same
(or similar) inside and outside Emacs - less swearing.

> > 3. Besides having the limitation of not being able to just
> > type to replace the region text, the current situation
> > suffers from treating mouse selection exceptionally.
> > A mouse selection has the deletion behavior of d-s mode,
> > but without its type-to-replace behavior.
> 
> Are you sure about that?  Like, really sure?

Well, let's see (I'm on MS Windows; YMMV):

1. emacs -Q (any Emacs version you like).

2. In *scratch*, select some text with the mouse.  Take
   your pick how you do this: drag mouse-1 or double-click it,
   or click mouse-1 then mouse-3 elsewhere, etc.

3. Type some text.

For me, the typed text is inserted at point, without any of the
selected (and highlighted) text being replaced.

If I hit a deletion key (e.g. Backspace or Delete) then the
selected text is deleted.  And that's the behavior I described.
Do you see something different?




reply via email to

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