all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* cua-mode and long key sequences
@ 2007-04-17  8:26 mopi
  2007-04-17  8:45 ` Lennart Borgman (gmail)
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: mopi @ 2007-04-17  8:26 UTC (permalink / raw)
  To: help-gnu-emacs


There is some special cases in cua mode that I want to improve. I'm
sure this has already been solved several times already so I turn to
the Emacs wizards in this group.

Consider the following:
1. Mark a region.
2. Type C-c and press the home button.

What I want to do is copy the region and go to the beginning of the
line. Instead of this Emacs helpfully greets me with "C-c <home> is
undefined". I understand the reason for this but I'm sure it's
possible to make it do what I want.

I have looked in cua.el but it isn't that clear to me what command C-c
sends.

The key sequences I want to modify is
C-c <home>
C-c <end>
C-c <next>
C-c <prior>
C-x <home>
C-x <end>
C-x <next>
C-x <prior>

Any suggestions or pointers to further reading?

Thanks
mopi.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17  8:26 cua-mode and long key sequences mopi
@ 2007-04-17  8:45 ` Lennart Borgman (gmail)
       [not found] ` <mailman.2167.1176799833.7795.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Lennart Borgman (gmail) @ 2007-04-17  8:45 UTC (permalink / raw)
  To: mopi; +Cc: help-gnu-emacs

mopi wrote:
> There is some special cases in cua mode that I want to improve. I'm
> sure this has already been solved several times already so I turn to
> the Emacs wizards in this group.
> 
> Consider the following:
> 1. Mark a region.
> 2. Type C-c and press the home button.
> 
> What I want to do is copy the region and go to the beginning of the
> line. Instead of this Emacs helpfully greets me with "C-c <home> is
> undefined". I understand the reason for this but I'm sure it's
> possible to make it do what I want.


Please try the Emacs 22 beta. It looks to me that CUA mode does what you 
want there.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
       [not found] ` <mailman.2167.1176799833.7795.help-gnu-emacs@gnu.org>
@ 2007-04-17  9:23   ` mopi
  2007-04-17  9:40     ` Lennart Borgman (gmail)
       [not found]     ` <mailman.2171.1176803115.7795.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 16+ messages in thread
From: mopi @ 2007-04-17  9:23 UTC (permalink / raw)
  To: help-gnu-emacs

On 17 Apr, 10:45, "Lennart Borgman (gmail)"
<lennart.borg...@gmail.com> wrote:
> Please try the Emacs 22 beta. It looks to me that CUA mode does what you
> want there.

I'm using the latest (unpatched) cvs version from
http://www.ourcomments.org/cgi-bin/emacsw32-dl-latest.pl. It is dated
20070409 so that is pretty new. Do you think I need an even newer one?

mopi

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17  9:23   ` mopi
@ 2007-04-17  9:40     ` Lennart Borgman (gmail)
       [not found]     ` <mailman.2171.1176803115.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Lennart Borgman (gmail) @ 2007-04-17  9:40 UTC (permalink / raw)
  To: mopi; +Cc: help-gnu-emacs

mopi wrote:
> On 17 Apr, 10:45, "Lennart Borgman (gmail)"
> <lennart.borg...@gmail.com> wrote:
>> Please try the Emacs 22 beta. It looks to me that CUA mode does what you
>> want there.
> 
> I'm using the latest (unpatched) cvs version from
> http://www.ourcomments.org/cgi-bin/emacsw32-dl-latest.pl. It is dated
> 20070409 so that is pretty new. Do you think I need an even newer one?


Eh, no. I myself always use the patched version, but that should not 
matter here.

I guess I am misunderstanding you then. If I press C-c when a region is 
marked and I have cua-mode on (as always) then the highlighting of the 
region disappears. Does not that happen for you?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
       [not found]     ` <mailman.2171.1176803115.7795.help-gnu-emacs@gnu.org>
@ 2007-04-17 10:09       ` mopi
  2007-04-17 10:47         ` Lennart Borgman (gmail)
  2007-04-18  6:23         ` Brian Elmegaard
  0 siblings, 2 replies; 16+ messages in thread
From: mopi @ 2007-04-17 10:09 UTC (permalink / raw)
  To: help-gnu-emacs

On 17 Apr, 11:40, "Lennart Borgman (gmail)"
<lennart.borg...@gmail.com> wrote:
> I guess I am misunderstanding you then. If I press C-c when a region is
> marked and I have cua-mode on (as always) then the highlighting of the
> region disappears. Does not that happen for you?

Well, yes. Sort of.
The region will disappear if I wait a little (very little) and it will
work as expected when I then press the Home key. But if you press the
Home key too fast after you have done C-c Emacs interprets it as a key-
sequence instead of two different commands.

I don't want to slow down my typing but I'm sure there is a way to
redefine what the C-c <home> et al key sequences do.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17 10:09       ` mopi
@ 2007-04-17 10:47         ` Lennart Borgman (gmail)
  2007-04-18  6:23         ` Brian Elmegaard
  1 sibling, 0 replies; 16+ messages in thread
From: Lennart Borgman (gmail) @ 2007-04-17 10:47 UTC (permalink / raw)
  To: mopi; +Cc: help-gnu-emacs

mopi wrote:
> On 17 Apr, 11:40, "Lennart Borgman (gmail)"
> <lennart.borg...@gmail.com> wrote:
>> I guess I am misunderstanding you then. If I press C-c when a region is
>> marked and I have cua-mode on (as always) then the highlighting of the
>> region disappears. Does not that happen for you?
> 
> Well, yes. Sort of.
> The region will disappear if I wait a little (very little) and it will
> work as expected when I then press the Home key. But if you press the
> Home key too fast after you have done C-c Emacs interprets it as a key-
> sequence instead of two different commands.
> 
> I don't want to slow down my typing but I'm sure there is a way to
> redefine what the C-c <home> et al key sequences do.


Wow, I never noticed that! I think there is a timeout you can set in 
cua-mode for this.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17  8:26 cua-mode and long key sequences mopi
  2007-04-17  8:45 ` Lennart Borgman (gmail)
       [not found] ` <mailman.2167.1176799833.7795.help-gnu-emacs@gnu.org>
@ 2007-04-17 10:52 ` Kim F. Storm
       [not found] ` <mailman.2173.1176807452.7795.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 16+ messages in thread
From: Kim F. Storm @ 2007-04-17 10:52 UTC (permalink / raw)
  To: mopi; +Cc: help-gnu-emacs

mopi <52hands@gmail.com> writes:

> There is some special cases in cua mode that I want to improve. I'm
> sure this has already been solved several times already so I turn to
> the Emacs wizards in this group.
>
> Consider the following:
> 1. Mark a region.
> 2. Type C-c and press the home button.
>
> What I want to do is copy the region and go to the beginning of the
> line. Instead of this Emacs helpfully greets me with "C-c <home> is
> undefined". I understand the reason for this but I'm sure it's
> possible to make it do what I want.
>
> I have looked in cua.el but it isn't that clear to me what command C-c
> sends.
>
> The key sequences I want to modify is
> C-c <home>
> C-c <end>
> C-c <next>
> C-c <prior>
> C-x <home>
> C-x <end>
> C-x <next>
> C-x <prior>
>
> Any suggestions or pointers to further reading?

Does this patch give the desired result?


*** cua-base.el	24 Feb 2007 22:51:52 +0100	1.78
--- cua-base.el	17 Apr 2007 12:46:11 +0200	
***************
*** 1429,1443 ****
    (define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler)
  
    (define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler)
-   (define-key cua--prefix-repeat-keymap [(control x) up]    'cua--prefix-cut-handler)
-   (define-key cua--prefix-repeat-keymap [(control x) down]  'cua--prefix-cut-handler)
-   (define-key cua--prefix-repeat-keymap [(control x) left]  'cua--prefix-cut-handler)
-   (define-key cua--prefix-repeat-keymap [(control x) right] 'cua--prefix-cut-handler)
    (define-key cua--prefix-repeat-keymap [(control c) (control c)] 'cua--prefix-repeat-handler)
!   (define-key cua--prefix-repeat-keymap [(control c) up]    'cua--prefix-copy-handler)
!   (define-key cua--prefix-repeat-keymap [(control c) down]  'cua--prefix-copy-handler)
!   (define-key cua--prefix-repeat-keymap [(control c) left]  'cua--prefix-copy-handler)
!   (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler)
  
    ;; Enable shifted fallbacks for C-x and C-c when region is active
    (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
--- 1429,1438 ----
    (define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler)
  
    (define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler)
    (define-key cua--prefix-repeat-keymap [(control c) (control c)] 'cua--prefix-repeat-handler)
!   (dolist (key '(up down left right home end next prior))
!     (define-key cua--prefix-repeat-keymap (vector '(control x) key) 'cua--prefix-cut-handler)
!     (define-key cua--prefix-repeat-keymap (vector '(control c) key) 'cua--prefix-copy-handler))
  
    ;; Enable shifted fallbacks for C-x and C-c when region is active
    (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)

-- 
Kim F. Storm  http://www.cua.dk

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
       [not found] ` <mailman.2173.1176807452.7795.help-gnu-emacs@gnu.org>
@ 2007-04-17 12:47   ` mopi
  2007-04-17 14:39     ` mopi
  2007-04-18  6:17     ` Brian Elmegaard
  0 siblings, 2 replies; 16+ messages in thread
From: mopi @ 2007-04-17 12:47 UTC (permalink / raw)
  To: help-gnu-emacs

On 17 Apr, 12:52, no-s...@cua.dk (Kim F. Storm) wrote:
> mopi <52ha...@gmail.com> writes:
> > There is some special cases in cua mode that I want to improve. I'm
> > sure this has already been solved several times already so I turn to
> > the Emacs wizards in this group.
>
> > Consider the following:
> > 1. Mark a region.
> > 2. Type C-c and press the home button.
>
> > What I want to do is copy the region and go to the beginning of the
> > line. Instead of this Emacs helpfully greets me with "C-c <home> is
> > undefined". I understand the reason for this but I'm sure it's
> > possible to make it do what I want.
>
> > I have looked in cua.el but it isn't that clear to me what command C-c
> > sends.
>
> > The key sequences I want to modify is
> > C-c <home>
> > C-c <end>
> > C-c <next>
> > C-c <prior>
> > C-x <home>
> > C-x <end>
> > C-x <next>
> > C-x <prior>
>
> > Any suggestions or pointers to further reading?
>
> Does this patch give the desired result?
>
> *** cua-base.el 24 Feb 2007 22:51:52 +0100      1.78
> --- cua-base.el 17 Apr 2007 12:46:11 +0200
> ***************
> *** 1429,1443 ****
>     (define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler)
>
>     (define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler)
> -   (define-key cua--prefix-repeat-keymap [(control x) up]    'cua--prefix-cut-handler)
> -   (define-key cua--prefix-repeat-keymap [(control x) down]  'cua--prefix-cut-handler)
> -   (define-key cua--prefix-repeat-keymap [(control x) left]  'cua--prefix-cut-handler)
> -   (define-key cua--prefix-repeat-keymap [(control x) right] 'cua--prefix-cut-handler)
>     (define-key cua--prefix-repeat-keymap [(control c) (control c)] 'cua--prefix-repeat-handler)
> !   (define-key cua--prefix-repeat-keymap [(control c) up]    'cua--prefix-copy-handler)
> !   (define-key cua--prefix-repeat-keymap [(control c) down]  'cua--prefix-copy-handler)
> !   (define-key cua--prefix-repeat-keymap [(control c) left]  'cua--prefix-copy-handler)
> !   (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler)
>
>     ;; Enable shifted fallbacks for C-x and C-c when region is active
>     (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
> --- 1429,1438 ----
>     (define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler)
>
>     (define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler)
>     (define-key cua--prefix-repeat-keymap [(control c) (control c)] 'cua--prefix-repeat-handler)
> !   (dolist (key '(up down left right home end next prior))
> !     (define-key cua--prefix-repeat-keymap (vector '(control x) key) 'cua--prefix-cut-handler)
> !     (define-key cua--prefix-repeat-keymap (vector '(control c) key) 'cua--prefix-copy-handler))
>
>     ;; Enable shifted fallbacks for C-x and C-c when region is active
>     (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
>
> --
> Kim F. Storm  http://www.cua.dk

This solved it (after I byte compiled the patched file)!

Thank you.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17 12:47   ` mopi
@ 2007-04-17 14:39     ` mopi
  2007-04-18  8:54       ` Kim F. Storm
  2007-04-18  6:17     ` Brian Elmegaard
  1 sibling, 1 reply; 16+ messages in thread
From: mopi @ 2007-04-17 14:39 UTC (permalink / raw)
  To: help-gnu-emacs

Kim,
I see that you are the original author of cua-mode. Will this change
make it into the main source tree of emacs?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17 12:47   ` mopi
  2007-04-17 14:39     ` mopi
@ 2007-04-18  6:17     ` Brian Elmegaard
  2007-04-18  9:58       ` Peter Dyballa
       [not found]       ` <mailman.2207.1176890622.7795.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 16+ messages in thread
From: Brian Elmegaard @ 2007-04-18  6:17 UTC (permalink / raw)
  To: help-gnu-emacs

mopi <52hands@gmail.com> writes:

>> Does this patch give the desired result?

Is there an easy way to include this (cvs-diff output?) as a patch? 
-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17 10:09       ` mopi
  2007-04-17 10:47         ` Lennart Borgman (gmail)
@ 2007-04-18  6:23         ` Brian Elmegaard
  2007-04-18  8:57           ` Kim F. Storm
       [not found]           ` <mailman.2203.1176886979.7795.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 16+ messages in thread
From: Brian Elmegaard @ 2007-04-18  6:23 UTC (permalink / raw)
  To: help-gnu-emacs

mopi <52hands@gmail.com> writes:

> I don't want to slow down my typing but I'm sure there is a way to
> redefine what the C-c <home> et al key sequences do.

You must be extremely fast moving from c to <home> :-) 

To me it is the other way around. If I am too slow so cua-mode reads
C-c pause <home> as C-c <home> 
whereas 
C-c <home> is copy-region-as-kill goto-char 1

-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-17 14:39     ` mopi
@ 2007-04-18  8:54       ` Kim F. Storm
  0 siblings, 0 replies; 16+ messages in thread
From: Kim F. Storm @ 2007-04-18  8:54 UTC (permalink / raw)
  To: mopi; +Cc: help-gnu-emacs

mopi <52hands@gmail.com> writes:

> Kim,
> I see that you are the original author of cua-mode. Will this change
> make it into the main source tree of emacs?

It is too late for Emacs 22.1 - 

I will reconsider the change for Emacs 22.2 / 23.1

-- 
Kim F. Storm  http://www.cua.dk

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-18  6:23         ` Brian Elmegaard
@ 2007-04-18  8:57           ` Kim F. Storm
       [not found]           ` <mailman.2203.1176886979.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Kim F. Storm @ 2007-04-18  8:57 UTC (permalink / raw)
  To: Brian Elmegaard; +Cc: help-gnu-emacs

Brian Elmegaard <brian@rkspeed-rugby.dk> writes:

> mopi <52hands@gmail.com> writes:
>
>> I don't want to slow down my typing but I'm sure there is a way to
>> redefine what the C-c <home> et al key sequences do.
>
> You must be extremely fast moving from c to <home> :-) 
>
> To me it is the other way around. If I am too slow so cua-mode reads
> C-c pause <home> as C-c <home> 
> whereas 
> C-c <home> is copy-region-as-kill goto-char 1

That's odd.

Is that only for C-c home, and it is with or without the patch?

Is this with Emacs 22?  On which platform?


Does is also happen with

emacs -Q
M-x cua-mode RET

Otherwise, you hve made some local customization to 
cause that behaviour.  If so -- which ?

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
  2007-04-18  6:17     ` Brian Elmegaard
@ 2007-04-18  9:58       ` Peter Dyballa
       [not found]       ` <mailman.2207.1176890622.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Peter Dyballa @ 2007-04-18  9:58 UTC (permalink / raw)
  To: Brian Elmegaard; +Cc: emacs List


Am 18.04.2007 um 08:17 schrieb Brian Elmegaard:

> Is there an easy way to include this (cvs-diff output?) as a patch?

Create in GNU Emacs a file in emacs/lisp, let's call it cua.patch,  
and keep it open in buffer. The Diff menu invites you to "Apply  
hunk." At least in CVS versions. You can delete the patch file now.

Then byte-compile the patched ELisp file or make a new bootstrap and  
install.

--
Greetings

   Pete

Time is an illusion. Lunchtime, doubly so.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
       [not found]       ` <mailman.2207.1176890622.7795.help-gnu-emacs@gnu.org>
@ 2007-04-18 10:44         ` Brian Elmegaard
  0 siblings, 0 replies; 16+ messages in thread
From: Brian Elmegaard @ 2007-04-18 10:44 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Create in GNU Emacs a file in emacs/lisp, let's call it cua.patch,
> and keep it open in buffer. The Diff menu invites you to "Apply
> hunk." At least in CVS versions. You can delete the patch file now.

Thanks.

-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cua-mode and long key sequences
       [not found]           ` <mailman.2203.1176886979.7795.help-gnu-emacs@gnu.org>
@ 2007-04-18 10:50             ` Brian Elmegaard
  0 siblings, 0 replies; 16+ messages in thread
From: Brian Elmegaard @ 2007-04-18 10:50 UTC (permalink / raw)
  To: help-gnu-emacs

storm@cua.dk (Kim F. Storm) writes:

> That's odd.

Yes, I see now. I don't really know what happened and I can't do it
again. My reply to mopi is just wrong. 

In fact I don't see the behaviour mopi describes at all.
C-c copies when I have marked a region. C-S-c is a prefix. 

My emacs is:
This is GNU Emacs 22.0.92.1 (i386-mingw-nt5.1.2600)
 of 2007-01-12 on LENNART-69DE564 (patched)

Regards and sorry for the confusion.
-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-04-18 10:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-17  8:26 cua-mode and long key sequences mopi
2007-04-17  8:45 ` Lennart Borgman (gmail)
     [not found] ` <mailman.2167.1176799833.7795.help-gnu-emacs@gnu.org>
2007-04-17  9:23   ` mopi
2007-04-17  9:40     ` Lennart Borgman (gmail)
     [not found]     ` <mailman.2171.1176803115.7795.help-gnu-emacs@gnu.org>
2007-04-17 10:09       ` mopi
2007-04-17 10:47         ` Lennart Borgman (gmail)
2007-04-18  6:23         ` Brian Elmegaard
2007-04-18  8:57           ` Kim F. Storm
     [not found]           ` <mailman.2203.1176886979.7795.help-gnu-emacs@gnu.org>
2007-04-18 10:50             ` Brian Elmegaard
2007-04-17 10:52 ` Kim F. Storm
     [not found] ` <mailman.2173.1176807452.7795.help-gnu-emacs@gnu.org>
2007-04-17 12:47   ` mopi
2007-04-17 14:39     ` mopi
2007-04-18  8:54       ` Kim F. Storm
2007-04-18  6:17     ` Brian Elmegaard
2007-04-18  9:58       ` Peter Dyballa
     [not found]       ` <mailman.2207.1176890622.7795.help-gnu-emacs@gnu.org>
2007-04-18 10:44         ` Brian Elmegaard

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.