emacs-devel
[Top][All Lists]
Advanced

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

RE: Proposal to change cursor appearance to indicate region activation


From: Drew Adams
Subject: RE: Proposal to change cursor appearance to indicate region activation
Date: Sat, 23 Nov 2013 12:25:08 -0800 (PST)

> > (add-hook 'deactivate-mark-hook (lambda () (setq cursor-type t)))
> > (add-hook 'activate-mark-hook (lambda () (setq cursor-type 'bar)))
> 
> I like the idea, but this collides with other uses of cursor-type.
> Could someone cook up a patch which only does the above if cursor-
> type has not been modified (and which lets users opt-out if they
> prefer).  Also, the patch should directly modify deactivate-mark
> and activate-mark rather than using the hooks.

If you do anything like this, please put it in a minor mode or make
it otherwise customizable (e.g. trivial to turn off).  I would even
argue against it being on by default (but not strongly) - I prefer
that the default behavior not be changed.

It is simple for a user or library to change the `cursor-type' on
demand or based on some dynamic condition.  Why put this on mark
(de)activation hooks unconditionally, or "directly modify
deactivate-mark and activate-mark"?  That sounds like a mistake.

For instance, I have the cursor type change to `box' for overwrite
mode and read-only buffers, and use type `bar' as the default.  And
the type changes to `box' when Emacs is idle.  But these things are
user choices.  They happen only if a user chooses them, and the
particular types used for each state are also customizable.

Emacs should do likewise: make such behavior optional.  You speak
of letting users opt out, but only if the `cursor-type' has been
modified, whatever that might mean (does it matter how it was
modified or how long ago?).

The problems this proposal purports to solve are exaggerated, IMO:

1. The 1st reason given for the proposal is to let users tell when
the active region is empty: "when the region is active but empty,
there's no visual indication of this status."

A better way to do that is to include the code from library
`modeline-posn.el' for this: show the region size, highlighted
with face `region', in the mode line in place of the buffer size
whenever the region is active.

2. The 2nd reason given for the proposal: "Neither is there
indication of the active region if point is one less than mark and
blink-cursor-mode is off."

I don't see that.  For me, the active region is highlighted in that
case.  Am I missing something?

And again, the `modeline-posn.el' region-size indication shows
clearly when the region size is 1, regardless of the where point
is relative to mark.

3. The 3rd reason given for the proposal: "Also, if point is
greater than mark, the active region is highlighted, but the block
cursor does an inverse-video highlight of the character following
the region."

So?  The cursor, block or otherwise, indicates point: where text
will insert.  A block cursor is on top of the character after
point, but that does not mean or suggest that that character is
selected, i.e., is in the region.

The proposal says that this "(speaking from experience) an Emacs
newbie finds distracting, since it seems to indicate that that
character is also part of the region, even though it actually
isn't."

In what way does it "seem to indicate" that the character under
the cursor is part of the region?  It never indicated that to me,
and I don't see how it would for others.

And even if some newbie did mistakenly get that impression, how
long does it take to realize that that impression is incorrect?
Emacs provides plenty of visual feedback about what is the
correct impression.  It doesn't take any thought to find out what
is in the region and what is not.  It just takes one or two
selections - an experimentation of maybe 20 seconds or so.
Seriously, how long did it take you to figure out the truth here?

4. The 4th and final reason given for this proposal: "Adding to
the confusion, the inverse-video highlighted character actually
is part of the region in the case that point is less than mark."

So?  The position of the cursor does not tell you anything about
whether the character after it (for `bar') or under it (for
`box') is part of the region.  For `bar', you can see the
character after the cursor, so you can tell.  OK.  For `box',
you can see the character also, and you can see the `region'
face applied to it as foreground.  I.e., you see the character
highlighted as part of the region, but you see it in inverse
video.

Admittedly, the `region' face as background instead of
foreground is more obvious.  I'll grant you that. But that alone
does not justify this feature being hardcoded into Emacs, IMO.

If this feature is added, please make it optional, easy to
change (turn off), and preferably not on by default.  And you
are welcome to consider incorporating the behavior of
`modeline-posn.el'.
http://www.emacswiki.org/emacs-en/download/modeline-posn.el



reply via email to

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