* Cua-mode makes active region disappear in transient-mark-mode
@ 2008-11-24 9:24 Teemu Likonen
2008-11-24 13:16 ` Xah Lee
2008-11-24 14:54 ` Teemu Likonen
0 siblings, 2 replies; 4+ messages in thread
From: Teemu Likonen @ 2008-11-24 9:24 UTC (permalink / raw
To: help-gnu-emacs
I like cua-selection-mode for its rectangle support. Still, there is a
serious annoyance to which I haven't found a solution. This affects
region behavior in transient-mark-mode which I also use.
When I select a paragraph with M-h (mark-paragraph) and move the point
the region disappears if cua-mode is switched on. Without cua-mode I can
move the edges of the region and it stays visible. This is the only
reason why I don't keep cua-(selection-)mode on by default. Can I make
cua-mode to not make active region disappear?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Cua-mode makes active region disappear in transient-mark-mode
2008-11-24 9:24 Cua-mode makes active region disappear in transient-mark-mode Teemu Likonen
@ 2008-11-24 13:16 ` Xah Lee
2008-11-24 16:25 ` Allan Gottlieb
2008-11-24 14:54 ` Teemu Likonen
1 sibling, 1 reply; 4+ messages in thread
From: Xah Lee @ 2008-11-24 13:16 UTC (permalink / raw
To: help-gnu-emacs
On Nov 24, 1:24 am, Teemu Likonen <tliko...@iki.fi> wrote:
> I like cua-selection-mode for its rectangle support. Still, there is a
> serious annoyance to which I haven't found a solution. This affects
> region behavior in transient-mark-mode which I also use.
>
> When I select a paragraph with M-h (mark-paragraph) and move the point
> the region disappears if cua-mode is switched on. Without cua-mode I can
> move the edges of the region and it stays visible. This is the only
> reason why I don't keep cua-(selection-)mode on by default. Can I make
> cua-mode to not make active region disappear?
on my machine, with cua-mode on, arrow keys or any cursor moving
commands don't deactivate the region.
i did spend maybe 30 min answering this post... scratched several
times on what i wrote about the var deactivate-mark and modern UI ...
so i got curious... if i started emacs with -q and then it does. So,
something's in my emacs init file did some magic... but i can't think
of any...
O, ok, i think i found it!
;; prevent cua-mode from going into selection mode when commands with
Shift key is used.
(add-hook 'cua-mode-hook
(lambda ()
(put 'cua-scroll-down 'CUA nil)
(put 'cua-scroll-up 'CUA nil)
(put 'backward-paragraph 'CUA nil)
(put 'forward-paragraph 'CUA nil)
(put 'beginning-of-buffer 'CUA nil)
(put 'end-of-buffer 'CUA nil)
(put 'move-end-of-line 'CUA nil)
)
)
from:
• A Ergonomic Keyboard Shortcut Layout For Emacs
http://xahlee.org/emacs/ergonomic_emacs_keybinding.html
... oh wait but the hook doesn't have any cursor moving commands...
note that i also have
(delete-selection-mode t)
but i don't think this matters.
(Note that delete-selection-mode automatically sets transient-mark-
mode to t, however, cua mode does not actually call transient-mark-
mode, but does emulate its behavior in its own implementation, and
actually set transient-mark-mode to t for display purposes)
OK, now i found it for sure.
Basically, if you remap your cursor moving keys, then it won't
deactivate selection.
For example, do a text selection, then type M-x backward-word, you'll
see that your region remains active. Since i have all my cursor moving
shortcuts different from default, so they don't deactivate region for
me. Perhaps cua mode is checking actual keypresses.
Ok, i try this: set the cursor moving commands's property CUA to nil,
like in the above hook.
cua mode is quite complex with respect to elisp coding ...
--------------
... i didn't know what cua rectangle features do, and did read up. It
is very nice. I wonder if it should be a separate package from cua.
(for those don't want to bother looking up, just turn cua-mode on,
then press Ctrl+Enter, then move arrow keys, then see that a real
rectangular highlighting is done, implemented using overlay.)
i've always been using kill-rectangle and string-rectangle for like 10
years. One thing i missed is how to actually copy and paste a column
of text. Never did bother to read the proper manual... and i suppose
now cua mode does it.
Cua mode does support copying/pasting a column of text right?
is it possible to do this with rectangle* commands?
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Cua-mode makes active region disappear in transient-mark-mode
2008-11-24 9:24 Cua-mode makes active region disappear in transient-mark-mode Teemu Likonen
2008-11-24 13:16 ` Xah Lee
@ 2008-11-24 14:54 ` Teemu Likonen
1 sibling, 0 replies; 4+ messages in thread
From: Teemu Likonen @ 2008-11-24 14:54 UTC (permalink / raw
To: help-gnu-emacs
Teemu Likonen (2008-11-24 09:24 +0000) wrote:
> I like cua-selection-mode for its rectangle support. Still, there is a
> serious annoyance to which I haven't found a solution. This affects
> region behavior in transient-mark-mode which I also use.
>
> When I select a paragraph with M-h (mark-paragraph) and move the point
> the region disappears if cua-mode is switched on. Without cua-mode I
> can move the edges of the region and it stays visible. This is the
> only reason why I don't keep cua-(selection-)mode on by default. Can I
> make cua-mode to not make active region disappear?
It turned out that the CUA property of these cursor moving commands
caused the funny things I described above. I fixed it with this hook:
(add-hook 'cua-mode-hook
(lambda ()
(dolist (cmd '(forward-char
backward-char
previous-line
next-line
forward-paragraph
backward-paragraph
beginning-of-buffer
end-of-buffer))
(put cmd 'CUA nil))))
I really think that the rectangle support should be separated from cua
bindings, to something like rectangle-mode or visual-rectangle-mode.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Cua-mode makes active region disappear in transient-mark-mode
2008-11-24 13:16 ` Xah Lee
@ 2008-11-24 16:25 ` Allan Gottlieb
0 siblings, 0 replies; 4+ messages in thread
From: Allan Gottlieb @ 2008-11-24 16:25 UTC (permalink / raw
To: help-gnu-emacs
At Mon, 24 Nov 2008 05:16:02 -0800 (PST) Xah Lee <xahlee@gmail.com> wrote:
> Cua mode does support copying/pasting a column of text right?
>
> is it possible to do this with rectangle* commands?
Sure. kill-rectangle followed by yank rectangle will do a move.
So kill followed by 2 yanks will copy. Or you can use
copy-rectangle-to-register followed by insert-register.
allan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-24 16:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 9:24 Cua-mode makes active region disappear in transient-mark-mode Teemu Likonen
2008-11-24 13:16 ` Xah Lee
2008-11-24 16:25 ` Allan Gottlieb
2008-11-24 14:54 ` Teemu Likonen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).