[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9934: 24.0.91; `region-active-p' definition
From: |
Drew Adams |
Subject: |
bug#9934: 24.0.91; `region-active-p' definition |
Date: |
Tue, 1 Nov 2011 15:26:35 -0700 |
> emacs -Q
> M-x transient-mark-mode
> M-: mark-active RET
> C-SPC
> M-: mark-active RET
You're right about that - my bad. And I do use (and transient-mark-mode
mark-active) in my own code (cross versions).
It is the name `region-active-p' that is a bit misleading. Outside t-m mode the
region is neither active nor inactive. When `region-active-p' returns nil it
does not necessarily mean that the region is inactive. It means that either the
region is inactive or t-m mode is turned off.
(not (region-active-p)) is really `region-active-or-not-t-m-mode'.
Pre-Emacs 23, `deactivate-mark' had no effect outside of t-m mode (as the doc
string said back then, `deactivate-mark' "makes a difference only in Transient
Mark mode"). (That is still the case apart from FORCE, as the current doc
string notes.) Mark activation/deactivation has no meaning outside t-m mode.
(And `mark-active' does not really test whether the mark is active - see below.)
Likewise region activation/deactivation. The two, region/mark active/inactive,
_should_ be synonymous. Whenever one is (in)active the other should be also.
That's unfortunately not necessarily the case, at least according to some
function/var names. The doc should be more careful and clearer, however.
`mark-active' has in fact the same kind of problem as `region-active-p': When
there is _no_ mark it is logically impossible to speak of _the mark_ being
active or inactive.
(not mark-active) is really `mark-inactive-or-nonexistent', where "inactive" is
only possible/meaningful in t-m mode. All that is really possible (i.e., with
any consequence) to test for the mark outside t-m mode is
existence/nonexistence.
`mark-active' was (and is) a sufficient test whenever t-m-mode is on, and it
makes no sense to test `mark-active' when the mode is off - other than as a test
for the _existence_ of the mark (same as (mark t) in that case).
The notion of "active/inactive region" simply makes no sense outside of t-m
mode. You've chosen to consider the region to be always "inactive" outside of
t-m mode, judging by the name `region-active-p'. But if it is _always_ inactive
then there is no such thing as active in that context - there is no
active/inactive state difference.
Active mark and region is really a t-m mode thing.
- bug#9934: 24.0.91; `region-active-p' definition, Drew Adams, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition, Andreas Schwab, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition, Drew Adams, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition, Andreas Schwab, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition, Drew Adams, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition, Andreas Schwab, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition, Drew Adams, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition, Andreas Schwab, 2011/11/01
bug#9934: 24.0.91; `region-active-p' definition, Stefan Monnier, 2011/11/01
- bug#9934: 24.0.91; `region-active-p' definition,
Drew Adams <=