[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11221: cua-mode activates the mark for shifted bindings
From: |
Stefan Monnier |
Subject: |
bug#11221: cua-mode activates the mark for shifted bindings |
Date: |
Thu, 12 Apr 2012 14:53:23 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) |
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)