diff options
Diffstat (limited to 'lisp/emulation')
| -rw-r--r-- | lisp/emulation/cua-base.el | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 51b47b104d0..b39945c7712 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el | |||
| @@ -974,6 +974,13 @@ Extra commands should be added to `cua-movement-commands'") | |||
| 974 | (defvar cua-movement-commands nil | 974 | (defvar cua-movement-commands nil |
| 975 | "User may add additional movement commands to this list.") | 975 | "User may add additional movement commands to this list.") |
| 976 | 976 | ||
| 977 | (defvar cua--preserve-mark-commands | ||
| 978 | '(end-of-buffer beginning-of-buffer) | ||
| 979 | "List of movement commands that move the mark. | ||
| 980 | CUA will preserve the previous mark position if a mark is already | ||
| 981 | active before one of these commands is executed.") | ||
| 982 | |||
| 983 | (defvar cua--undo-push-mark nil) | ||
| 977 | 984 | ||
| 978 | ;;; Scrolling commands which does not signal errors at top/bottom | 985 | ;;; Scrolling commands which does not signal errors at top/bottom |
| 979 | ;;; of buffer at first key-press (instead moves to top/bottom | 986 | ;;; of buffer at first key-press (instead moves to top/bottom |
| @@ -1062,8 +1069,15 @@ If ARG is the atom `-', scroll upward by nearly full screen." | |||
| 1062 | ;; If rectangle is active, expand rectangle in specified direction and ignore the movement. | 1069 | ;; If rectangle is active, expand rectangle in specified direction and ignore the movement. |
| 1063 | (if movement | 1070 | (if movement |
| 1064 | (cond | 1071 | (cond |
| 1065 | ((memq 'shift (event-modifiers (aref (this-single-command-raw-keys) 0))) | 1072 | ((memq 'shift (event-modifiers |
| 1066 | (unless mark-active | 1073 | (aref (if window-system |
| 1074 | (this-single-command-raw-keys) | ||
| 1075 | (this-single-command-keys)) 0))) | ||
| 1076 | (if mark-active | ||
| 1077 | (if (and (memq this-command cua--preserve-mark-commands) | ||
| 1078 | (not inhibit-mark-movement)) | ||
| 1079 | (setq cua--undo-push-mark t | ||
| 1080 | inhibit-mark-movement t)) | ||
| 1067 | (push-mark-command nil t)) | 1081 | (push-mark-command nil t)) |
| 1068 | (setq cua--last-region-shifted t) | 1082 | (setq cua--last-region-shifted t) |
| 1069 | (setq cua--explicit-region-start nil)) | 1083 | (setq cua--explicit-region-start nil)) |
| @@ -1110,6 +1124,9 @@ If ARG is the atom `-', scroll upward by nearly full screen." | |||
| 1110 | (defun cua--post-command-handler () | 1124 | (defun cua--post-command-handler () |
| 1111 | (condition-case nil | 1125 | (condition-case nil |
| 1112 | (progn | 1126 | (progn |
| 1127 | (when cua--undo-push-mark | ||
| 1128 | (setq cua--undo-push-mark nil | ||
| 1129 | inhibit-mark-movement nil)) | ||
| 1113 | (when cua--global-mark-active | 1130 | (when cua--global-mark-active |
| 1114 | (cua--global-mark-post-command)) | 1131 | (cua--global-mark-post-command)) |
| 1115 | (when (fboundp 'cua--rectangle-post-command) | 1132 | (when (fboundp 'cua--rectangle-post-command) |