aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer2009-11-22 03:14:14 +0000
committerMichael Kifer2009-11-22 03:14:14 +0000
commit433d9ace74fbd35205c06bcef487bd3e5d41e6bb (patch)
treea7d85bd9038bbc883093b9a830980723b4639b03 /lisp/emulation
parent5ea5dbc9255d4abf0e2ab727167a2c9ba9c11076 (diff)
downloademacs-433d9ace74fbd35205c06bcef487bd3e5d41e6bb.tar.gz
emacs-433d9ace74fbd35205c06bcef487bd3e5d41e6bb.zip
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.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-cmd.el27
-rw-r--r--lisp/emulation/viper-util.el11
-rw-r--r--lisp/emulation/viper.el5
3 files changed, 32 insertions, 11 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index fdaeb13f3e2..56fead09156 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-event ?\\) 722 (if (viper= (viper-last-command-char) ?\\)
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
@@ -1181,7 +1181,10 @@ as a Meta key and any number of multiple escapes is allowed."
1181 ((eq event-char 'delete) (setq event-char ?\C-?)) 1181 ((eq event-char 'delete) (setq event-char ?\C-?))
1182 ((eq event-char 'backspace) (setq event-char ?\C-h)) 1182 ((eq event-char 'backspace) (setq event-char ?\C-h))
1183 ((eq event-char 'space) (setq event-char ?\ ))) 1183 ((eq event-char 'space) (setq event-char ?\ )))
1184 (setq last-command-event (or com event-char)) 1184 (setq last-command-event
1185 (if (featurep 'xemacs)
1186 (character-to-event (or com event-char))
1187 (or com event-char)))
1185 (setq func (viper-exec-form-in-vi 1188 (setq func (viper-exec-form-in-vi
1186 `(key-binding (char-to-string ,event-char)))) 1189 `(key-binding (char-to-string ,event-char))))
1187 (funcall func prefix-arg) 1190 (funcall func prefix-arg)
@@ -1311,7 +1314,7 @@ as a Meta key and any number of multiple escapes is allowed."
1311 (interactive "P") 1314 (interactive "P")
1312 (viper-leave-region-active) 1315 (viper-leave-region-active)
1313 (viper-prefix-arg-value 1316 (viper-prefix-arg-value
1314 last-command-event (if (consp arg) (cdr arg) nil))) 1317 (viper-last-command-char) (if (consp arg) (cdr arg) nil)))
1315 1318
1316(defun viper-command-argument (arg) 1319(defun viper-command-argument (arg)
1317 "Accept a motion command as an argument." 1320 "Accept a motion command as an argument."
@@ -1319,7 +1322,7 @@ as a Meta key and any number of multiple escapes is allowed."
1319 (let ((viper-intermediate-command 'viper-command-argument)) 1322 (let ((viper-intermediate-command 'viper-command-argument))
1320 (condition-case nil 1323 (condition-case nil
1321 (viper-prefix-arg-com 1324 (viper-prefix-arg-com
1322 last-command-event 1325 (viper-last-command-char)
1323 (cond ((null arg) nil) 1326 (cond ((null arg) nil)
1324 ((consp arg) (car arg)) 1327 ((consp arg) (car arg))
1325 ((integerp arg) arg) 1328 ((integerp arg) arg)
@@ -2096,7 +2099,7 @@ Undo previous insertion and inserts new."
2096 "Exit minibuffer Viper way." 2099 "Exit minibuffer Viper way."
2097 (interactive) 2100 (interactive)
2098 (let (command) 2101 (let (command)
2099 (setq command (local-key-binding (char-to-string last-command-event))) 2102 (setq command (local-key-binding (char-to-string (viper-last-command-char))))
2100 (run-hooks 'viper-minibuffer-exit-hook) 2103 (run-hooks 'viper-minibuffer-exit-hook)
2101 (if command 2104 (if command
2102 (command-execute command) 2105 (command-execute command)
@@ -3771,7 +3774,9 @@ If MAJOR-MODE is set, set the macros only in that major mode."
3771 "///" 'vi-state 3774 "///" 'vi-state
3772 [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] 3775 [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]
3773 scope) 3776 scope)
3774 (if (called-interactively-p 'interactive) 3777 ;; XEmacs has no called-interactively-p
3778 ;; (if (called-interactively-p 'interactive)
3779 (if (interactive-p)
3775 (message 3780 (message
3776 "// and /// now toggle case-sensitivity and regexp search"))) 3781 "// and /// now toggle case-sensitivity and regexp search")))
3777 (viper-unrecord-kbd-macro "//" 'vi-state) 3782 (viper-unrecord-kbd-macro "//" 'vi-state)
@@ -3794,7 +3799,10 @@ With a prefix argument, unsets the macro."
3794 "%%%" 'vi-state 3799 "%%%" 'vi-state
3795 [(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] 3800 [(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]
3796 't) 3801 't)
3797 (if (called-interactively-p 'interactive) 3802 ;; XEmacs has no called-interactively-p. And interactive-p
3803 ;; works fine here.
3804 ;; (if (called-interactively-p 'interactive)
3805 (if (interactive-p)
3798 (message 3806 (message
3799 "%%%%%% now toggles whether comments should be parsed for matching parentheses"))) 3807 "%%%%%% now toggles whether comments should be parsed for matching parentheses")))
3800 (viper-unrecord-kbd-macro "%%%" 'vi-state)))) 3808 (viper-unrecord-kbd-macro "%%%" 'vi-state))))
@@ -3823,7 +3831,10 @@ the macros are set in the current major mode.
3823 "///" 'emacs-state 3831 "///" 'emacs-state
3824 [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] 3832 [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]
3825 (or arg-majormode major-mode)) 3833 (or arg-majormode major-mode))
3826 (if (called-interactively-p 'interactive) 3834 ;; called-interactively-p does not work for
3835 ;; XEmacs. interactive-p is ok here.
3836 ;; (if (called-interactively-p 'interactive)
3837 (if (interactive-p)
3827 (message 3838 (message
3828 "// and /// now toggle case-sensitivity and regexp search."))) 3839 "// and /// now toggle case-sensitivity and regexp search.")))
3829 (viper-unrecord-kbd-macro "//" 'emacs-state) 3840 (viper-unrecord-kbd-macro "//" 'emacs-state)
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 503265c8b85..80cf3c78f60 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -174,12 +174,14 @@ Otherwise return the normal value."
174 (viper-frame-value viper-vi-state-cursor-color) 174 (viper-frame-value viper-vi-state-cursor-color)
175 frame)))) 175 frame))))
176 176
177;; By default, saves current frame cursor color in the 177;; By default, saves current frame cursor color before changing viper state
178;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay
179(defun viper-save-cursor-color (before-which-mode) 178(defun viper-save-cursor-color (before-which-mode)
180 (if (and (viper-window-display-p) (viper-color-display-p)) 179 (if (and (viper-window-display-p) (viper-color-display-p))
181 (let ((color (viper-get-cursor-color))) 180 (let ((color (viper-get-cursor-color)))
182 (if (and (stringp color) (viper-color-defined-p color) 181 (if (and (stringp color) (viper-color-defined-p color)
182 ;; there is something fishy in that the color is not saved if
183 ;; it is the same as frames default cursor color. need to be
184 ;; checked.
183 (not (string= color 185 (not (string= color
184 (viper-frame-value 186 (viper-frame-value
185 viper-replace-overlay-cursor-color)))) 187 viper-replace-overlay-cursor-color))))
@@ -1047,6 +1049,11 @@ Otherwise return the normal value."
1047 (append mod (list basis)) 1049 (append mod (list basis))
1048 basis)))) 1050 basis))))
1049 1051
1052(defun viper-last-command-char ()
1053 (if (featurep 'xemacs)
1054 (event-to-character last-command-event)
1055 last-command-event))
1056
1050(defun viper-key-to-emacs-key (key) 1057(defun viper-key-to-emacs-key (key)
1051 (let (key-name char-p modifiers mod-char-list base-key base-key-name) 1058 (let (key-name char-p modifiers mod-char-list base-key base-key-name)
1052 (cond ((featurep 'xemacs) key) 1059 (cond ((featurep 'xemacs) key)
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 24ed2dc80ba..a02c144d7bd 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -889,7 +889,10 @@ It also can't undo some Viper settings."
889 (defadvice self-insert-command (around viper-self-insert-ad activate) 889 (defadvice self-insert-command (around viper-self-insert-ad activate)
890 "Ignore all self-inserting keys in the vi-state." 890 "Ignore all self-inserting keys in the vi-state."
891 (if (and (eq viper-current-state 'vi-state) 891 (if (and (eq viper-current-state 'vi-state)
892 (called-interactively-p 'interactive)) 892 ;; Do not use called-interactively-p here. XEmacs does not have it
893 ;; and interactive-p is just fine.
894 ;; (called-interactively-p 'interactive))
895 (interactive-p))
893 (beep 1) 896 (beep 1)
894 ad-do-it 897 ad-do-it
895 )) 898 ))