all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: 9934@debbugs.gnu.org
Subject: bug#9934: 24.0.91; `region-active-p' definition
Date: Tue, 1 Nov 2011 15:26:35 -0700	[thread overview]
Message-ID: <FABB045649F24350A6983CF6C968CDE5@us.oracle.com> (raw)
In-Reply-To: <jwv39e7fvwo.fsf-monnier+emacs@gnu.org>

> 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.






  reply	other threads:[~2011-11-01 22:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-11-02  1:26     ` Stefan Monnier

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=FABB045649F24350A6983CF6C968CDE5@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=9934@debbugs.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.