all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Possible bug in cua-mode: deactivates region
@ 2008-11-24 15:19 Teemu Likonen
  2008-11-24 18:13 ` Teemu Likonen
  0 siblings, 1 reply; 2+ messages in thread
From: Teemu Likonen @ 2008-11-24 15:19 UTC (permalink / raw)
  To: emacs-devel

I noticed that in cua-mode the cursor-moving commands deactivate the
region when it is selected with M-h (mark-paragraph) in
transient-mark-mode.

I like to use cua-mode only for its rectangle support so I have set
cua-enable-cua-keys to nil. Still the normal region (selected with M-h)
is deactivated when I move the cursor. It has something to do with CUA
property since I managed to fix the issue with the following 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))))

In other words, by setting the CUA property to nil for these commands
the region is not deactivated anymore. I'm quite a beginner with Emacs
so I don't know if this is a bug or just a result from something I don't
understand. I'd like to hear comments about this behavior.

(As a side note, I feel that it would be more logical if cua-mode's
rectangle support was a completely separate mode, like rectangle-mode,
and only Common User Access bindings were in the cua-mode.)




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

* Re: Possible bug in cua-mode: deactivates region
  2008-11-24 15:19 Possible bug in cua-mode: deactivates region Teemu Likonen
@ 2008-11-24 18:13 ` Teemu Likonen
  0 siblings, 0 replies; 2+ messages in thread
From: Teemu Likonen @ 2008-11-24 18:13 UTC (permalink / raw)
  To: emacs-devel

Teemu Likonen (2008-11-24 17:19 +0200) wrote:

> I like to use cua-mode only for its rectangle support so I have set
> cua-enable-cua-keys to nil. Still the normal region (selected with
> M-h) is deactivated when I move the cursor. It has something to do
> with CUA property since I managed to fix the issue with the following
> hook:

> In other words, by setting the CUA property to nil for these commands
> the region is not deactivated anymore.

Perhaps the following change would prevent cua-mode from changing these
properties when cua-enable-cua-keys is nil.


diff --git i/lisp/emulation/cua-base.el w/lisp/emulation/cua-base.el
index 8a366a2..b40497d 100644
--- i/lisp/emulation/cua-base.el
+++ w/lisp/emulation/cua-base.el
@@ -1150,8 +1150,10 @@ If ARG is the atom `-', scroll downward by nearly full screen."
 	(scroll-up arg)
       (end-of-buffer (goto-char (point-max)))))))
 
+(when cua-enable-cua-keys
 (put 'cua-scroll-up 'CUA 'move)
 (put 'cua-scroll-up 'isearch-scroll t)
+)
 
 (defun cua-scroll-down (&optional arg)
   "Scroll text of current window downward ARG lines; or near full screen if no ARG.
@@ -1171,8 +1173,10 @@ If ARG is the atom `-', scroll upward by nearly full screen."
 	(scroll-down arg)
       (beginning-of-buffer (goto-char (point-min)))))))
 
+(when cua-enable-cua-keys
 (put 'cua-scroll-down 'CUA 'move)
 (put 'cua-scroll-down 'isearch-scroll t)
+)
 
 ;;; Cursor indications
 
@@ -1490,6 +1494,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
 
 ;; Setup standard movement commands to be recognized by CUA.
 
+(when cua-enable-cua-keys
 (dolist (cmd
  '(forward-char backward-char
    next-line previous-line
@@ -1505,6 +1510,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
    forward-sentence backward-sentence
    forward-paragraph backward-paragraph))
   (put cmd 'CUA 'move))
+)
 
 ;; State prior to enabling cua-mode
 ;; Value is a list with the following elements:




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

end of thread, other threads:[~2008-11-24 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 15:19 Possible bug in cua-mode: deactivates region Teemu Likonen
2008-11-24 18:13 ` Teemu Likonen

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.