comparison lisp/emulation/cua-base.el @ 64989:6b11882571cb

(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.
author Kim F. Storm <storm@cua.dk>
date Mon, 15 Aug 2005 14:10:39 +0000
parents 34bd8e434dd7
children 01f4ad04e6ac 532e0a9335a9 2d92f5c9d6ae
comparison
equal deleted inserted replaced
64988:94244c068735 64989:6b11882571cb
573 573
574 ;;; Aux. variables 574 ;;; Aux. variables
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)
581 582
582 ;; buffer + point prior to current command when rectangle is active 583 ;; buffer + point prior to current command when rectangle is active
583 ;; checked in post-command hook to see if point was moved 584 ;; checked in post-command hook to see if point was moved
584 (defvar cua--buffer-and-point-before-command nil) 585 (defvar cua--buffer-and-point-before-command nil)
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
591 593
592 ;;; Prefix key override mechanism 594 ;;; Prefix key override mechanism
757 (delete-region start end) 759 (delete-region start end)
758 (setq cua--last-deleted-region-pos 760 (setq cua--last-deleted-region-pos
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.
773 With numeric prefix arg, copy to register 0-9 instead." 780 With numeric prefix arg, copy to register 0-9 instead."
774 (interactive "P") 781 (interactive "P")
1357 :set-after '(cua-enable-modeline-indications cua-use-hyper-key) 1364 :set-after '(cua-enable-modeline-indications cua-use-hyper-key)
1358 :require 'cua-base 1365 :require 'cua-base
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)
1367 (setq cua--keymaps-initalized t)) 1372 (setq cua--keymaps-initalized t))
1368 1373