diff lisp/emulation/viper-cmd.el @ 106192:a2ee981efbec

2009-11-22 Michael Kifer <kifer@cs.stonybrook.edu> * viper-cmd.el: use viper-last-command-char instead of last-command-char/last-command-event. (viper-prefix-arg-value): do correct conversion of event-char for XEmacs. * viper-util.el, viper.el: use viper-last-command-char instead of last-command-char/last-command-event. * ediff-init.el, ediff-mult.el, ediff-util.el: relpace last-command-char and last-command-event with (ediff-last-command-char) everywhere. * ediff-vers.el (ediff-rcs-get-output-buffer): make sure the buffer is created in fundamental mode. * ediff.el (ediff-version): revert the change of interactive-p to called-interactively-p.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sun, 22 Nov 2009 03:14:14 +0000
parents 328150f0cf76
children 1d1d5d9bd884
line wrap: on
line diff
--- a/lisp/emulation/viper-cmd.el	Sun Nov 22 02:19:23 2009 +0000
+++ b/lisp/emulation/viper-cmd.el	Sun Nov 22 03:14:14 2009 +0000
@@ -719,7 +719,7 @@
 ARG is used as the prefix value for the executed command.  If
 EVENTS is a list of events, which become the beginning of the command."
   (interactive "P")
-  (if (viper= last-command-event ?\\)
+  (if (viper= (viper-last-command-char) ?\\)
       (message "Switched to EMACS state for the next command..."))
   (viper-escape-to-state arg events 'emacs-state))
 
@@ -1181,7 +1181,10 @@
 		((eq event-char 'delete) (setq event-char ?\C-?))
 		((eq event-char 'backspace) (setq event-char ?\C-h))
 		((eq event-char 'space) (setq event-char ?\ )))
-	  (setq last-command-event (or com event-char))
+	  (setq last-command-event 
+		(if (featurep 'xemacs)
+		    (character-to-event (or com event-char))
+		  (or com event-char)))
 	  (setq func (viper-exec-form-in-vi
 		      `(key-binding (char-to-string ,event-char))))
 	  (funcall func prefix-arg)
@@ -1311,7 +1314,7 @@
   (interactive "P")
   (viper-leave-region-active)
   (viper-prefix-arg-value
-   last-command-event (if (consp arg) (cdr arg) nil)))
+   (viper-last-command-char) (if (consp arg) (cdr arg) nil)))
 
 (defun viper-command-argument (arg)
   "Accept a motion command as an argument."
@@ -1319,7 +1322,7 @@
   (let ((viper-intermediate-command 'viper-command-argument))
     (condition-case nil
 	(viper-prefix-arg-com
-	 last-command-event
+	 (viper-last-command-char)
 	 (cond ((null arg) nil)
 	       ((consp arg) (car arg))
 	       ((integerp arg) arg)
@@ -2096,7 +2099,7 @@
   "Exit minibuffer Viper way."
   (interactive)
   (let (command)
-    (setq command (local-key-binding (char-to-string last-command-event)))
+    (setq command (local-key-binding (char-to-string (viper-last-command-char))))
     (run-hooks 'viper-minibuffer-exit-hook)
     (if command
 	(command-execute command)
@@ -3771,7 +3774,9 @@
 	       "///" 'vi-state
 	       [2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
 	       scope)
-	      (if (called-interactively-p 'interactive)
+	      ;; XEmacs has no called-interactively-p
+	      ;; (if (called-interactively-p 'interactive)
+	      (if (interactive-p)
 		  (message
 		   "// and /// now toggle case-sensitivity and regexp search")))
 	  (viper-unrecord-kbd-macro "//" 'vi-state)
@@ -3794,7 +3799,10 @@
 	     "%%%" 'vi-state
 	     [(meta x) v i p e r - t o g g l e - p a r s e - s e x p - i g n o r e - c o m m e n t s return]
 	     't)
-	    (if (called-interactively-p 'interactive)
+	    ;; XEmacs has no called-interactively-p. And interactive-p
+	    ;; works fine here.
+	    ;; (if (called-interactively-p 'interactive)
+	    (if (interactive-p)
 		(message
 		 "%%%%%% now toggles whether comments should be parsed for matching parentheses")))
 	(viper-unrecord-kbd-macro "%%%" 'vi-state))))
@@ -3823,7 +3831,10 @@
 	     "///" 'emacs-state
 	     [2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
 	     (or arg-majormode major-mode))
-	    (if (called-interactively-p 'interactive)
+	    ;; called-interactively-p does not work for
+	    ;; XEmacs. interactive-p is ok here.
+	    ;; (if (called-interactively-p 'interactive)
+	    (if (interactive-p)
 		(message
 		 "// and /// now toggle case-sensitivity and regexp search.")))
 	(viper-unrecord-kbd-macro "//" 'emacs-state)