GNU bug report logs - #11221
cua-mode activates the mark for shifted bindings

Previous Next

Package: emacs;

Reported by: Brian Tannahill <bjt1230 <at> gmail.com>

Date: Wed, 11 Apr 2012 16:05:01 UTC

Severity: normal

Fixed in version 24.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 11221 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Brian Tannahill <bjt1230 <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 11221 <at> debbugs.gnu.org,
	"Kim F. Storm" <storm <at> cua.dk>
Subject: Re: bug#11221: cua-mode activates the mark for shifted bindings
Date: Thu, 12 Apr 2012 14:53:23 -0400
retitle 11221 cua-mode activates the mark for shifted bindings
thanks

> After working through my .emacs file I found that this problem goes away
> when I turn off cua-mode.

Indeed, I can reproduce it now with:

   emacs -Q
   M-: (global-set-key (kbd "M-J") 'backward-word) RET
   M-x cua-mode RET
 
after which M-J will not only move point but also activate the mark.

> Not sure whether this is actually a bug or if it's the intended behavior.

The shift-select-mode we added in Emacs-23 was careful to get this
right, so I think it's at least a misfeature of cua-mode.
The code in cua--pre-command-handler-1 does not try to catch
this situation, currently.

Kim, WDYT about the patch below, which makes cua-mode use the same
mechanism as shift-select-mode?


        Stefan


=== modified file 'lisp/emulation/cua-base.el'
--- lisp/emulation/cua-base.el	2012-03-10 08:26:45 +0000
+++ lisp/emulation/cua-base.el	2012-04-12 18:50:34 +0000
@@ -1246,22 +1246,7 @@
    ;;   (and region not started with C-SPC).
    ;; If rectangle is active, expand rectangle in specified direction and
    ;;   ignore the movement.
-   ((if window-system
-        ;; Shortcut for window-system, assuming that input-decode-map is empty.
-	(memq 'shift (event-modifiers
-		      (aref (this-single-command-raw-keys) 0)))
-      (or
-       ;; Check if the final key-sequence was shifted.
-       (memq 'shift (event-modifiers
-		     (aref (this-single-command-keys) 0)))
-       ;; If not, maybe the raw key-sequence was mapped by input-decode-map
-       ;; to a shifted key (and then mapped down to its unshifted form).
-       (let* ((keys (this-single-command-raw-keys))
-              (ev (lookup-key input-decode-map keys)))
-         (or (and (vector ev) (memq 'shift (event-modifiers (aref ev 0))))
-             ;; Or maybe, the raw key-sequence was not an escape sequence
-             ;; and was shifted (and then mapped down to its unshifted form).
-             (memq 'shift (event-modifiers (aref keys 0)))))))
+   (this-command-keys-shift-translated
     (unless mark-active
       (push-mark-command nil t))
     (setq cua--last-region-shifted t)





This bug report was last modified 13 years and 135 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.