* bug#9934: 24.0.91; `region-active-p' definition
@ 2011-11-01 17:12 Drew Adams
2011-11-01 17:59 ` Andreas Schwab
2011-11-01 20:09 ` Stefan Monnier
0 siblings, 2 replies; 11+ messages in thread
From: Drew Adams @ 2011-11-01 17:12 UTC (permalink / raw
To: 9934
The definition:
(defun region-active-p () "..."
(and transient-mark-mode mark-active))
Makes no sense, AFAICT. The mark *cannot* be active unless
`transient-mark-mode' is non-nil. The very definitions of "active" mark
and "active" region imply transient mark mode. When transient mark mode
is off, the region and mark are *never* active - the notion of "active"
does not exist in that context.
And since the correct definition: (defun region-active-p () mark-active)
is so trivial, this function should just be removed.
When is there ever any reason to test (and transient-mark-mode
mark-active)? When is that value ever different from just the value of
mark-active?
In GNU Emacs 24.0.91.1 (i386-mingw-nt5.1.2600) of 2011-10-30 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.6) --no-opt --cflags
-I"D:/devel/emacs/libs/libXpm-3.5.8/include"
-I"D:/devel/emacs/libs/libXpm-3.5.8/src"
-I"D:/devel/emacs/libs/libpng-dev_1.4.3-1/include"
-I"D:/devel/emacs/libs/zlib-dev_1.2.5-2/include"
-I"D:/devel/emacs/libs/giflib-4.1.4-1/include"
-I"D:/devel/emacs/libs/jpeg-6b-4/include"
-I"D:/devel/emacs/libs/tiff-3.8.2-1/include"
-I"D:/devel/emacs/libs/gnutls-2.10.1/include" --ldflags
-L"D:/devel/emacs/libs/gnutls-2.10.1/lib"'
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 17:12 bug#9934: 24.0.91; `region-active-p' definition Drew Adams
@ 2011-11-01 17:59 ` Andreas Schwab
2011-11-01 18:13 ` Drew Adams
2011-11-01 20:09 ` Stefan Monnier
1 sibling, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2011-11-01 17:59 UTC (permalink / raw
To: Drew Adams; +Cc: 9934
"Drew Adams" <drew.adams@oracle.com> writes:
> When transient mark mode is off, the region and mark are *never*
> active
If transient mark mode is off then the mark is active as soon as it is
set.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 17:59 ` Andreas Schwab
@ 2011-11-01 18:13 ` Drew Adams
2011-11-01 18:50 ` Andreas Schwab
0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2011-11-01 18:13 UTC (permalink / raw
To: 'Andreas Schwab'; +Cc: 9934
> > When transient mark mode is off, the region and mark are
> > *never* active
>
> If transient mark mode is off then the mark is active as
> soon as it is set.
Prove it. Show me the code that supports such a claim.
Nonsensical. If t-m mode is off, what does it mean for the mark to be active or
inactive? Nothing.
What user-visible or code-visible difference does it make whether the mark is
"active" or "inactive" when t-m mode is off? None.
There is no such notion ("active") when t-m mode is off. Never has been.
Cannot be.
You cannot have a distinction (e.g., active vs inactive) unless there is some
_difference_ in behavior. When t-m mode is off there are not two states for the
mark - no distinction.
There is no active region when t-m-m mode is off - there is just the region: it
does not have two states active/inactive.
An active mark _means_ an active region, and vice versa. And activeness is
indicated by highlighting. Deactivating the mark turns off the highlighting.
This is straight out of the doc, and it corresponds with both Emacs history and,
well, logic.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 18:13 ` Drew Adams
@ 2011-11-01 18:50 ` Andreas Schwab
2011-11-01 19:43 ` Drew Adams
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2011-11-01 18:50 UTC (permalink / raw
To: Drew Adams; +Cc: 9934
"Drew Adams" <drew.adams@oracle.com> writes:
> there is just the region
The region does not exist if there is no mark.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 18:50 ` Andreas Schwab
@ 2011-11-01 19:43 ` Drew Adams
2011-11-01 20:42 ` Andreas Schwab
0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2011-11-01 19:43 UTC (permalink / raw
To: 'Andreas Schwab'; +Cc: 9934
> The region does not exist if there is no mark.
Correct. And irrelevant here.
When there is no region, a fortiori you cannot speak of it having two states,
active and inactive.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 19:43 ` Drew Adams
@ 2011-11-01 20:42 ` Andreas Schwab
2011-11-01 22:26 ` Drew Adams
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2011-11-01 20:42 UTC (permalink / raw
To: Drew Adams; +Cc: 9934
A non-existent region is inactive.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 20:42 ` Andreas Schwab
@ 2011-11-01 22:26 ` Drew Adams
2011-11-01 22:45 ` Andreas Schwab
0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2011-11-01 22:26 UTC (permalink / raw
To: 'Andreas Schwab'; +Cc: 9934
> A non-existent region is inactive.
A non-existent region is simply... _not_.
It is not a region, a fortiori not an inactive region.
Or, rather, from false anything follows.
A non-existent region is active. And inactive. And red, and president... It
is a region and not a region. You can say whatever you like about a
non-existent X, even that it exists!.
If x is an element of the empty set, then <say anything you like, about x or
anything else>.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 17:12 bug#9934: 24.0.91; `region-active-p' definition Drew Adams
2011-11-01 17:59 ` Andreas Schwab
@ 2011-11-01 20:09 ` Stefan Monnier
2011-11-01 22:26 ` Drew Adams
1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2011-11-01 20:09 UTC (permalink / raw
To: Drew Adams; +Cc: 9934-done
> When is there ever any reason to test (and transient-mark-mode
> mark-active)? When is that value ever different from just the value of
> mark-active?
emacs -Q
M-x transient-mark-mode
M-: mark-active RET
C-SPC
M-: mark-active RET
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 20:09 ` Stefan Monnier
@ 2011-11-01 22:26 ` Drew Adams
2011-11-02 1:26 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2011-11-01 22:26 UTC (permalink / raw
To: 'Stefan Monnier'; +Cc: 9934
> 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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#9934: 24.0.91; `region-active-p' definition
2011-11-01 22:26 ` Drew Adams
@ 2011-11-02 1:26 ` Stefan Monnier
0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2011-11-02 1:26 UTC (permalink / raw
To: Drew Adams; +Cc: 9934
> 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
That's false as well. (transient-mark-mode -1) followed by C-SPC C-SPC
will create an active region.
Nowadays transient-mark-mode basically only toggles the behavior between
C-SPC and C-SPC SPC as well as between C-x C-x and C-u C-x C-x.
Yes, mark-active is weird and messy and so is transient-mark-mode.
The implementation is ugly, messy, and twisted. Patches to clean up the
mess are welcome, but I see no bug here.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-11-02 1:26 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 17:12 bug#9934: 24.0.91; `region-active-p' definition Drew Adams
2011-11-01 17:59 ` Andreas Schwab
2011-11-01 18:13 ` Drew Adams
2011-11-01 18:50 ` Andreas Schwab
2011-11-01 19:43 ` Drew Adams
2011-11-01 20:42 ` Andreas Schwab
2011-11-01 22:26 ` Drew Adams
2011-11-01 22:45 ` Andreas Schwab
2011-11-01 20:09 ` Stefan Monnier
2011-11-01 22:26 ` Drew Adams
2011-11-02 1:26 ` Stefan Monnier
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.