X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ed7f1a6c5caaf4159125c08db5d18c5471fdd032..4ed1626da6e9f060129808273b7b94e3d4f69dc9:/lisp/emulation/cua-base.el diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index b643d521ad..6b9ae35141 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -1,6 +1,6 @@ ;;; cua-base.el --- emulate CUA key bindings -;; Copyright (C) 1997-2011 Free Software Foundation, Inc. +;; Copyright (C) 1997-2012 Free Software Foundation, Inc. ;; Author: Kim F. Storm ;; Keywords: keyboard emulations convenience cua @@ -84,7 +84,7 @@ ;; If you have just replaced a highlighted region with typed text, ;; you can repeat the replace with M-v. This will search forward -;; for a streach of text identical to the previous contents of the +;; for a stretch of text identical to the previous contents of the ;; region (i.e. the contents of register 0) and replace it with the ;; text you typed to replace the original region. Repeating M-v will ;; replace the next matching region and so on. @@ -116,7 +116,7 @@ ;; CUA register support ;; -------------------- -;; Emacs' standard register support is also based on a separate set of +;; Emacs's standard register support is also based on a separate set of ;; "register commands". ;; ;; CUA's register support is activated by providing a numeric @@ -134,7 +134,7 @@ ;; CUA rectangle support ;; --------------------- -;; Emacs' normal rectangle support is based on interpreting the region +;; Emacs's normal rectangle support is based on interpreting the region ;; between the mark and point as a "virtual rectangle", and using a ;; completely separate set of "rectangle commands" [C-x r ...] on the ;; region to copy, kill, fill a.s.o. the virtual rectangle. @@ -368,7 +368,7 @@ interpreted as a register number." (defcustom cua-check-pending-input t "If non-nil, don't override prefix key if input pending. -It is rumoured that `input-pending-p' is unreliable under some window +It is rumored that `input-pending-p' is unreliable under some window managers, so try setting this to nil, if prefix override doesn't work." :type 'boolean :group 'cua) @@ -463,7 +463,7 @@ Must be set prior to enabling CUA." (defface cua-global-mark '((((min-colors 88)(class color)) :foreground "black" :background "yellow1") (((class color)) :foreground "black" :background "yellow") - (t :bold t)) + (t :weight bold)) "Font used by CUA for highlighting the global mark." :group 'cua) @@ -1002,15 +1002,21 @@ behavior, see `cua-paste-pop-rotate-temporarily'." (setq this-command 'cua-paste-pop)))) (defun cua-exchange-point-and-mark (arg) - "Exchanges point and mark, but don't activate the mark. -Activates the mark if a prefix argument is given." + "Exchange point and mark. +Don't activate the mark if `cua-enable-cua-keys' is non-nil. +Otherwise, just activate the mark if a prefix ARG is given. + +See also `exchange-point-and-mark'." (interactive "P") - (if arg - (setq mark-active t) - (let (mark-active) - (exchange-point-and-mark) - (if cua--rectangle - (cua--rectangle-corner 0))))) + (cond ((null cua-enable-cua-keys) + (exchange-point-and-mark arg)) + (arg + (setq mark-active t)) + (t + (let (mark-active) + (exchange-point-and-mark) + (if cua--rectangle + (cua--rectangle-corner 0)))))) ;; Typed text that replaced the highlighted region. (defvar cua--repeat-replace-text nil) @@ -1121,7 +1127,7 @@ With a double \\[universal-argument] prefix argument, unconditionally set mark." (pop-to-mark-command))) ((and cua-toggle-set-mark mark-active) (cua--deactivate) - (message "Mark Cleared")) + (message "Mark cleared")) (t (push-mark-command nil nil) (setq cua--explicit-region-start t) @@ -1242,26 +1248,11 @@ If ARG is the atom `-', scroll upward by nearly full screen." ;; 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 + ;; If region is active, region is canceled 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 window-system - ;; Shortcut for window-system, assuming that input-decode-map is empty. - (memq 'shift (event-modifiers - (aref (this-single-command-raw-keys) 0))) - (or - ;; Check if the final key-sequence was shifted. - (memq 'shift (event-modifiers - (aref (this-single-command-keys) 0))) - ;; If not, maybe the raw key-sequence was mapped by input-decode-map - ;; to a shifted key (and then mapped down to its unshifted form). - (let* ((keys (this-single-command-raw-keys)) - (ev (lookup-key input-decode-map keys))) - (or (and (vector ev) (memq 'shift (event-modifiers (aref ev 0)))) - ;; Or maybe, the raw key-sequence was not an escape sequence - ;; and was shifted (and then mapped down to its unshifted form). - (memq 'shift (event-modifiers (aref keys 0))))))) + (this-command-keys-shift-translated (unless mark-active (push-mark-command nil t)) (setq cua--last-region-shifted t) @@ -1478,6 +1469,7 @@ If ARG is the atom `-', scroll upward by nearly full screen." (define-key cua--region-keymap [remap backward-delete-char] 'cua-delete-region) (define-key cua--region-keymap [remap backward-delete-char-untabify] 'cua-delete-region) (define-key cua--region-keymap [remap delete-char] 'cua-delete-region) + (define-key cua--region-keymap [remap delete-forward-char] 'cua-delete-region) ;; kill region (define-key cua--region-keymap [remap kill-region] 'cua-cut-region) (define-key cua--region-keymap [remap clipboard-kill-region] 'cua-cut-region) @@ -1531,16 +1523,17 @@ If ARG is the atom `-', scroll upward by nearly full screen." ;;;###autoload (define-minor-mode cua-mode - "Toggle CUA key-binding mode. -When enabled, using shifted movement keys will activate the -region (and highlight the region using `transient-mark-mode'), -and typed text replaces the active selection. - -Also when enabled, you can use C-z, C-x, C-c, and C-v to undo, -cut, copy, and paste in addition to the normal Emacs bindings. -The C-x and C-c keys only do cut and copy when the region is -active, so in most cases, they do not conflict with the normal -function of these prefix keys. + "Toggle Common User Access style editing (CUA mode). +With a prefix argument ARG, enable CUA mode if ARG is positive, +and disable it otherwise. If called from Lisp, enable the mode +if ARG is omitted or nil. + +CUA mode is a global minor mode. When enabled, typed text +replaces the active selection, and you can use C-z, C-x, C-c, and +C-v to undo, cut, copy, and paste in addition to the normal Emacs +bindings. The C-x and C-c keys only do cut and copy when the +region is active, so in most cases, they do not conflict with the +normal function of these prefix keys. If you really need to perform a command which starts with one of the prefix keys even when the region is active, you have three