help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to activate region


From: Andreas Röhler
Subject: Re: how to activate region
Date: Thu, 14 May 2009 10:24:52 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Barry Margolin wrote:
> In article <mailman.7100.1242253215.31690.help-gnu-emacs@gnu.org>,
>  Samuel Wales <samologist@gmail.com> wrote:
>
>   
>> When transient-mark-mode is off, there must be a way to activate the
>> existing region for commands that require it to be active.  Anybody
>> know what it is?  The manual and apropos have yielded nothing so far.
>>
>> Thanks.
>>     
>
> C-x C-x.  This has the side effect of swapping the point and mark, so 
> you can type it again to get back where you were.
>
> I don't think there's a standard command that does nothing but activate 
> the region.  It should be trivial to write one, though.
>
>   

The question seems too, what "active region" means.

AFAIU we have three different states to deal with:

- the mark is set
- the mark is set and exists at different location from point, i.e.
region has an extent
- region has an extent and is visible (transient-mark-mode on)

Presently region-active-p is defined in simple.el

,----
| (defun region-active-p ()
|   "Return t if Transient Mark mode is enabled and the mark is active.
|
| Most commands that act on the region if it is active and
| Transient Mark mode is enabled, and on the text near point
| otherwise, should use `use-region-p' instead.  That function
| checks the value of `use-empty-active-region' as well."
|   (and transient-mark-mode mark-active))
`----

i.e. AFAIU it does not require an extent.

IMO if the mark is set, a region is active basically.

I use

(defsubst region-exists-p ()
 "(not (null (mark)))"
 (not (null (mark))))

Cheers

Andreas Röhler




reply via email to

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