Commit a4047f9d authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Remove XEmacs compat code from viper-cmd.el

* lisp/emulation/viper-cmd.el (viper-change-state)
(viper-escape-to-state, viper-special-read-and-insert-char)
(viper-prefix-arg-value, viper-prefix-arg-com)
(viper-display-current-destructive-command)
(viper-file-add-suffix, viper-adjust-window)
(viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros): Remove XEmacs compat code.
parent 1f6e6ee4
...@@ -293,12 +293,6 @@ ...@@ -293,12 +293,6 @@
;; desirable that viper-pre-command-sentinel is the last hook and ;; desirable that viper-pre-command-sentinel is the last hook and
;; viper-post-command-sentinel is the first hook. ;; viper-post-command-sentinel is the first hook.
(when (featurep 'xemacs)
(make-local-hook 'viper-after-change-functions)
(make-local-hook 'viper-before-change-functions)
(make-local-hook 'viper-post-command-hooks)
(make-local-hook 'viper-pre-command-hooks))
(remove-hook 'post-command-hook 'viper-post-command-sentinel) (remove-hook 'post-command-hook 'viper-post-command-sentinel)
(add-hook 'post-command-hook 'viper-post-command-sentinel) (add-hook 'post-command-hook 'viper-post-command-sentinel)
(remove-hook 'pre-command-hook 'viper-pre-command-sentinel) (remove-hook 'pre-command-hook 'viper-pre-command-sentinel)
...@@ -764,21 +758,15 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to ...@@ -764,21 +758,15 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
;; this-command, last-command-char, last-command-event ;; this-command, last-command-char, last-command-event
(setq this-command com) (setq this-command com)
(if (featurep 'xemacs) ;; Emacs represents key sequences as sequences (str or vec)
;; XEmacs represents key sequences as vectors (setq last-command-event
(setq last-command-event (viper-copy-event (viper-seq-last-elt key)))
(viper-copy-event (viper-seq-last-elt key))
last-command-char (event-to-character last-command-event))
;; Emacs represents them as sequences (str or vec)
(setq last-command-event
(viper-copy-event (viper-seq-last-elt key))))
(if (commandp com) (if (commandp com)
;; pretend that current state is the state we escaped to ;; pretend that current state is the state we escaped to
(let ((viper-current-state state)) (let ((viper-current-state state))
(setq prefix-arg (or prefix-arg arg)) (setq prefix-arg (or prefix-arg arg))
(command-execute com))) (command-execute com))))
)
(quit (ding)) (quit (ding))
(error (beep 1)))) (error (beep 1))))
;; set state in the new buffer ;; set state in the new buffer
...@@ -826,30 +814,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to ...@@ -826,30 +814,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
(insert quail-current-str)) (insert quail-current-str))
(setq ch (or ch (setq ch (or ch
(aref quail-current-str (aref quail-current-str
(1- (length quail-current-str))))) (1- (length quail-current-str)))))))
))
((and viper-special-input-method
(featurep 'xemacs)
(fboundp 'quail-start-translation))
;; same as above but for XEmacs, which doesn't have
;; quail-input-method
(let (unread-command-events)
(setq ch (read-char-exclusive))
;; replace ^M with the newline
(if (eq ch ?\C-m) (setq ch ?\n))
;; Make sure ^V and ^Q work as quotation chars
(if (memq ch '(?\C-v ?\C-q))
(setq ch (read-char-exclusive)))
(viper-set-unread-command-events ch)
(quail-start-translation nil)
(if (and ch (string= quail-current-str ""))
(insert ch)
(insert quail-current-str))
(setq ch (or ch
(aref quail-current-str
(1- (length quail-current-str)))))
))
((and (boundp 'iso-accents-mode) iso-accents-mode) ((and (boundp 'iso-accents-mode) iso-accents-mode)
(setq ch (aref (read-key-sequence nil) 0)) (setq ch (aref (read-key-sequence nil) 0))
;; replace ^M with the newline ;; replace ^M with the newline
...@@ -859,25 +824,14 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to ...@@ -859,25 +824,14 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
(setq ch (aref (read-key-sequence nil) 0))) (setq ch (aref (read-key-sequence nil) 0)))
(insert ch)) (insert ch))
(t (t
;;(setq ch (read-char-exclusive))
(setq ch (aref (read-key-sequence nil) 0)) (setq ch (aref (read-key-sequence nil) 0))
(if (featurep 'xemacs)
(setq ch (event-to-character ch)))
;; replace ^M with the newline ;; replace ^M with the newline
(if (eq ch ?\C-m) (setq ch ?\n)) (if (eq ch ?\C-m) (setq ch ?\n))
;; Make sure ^V and ^Q work as quotation chars ;; Make sure ^V and ^Q work as quotation chars
(if (memq ch '(?\C-v ?\C-q)) (if (memq ch '(?\C-v ?\C-q))
(progn (setq ch (aref (read-key-sequence nil) 0)))
;;(setq ch (read-char-exclusive)) (insert ch)))
(setq ch (aref (read-key-sequence nil) 0)) (setq last-command-event (viper-copy-event ch))
(if (featurep 'xemacs)
(setq ch (event-to-character ch))))
)
(insert ch))
)
(setq last-command-event
(viper-copy-event (if (featurep 'xemacs)
(character-to-event ch) ch)))
) ; let ) ; let
(error nil) (error nil)
) ; condition-case ) ; condition-case
...@@ -1096,10 +1050,7 @@ as a Meta key and any number of multiple escapes are allowed." ...@@ -1096,10 +1050,7 @@ as a Meta key and any number of multiple escapes are allowed."
((eq event-char 'delete) (setq event-char ?\C-?)) ((eq event-char 'delete) (setq event-char ?\C-?))
((eq event-char 'backspace) (setq event-char ?\C-h)) ((eq event-char 'backspace) (setq event-char ?\C-h))
((eq event-char 'space) (setq event-char ?\ ))) ((eq event-char 'space) (setq event-char ?\ )))
(setq last-command-event (setq last-command-event (or com event-char))
(if (featurep 'xemacs)
(character-to-event (or com event-char))
(or com event-char)))
(setq func (viper-exec-form-in-vi (setq func (viper-exec-form-in-vi
`(key-binding (char-to-string ,event-char)))) `(key-binding (char-to-string ,event-char))))
(funcall func prefix-arg) (funcall func prefix-arg)
...@@ -1203,9 +1154,7 @@ as a Meta key and any number of multiple escapes are allowed." ...@@ -1203,9 +1154,7 @@ as a Meta key and any number of multiple escapes are allowed."
(if cmd-to-exec-at-end (if cmd-to-exec-at-end
(progn (progn
(setq last-command-event (setq last-command-event (viper-copy-event char))
(viper-copy-event
(if (featurep 'xemacs) (character-to-event char) char)))
(condition-case err (condition-case err
(funcall cmd-to-exec-at-end cmd-info) (funcall cmd-to-exec-at-end cmd-info)
(error (error
...@@ -1732,18 +1681,9 @@ invokes the command before that, etc." ...@@ -1732,18 +1681,9 @@ invokes the command before that, etc."
(message " `.' runs `%s'%s" (message " `.' runs `%s'%s"
(viper-array-to-string keys) (viper-array-to-string keys)
(viper-abbreviate-string (viper-abbreviate-string
(if (featurep 'xemacs) text max-text-len
(replace-in-string ; xemacs
(cond ((characterp text) (char-to-string text))
((stringp text) text)
(t ""))
"\n" "^J")
text ; emacs
)
max-text-len
(format-message " inserting `") (format-message "'") (format-message " inserting `") (format-message "'")
" .......")) " ......."))))
))
;; don't change viper-d-com if it was viper-repeat command invoked with `.' ;; don't change viper-d-com if it was viper-repeat command invoked with `.'
...@@ -2053,15 +1993,10 @@ To turn this feature off, set this variable to nil." ...@@ -2053,15 +1993,10 @@ To turn this feature off, set this variable to nil."
(setq cmd (setq cmd
(key-binding (setq key (read-key-sequence nil)))) (key-binding (setq key (read-key-sequence nil))))
(cond ((eq cmd 'self-insert-command) (cond ((eq cmd 'self-insert-command)
(if (featurep 'xemacs) (insert key))
(insert (events-to-keys key)) ; xemacs
(insert key) ; emacs
))
((memq cmd '(exit-minibuffer viper-exit-minibuffer)) ((memq cmd '(exit-minibuffer viper-exit-minibuffer))
nil) nil)
(t (command-execute cmd))) (t (command-execute cmd))))))))))
)))
))))
(defun viper-minibuffer-trim-tail () (defun viper-minibuffer-trim-tail ()
...@@ -3351,9 +3286,7 @@ controlled by the sign of prefix numeric value." ...@@ -3351,9 +3286,7 @@ controlled by the sign of prefix numeric value."
;; (which is called from viper-search-forward/backward/next). If the value of ;; (which is called from viper-search-forward/backward/next). If the value of
;; viper-search-scroll-threshold is negative - don't scroll. ;; viper-search-scroll-threshold is negative - don't scroll.
(defun viper-adjust-window () (defun viper-adjust-window ()
(let ((win-height (if (featurep 'xemacs) (let ((win-height (1- (window-height))) ; adjust for mode line
(window-displayed-height)
(1- (window-height)))) ; adjust for mode line
(pt (point)) (pt (point))
at-top-p at-bottom-p at-top-p at-bottom-p
min-scroll direction) min-scroll direction)
...@@ -3671,9 +3604,7 @@ If MODE is set, set the macros only in that major mode." ...@@ -3671,9 +3604,7 @@ If MODE is set, set the macros only in that major mode."
"///" 'vi-state "///" '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] [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) scope)
(if (if (featurep 'xemacs) (if (called-interactively-p 'interactive)
(interactive-p)
(called-interactively-p 'interactive))
(message (message
"// and /// now toggle case-sensitivity and regexp search"))) "// and /// now toggle case-sensitivity and regexp search")))
(viper-unrecord-kbd-macro "//" 'vi-state) (viper-unrecord-kbd-macro "//" 'vi-state)
...@@ -3696,9 +3627,7 @@ With a prefix argument, unsets the macro." ...@@ -3696,9 +3627,7 @@ With a prefix argument, unsets the macro."
"%%%" 'vi-state "%%%" '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] [(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) 't)
(if (if (featurep 'xemacs) (if (called-interactively-p 'interactive)
(interactive-p)
(called-interactively-p 'interactive))
(message (message
"%%%%%% now toggles whether comments should be parsed for matching parentheses"))) "%%%%%% now toggles whether comments should be parsed for matching parentheses")))
(viper-unrecord-kbd-macro "%%%" 'vi-state)))) (viper-unrecord-kbd-macro "%%%" 'vi-state))))
...@@ -3727,9 +3656,7 @@ the macros are set in the current major mode. ...@@ -3727,9 +3656,7 @@ the macros are set in the current major mode.
"///" 'emacs-state "///" '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] [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)) (or arg-majormode major-mode))
(if (if (featurep 'xemacs) (if (called-interactively-p 'interactive)
(interactive-p)
(called-interactively-p 'interactive))
(message (message
"// and /// now toggle case-sensitivity and regexp search."))) "// and /// now toggle case-sensitivity and regexp search.")))
(viper-unrecord-kbd-macro "//" 'emacs-state) (viper-unrecord-kbd-macro "//" 'emacs-state)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment