help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: [External] : Re: What can cause downcasing in Emacs Lisp code?


From: Drew Adams
Subject: RE: [External] : Re: What can cause downcasing in Emacs Lisp code?
Date: Fri, 21 May 2021 20:42:52 +0000

> During few months I found my sources downcased partially,
> but if 30% downcased it seem as region was downcased, I 
> just don't remember marking that much of region.

OK, here's the thing...

`downcase-region' and some other commands that act on the
region are _very old_.  They predate even the existence of
`transient-mark-mode', let alone the turning ON of that
mode by default.

This and similar commands act on the region _regardless
of whether it is active_.  That's just the way things are.

And yes, you pretty much always have a nonempty region to
act on.  And yes, users who expect commands that act on
the region text to do so only when the region is active
can be bitten by such (now exceptional) behavior.

Usually someone who uses such a command notices the effect
immediately, in which case, a quick `undo' takes care of
it.  But with a command such as `downcase-region' when the
region is mostly already in the resulting state (in this
case, already lowercase), a user might not notice that
some things were changed (e.g. a few chars, even possibly
off-screen).

Now that I think about it, it might make sense for Emacs
to change the default behavior of such commands, so that
they would do something "safer".

For example, when invoked interactively, if the region is
not active and if `transient-mark-mode' is turned on, do
something like:

* be a no-op
* raise an error
* prompt for confirmation first

Those conditions are important: There'd be no change when
invoked from code, or when t-m-mode is off.  Oldbies who
leave that mode off would see no change in behavior, and
the same for existing Lisp code.

reply via email to

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