Variable: cua-mode
cua-mode is a customizable variable defined in cua-base.el.gz.
Value
nil
Documentation
Non-nil if Cua mode is enabled.
See the cua-mode(var)/cua-mode(fun) command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node (emacs)Easy Customization)
or call the function cua-mode(var)/cua-mode(fun).
Probably introduced at or before Emacs version 22.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emulation/cua-base.el.gz
;;;###autoload
(define-minor-mode cua-mode
"Toggle Common User Access style editing (CUA mode).
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
options:
- press the prefix key twice very quickly (within 0.2 seconds),
- press the prefix key and the following key within 0.2 seconds, or
- use the SHIFT key with the prefix key, i.e. C-S-x or C-S-c.
You can customize `cua-enable-cua-keys' to completely disable the
CUA bindings, or `cua-prefix-override-inhibit-delay' to change
the prefix fallback behavior."
:global t
:set-after '(cua-enable-modeline-indications
cua-remap-control-v cua-remap-control-z
cua-rectangle-mark-key cua-rectangle-modifier-key)
:link '(emacs-commentary-link "cua-base.el")
(setq mark-even-if-inactive t)
(setq highlight-nonselected-windows nil)
(unless cua--keymaps-initialized
(cua--init-keymaps)
(setq cua--keymaps-initialized t))
(if cua-mode
(progn
(add-hook 'pre-command-hook #'cua--pre-command-handler)
(add-hook 'post-command-hook #'cua--post-command-handler)
(if (and cua-enable-modeline-indications (not (assoc 'cua-mode minor-mode-alist)))
(setq minor-mode-alist (cons '(cua-mode cua--status-string) minor-mode-alist)))
(if cua-enable-cursor-indications
(cua--update-indications)))
(remove-hook 'pre-command-hook #'cua--pre-command-handler)
(remove-hook 'post-command-hook #'cua--post-command-handler))
(if (not cua-mode)
(setq emulation-mode-map-alists
(delq 'cua--keymap-alist emulation-mode-map-alists))
(add-to-ordered-list 'emulation-mode-map-alists 'cua--keymap-alist 400)
(cua--select-keymaps))
(cond
(cua-mode
(unless cua--saved-state
(setq cua--saved-state
(list
(and (boundp 'delete-selection-mode) delete-selection-mode))))
(if cua-delete-selection
(delete-selection-mode 1)
(if (and (boundp 'delete-selection-mode) delete-selection-mode)
(delete-selection-mode -1)))
(if cua-highlight-region-shift-only (transient-mark-mode -1))
(if cua-delete-copy-to-register-0
(setq delete-selection-save-to-register ?0))
(cua--deactivate))
(cua--saved-state
(if (nth 0 cua--saved-state)
(delete-selection-mode 1)
(if (and (boundp 'delete-selection-mode) delete-selection-mode)
(delete-selection-mode -1)))
(if (called-interactively-p 'interactive)
(message "CUA mode disabled.%s"
(if (nth 0 cua--saved-state) " Delete-Selection enabled" "")))
(setq cua--saved-state nil))))