summaryrefslogtreecommitdiff
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>2009-11-22 03:14:14 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>2009-11-22 03:14:14 +0000
commit433d9ace74fbd35205c06bcef487bd3e5d41e6bb (patch)
treea7d85bd9038bbc883093b9a830980723b4639b03 /lisp/emulation
parent5ea5dbc9255d4abf0e2ab727167a2c9ba9c11076 (diff)
downloademacs-433d9ace74fbd35205c06bcef487bd3e5d41e6bb.tar.gz
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 @@
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 @@ as a Meta key and any number of multiple escapes is allowed."
((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 @@ as a Meta key and any number of multiple escapes is allowed."
(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 @@ as a Meta key and any number of multiple escapes is allowed."
(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 @@ Undo previous insertion and inserts new."
"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 @@ If MAJOR-MODE is set, set the macros only in that major mode."
"///" '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 @@ With a prefix argument, unsets the macro."
"%%%" '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 @@ the macros are set in the current major mode.
"///" '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)
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."
(viper-frame-value viper-vi-state-cursor-color)
frame))))
-;; By default, saves current frame cursor color in the
-;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay
+;; By default, saves current frame cursor color before changing viper state
(defun viper-save-cursor-color (before-which-mode)
(if (and (viper-window-display-p) (viper-color-display-p))
(let ((color (viper-get-cursor-color)))
(if (and (stringp color) (viper-color-defined-p color)
+ ;; there is something fishy in that the color is not saved if
+ ;; it is the same as frames default cursor color. need to be
+ ;; checked.
(not (string= color
(viper-frame-value
viper-replace-overlay-cursor-color))))
@@ -1047,6 +1049,11 @@ Otherwise return the normal value."
(append mod (list basis))
basis))))
+(defun viper-last-command-char ()
+ (if (featurep 'xemacs)
+ (event-to-character last-command-event)
+ last-command-event))
+
(defun viper-key-to-emacs-key (key)
(let (key-name char-p modifiers mod-char-list base-key base-key-name)
(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."
(defadvice self-insert-command (around viper-self-insert-ad activate)
"Ignore all self-inserting keys in the vi-state."
(if (and (eq viper-current-state 'vi-state)
- (called-interactively-p 'interactive))
+ ;; Do not use called-interactively-p here. XEmacs does not have it
+ ;; and interactive-p is just fine.
+ ;; (called-interactively-p 'interactive))
+ (interactive-p))
(beep 1)
ad-do-it
))