GNU bug report logs - #9934
24.0.91; `region-active-p' definition

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Tue, 1 Nov 2011 17:16:02 UTC

Severity: minor

Found in version 24.0.91

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9934 in the body.
You can then email your comments to 9934 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 17:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 01 Nov 2011 17:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.91; `region-active-p' definition
Date: Tue, 1 Nov 2011 10:12:45 -0700
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"'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 18:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9934 <at> debbugs.gnu.org
Subject: Re: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 01 Nov 2011 18:59:32 +0100
"Drew Adams" <drew.adams <at> 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 <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 18:16:02 GMT) Full text and rfc822 format available.

Message #11 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Andreas Schwab'" <schwab <at> linux-m68k.org>
Cc: 9934 <at> debbugs.gnu.org
Subject: RE: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 1 Nov 2011 11:13:16 -0700
> > 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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 18:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9934 <at> debbugs.gnu.org
Subject: Re: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 01 Nov 2011 19:50:12 +0100
"Drew Adams" <drew.adams <at> oracle.com> writes:

> there is just the region

The region does not exist if there is no mark.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 19:46:02 GMT) Full text and rfc822 format available.

Message #17 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Andreas Schwab'" <schwab <at> linux-m68k.org>
Cc: 9934 <at> debbugs.gnu.org
Subject: RE: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 1 Nov 2011 12:43:00 -0700
> 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.





Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Tue, 01 Nov 2011 20:12:02 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Tue, 01 Nov 2011 20:12:02 GMT) Full text and rfc822 format available.

Message #22 received at 9934-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9934-done <at> debbugs.gnu.org
Subject: Re: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 01 Nov 2011 16:09:06 -0400
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 20:45:02 GMT) Full text and rfc822 format available.

Message #25 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9934 <at> debbugs.gnu.org
Subject: Re: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 01 Nov 2011 21:42:11 +0100
A non-existent region is inactive.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 22:30:01 GMT) Full text and rfc822 format available.

Message #28 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Andreas Schwab'" <schwab <at> linux-m68k.org>
Cc: 9934 <at> debbugs.gnu.org
Subject: RE: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 1 Nov 2011 15:26:33 -0700
> 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>.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 22:30:02 GMT) Full text and rfc822 format available.

Message #31 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 9934 <at> debbugs.gnu.org
Subject: RE: 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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Tue, 01 Nov 2011 22:49:02 GMT) Full text and rfc822 format available.

Message #34 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9934 <at> debbugs.gnu.org
Subject: Re: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 01 Nov 2011 23:45:45 +0100
The region has nothing to do with logic or set theory.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9934; Package emacs. (Wed, 02 Nov 2011 01:29:01 GMT) Full text and rfc822 format available.

Message #37 received at 9934 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9934 <at> debbugs.gnu.org
Subject: Re: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 01 Nov 2011 21:26:00 -0400
> 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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Nov 2011 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 204 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.