* how to activate region
@ 2009-05-13 22:19 Samuel Wales
2009-05-13 23:16 ` Leo
0 siblings, 1 reply; 12+ messages in thread
From: Samuel Wales @ 2009-05-13 22:19 UTC (permalink / raw
To: help-gnu-emacs
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.
--
Myalgic encephalomyelitis denialism is causing death and severe suffering
worse than MS. Conflicts of interest are destroying research. /You/ can
get the disease at any time permanently. Do science and justice matter to
you? Posters: http://www.mefreeforall.org/fileadmin/PDFs/ME_Awareness_Posters_2009.pdf
Overview: http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-13 22:19 Samuel Wales
@ 2009-05-13 23:16 ` Leo
2009-05-14 4:32 ` Samuel Wales
0 siblings, 1 reply; 12+ messages in thread
From: Leo @ 2009-05-13 23:16 UTC (permalink / raw
To: help-gnu-emacs
On 2009-05-13 23:19 +0100, Samuel Wales 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-SPC twice.
--
.: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :.
www.git-scm.com
git - the one true version control system
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-13 23:16 ` Leo
@ 2009-05-14 4:32 ` Samuel Wales
2009-05-14 4:33 ` Samuel Wales
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Samuel Wales @ 2009-05-14 4:32 UTC (permalink / raw
To: Leo; +Cc: help-gnu-emacs
On Wed, May 13, 2009 at 16:16, Leo <sdl.web@gmail.com> wrote:
> C-SPC twice.
That, unfortunately, has the side effect of setting mark.
--
Myalgic encephalomyelitis denialism is causing death and severe suffering
worse than MS. Conflicts of interest are destroying research. /You/ can
get the disease at any time permanently. Do science and justice matter to
you? Posters: http://www.mefreeforall.org/fileadmin/PDFs/ME_Awareness_Posters_2009.pdf
Overview: http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-14 4:32 ` Samuel Wales
@ 2009-05-14 4:33 ` Samuel Wales
2009-05-14 6:04 ` Andreas Röhler
2009-05-14 4:55 ` Kevin Rodgers
[not found] ` <mailman.7129.1242276989.31690.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 12+ messages in thread
From: Samuel Wales @ 2009-05-14 4:33 UTC (permalink / raw
To: Leo; +Cc: help-gnu-emacs
What I want is the existing region.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-14 4:32 ` Samuel Wales
2009-05-14 4:33 ` Samuel Wales
@ 2009-05-14 4:55 ` Kevin Rodgers
[not found] ` <mailman.7129.1242276989.31690.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2009-05-14 4:55 UTC (permalink / raw
To: help-gnu-emacs
Samuel Wales wrote:
> On Wed, May 13, 2009 at 16:16, Leo <sdl.web@gmail.com> wrote:
>> C-SPC twice.
>
> That, unfortunately, has the side effect of setting mark.
,----[ C-h k C-x C-x ]
| C-x C-x runs the command exchange-point-and-mark
| which is an interactive compiled Lisp function in `simple.el'.
| It is bound to C-x C-x.
| (exchange-point-and-mark &optional arg)
|
| Put the mark where point is now, and point where the mark is now.
| This command works even when the mark is not active,
| and it reactivates the mark.
| With prefix arg, `transient-mark-mode' is enabled temporarily.
|
| [back]
`----
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
[not found] <mailman.7100.1242253215.31690.help-gnu-emacs@gnu.org>
@ 2009-05-14 4:59 ` Barry Margolin
2009-05-14 8:24 ` Andreas Röhler
2009-05-15 1:46 ` Barry Margolin
1 sibling, 1 reply; 12+ messages in thread
From: Barry Margolin @ 2009-05-14 4:59 UTC (permalink / raw
To: help-gnu-emacs
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.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
[not found] ` <mailman.7129.1242276989.31690.help-gnu-emacs@gnu.org>
@ 2009-05-14 5:12 ` Barry Margolin
0 siblings, 0 replies; 12+ messages in thread
From: Barry Margolin @ 2009-05-14 5:12 UTC (permalink / raw
To: help-gnu-emacs
In article <mailman.7129.1242276989.31690.help-gnu-emacs@gnu.org>,
Kevin Rodgers <kevin.d.rodgers@gmail.com> wrote:
> Samuel Wales wrote:
> > On Wed, May 13, 2009 at 16:16, Leo <sdl.web@gmail.com> wrote:
> >> C-SPC twice.
> >
> > That, unfortunately, has the side effect of setting mark.
>
> ,----[ C-h k C-x C-x ]
> | C-x C-x runs the command exchange-point-and-mark
> | which is an interactive compiled Lisp function in `simple.el'.
> | It is bound to C-x C-x.
> | (exchange-point-and-mark &optional arg)
> |
> | Put the mark where point is now, and point where the mark is now.
> | This command works even when the mark is not active,
> | and it reactivates the mark.
> | With prefix arg, `transient-mark-mode' is enabled temporarily.
> |
> | [back]
> `----
Perhaps if transient-mark-mode is already enabled, the prefix arg
*should* do what the OP wants, which is to just activate the mark
without moving point.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-14 4:33 ` Samuel Wales
@ 2009-05-14 6:04 ` Andreas Röhler
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Röhler @ 2009-05-14 6:04 UTC (permalink / raw
To: Samuel Wales; +Cc: help-gnu-emacs
Samuel Wales wrote:
> What I want is the existing region.
>
>
>
>
AFAIK editing commands dealing with region quite often
require transient-mark-mode, avoiding unnoticed edits.
Maybe tell what command you want to use.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-14 4:59 ` how to activate region Barry Margolin
@ 2009-05-14 8:24 ` Andreas Röhler
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Röhler @ 2009-05-14 8:24 UTC (permalink / raw
To: Barry Margolin; +Cc: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
[not found] <mailman.7100.1242253215.31690.help-gnu-emacs@gnu.org>
2009-05-14 4:59 ` how to activate region Barry Margolin
@ 2009-05-15 1:46 ` Barry Margolin
2009-05-15 20:16 ` Samuel Wales
1 sibling, 1 reply; 12+ messages in thread
From: Barry Margolin @ 2009-05-15 1:46 UTC (permalink / raw
To: help-gnu-emacs
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.
I just noticed that you said "when transient-mark-mode is off". That
changes my answer.
When transient-mark-mode is off, the commands that require the region
should always succeed as long as you've set the mark. Are you talking
about commands that change their behavior depending on whether the
region is active? Like M-x replace-string, which operates on the region
if it's active, or the rest of the buffer otherwise. That's the point
of this feature of C-x C-x:
With prefix arg, `transient-mark-mode' is enabled temporarily.
So type C-u C-x C-x, then M-x replace-string, and it should do what you
want.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-15 1:46 ` Barry Margolin
@ 2009-05-15 20:16 ` Samuel Wales
2009-05-15 20:43 ` Samuel Wales
0 siblings, 1 reply; 12+ messages in thread
From: Samuel Wales @ 2009-05-15 20:16 UTC (permalink / raw
To: Barry Margolin; +Cc: help-gnu-emacs
I did try the above solutions before posting. They were the most
obvious things to try.
They do not work.
When transient-mark-mode is off, you can temporarily activate it with
c-spc c-spc /and then moving point/. That is not a solution because I
want to convert the /existing/ non-active region into an active one.
Remember that a region is just point and mark. An /active/ region is
different. Some commands require the region to be active.
As I mentioned, c-spc c-spc has the side effect of setting the mark.
You will notice that when you set the mark, point equals mark.
When point equals mark, there is no useful region. Therefore c-x c-x
does nothing useful when you do that.
Suppose I have a region already. Perhaps you are thinking that c-x
c-x will activate it? No, remember that transient-mark-mode is off.
That does not work.
So you see, c-x c-x is useless for making the existing region active,
and c-spc c-spc is useless for making the existing region active.
My original question remains unanswered.
---------------
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.
---------------
Am I mistaken? Was my question answered? It seems to me that there
were a lot of answers to questions that I did not ask. Perhaps we get
a lot of /those/ questions on the list and it seemed like mine was
similar?
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: how to activate region
2009-05-15 20:16 ` Samuel Wales
@ 2009-05-15 20:43 ` Samuel Wales
0 siblings, 0 replies; 12+ messages in thread
From: Samuel Wales @ 2009-05-15 20:43 UTC (permalink / raw
To: help-gnu-emacs
Apologies for the noise. I noticed that the solution was pointed to
in the thread. (Thank you.) Somehow I missed it.
Here is the solution to overload c-x c-x to do what I want. (Although
I would use defadvice if possible.)
;;i would use defadvice, which would be much better, but i don't
;;know how to call the original again with an argument
(setf transient-mark-mode nil)
(substitute-key-definition 'exchange-point-and-mark
'alpha-exchange-point-and-mark
global-map)
(defun alpha-exchange-point-and-mark ()
"same as original, but activate region"
(interactive)
;;why this has to be done twice, i don't know; it fails to
;;exchange when t
(exchange-point-and-mark)
(exchange-point-and-mark t))
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-05-15 20:43 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.7100.1242253215.31690.help-gnu-emacs@gnu.org>
2009-05-14 4:59 ` how to activate region Barry Margolin
2009-05-14 8:24 ` Andreas Röhler
2009-05-15 1:46 ` Barry Margolin
2009-05-15 20:16 ` Samuel Wales
2009-05-15 20:43 ` Samuel Wales
2009-05-13 22:19 Samuel Wales
2009-05-13 23:16 ` Leo
2009-05-14 4:32 ` Samuel Wales
2009-05-14 4:33 ` Samuel Wales
2009-05-14 6:04 ` Andreas Röhler
2009-05-14 4:55 ` Kevin Rodgers
[not found] ` <mailman.7129.1242276989.31690.help-gnu-emacs@gnu.org>
2009-05-14 5:12 ` Barry Margolin
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.