emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emulation/cua-base.el,v


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/lisp/emulation/cua-base.el,v
Date: Tue, 05 Sep 2006 20:54:17 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kim F. Storm <kfstorm>  06/09/05 20:54:16

Index: cua-base.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emulation/cua-base.el,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- cua-base.el 14 Jul 2006 22:14:08 -0000      1.72
+++ cua-base.el 5 Sep 2006 20:54:16 -0000       1.73
@@ -1097,20 +1097,46 @@
 ;;; Pre-command hook
 
 (defun cua--pre-command-handler-1 ()
-  (let ((movement (eq (get this-command 'CUA) 'move)))
-
     ;; Cancel prefix key timeout if user enters another key.
     (when cua--prefix-override-timer
       (if (timerp cua--prefix-override-timer)
          (cancel-timer cua--prefix-override-timer))
       (setq cua--prefix-override-timer nil))
 
+  (cond
+   ;; Only symbol commands can have necessary properties
+   ((not (symbolp this-command))
+    nil)
+
+   ;; Handle delete-selection property on non-movement commands
+   ((not (eq (get this-command 'CUA) 'move))
+    (when (and mark-active (not deactivate-mark))
+      (let* ((ds (or (get this-command 'delete-selection)
+                    (get this-command 'pending-delete)))
+            (nc (cond
+                 ((not ds) nil)
+                 ((eq ds 'yank)
+                  'cua-paste)
+                 ((eq ds 'kill)
+                  (if cua--rectangle
+                      'cua-copy-rectangle
+                    'cua-copy-region))
+                 ((eq ds 'supersede)
+                  (if cua--rectangle
+                      'cua-delete-rectangle
+                    'cua-delete-region))
+                 (t
+                  (if cua--rectangle
+                      'cua-delete-rectangle ;; replace?
+                    'cua-replace-region)))))
+       (if nc
+           (setq this-original-command this-command
+                 this-command nc)))))
+
     ;; 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 movement
-       (cond
         ((if window-system
              (memq 'shift (event-modifiers
                            (aref (this-single-command-raw-keys) 0)))
@@ -1129,41 +1155,21 @@
            (push-mark-command nil t))
          (setq cua--last-region-shifted t)
          (setq cua--explicit-region-start nil))
+
+   ;; Set mark if user explicitly said to do so
         ((or cua--explicit-region-start cua--rectangle)
          (unless mark-active
            (push-mark-command nil nil)))
+
+   ;; Else clear mark after this command.
         (t
          ;; If we set mark-active to nil here, the region highlight will not be
          ;; removed by the direct_output_ commands.
          (setq deactivate-mark t)))
 
-      ;; Handle delete-selection property on other commands
-      (if (and mark-active (not deactivate-mark))
-         (let* ((ds (or (get this-command 'delete-selection)
-                        (get this-command 'pending-delete)))
-                (nc (cond
-                     ((not ds) nil)
-                     ((eq ds 'yank)
-                      'cua-paste)
-                     ((eq ds 'kill)
-                      (if cua--rectangle
-                          'cua-copy-rectangle
-                        'cua-copy-region))
-                     ((eq ds 'supersede)
-                      (if cua--rectangle
-                          'cua-delete-rectangle
-                        'cua-delete-region))
-                     (t
-                      (if cua--rectangle
-                          'cua-delete-rectangle ;; replace?
-                        'cua-replace-region)))))
-           (if nc
-               (setq this-original-command this-command
-                     this-command nc)))))
-
     ;; Detect extension of rectangles by mouse or other movement
     (setq cua--buffer-and-point-before-command
-         (if cua--rectangle (cons (current-buffer) (point))))))
+       (if cua--rectangle (cons (current-buffer) (point)))))
 
 (defun cua--pre-command-handler ()
   (when cua-mode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]