unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean Louis <bugs@gnu.support>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>,
	Eduardo Ochs <eduardoochs@gmail.com>
Subject: RE: [External] : Re: What can cause downcasing in Emacs Lisp code?
Date: Fri, 21 May 2021 20:42:52 +0000	[thread overview]
Message-ID: <SA2PR10MB4474B5BCA386AA73CF72EE1CF3299@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <YKgSjAr1VIBbMqCu@protected.localdomain>

> 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	other threads:[~2021-05-21 20:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 16:49 What can cause downcasing in Emacs Lisp code? Jean Louis
2021-05-20 17:21 ` Eduardo Ochs
2021-05-21  5:54   ` Jean Louis
2021-05-21 15:20     ` [External] : " Drew Adams
2021-05-21 15:45       ` Jean Louis
2021-05-21 16:01         ` Drew Adams
2021-05-21 20:05           ` Jean Louis
2021-05-21 20:42             ` Drew Adams [this message]
2021-05-21 21:00               ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR10MB4474B5BCA386AA73CF72EE1CF3299@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=bugs@gnu.support \
    --cc=eduardoochs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).