mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-24 10:38:38 +00:00
(cua-mode): Use define-minor-mode.
(cua-global-mark-face): Fix face format.
This commit is contained in:
parent
eb81f2758f
commit
80d9508acf
@ -1,5 +1,12 @@
|
|||||||
2003-04-18 Stefan Monnier <monnier@cs.yale.edu>
|
2003-04-18 Stefan Monnier <monnier@cs.yale.edu>
|
||||||
|
|
||||||
|
* emulation/cua-base.el (cua-mode): Use define-minor-mode.
|
||||||
|
(cua-global-mark-face): Fix face format.
|
||||||
|
|
||||||
|
* emacs-lisp/easy-mmode.el (define-minor-mode): Only echo a message
|
||||||
|
if the body didn't do so already.
|
||||||
|
(easy-mmode-define-keymap): Remove unused var `suppress'.
|
||||||
|
|
||||||
* view.el (view-read-only): Move to files.el.
|
* view.el (view-read-only): Move to files.el.
|
||||||
* files.el (view-read-only): Move from view.el.
|
* files.el (view-read-only): Move from view.el.
|
||||||
|
|
||||||
|
@ -260,29 +260,6 @@
|
|||||||
:link '(emacs-commentary-link :tag "Commentary" "cua-base.el")
|
:link '(emacs-commentary-link :tag "Commentary" "cua-base.el")
|
||||||
:link '(emacs-library-link :tag "Lisp File" "cua-base.el"))
|
:link '(emacs-library-link :tag "Lisp File" "cua-base.el"))
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defcustom cua-mode nil
|
|
||||||
"Non-nil means that CUA emulation mode is enabled.
|
|
||||||
In CUA mode, shifted movement keys highlight and extend the region.
|
|
||||||
When a region is highlighted, the binding of the C-x and C-c keys are
|
|
||||||
temporarily changed to work as Motif, MAC or MS-Windows cut and paste.
|
|
||||||
Also, insertion commands first delete the region and then insert.
|
|
||||||
This mode enables Transient Mark mode and it provides a superset of the
|
|
||||||
PC Selection Mode and Delete Selection Modes.
|
|
||||||
|
|
||||||
Setting this variable directly does not take effect;
|
|
||||||
use either \\[customize] or the function `cua-mode'."
|
|
||||||
:set (lambda (symbol value)
|
|
||||||
(cua-mode (or value 0)))
|
|
||||||
:initialize 'custom-initialize-default
|
|
||||||
:set-after '(cua-enable-modeline-indications cua-use-hyper-key)
|
|
||||||
:require 'cua-base
|
|
||||||
:link '(emacs-commentary-link "cua-base.el")
|
|
||||||
:version "21.4"
|
|
||||||
:type 'boolean
|
|
||||||
:group 'cua)
|
|
||||||
|
|
||||||
|
|
||||||
(defcustom cua-enable-cua-keys t
|
(defcustom cua-enable-cua-keys t
|
||||||
"*Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste.
|
"*Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste.
|
||||||
If the value is t, these mappings are always enabled. If the value is
|
If the value is t, these mappings are always enabled. If the value is
|
||||||
@ -405,9 +382,9 @@ Can be toggled by [M-p] while the rectangle is active,"
|
|||||||
:group 'cua)
|
:group 'cua)
|
||||||
|
|
||||||
(defface cua-global-mark-face '((((class color))
|
(defface cua-global-mark-face '((((class color))
|
||||||
(:foreground "black")
|
:foreground "black"
|
||||||
(:background "yellow"))
|
:background "yellow")
|
||||||
(t (:bold t)))
|
(t :bold t))
|
||||||
"*Font used by CUA for highlighting the global mark."
|
"*Font used by CUA for highlighting the global mark."
|
||||||
:group 'cua)
|
:group 'cua)
|
||||||
|
|
||||||
@ -1181,19 +1158,17 @@ Extra commands should be added to `cua-movement-commands'")
|
|||||||
(defvar cua--saved-state nil)
|
(defvar cua--saved-state nil)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun cua-mode (&optional arg)
|
(define-minor-mode cua-mode
|
||||||
"Toggle CUA key-binding mode.
|
"Toggle CUA key-binding mode.
|
||||||
When enabled, using shifted movement keys will activate the region (and
|
When enabled, using shifted movement keys will activate the region (and
|
||||||
highlight the region using `transient-mark-mode'), and typed text replaces
|
highlight the region using `transient-mark-mode'), and typed text replaces
|
||||||
the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and
|
the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and
|
||||||
paste (in addition to the normal emacs bindings)."
|
paste (in addition to the normal emacs bindings)."
|
||||||
(interactive "P")
|
:global t
|
||||||
(setq cua-mode
|
:set-after '(cua-enable-modeline-indications cua-use-hyper-key)
|
||||||
(cond
|
:require 'cua-base
|
||||||
((null arg) (not cua-mode))
|
:link '(emacs-commentary-link "cua-base.el")
|
||||||
((symbolp arg) t)
|
:version "21.4"
|
||||||
(t (> (prefix-numeric-value arg) 0))))
|
|
||||||
|
|
||||||
(setq mark-even-if-inactive t)
|
(setq mark-even-if-inactive t)
|
||||||
(setq highlight-nonselected-windows nil)
|
(setq highlight-nonselected-windows nil)
|
||||||
(make-variable-buffer-local 'cua--explicit-region-start)
|
(make-variable-buffer-local 'cua--explicit-region-start)
|
||||||
@ -1235,9 +1210,7 @@ paste (in addition to the normal emacs bindings)."
|
|||||||
(setq transient-mark-mode (and cua-mode
|
(setq transient-mark-mode (and cua-mode
|
||||||
(if cua-highlight-region-shift-only
|
(if cua-highlight-region-shift-only
|
||||||
(not cua--explicit-region-start)
|
(not cua--explicit-region-start)
|
||||||
t)))
|
t))))
|
||||||
(if (interactive-p)
|
|
||||||
(message "CUA mode enabled")))
|
|
||||||
(cua--saved-state
|
(cua--saved-state
|
||||||
(setq transient-mark-mode (car cua--saved-state))
|
(setq transient-mark-mode (car cua--saved-state))
|
||||||
(if (nth 1 cua--saved-state)
|
(if (nth 1 cua--saved-state)
|
||||||
@ -1250,11 +1223,7 @@ paste (in addition to the normal emacs bindings)."
|
|||||||
(if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "")
|
(if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "")
|
||||||
(if (nth 2 cua--saved-state) " PC-Selection" "")
|
(if (nth 2 cua--saved-state) " PC-Selection" "")
|
||||||
(if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" "")))
|
(if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" "")))
|
||||||
(setq cua--saved-state nil))
|
(setq cua--saved-state nil))))
|
||||||
|
|
||||||
(t
|
|
||||||
(if (interactive-p)
|
|
||||||
(message "CUA mode disabled")))))
|
|
||||||
|
|
||||||
(defun cua-debug ()
|
(defun cua-debug ()
|
||||||
"Toggle cua debugging."
|
"Toggle cua debugging."
|
||||||
|
Loading…
Reference in New Issue
Block a user