aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2005-08-15 14:10:39 +0000
committerKim F. Storm2005-08-15 14:10:39 +0000
commitecd6106722bb32fe7c25879e9ba45223edba9276 (patch)
treef5e6ba1069cba0b365133845160486881e764679
parentfb90e6d951ec31f222a7036b8f0e687e34a92f1c (diff)
downloademacs-ecd6106722bb32fe7c25879e9ba45223edba9276.tar.gz
emacs-ecd6106722bb32fe7c25879e9ba45223edba9276.zip
(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.
-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."
575 575
576;; Current region was started using cua-set-mark. 576;; Current region was started using cua-set-mark.
577(defvar cua--explicit-region-start nil) 577(defvar cua--explicit-region-start nil)
578(make-variable-buffer-local 'cua--explicit-region-start)
578 579
579;; Latest region was started using shifted movement command. 580;; Latest region was started using shifted movement command.
580(defvar cua--last-region-shifted nil) 581(defvar cua--last-region-shifted nil)
@@ -585,6 +586,7 @@ a cons (TYPE . COLOR), then both properties are affected."
585 586
586;; status string for mode line indications 587;; status string for mode line indications
587(defvar cua--status-string nil) 588(defvar cua--status-string nil)
589(make-variable-buffer-local 'cua--status-string)
588 590
589(defvar cua--debug nil) 591(defvar cua--debug nil)
590 592
@@ -759,14 +761,19 @@ Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil."
759 (cons (current-buffer) 761 (cons (current-buffer)
760 (and (consp buffer-undo-list) 762 (and (consp buffer-undo-list)
761 (car buffer-undo-list)))) 763 (car buffer-undo-list))))
762 (cua--deactivate))) 764 (cua--deactivate)
765 (/= start end)))
763 766
764(defun cua-replace-region () 767(defun cua-replace-region ()
765 "Replace the active region with the character you type." 768 "Replace the active region with the character you type."
766 (interactive) 769 (interactive)
767 (cua-delete-region) 770 (let ((not-empty (cua-delete-region)))
768 (unless (eq this-original-command this-command) 771 (unless (eq this-original-command this-command)
769 (cua--fallback))) 772 (let ((overwrite-mode
773 (and overwrite-mode
774 not-empty
775 (not (eq this-original-command 'self-insert-command)))))
776 (cua--fallback)))))
770 777
771(defun cua-copy-region (arg) 778(defun cua-copy-region (arg)
772 "Copy the region to the kill ring. 779 "Copy the region to the kill ring.
@@ -1359,8 +1366,6 @@ the prefix fallback behavior."
1359 :link '(emacs-commentary-link "cua-base.el") 1366 :link '(emacs-commentary-link "cua-base.el")
1360 (setq mark-even-if-inactive t) 1367 (setq mark-even-if-inactive t)
1361 (setq highlight-nonselected-windows nil) 1368 (setq highlight-nonselected-windows nil)
1362 (make-variable-buffer-local 'cua--explicit-region-start)
1363 (make-variable-buffer-local 'cua--status-string)
1364 1369
1365 (unless cua--keymaps-initalized 1370 (unless cua--keymaps-initalized
1366 (cua--init-keymaps) 1371 (cua--init-keymaps)