summaryrefslogtreecommitdiff
path: root/lisp/emulation/cua-base.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2005-08-15 14:10:39 +0000
committerKim F. Storm <storm@cua.dk>2005-08-15 14:10:39 +0000
commitecd6106722bb32fe7c25879e9ba45223edba9276 (patch)
treef5e6ba1069cba0b365133845160486881e764679 /lisp/emulation/cua-base.el
parentfb90e6d951ec31f222a7036b8f0e687e34a92f1c (diff)
downloademacs-ecd6106722bb32fe7c25879e9ba45223edba9276.tar.gz
(cua-delete-region): Return t if
deleted region was non-empty. (cua-replace-region): Inhibit overwrite-mode for self-insert-command if replaced region was non-empty. (cua--explicit-region-start, cua--status-string): Make them buffer-local at top-level... (cua-mode): ...rather than when mode is enabled.
Diffstat (limited to 'lisp/emulation/cua-base.el')
-rw-r--r--lisp/emulation/cua-base.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index beb30d500d4..0e60e60b4c4 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -575,6 +575,7 @@ a cons (TYPE . COLOR), then both properties are affected."
;; Current region was started using cua-set-mark.
(defvar cua--explicit-region-start nil)
+(make-variable-buffer-local 'cua--explicit-region-start)
;; Latest region was started using shifted movement command.
(defvar cua--last-region-shifted nil)
@@ -585,6 +586,7 @@ a cons (TYPE . COLOR), then both properties are affected."
;; status string for mode line indications
(defvar cua--status-string nil)
+(make-variable-buffer-local 'cua--status-string)
(defvar cua--debug nil)
@@ -759,14 +761,19 @@ Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil."
(cons (current-buffer)
(and (consp buffer-undo-list)
(car buffer-undo-list))))
- (cua--deactivate)))
+ (cua--deactivate)
+ (/= start end)))
(defun cua-replace-region ()
"Replace the active region with the character you type."
(interactive)
- (cua-delete-region)
- (unless (eq this-original-command this-command)
- (cua--fallback)))
+ (let ((not-empty (cua-delete-region)))
+ (unless (eq this-original-command this-command)
+ (let ((overwrite-mode
+ (and overwrite-mode
+ not-empty
+ (not (eq this-original-command 'self-insert-command)))))
+ (cua--fallback)))))
(defun cua-copy-region (arg)
"Copy the region to the kill ring.
@@ -1359,8 +1366,6 @@ the prefix fallback behavior."
:link '(emacs-commentary-link "cua-base.el")
(setq mark-even-if-inactive t)
(setq highlight-nonselected-windows nil)
- (make-variable-buffer-local 'cua--explicit-region-start)
- (make-variable-buffer-local 'cua--status-string)
(unless cua--keymaps-initalized
(cua--init-keymaps)