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

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

Re: cua-mode and long key sequences


From: Kim F. Storm
Subject: Re: cua-mode and long key sequences
Date: Tue, 17 Apr 2007 12:52:10 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

mopi <address@hidden> 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





reply via email to

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