Commit dfec2bc7 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Remove most of the XEmacs compat code from viper*.el

* lisp/emulation/viper-cmd.el ()
(viper-insert-state-post-command-sentinel)
(viper-change-state-to-vi, viper-change-state-to-insert)
(viper-change-state-to-emacs, viper-escape-to-state)
(viper-special-read-and-insert-char, viper-toggle-key-action)
(viper-prefix-arg-value, viper-prefix-arg-com)
(viper-digit-argument, viper-command-argument, )
(viper-exec-Yank, viper-repeat, viper-forward-char)
(viper-backward-char, viper-forward-word, viper-forward-Word)
(viper-end-of-word, viper-end-of-Word, viper-backward-word)
(viper-backward-Word, viper-beginning-of-line)
(viper-bol-and-skip-white, viper-goto-eol, viper-goto-col)
(viper-next-line, viper-next-line-at-bol, viper-previous-line)
(viper-previous-line-at-bol, viper-goto-line, )
(viper-repeat-find, viper-repeat-find-opposite)
(viper-window-top, viper-window-middle, viper-window-bottom)
(viper-paren-match, viper-search, viper-buffer-search-enable)
(viper-put-back, viper-Put-back, viper-mark-point)
(viper-cycle-through-mark-ring, viper-goto-mark-subr)
(viper-brac-function, viper-register-to-point)
(viper-submit-report): Remove some XEmacs compat code.

* lisp/emulation/viper-ex.el (viper-get-ex-address-subr)
(viper-handle-!, ex-edit, ex-mark, ex-next-related-buffer)
(ex-help, ex-write, ex-write-info, viper-info-on-file): Ditto.

* lisp/emulation/viper-keym.el (viper-add-keymap): Ditto.

* lisp/emulation/viper-macs.el (viper-record-kbd-macro): Remove
XEmacs compat code.

* lisp/emulation/viper-mous.el (viper-mouse-click-insert-word)
(viper-mouse-click-search-word): Remove some XEmacs compat code.

* lisp/emulation/viper-util.el (viper-overlay-p)
(viper-color-defined-p, viper-iconify, viper-memq-char)
(viper-char-equal, viper=, viper-color-display-p)
(viper-get-cursor-color, viper-frame-value)
(viper-change-cursor-color, viper-save-cursor-color)
(viper-restore-cursor-color, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-put-on-search-overlay)
(viper-flash-search-pattern, viper-hide-search-overlay)
(viper-move-replace-overlay, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-hide-replace-overlay)
(viper-replace-start, viper-replace-end)
(viper-set-minibuffer-overlay, viper-check-minibuffer-overlay)
(viper-abbreviate-file-name, viper-mark-marker)
(viper-set-mark-if-necessary, viper-leave-region-active)
(viper-copy-event, viper-read-event-convert-to-char)
(viper-event-key, viper-last-command-char)
(viper-key-to-emacs-key, viper-eventify-list-xemacs)
(viper-set-unread-command-events, viper-char-array-p)
(viper-key-press-events-to-chars, viper-read-char-exclusive):
Remove most of the XEmacs compat code.

* lisp/emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings): Remove some XEmacs compat code.
parent 82aeaf16
This diff is collapsed.
......@@ -882,7 +882,8 @@ reversed."
(exchange-point-and-mark)
(goto-char
(viper-register-to-point
(viper-int-to-char (1+ (- ex-token ?a))) 'enforce-buffer)))
(1+ (- ex-token ?a)))
'enforce-buffer))
(setq address (point-marker)))))
address))
......@@ -1085,7 +1086,7 @@ reversed."
(defun viper-handle-! ()
(interactive)
(if (and (string=
(buffer-string) (viper-abbreviate-file-name default-directory))
(buffer-string) (abbreviate-file-name default-directory))
(member ex-token '("read" "write")))
(erase-buffer))
(insert "!"))
......@@ -1263,7 +1264,7 @@ reversed."
(if (not file)
(viper-get-ex-file))
(cond ((and (string= ex-file "") buffer-file-name)
(setq ex-file (viper-abbreviate-file-name (buffer-file-name))))
(setq ex-file (abbreviate-file-name (buffer-file-name))))
((string= ex-file "")
(error viper-NoFileSpecified)))
......@@ -1480,7 +1481,7 @@ reversed."
(error "`%s' requires a following letter" ex-token))))
(save-excursion
(goto-char (car ex-addresses))
(point-to-register (viper-int-to-char (1+ (- char ?a)))))))
(point-to-register (1+ (- char ?a))))))
......@@ -1547,7 +1548,7 @@ reversed."
(if (not (viper-buffer-live-p buf))
(error "Didn't find buffer %S or file %S"
file-or-buffer-name
(viper-abbreviate-file-name
(abbreviate-file-name
(expand-file-name file-or-buffer-name))))
(if (equal buf (current-buffer))
......@@ -1562,7 +1563,7 @@ reversed."
;; setup buffer
(if (setq wind (viper-get-visible-buffer-window buf))
()
(setq wind (get-lru-window (if (featurep 'xemacs) nil 'visible)))
(setq wind (get-lru-window 'visible))
(set-window-buffer wind buf))
(if (viper-window-display-p)
......@@ -1884,17 +1885,15 @@ reversed."
(condition-case nil
(progn
(pop-to-buffer (get-buffer-create "*info*"))
(info (if (featurep 'xemacs) "viper.info" "viper"))
(info "viper")
(message "Type `i' to search for a specific topic"))
(error (beep 1)
(with-output-to-temp-buffer " *viper-info*"
(princ (format "
The Info file for Viper does not seem to be installed.
This file is part of the standard distribution of %sEmacs.
Please contact your system administrator. "
(if (featurep 'xemacs) "X" "")
))))))
This file is part of the standard distribution of Emacs.
Please contact your system administrator. "))))))
;; Ex source command.
;; Loads the file specified as argument or viper-custom-file-name.
......@@ -2089,9 +2088,7 @@ Please contact your system administrator. "
;; create temp buffer for the region
(setq temp-buf (get-buffer-create " *ex-write*"))
(set-buffer temp-buf)
(if (featurep 'xemacs)
(set-visited-file-name ex-file)
(set-visited-file-name ex-file 'noquery))
(set-visited-file-name ex-file 'noquery)
(erase-buffer)
(if (and file-exists ex-append)
(insert-file-contents ex-file))
......@@ -2130,7 +2127,7 @@ Please contact your system administrator. "
(defun ex-write-info (exists file-name beg end)
(message "`%s'%s %d lines, %d characters"
(viper-abbreviate-file-name file-name)
(abbreviate-file-name file-name)
(if exists "" " [New file]")
(count-lines beg (min (1+ end) (point-max)))
(- end beg)))
......@@ -2226,9 +2223,9 @@ Type `mak ' (including the space) to run make with no args."
lines file info)
(setq lines (count-lines (point-min) (viper-line-pos 'end))
file (cond ((buffer-file-name)
(concat (viper-abbreviate-file-name (buffer-file-name)) ":"))
(concat (abbreviate-file-name (buffer-file-name)) ":"))
((buffer-file-name (buffer-base-buffer))
(concat (viper-abbreviate-file-name (buffer-file-name (buffer-base-buffer))) " (indirect buffer):"))
(concat (abbreviate-file-name (buffer-file-name (buffer-base-buffer))) " (indirect buffer):"))
(t (concat (buffer-name) " [Not visiting any file]:")))
info (format "line=%d/%d pos=%d/%d col=%d %s"
(if (= pos1 pos2)
......
......@@ -642,12 +642,8 @@ Arguments: (major-mode viper-state keymap)"
(defun viper-add-keymap (mapsrc mapdst)
"Add contents of mapsrc to mapdst. It is assumed that mapsrc is sparse."
(if (featurep 'xemacs)
;; Emacs 22 has map-keymap.
(map-keymap (lambda (key binding) (define-key mapdst key binding))
mapsrc)
(mapc (lambda (p) (define-key mapdst (vector (car p)) (cdr p)))
(cdr mapsrc))))
(mapc (lambda (p) (define-key mapdst (vector (car p)) (cdr p)))
(cdr mapsrc)))
(defun viper-modify-keymap (map alist)
"Modifies MAP with bindings specified in the ALIST. The alist has the
......
......@@ -415,7 +415,7 @@ If SCOPE is nil, the user is asked to specify the scope."
t)))
(if (y-or-n-p
(format "Save this macro in %s? "
(viper-abbreviate-file-name viper-custom-file-name)))
(abbreviate-file-name viper-custom-file-name)))
(viper-save-string-in-file
(format "\n(viper-record-kbd-macro %S '%S %s '%S)"
(viper-display-macro macro-name)
......
......@@ -280,7 +280,7 @@ See `viper-surrounding-word' for the definition of a word in this case."
;; the next pending event is not a mouse event, we execute the
;; current mouse event
(progn
(setq interrupting-event (viper-read-event))
(setq interrupting-event (read-event))
(viper-mouse-event-p last-input-event)))
(progn ; interrupted wait
(setq viper-global-prefix-argument arg)
......@@ -362,7 +362,7 @@ this command."
;; pending event is not a mouse event, we execute the current mouse
;; event
(progn
(viper-read-event)
(read-event)
(viper-mouse-event-p last-input-event)))
(progn ; interrupted wait
(setq viper-global-prefix-argument (or viper-global-prefix-argument
......@@ -380,7 +380,7 @@ this command."
viper-global-prefix-argument nil))
(setq arg (or arg 1))
(viper-deactivate-mark)
(deactivate-mark)
(if (or (not (string= click-word viper-s-string))
(not (markerp viper-search-start-marker))
(not (equal (marker-buffer viper-search-start-marker)
......
This diff is collapsed.
......@@ -700,8 +700,6 @@ It also can't undo some Viper settings."
(and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
(viper-delocalize-var 'minor-mode-map-alist))
(viper-delocalize-var 'require-final-newline)
(if (featurep 'xemacs) (viper-delocalize-var 'bar-cursor))
;; deactivate all advices done by Viper.
(viper--deactivate-advice-list)
......@@ -787,8 +785,6 @@ It also can't undo some Viper settings."
;; In emacs, we have to advice handle-switch-frame
;; This advice is undone earlier, when all advices matching "viper-" are
;; deactivated.
(if (featurep 'xemacs)
(remove-hook 'mouse-leave-frame-hook #'viper-remember-current-frame))
) ; end viper-go-away
......@@ -935,15 +931,7 @@ Two differences:
(lambda (orig-fun &rest args)
;; FIXME: Use remapping?
(if (and (eq viper-current-state 'vi-state)
;; Do not use called-interactively-p here. XEmacs does not have it
;; and interactive-p is just fine.
(if (featurep 'xemacs)
(interactive-p)
;; Respect the spirit of the above comment, though it
;; seems pointless, since XE doesn't have advice-add or
;; lexical binding or any other of the newer features
;; this file uses.
(called-interactively-p 'interactive)))
(called-interactively-p 'interactive))
(beep 1)
(apply orig-fun args))))
......@@ -1083,13 +1071,11 @@ This may be needed if the previous `:map' command terminated abnormally."
;; catch frame switching event
(if (viper-window-display-p)
(if (featurep 'xemacs)
(add-hook 'mouse-leave-frame-hook
#'viper-remember-current-frame)
(viper--advice-add 'handle-switch-frame :before
(lambda (&rest _)
"Remember the selected frame before the switch-frame event."
(viper-remember-current-frame (selected-frame))))))
(viper--advice-add
'handle-switch-frame :before
(lambda (&rest _)
"Remember the selected frame before the switch-frame event."
(viper-remember-current-frame (selected-frame)))))
) ; end viper-non-hook-settings
......
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