aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2005-02-07 11:44:40 +0000
committerKim F. Storm2005-02-07 11:44:40 +0000
commit4905133fd709e6d349d2c1fa331a6015a134520b (patch)
treea860338e1f662b70d4d1f53d1ddc64a12c226cea
parent82ec225b4080074f7aab9fec10c86b2864cc58fe (diff)
downloademacs-4905133fd709e6d349d2c1fa331a6015a134520b.tar.gz
emacs-4905133fd709e6d349d2c1fa331a6015a134520b.zip
(cua-max-undo, cua-undo): Remove.
(cua--standard-movement-commands): Remove list. Instead, set CUA property value to move for movement commands. (cua-movement-commands): Remove. Users must set CUA prop instead. (cua--pre-command-handler): Check CUA property. (cua--init-keymaps): Don't remap undo commands. (cua-mode): Don't call cua--rectangle-on-off.
-rw-r--r--lisp/emulation/cua-base.el58
1 files changed, 20 insertions, 38 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 24adae30040..fd550eb3c0b 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -1,6 +1,6 @@
1;;; cua-base.el --- emulate CUA key bindings 1;;; cua-base.el --- emulate CUA key bindings
2 2
3;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 3;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Kim F. Storm <storm@cua.dk> 6;; Author: Kim F. Storm <storm@cua.dk>
@@ -392,11 +392,6 @@ and after the region marked by the rectangle to search."
392 "*Font used by CUA for highlighting the non-selected rectangle lines." 392 "*Font used by CUA for highlighting the non-selected rectangle lines."
393 :group 'cua) 393 :group 'cua)
394 394
395(defcustom cua-undo-max 64
396 "*Max no of undoable CUA rectangle changes (including undo)."
397 :type 'integer
398 :group 'cua)
399
400 395
401;;; Global Mark Customization 396;;; Global Mark Customization
402 397
@@ -739,15 +734,6 @@ Repeating prefix key when region is active works as a single prefix key."
739 (+ arg ?0))) 734 (+ arg ?0)))
740 (if cua--register nil arg)) 735 (if cua--register nil arg))
741 736
742;;; Enhanced undo - restore rectangle selections
743
744(defun cua-undo (&optional arg)
745 "Undo some previous changes.
746Knows about CUA rectangle highlighting in addition to standard undo."
747 (interactive "*P")
748 (if (fboundp 'cua--rectangle-undo)
749 (cua--rectangle-undo arg)
750 (undo arg)))
751 737
752;;; Region specific commands 738;;; Region specific commands
753 739
@@ -988,21 +974,6 @@ With a double \\[universal-argument] prefix argument, unconditionally set mark."
988 (if cua-enable-region-auto-help 974 (if cua-enable-region-auto-help
989 (cua-help-for-region t))))) 975 (cua-help-for-region t)))))
990 976
991(defvar cua--standard-movement-commands
992 '(forward-char backward-char
993 next-line previous-line
994 forward-word backward-word
995 end-of-line beginning-of-line
996 end-of-buffer beginning-of-buffer
997 scroll-up scroll-down cua-scroll-up cua-scroll-down
998 forward-sentence backward-sentence
999 forward-paragraph backward-paragraph)
1000 "List of standard movement commands.
1001Extra commands should be added to `cua-movement-commands'")
1002
1003(defvar cua-movement-commands nil
1004 "User may add additional movement commands to this list.")
1005
1006;;; Scrolling commands which does not signal errors at top/bottom 977;;; Scrolling commands which does not signal errors at top/bottom
1007;;; of buffer at first key-press (instead moves to top/bottom 978;;; of buffer at first key-press (instead moves to top/bottom
1008;;; of buffer). 979;;; of buffer).
@@ -1025,6 +996,8 @@ If ARG is the atom `-', scroll downward by nearly full screen."
1025 (scroll-up arg) 996 (scroll-up arg)
1026 (end-of-buffer (goto-char (point-max))))))) 997 (end-of-buffer (goto-char (point-max)))))))
1027 998
999(put 'cua-scroll-up 'CUA 'move)
1000
1028(defun cua-scroll-down (&optional arg) 1001(defun cua-scroll-down (&optional arg)
1029 "Scroll text of current window downward ARG lines; or near full screen if no ARG. 1002 "Scroll text of current window downward ARG lines; or near full screen if no ARG.
1030If window cannot be scrolled further, move cursor to top line instead. 1003If window cannot be scrolled further, move cursor to top line instead.
@@ -1043,6 +1016,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1043 (scroll-down arg) 1016 (scroll-down arg)
1044 (beginning-of-buffer (goto-char (point-min))))))) 1017 (beginning-of-buffer (goto-char (point-min)))))))
1045 1018
1019(put 'cua-scroll-up 'CUA 'move)
1020
1046;;; Cursor indications 1021;;; Cursor indications
1047 1022
1048(defun cua--update-indications () 1023(defun cua--update-indications ()
@@ -1073,8 +1048,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1073 1048
1074(defun cua--pre-command-handler () 1049(defun cua--pre-command-handler ()
1075 (condition-case nil 1050 (condition-case nil
1076 (let ((movement (or (memq this-command cua--standard-movement-commands) 1051 (let ((movement (eq (get this-command 'CUA) 'move)))
1077 (memq this-command cua-movement-commands))))
1078 1052
1079 ;; Cancel prefix key timeout if user enters another key. 1053 ;; Cancel prefix key timeout if user enters another key.
1080 (when cua--prefix-override-timer 1054 (when cua--prefix-override-timer
@@ -1251,9 +1225,6 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1251 (define-key cua-global-keymap [remap yank-pop] 'cua-paste-pop) 1225 (define-key cua-global-keymap [remap yank-pop] 'cua-paste-pop)
1252 ;; set mark 1226 ;; set mark
1253 (define-key cua-global-keymap [remap set-mark-command] 'cua-set-mark) 1227 (define-key cua-global-keymap [remap set-mark-command] 'cua-set-mark)
1254 ;; undo
1255 (define-key cua-global-keymap [remap undo] 'cua-undo)
1256 (define-key cua-global-keymap [remap advertised-undo] 'cua-undo)
1257 1228
1258 ;; scrolling 1229 ;; scrolling
1259 (define-key cua-global-keymap [remap scroll-up] 'cua-scroll-up) 1230 (define-key cua-global-keymap [remap scroll-up] 'cua-scroll-up)
@@ -1305,6 +1276,20 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1305 (define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel) 1276 (define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel)
1306 ) 1277 )
1307 1278
1279
1280;; Setup standard movement commands to be recognized by CUA.
1281
1282(dolist (cmd
1283 '(forward-char backward-char
1284 next-line previous-line
1285 forward-word backward-word
1286 end-of-line beginning-of-line
1287 end-of-buffer beginning-of-buffer
1288 scroll-up scroll-down
1289 forward-sentence backward-sentence
1290 forward-paragraph backward-paragraph))
1291 (put cmd 'CUA 'move))
1292
1308;; State prior to enabling cua-mode 1293;; State prior to enabling cua-mode
1309;; Value is a list with the following elements: 1294;; Value is a list with the following elements:
1310;; transient-mark-mode 1295;; transient-mark-mode
@@ -1350,9 +1335,6 @@ paste (in addition to the normal emacs bindings)."
1350 (add-to-list 'emulation-mode-map-alists 'cua--keymap-alist) 1335 (add-to-list 'emulation-mode-map-alists 'cua--keymap-alist)
1351 (cua--select-keymaps)) 1336 (cua--select-keymaps))
1352 1337
1353 (if (fboundp 'cua--rectangle-on-off)
1354 (cua--rectangle-on-off cua-mode))
1355
1356 (cond 1338 (cond
1357 (cua-mode 1339 (cua-mode
1358 (setq cua--saved-state 1340 (setq cua--saved-state