[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: Change default behavior of some commands that act o
From: |
Drew Adams |
Subject: |
RE: [External] : Re: Change default behavior of some commands that act on region? |
Date: |
Sun, 23 May 2021 00:25:34 +0000 |
> > 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)
RE: [External] : Re: Change default behavior of some commands that act on region?, Drew Adams, 2021/05/22
Re: Change default behavior of some commands that act on region?, Stefan Monnier, 2021/05/22
- Re: Change default behavior of some commands that act on region?, Eli Zaretskii, 2021/05/22
- RE: [External] : Re: Change default behavior of some commands that act on region?, Drew Adams, 2021/05/22
- Re: [External] : Re: Change default behavior of some commands that act on region?, Eli Zaretskii, 2021/05/23
- RE: [External] : Re: Change default behavior of some commands that act on region?, Drew Adams, 2021/05/23
- Re: [External] : Re: Change default behavior of some commands that act on region?, Eli Zaretskii, 2021/05/23
- RE: [External] : Re: Change default behavior of some commands that act on region?, Drew Adams, 2021/05/23
- Re: [External] : Re: Change default behavior of some commands that act on region?, Eli Zaretskii, 2021/05/23
- RE: [External] : Re: Change default behavior of some commands that act on region?, Drew Adams, 2021/05/23
- Re: [External] : Re: Change default behavior of some commands that act on region?, Eli Zaretskii, 2021/05/23