aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation/viper-cmd.el
diff options
context:
space:
mode:
authorGlenn Morris2009-01-09 04:36:00 +0000
committerGlenn Morris2009-01-09 04:36:00 +0000
commita4d9b7bca3dc69efe89eecbd81ed96859f7cd818 (patch)
treea946b8d6c185093144a33d99a33c9fbaed0eb068 /lisp/emulation/viper-cmd.el
parent61a846fbec62231eb19bdd41e08fd89f57787195 (diff)
downloademacs-a4d9b7bca3dc69efe89eecbd81ed96859f7cd818.tar.gz
emacs-a4d9b7bca3dc69efe89eecbd81ed96859f7cd818.zip
Replace last-command-char with last-command-event.
Diffstat (limited to 'lisp/emulation/viper-cmd.el')
-rw-r--r--lisp/emulation/viper-cmd.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 5040b278728..95f601716fa 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -719,7 +719,7 @@
719ARG is used as the prefix value for the executed command. If 719ARG is used as the prefix value for the executed command. If
720EVENTS is a list of events, which become the beginning of the command." 720EVENTS is a list of events, which become the beginning of the command."
721 (interactive "P") 721 (interactive "P")
722 (if (viper= last-command-char ?\\) 722 (if (viper= last-command-event ?\\)
723 (message "Switched to EMACS state for the next command...")) 723 (message "Switched to EMACS state for the next command..."))
724 (viper-escape-to-state arg events 'emacs-state)) 724 (viper-escape-to-state arg events 'emacs-state))
725 725
@@ -773,8 +773,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
773 last-command-char (event-to-character last-command-event)) 773 last-command-char (event-to-character last-command-event))
774 ;; Emacs represents them as sequences (str or vec) 774 ;; Emacs represents them as sequences (str or vec)
775 (setq last-command-event 775 (setq last-command-event
776 (viper-copy-event (viper-seq-last-elt key)) 776 (viper-copy-event (viper-seq-last-elt key))))
777 last-command-char last-command-event))
778 777
779 (if (commandp com) 778 (if (commandp com)
780 ;; pretend that current state is the state we excaped to 779 ;; pretend that current state is the state we excaped to
@@ -1170,7 +1169,7 @@ as a Meta key and any number of multiple escapes is allowed."
1170 ;; then execute it with funcall and clear prefix-arg in order to not 1169 ;; then execute it with funcall and clear prefix-arg in order to not
1171 ;; confuse subsequent commands 1170 ;; confuse subsequent commands
1172 (progn 1171 (progn
1173 ;; last-command-char is the char we want emacs to think was typed 1172 ;; last-command-event is the char we want emacs to think was typed
1174 ;; last. If com is not nil, the viper-digit-argument command was 1173 ;; last. If com is not nil, the viper-digit-argument command was
1175 ;; called from within viper-prefix-arg command, such as `d', `w', 1174 ;; called from within viper-prefix-arg command, such as `d', `w',
1176 ;; etc., i.e., the user typed, say, d2. In this case, `com' would be 1175 ;; etc., i.e., the user typed, say, d2. In this case, `com' would be
@@ -1178,13 +1177,13 @@ as a Meta key and any number of multiple escapes is allowed."
1178 ;; viper-escape-to-vi (which is indicated by the fact that the 1177 ;; viper-escape-to-vi (which is indicated by the fact that the
1179 ;; current state is not vi-state), then `event-char' represents the 1178 ;; current state is not vi-state), then `event-char' represents the
1180 ;; vi command to be executed (e.g., `d', `w', etc). Again, 1179 ;; vi command to be executed (e.g., `d', `w', etc). Again,
1181 ;; last-command-char must make emacs believe that this is the command 1180 ;; last-command-event must make emacs believe that this is the command
1182 ;; we typed. 1181 ;; we typed.
1183 (cond ((eq event-char 'return) (setq event-char ?\C-m)) 1182 (cond ((eq event-char 'return) (setq event-char ?\C-m))
1184 ((eq event-char 'delete) (setq event-char ?\C-?)) 1183 ((eq event-char 'delete) (setq event-char ?\C-?))
1185 ((eq event-char 'backspace) (setq event-char ?\C-h)) 1184 ((eq event-char 'backspace) (setq event-char ?\C-h))
1186 ((eq event-char 'space) (setq event-char ?\ ))) 1185 ((eq event-char 'space) (setq event-char ?\ )))
1187 (setq last-command-char (or com event-char)) 1186 (setq last-command-event (or com event-char))
1188 (setq func (viper-exec-form-in-vi 1187 (setq func (viper-exec-form-in-vi
1189 `(key-binding (char-to-string ,event-char)))) 1188 `(key-binding (char-to-string ,event-char))))
1190 (funcall func prefix-arg) 1189 (funcall func prefix-arg)
@@ -1288,7 +1287,6 @@ as a Meta key and any number of multiple escapes is allowed."
1288 1287
1289 (if cmd-to-exec-at-end 1288 (if cmd-to-exec-at-end
1290 (progn 1289 (progn
1291 (setq last-command-char char)
1292 (setq last-command-event 1290 (setq last-command-event
1293 (viper-copy-event 1291 (viper-copy-event
1294 (if (featurep 'xemacs) (character-to-event char) char))) 1292 (if (featurep 'xemacs) (character-to-event char) char)))
@@ -1315,7 +1313,7 @@ as a Meta key and any number of multiple escapes is allowed."
1315 (interactive "P") 1313 (interactive "P")
1316 (viper-leave-region-active) 1314 (viper-leave-region-active)
1317 (viper-prefix-arg-value 1315 (viper-prefix-arg-value
1318 last-command-char (if (consp arg) (cdr arg) nil))) 1316 last-command-event (if (consp arg) (cdr arg) nil)))
1319 1317
1320(defun viper-command-argument (arg) 1318(defun viper-command-argument (arg)
1321 "Accept a motion command as an argument." 1319 "Accept a motion command as an argument."
@@ -1323,7 +1321,7 @@ as a Meta key and any number of multiple escapes is allowed."
1323 (let ((viper-intermediate-command 'viper-command-argument)) 1321 (let ((viper-intermediate-command 'viper-command-argument))
1324 (condition-case nil 1322 (condition-case nil
1325 (viper-prefix-arg-com 1323 (viper-prefix-arg-com
1326 last-command-char 1324 last-command-event
1327 (cond ((null arg) nil) 1325 (cond ((null arg) nil)
1328 ((consp arg) (car arg)) 1326 ((consp arg) (car arg))
1329 ((integerp arg) arg) 1327 ((integerp arg) arg)
@@ -2100,7 +2098,7 @@ Undo previous insertion and inserts new."
2100 "Exit minibuffer Viper way." 2098 "Exit minibuffer Viper way."
2101 (interactive) 2099 (interactive)
2102 (let (command) 2100 (let (command)
2103 (setq command (local-key-binding (char-to-string last-command-char))) 2101 (setq command (local-key-binding (char-to-string last-command-event)))
2104 (run-hooks 'viper-minibuffer-exit-hook) 2102 (run-hooks 'viper-minibuffer-exit-hook)
2105 (if command 2103 (if command
2106 (command-execute command) 2104 (command-execute command)