aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-04 14:44:34 +0200
committerLars Ingebrigtsen2019-10-04 14:44:34 +0200
commit1039c2e2eb14d5016b9178aaa656c7d1759723d5 (patch)
treecb24d874352910a7689cdad9c5f3cb80479a899d
parent07959a0ffbb585931d1d62c266e83d79931cc561 (diff)
downloademacs-1039c2e2eb14d5016b9178aaa656c7d1759723d5.tar.gz
emacs-1039c2e2eb14d5016b9178aaa656c7d1759723d5.zip
Remove some more XEmacs compat code from viper*.el
* lisp/emulation/viper-ex.el (viper-ex-read-file-name): Ditto. * lisp/emulation/viper-init.el (viper-ms-style-os-p) (viper-has-face-support-p, viper-deactivate-input-method) (viper-activate-input-method, viper-set-input-method): Ditto. * lisp/emulation/viper-util.el (viper-get-saved-cursor-color-in-replace-mode) (viper-get-saved-cursor-color-in-insert-mode) (viper-get-saved-cursor-color-in-emacs-mode) (viper-set-replace-overlay, viper-key-to-emacs-key) (viper-set-unread-command-events): Ditto. * lisp/emulation/viper.el (viper-go-away, viper-set-hooks) (viper-non-hook-settings): Remove XEmacs compat code.
-rw-r--r--lisp/emulation/viper-ex.el5
-rw-r--r--lisp/emulation/viper-init.el35
-rw-r--r--lisp/emulation/viper-util.el75
-rw-r--r--lisp/emulation/viper.el18
4 files changed, 43 insertions, 90 deletions
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index 26bca686cb3..6df6a55b4c5 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -1101,10 +1101,7 @@ reversed."
1101 (copy-keymap minibuffer-local-completion-map)) 1101 (copy-keymap minibuffer-local-completion-map))
1102 beg end cont val) 1102 beg end cont val)
1103 1103
1104 (viper-add-keymap ex-read-filename-map 1104 (viper-add-keymap ex-read-filename-map minibuffer-local-completion-map)
1105 (if (featurep 'emacs)
1106 minibuffer-local-completion-map
1107 read-file-name-map))
1108 1105
1109 (setq cont (setq viper-keep-reading-filename t)) 1106 (setq cont (setq viper-keep-reading-filename t))
1110 (while cont 1107 (while cont
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 5a80804e757..ea041564cce 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -62,9 +62,7 @@
62(defun viper-window-display-p () 62(defun viper-window-display-p ()
63 (and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc))))) 63 (and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc)))))
64 64
65(defcustom viper-ms-style-os-p 65(defcustom viper-ms-style-os-p (memq system-type '(ms-dos windows-nt))
66 (memq system-type (if (featurep 'emacs) '(ms-dos windows-nt)
67 '(ms-dos windows-nt windows-95)))
68 "Non-nil if Emacs is running under an MS-style OS: MS-DOS, or MS-Windows." 66 "Non-nil if Emacs is running under an MS-style OS: MS-DOS, or MS-Windows."
69 :type 'boolean 67 :type 'boolean
70 :tag "Is it Microsoft-made OS?" 68 :tag "Is it Microsoft-made OS?"
@@ -89,8 +87,7 @@ In all likelihood, you don't need to bother with this setting."
89 (cond ((viper-window-display-p)) 87 (cond ((viper-window-display-p))
90 (viper-force-faces) 88 (viper-force-faces)
91 ((viper-color-display-p)) 89 ((viper-color-display-p))
92 ((featurep 'emacs) (memq (viper-device-type) '(pc))) 90 (t (memq (viper-device-type) '(pc)))))
93 ((featurep 'xemacs) (memq (viper-device-type) '(tty pc)))))
94 91
95 92
96;;; Macros 93;;; Macros
@@ -334,25 +331,12 @@ Use `\\[viper-set-expert-level]' to change this.")
334 (or current-input-method default-input-method)) 331 (or current-input-method default-input-method))
335 ""))))) 332 "")))))
336 333
337(defun viper-deactivate-input-method () 334(define-obsolete-function-alias 'viper-deactivate-input-method
338 (cond ((and (featurep 'emacs) (fboundp 'deactivate-input-method)) 335 #'deactivate-input-method "27.1")
339 (deactivate-input-method)) 336
340 ((and (featurep 'xemacs) (boundp 'current-input-method))
341 ;; XEmacs had broken quail-mode for some time, so we are working around
342 ;; it here
343 (setq quail-mode nil)
344 (if (featurep 'quail)
345 (quail-delete-overlays))
346 (setq describe-current-input-method-function nil)
347 (setq current-input-method nil)
348 (run-hooks 'input-method-deactivate-hook)
349 (force-mode-line-update))
350 ))
351(defun viper-activate-input-method () 337(defun viper-activate-input-method ()
352 (cond ((and (featurep 'emacs) (fboundp 'activate-input-method)) 338 (declare (obsolete activate-input-method "27.1"))
353 (activate-input-method default-input-method)) 339 (activate-input-method default-input-method))
354 ((featurep 'xemacs)
355 (if (fboundp 'quail-mode) (quail-mode 1)))))
356 340
357;; Set quail-mode to ARG 341;; Set quail-mode to ARG
358(defun viper-set-input-method (arg) 342(defun viper-set-input-method (arg)
@@ -360,10 +344,9 @@ Use `\\[viper-set-expert-level]' to change this.")
360 (let (viper-mule-hook-flag) ; temporarily deactivate viper mule hooks 344 (let (viper-mule-hook-flag) ; temporarily deactivate viper mule hooks
361 (cond ((and arg (> (prefix-numeric-value arg) 0) default-input-method) 345 (cond ((and arg (> (prefix-numeric-value arg) 0) default-input-method)
362 ;; activate input method 346 ;; activate input method
363 (viper-activate-input-method)) 347 (activate-input-method default-input-method))
364 (t ; deactivate input method 348 (t ; deactivate input method
365 (viper-deactivate-input-method))) 349 (deactivate-input-method)))))
366 ))
367 350
368 351
369;; VI-style Undo 352;; VI-style Undo
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 1d7bb1580ce..046cee9912c 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -166,30 +166,21 @@ Otherwise return the normal value."
166 166
167(defun viper-get-saved-cursor-color-in-replace-mode () 167(defun viper-get-saved-cursor-color-in-replace-mode ()
168 (or 168 (or
169 (funcall 169 (frame-parameter (selected-frame) 'viper-saved-cursor-color-in-replace-mode)
170 (if (featurep 'emacs) 'frame-parameter 'frame-property)
171 (selected-frame)
172 'viper-saved-cursor-color-in-replace-mode)
173 (or (and (eq viper-current-state 'emacs-mode) 170 (or (and (eq viper-current-state 'emacs-mode)
174 (viper-frame-value viper-emacs-state-cursor-color)) 171 (viper-frame-value viper-emacs-state-cursor-color))
175 (viper-frame-value viper-vi-state-cursor-color)))) 172 (viper-frame-value viper-vi-state-cursor-color))))
176 173
177(defun viper-get-saved-cursor-color-in-insert-mode () 174(defun viper-get-saved-cursor-color-in-insert-mode ()
178 (or 175 (or
179 (funcall 176 (frame-parameter (selected-frame) 'viper-saved-cursor-color-in-insert-mode)
180 (if (featurep 'emacs) 'frame-parameter 'frame-property)
181 (selected-frame)
182 'viper-saved-cursor-color-in-insert-mode)
183 (or (and (eq viper-current-state 'emacs-mode) 177 (or (and (eq viper-current-state 'emacs-mode)
184 (viper-frame-value viper-emacs-state-cursor-color)) 178 (viper-frame-value viper-emacs-state-cursor-color))
185 (viper-frame-value viper-vi-state-cursor-color)))) 179 (viper-frame-value viper-vi-state-cursor-color))))
186 180
187(defun viper-get-saved-cursor-color-in-emacs-mode () 181(defun viper-get-saved-cursor-color-in-emacs-mode ()
188 (or 182 (or
189 (funcall 183 (frame-parameter (selected-frame) 'viper-saved-cursor-color-in-emacs-mode)
190 (if (featurep 'emacs) 'frame-parameter 'frame-property)
191 (selected-frame)
192 'viper-saved-cursor-color-in-emacs-mode)
193 (viper-frame-value viper-vi-state-cursor-color))) 184 (viper-frame-value viper-vi-state-cursor-color)))
194 185
195;; restore cursor color from replace overlay 186;; restore cursor color from replace overlay
@@ -738,8 +729,7 @@ Otherwise return the normal value."
738 (viper-move-replace-overlay beg end) 729 (viper-move-replace-overlay beg end)
739 (setq viper-replace-overlay (make-overlay beg end (current-buffer))) 730 (setq viper-replace-overlay (make-overlay beg end (current-buffer)))
740 ;; never detach 731 ;; never detach
741 (overlay-put 732 (overlay-put viper-replace-overlay 'evaporate nil)
742 viper-replace-overlay (if (featurep 'emacs) 'evaporate 'detachable) nil)
743 (overlay-put 733 (overlay-put
744 viper-replace-overlay 'priority viper-replace-overlay-priority) 734 viper-replace-overlay 'priority viper-replace-overlay-priority)
745 ;; If Emacs will start supporting overlay maps, as it currently supports 735 ;; If Emacs will start supporting overlay maps, as it currently supports
@@ -939,10 +929,10 @@ Otherwise return the normal value."
939 (string-to-char key-name)) 929 (string-to-char key-name))
940 ;; Emacs doesn't recognize `return' and `escape' as events on 930 ;; Emacs doesn't recognize `return' and `escape' as events on
941 ;; dumb terminals, so we translate them into characters 931 ;; dumb terminals, so we translate them into characters
942 ((and (featurep 'emacs) (not (viper-window-display-p)) 932 ((and (not (viper-window-display-p))
943 (string= key-name "return")) 933 (string= key-name "return"))
944 ?\C-m) 934 ?\C-m)
945 ((and (featurep 'emacs) (not (viper-window-display-p)) 935 ((and (not (viper-window-display-p))
946 (string= key-name "escape")) 936 (string= key-name "escape"))
947 ?\e) 937 ?\e)
948 ;; pass symbol-event as is 938 ;; pass symbol-event as is
@@ -978,41 +968,28 @@ Otherwise return the normal value."
978(define-obsolete-function-alias 'viper-eventify-list-xemacs 'ignore "27.1") 968(define-obsolete-function-alias 'viper-eventify-list-xemacs 'ignore "27.1")
979 969
980 970
981;; Smooths out the difference between Emacs's unread-command-events 971;; Arg is a character, an event, a list of events or a sequence of
982;; and XEmacs unread-command-event. Arg is a character, an event, a list of 972;; keys.
983;; events or a sequence of keys.
984;; 973;;
985;; Due to the way unread-command-events in Emacs (not XEmacs), a non-event 974;; Due to the way unread-command-events works in Emacs, a non-event
986;; symbol in unread-command-events list may cause Emacs to turn this symbol 975;; symbol in unread-command-events list may cause Emacs to turn this
987;; into an event. Below, we delete nil from event lists, since nil is the most 976;; symbol into an event. Below, we delete nil from event lists, since
988;; common symbol that might appear in this wrong context. 977;; nil is the most common symbol that might appear in this wrong
978;; context.
989(defun viper-set-unread-command-events (arg) 979(defun viper-set-unread-command-events (arg)
990 (if (featurep 'emacs) 980 (setq
991 (setq 981 unread-command-events
992 unread-command-events 982 (let ((new-events
993 (let ((new-events 983 (cond ((eventp arg) (list arg))
994 (cond ((eventp arg) (list arg)) 984 ((listp arg) arg)
995 ((listp arg) arg) 985 ((sequencep arg)
996 ((sequencep arg) 986 (listify-key-sequence arg))
997 (listify-key-sequence arg)) 987 (t (error
998 (t (error 988 "viper-set-unread-command-events: Invalid argument, %S"
999 "viper-set-unread-command-events: Invalid argument, %S" 989 arg)))))
1000 arg))))) 990 (if (not (eventp nil))
1001 (if (not (eventp nil)) 991 (setq new-events (delq nil new-events)))
1002 (setq new-events (delq nil new-events))) 992 (append new-events unread-command-events))))
1003 (append new-events unread-command-events)))
1004 ;; XEmacs
1005 (setq
1006 unread-command-events
1007 (append
1008 (cond ((characterp arg) (list (character-to-event arg)))
1009 ((eventp arg) (list arg))
1010 ((stringp arg) (mapcar 'character-to-event arg))
1011 ((vectorp arg) (append arg nil)) ; turn into list
1012 ((listp arg) nil)
1013 (t (error
1014 "viper-set-unread-command-events: Invalid argument, %S" arg)))
1015 unread-command-events))))
1016 993
1017 994
1018;; Check if vec is a vector of key-press events representing characters 995;; Check if vec is a vector of key-press events representing characters
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 0f5c92c2c9e..7297d998860 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -689,11 +689,10 @@ It also can't undo some Viper settings."
689 (viper-standard-value 'major-mode 689 (viper-standard-value 'major-mode
690 viper-saved-non-viper-variables)) 690 viper-saved-non-viper-variables))
691 691
692 (if (featurep 'emacs) 692 (setq-default
693 (setq-default 693 mark-even-if-inactive
694 mark-even-if-inactive 694 (viper-standard-value
695 (viper-standard-value 695 'mark-even-if-inactive viper-saved-non-viper-variables))
696 'mark-even-if-inactive viper-saved-non-viper-variables)))
697 696
698 ;; Ideally, we would like to be able to de-localize local variables 697 ;; Ideally, we would like to be able to de-localize local variables
699 (unless 698 (unless
@@ -1018,7 +1017,7 @@ Two differences:
1018 (lambda (orig-fun &rest args) 1017 (lambda (orig-fun &rest args)
1019 "Adjust input-method toggling in vi-state." 1018 "Adjust input-method toggling in vi-state."
1020 (if (and viper-special-input-method (eq viper-current-state 'vi-state)) 1019 (if (and viper-special-input-method (eq viper-current-state 'vi-state))
1021 (viper-deactivate-input-method) 1020 (deactivate-input-method)
1022 (apply orig-fun args)))) 1021 (apply orig-fun args))))
1023 1022
1024 ) ; viper-set-hooks 1023 ) ; viper-set-hooks
@@ -1035,8 +1034,7 @@ Two differences:
1035 require-final-newline t) 1034 require-final-newline t)
1036 1035
1037 ;; don't bark when mark is inactive 1036 ;; don't bark when mark is inactive
1038 (if (featurep 'emacs) 1037 (setq mark-even-if-inactive t)
1039 (setq mark-even-if-inactive t))
1040 1038
1041 (setq scroll-step 1) 1039 (setq scroll-step 1)
1042 1040
@@ -1134,9 +1132,7 @@ These two lines must come in the order given."))
1134 (cons 'mode-line-buffer-identification 1132 (cons 'mode-line-buffer-identification
1135 (list (default-value 'mode-line-buffer-identification))) 1133 (list (default-value 'mode-line-buffer-identification)))
1136 (cons 'global-mode-string (list global-mode-string)) 1134 (cons 'global-mode-string (list global-mode-string))
1137 (if (featurep 'emacs) 1135 (cons 'mark-even-if-inactive (list mark-even-if-inactive)))))
1138 (cons 'mark-even-if-inactive (list mark-even-if-inactive)))
1139 )))
1140 1136
1141 1137
1142;; Set some useful macros, advices 1138;; Set some useful macros, advices