(cua--pre-command-handler-1):
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 15 Nov 2007 16:36:03 +0000 (16:36 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 15 Nov 2007 16:36:03 +0000 (16:36 +0000)
Use input-decode-map instead of function-key-map.
Use event-modifiers now that it works reliably.

lisp/ChangeLog
lisp/emulation/cua-base.el

index a88e4fe..82c3b38 100644 (file)
@@ -1,5 +1,9 @@
 2007-11-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * emulation/cua-base.el (cua--pre-command-handler-1):
+       Use input-decode-map instead of function-key-map.
+       Use event-modifiers now that it works reliably.
+
        * vc.el (vc-diff-internal): Pop-to-buffer later.
 
        * subr.el (event-modifiers): Use internal-event-symbol-parse-modifiers.
index fbb39ee..c720a78 100644 (file)
@@ -1225,22 +1225,26 @@ If ARG is the atom `-', scroll upward by nearly full screen."
 
    ;; Handle shifted cursor keys and other movement commands.
    ;; If region is not active, region is activated if key is shifted.
-   ;; If region is active, region is cancelled if key is unshifted (and region not started with C-SPC).
-   ;; If rectangle is active, expand rectangle in specified direction and ignore the movement.
+   ;; If region is active, region is cancelled if key is unshifted
+   ;;   (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)))
-       ;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home.
-       (and (boundp 'local-function-key-map)
-           local-function-key-map
-           (let ((ev (lookup-key local-function-key-map
-                                 (this-single-command-raw-keys))))
-             (and (vector ev)
-                  (symbolp (setq ev (aref ev 0)))
-                  (string-match "S-" (symbol-name ev)))))))
+       ;; 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)))))))
     (unless mark-active
       (push-mark-command nil t))
     (setq cua--last-region-shifted t)