all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch: Respect CUA enter behavior in org-mode and `enriched-mode'.
@ 2013-07-24 22:07 David Reitter
  0 siblings, 0 replies; only message in thread
From: David Reitter @ 2013-07-24 22:07 UTC (permalink / raw
  To: emacs-devel@gnu.org developers

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 <david.reitter@gmail.com>
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)




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-24 22:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-24 22:07 Patch: Respect CUA enter behavior in org-mode and `enriched-mode' David Reitter

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.