Remove more XEmacs compat code from viper-*.el

* lisp/emulation/viper-cmd.el (viper-submit-report):
* lisp/emulation/viper-init.el (viper-set-insert-cursor-type)
(viper-restore-cursor-type, viper-use-replace-region-delimiters)
(viper-has-face-support-p, viper-window-display-p)
(viper-color-display-p, viper-device-type):
* lisp/emulation/viper-mous.el (viper-mouse-click-search-word)
(viper-mouse-click-insert-word, viper-mouse-click-get-word)
(viper-mouse-click-posn, viper-mouse-click-window):
* lisp/emulation/viper-util.el (viper-abbreviate-file-name)
(viper-set-replace-overlay, viper-maybe-checkout): Remove XEmacs
compat code.
This commit is contained in:
Stefan Kangas 2019-10-21 21:19:25 +02:00
parent 8f9ed4c71d
commit 969f84b694
4 changed files with 19 additions and 52 deletions

View file

@ -4756,14 +4756,12 @@ Please, specify your level now: "))
(defun viper-submit-report ()
"Submit bug report on Viper."
(interactive)
(defvar viper-device-type)
(defvar viper-color-display-p)
(defvar viper-frame-parameters)
(defvar viper-minibuffer-emacs-face)
(defvar viper-minibuffer-vi-face)
(defvar viper-minibuffer-insert-face)
(let ((reporter-prompt-for-summary-p t)
(viper-device-type (viper-device-type))
(viper-color-display-p (if (viper-window-display-p)
(viper-color-display-p)
'non-x))
@ -4824,7 +4822,7 @@ Please, specify your level now: "))
'ex-cycle-through-non-files
'viper-expert-level
'major-mode
'viper-device-type
'window-system
'viper-color-display-p
'viper-frame-parameters
'viper-minibuffer-vi-face

View file

@ -46,21 +46,16 @@
;; Tell whether we are running as a window application or on a TTY
(defsubst viper-device-type ()
(if (featurep 'xemacs)
(device-type (selected-device))
window-system))
(define-obsolete-function-alias 'viper-device-type 'window-system "27.1")
(defun viper-color-display-p ()
(condition-case nil
(if (featurep 'xemacs)
(eq (device-class (selected-device)) 'color)
(display-color-p))
(display-color-p)
(error nil)))
;; in XEmacs: device-type is tty on tty and stream in batch.
(defun viper-window-display-p ()
(and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc)))))
(and window-system (not (memq window-system '(tty stream pc)))))
(defcustom viper-ms-style-os-p (memq system-type '(ms-dos windows-nt))
"Non-nil if Emacs is running under an MS-style OS: MS-DOS, or MS-Windows."
@ -87,7 +82,7 @@ In all likelihood, you don't need to bother with this setting."
(cond ((viper-window-display-p))
(viper-force-faces)
((viper-color-display-p))
(t (memq (viper-device-type) '(pc)))))
(t (memq window-system '(pc)))))
;;; Macros
@ -403,15 +398,6 @@ delete the text being replaced, as in standard Vi."
;; internal var, used to remember the default cursor color of emacs frames
(defvar viper-vi-state-cursor-color nil)
;; Frame-local variables are obsolete from Emacs 22.2 onwards, so we
;; do it by hand with viper-frame-value (qv).
(when (and (featurep 'xemacs)
(fboundp 'make-variable-frame-local))
(make-variable-frame-local 'viper-replace-overlay-cursor-color)
(make-variable-frame-local 'viper-insert-state-cursor-color)
(make-variable-frame-local 'viper-emacs-state-cursor-color)
(make-variable-frame-local 'viper-vi-state-cursor-color))
(viper-deflocalvar viper-replace-overlay nil "")
(put 'viper-replace-overlay 'permanent-local t)
@ -428,8 +414,7 @@ is non-nil."
:type 'string
:group 'viper)
(defcustom viper-use-replace-region-delimiters
(or (not (viper-has-face-support-p))
(and (featurep 'xemacs) (eq (viper-device-type) 'tty)))
(not (viper-has-face-support-p))
"If non-nil, Viper will always use `viper-replace-region-end-delimiter' and
`viper-replace-region-start-delimiter' to delimit replacement regions, even on
color displays. By default, the delimiters are used only on TTYs."
@ -441,15 +426,6 @@ color displays. By default, the delimiters are used only on TTYs."
:type 'symbol
:group 'viper)
;; XEmacs requires glyphs
(when (featurep 'xemacs)
(or (glyphp viper-replace-region-end-delimiter)
(setq viper-replace-region-end-delimiter
(make-glyph viper-replace-region-end-delimiter)))
(or (glyphp viper-replace-region-start-delimiter)
(setq viper-replace-region-start-delimiter
(make-glyph viper-replace-region-start-delimiter))))
;; These are local marker that must be initialized to nil and moved with
;; `viper-move-marker-locally'
;;
@ -949,15 +925,11 @@ Should be set in `viper-custom-file-name'."
(defun viper-restore-cursor-type ()
(condition-case nil
(if (featurep 'xemacs)
(set (make-local-variable 'bar-cursor) nil)
(setq cursor-type (default-value 'cursor-type)))
(setq cursor-type (default-value 'cursor-type))
(error nil)))
(defun viper-set-insert-cursor-type ()
(if (featurep 'xemacs)
(set (make-local-variable 'bar-cursor) 2)
(setq cursor-type '(bar . 2))))
(setq cursor-type '(bar . 2)))
(defun viper-ESC-keyseq-timeout ()
"Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.

View file

@ -109,8 +109,7 @@ considered related."
;; Returns window where click occurs
(defun viper-mouse-click-window (click)
(let ((win (if (featurep 'xemacs) (event-window click)
(posn-window (event-start click)))))
(let ((win (posn-window (event-start click))))
(if (window-live-p win)
win
(error "Click was not over a live window"))))
@ -127,10 +126,10 @@ considered related."
(defsubst viper-mouse-click-window-buffer-name (click)
(buffer-name (viper-mouse-click-window-buffer click)))
;; Returns position of a click
(defsubst viper-mouse-click-posn (click)
(if (featurep 'xemacs) (event-point click)
(posn-point (event-start click))))
"Returns position of a click."
(declare (obsolete nil "27.1"))
(posn-point (event-start click)))
@ -225,7 +224,7 @@ On single or double click, returns the word as determined by
`viper-surrounding-word-function'."
(let ((click-word "")
(click-pos (viper-mouse-click-posn click))
(click-pos (posn-point (event-start click)))
(click-buf (viper-mouse-click-window-buffer click)))
(or (natnump count) (setq count 1))
(or (natnump click-count) (setq click-count 1))
@ -257,8 +256,7 @@ See `viper-surrounding-word' for the definition of a word in this case."
(or (not (eq (key-binding viper-mouse-down-insert-key-parsed)
'viper-mouse-catch-frame-switch))
(not (eq (key-binding viper-mouse-up-insert-key-parsed)
'viper-mouse-click-insert-word))
(and (featurep 'xemacs) (not (event-over-text-area-p click)))))
'viper-mouse-click-insert-word))))
() ; do nothing, if binding isn't right or not over text
;; turn arg into a number
(cond ((integerp arg) nil)
@ -348,8 +346,7 @@ this command.
(or (not (eq (key-binding viper-mouse-down-search-key-parsed)
'viper-mouse-catch-frame-switch))
(not (eq (key-binding viper-mouse-up-search-key-parsed)
'viper-mouse-click-search-word))
(and (featurep 'xemacs) (not (event-over-text-area-p click)))))
'viper-mouse-click-search-word))))
() ; do nothing, if binding isn't right or not over text
(let ((previous-search-string viper-s-string)
click-word click-count)

View file

@ -685,7 +685,7 @@ Otherwise return the normal value."
(y-or-n-p
(format
"File %s is checked in. Check it out? "
(viper-abbreviate-file-name file))))
(abbreviate-file-name file))))
(with-current-buffer buf
(command-execute checkout-function)))))
@ -737,7 +737,7 @@ Otherwise return the normal value."
;; just have keymap attached to replace overlay.
;;(overlay-put
;; viper-replace-overlay
;; (if (featurep 'xemacs) 'keymap 'local-map)
;; 'local-map
;; viper-replace-map)
)
(if (viper-has-face-support-p)
@ -804,8 +804,8 @@ Otherwise return the normal value."
;;; XEmacs compatibility
(defun viper-abbreviate-file-name (file)
(abbreviate-file-name file))
(define-obsolete-function-alias 'viper-abbreviate-file-name
'abbreviate-file-name "27.1")
;; Sit for VAL milliseconds. XEmacs doesn't support the millisecond arg
;; in sit-for, so this function smooths out the differences.