emacs-devel
[Top][All Lists]
Advanced

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

Patch: Respect CUA enter behavior in org-mode and `enriched-mode'.


From: David Reitter
Subject: Patch: Respect CUA enter behavior in org-mode and `enriched-mode'.
Date: Wed, 24 Jul 2013 18:07:15 -0400

In `enriched-mode' and `org-mode', the `enter' key behaves inconsistently when 
there is an active region and CUA is on.

In CUA mode and default configuration, I expect buffer-changing inputs to 
replace the region.  Enter typically does that, except in some modes.  

The patch below addresses that.  I see no good, cost-effective way to deal with 
this in a more general way.
The `cua-replace-region' calls the original command, so it should preserve 
mode-specific functionality.


commit eed580949ab7b33d2c9cba288629c4605fde9c13
Author: David Reitter <address@hidden>
Date:   Wed Jul 24 17:58:05 2013 -0400

    cua--region-keymap: remap additional enter key function as to respect 
`overwrite-mode'
    remap `org-return' (used by `org-mode) and
    `reindent-then-newline-and-indent' (used by `enriched-mode') to facilitate
    replacing the region in `cua-mode' (see also `override-mode').

diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 6de278f..2500274 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -1463,6 +1463,8 @@ If ARG is the atom `-', scroll upward by nearly full 
screen."
   (define-key cua--region-keymap [remap insert-register]       
'cua-replace-region)
   (define-key cua--region-keymap [remap newline-and-indent]    
'cua-replace-region)
   (define-key cua--region-keymap [remap newline]               
'cua-replace-region)
+  (define-key cua--region-keymap [remap reindent-then-newline-and-indent] 
'cua-replace-region)
+  (define-key cua--region-keymap [remap org-return]            
'cua-replace-region)
   (define-key cua--region-keymap [remap open-line]             
'cua-replace-region)
   ;; delete current region
   (define-key cua--region-keymap [remap delete-backward-char]  
'cua-delete-region)




reply via email to

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