all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: Change default behavior of some commands that act on region?
Date: Sun, 23 May 2021 00:25:34 +0000	[thread overview]
Message-ID: <SA2PR10MB447427EA2DD4AB1EE124BDA9F3279@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <83sg2ekg93.fsf@gnu.org>

> > Breaking long-standing behavior.  I'll let others figure
> > out how to minimize this (e.g. by testing for
> > `transient-mark-mode` or something).

There's nothing to figure out.  The proposal said
clearly from the outset that it would have NO effect
when `transient-mark-mode' is turned OFF.

So yes, `transient-mark-mode' would be tested, and if
nil then the long-standing behavior would be UNCHANGED.

Similarly, the behavior of Lisp code that invokes the
command non-interactively would be UNCHANGED.

(if (or (not (called-interactively-p 'interactive))
        (not transient-mark-mode))
    (apply COMMAND ARGS) ; NO CHANGE FROM PAST BEHAVIOR

  ;; Do what user wants for such a command
  ;; when region is inactive.
  ...
  )

The only change in "long-standing behavior" would be for
interactive use when `transient-mark-mode' is turned ON.

And even that could be configurable.  E.g.:

* A list (defvar) of the commands that would be affected.
  Users could change this, but mostly would not bother.

* A defcustom to choose command behavior for inactive region:

  1. Do nothing (ignore - command is a no-op on inactive region).

  2. Prompt to confirm action.
     (e.g. "Region is inactive.  Invoke `foobar' on it anyway?")

  3. Raise an error.
     (e.g. "Cannot use `foobar' interactively with inactive region")

  A good default behavior would be to do nothing (#1),
  in keeping with the aim to use `transient-mark-mode'
  to govern things.  These are essentially commands that
  never learned about `transient-mark-mode' and active
  regions.  In general, there's little sense in turning
  on `transient-mark-mode' and wanting commands to act
  on the INactive region.

* For named commands at least, we could add an ability to
  override the defcustom behavior for particular commands:

  (put 'foobar 'inactive-region-command-action 'error)




  parent reply	other threads:[~2021-05-23  0:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 20:58 Change default behavior of some commands that act on region? Drew Adams
2021-05-22  6:04 ` Eli Zaretskii
2021-05-22  6:19   ` Clément Pit-Claudel
2021-05-22  6:36     ` Emanuel Berg via Emacs development discussions.
2021-05-22  7:00       ` Clément Pit-Claudel
2021-05-22  6:45     ` Eli Zaretskii
2021-05-22  7:00       ` Clément Pit-Claudel
2021-05-22  7:23         ` Eli Zaretskii
2021-05-23  0:23         ` [External] : " Drew Adams
2021-05-23  0:23   ` Drew Adams
2021-05-22 14:03 ` Stefan Monnier
2021-05-22 14:14   ` Eli Zaretskii
2021-05-22 14:33     ` Stefan Monnier
2021-05-23  0:25     ` Drew Adams [this message]
2021-05-22 19:26   ` [External] : " Drew Adams
2021-05-22 21:16     ` Stefan Monnier
2021-05-23  0:25       ` Drew Adams
2021-05-23  6:39     ` Eli Zaretskii
2021-05-23 14:27       ` Drew Adams
2021-05-23 15:13         ` Eli Zaretskii
2021-05-23 17:50           ` Drew Adams
2021-05-23 18:08             ` Eli Zaretskii
2021-05-23 19:22               ` Drew Adams
2021-05-23 19:42                 ` Eli Zaretskii
2021-05-23 20:07                   ` Drew Adams
2021-05-22 23:07   ` Tim Cross
2021-05-23  0:24     ` [External] : " Drew Adams
2021-05-23  0:55     ` Stefan Monnier
2021-05-23  1:37       ` [External] : " Drew Adams
2021-05-23  7:14         ` Eli Zaretskii
2021-05-23 14:28           ` Drew Adams
2021-05-23 15:12             ` Alan Mackenzie
2021-05-23 17:48               ` Drew Adams
2021-05-23 18:44               ` T.V Raman
2021-05-22 20:48 ` Juri Linkov
2021-05-23  0:24   ` [External] : " Drew Adams

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

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

  git send-email \
    --in-reply-to=SA2PR10MB447427EA2DD4AB1EE124BDA9F3279@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.