emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Documentation of transient-mark-mode is sloppy, wrong, and confused.


From: Alan Mackenzie
Subject: Re: Documentation of transient-mark-mode is sloppy, wrong, and confused.
Date: Fri, 29 May 2009 11:01:29 +0000
User-agent: Mutt/1.5.9i

Hi, Davis!

On Thu, May 28, 2009 at 04:53:14PM -0700, Davis Herring wrote:
> >>   Some commands, which ordinarily operate on the region when the
> >>   mark is active, instead act on the entire buffer.

> > That is a definition of "active", surely, as I suggested above.
> > Surely, it is better to regard the mark and region as being inactive
> > when t-m-m is disabled?

> It seems to me that there are two kinds of activeness of the mark (and
> the region; they have between them only one state).  The first kind
> (call it active1) is associated with commands like `kill-region', which
> refuse to do anything unless the region is active1.  Outside of
> transient mark mode, the mark is always active1 if it exists at all;
> with tmm, the mark is frequently activated1 and deactivated1.

> The other kind (active2) is associated with commands like `undo',
> `insert-parentheses', and `how-many', which restrict, extend, or change
> (respectively) their area of effect to be the region iff it is active2. 
> Outside of transient mark mode, the mark is never active2 at all; with
> tmm, the mark is active2 iff it is active1.

Bingo!  That's the answer!  Thanks!

So an honest @dfn{active} would be along the lines:

    Historically, @dfn{active region} has had two distinct, sometimes
    contradictory meanings:
    @itemize @bullet
    @item
    Certain commands which use the region, such as @key{C-w}
    (@code{kill-region}) are disabled when the region isn't @dfn{active}.
    As from Emacs 23, the region is now always ``active'' in this sense,
    unless you set the user option @code{mark-even-when-inactive}
    (@pxref{...}).
    @item
    Certain commands work in an enhanced manner when the region is
    @dfn{active}: for example, `fill-paragraph' (@pxref{..}) fills the
    region when it is active, rather than just the current paragraph.
    When the region is ``active'' in this sense, it is highlit.
    @end @itemize

    Most uses of ``active'' in this manual have the second meaning.

> So we see that while there are two predicates, they can be resolved as (or
> (not transient-mark-mode) (mark-active)) and (and transient-mark-mode
> (mark-active)).

I think these can be more simply expressed as (i) mark-active and (ii)
(use-region-p).

> Since my imaginary function `mark-active' is only ever called when tmm
> is on, we may take it to return nil otherwise and replace active2 with
> just (mark-active).  There is then only one variable "active", but tmm
> has different effects on different interpretations of its value.

> Sidebar: I like the 22 feature of turning tmm on temporarily; I don't like
> it in general (partly because I like the mark being active1), but
> otherwise I cannot have an active2 mark at all.

Doesn't (setq mark-even-if-inactive t) do what you want?

> Davis

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]