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
......@@ -164,7 +164,7 @@
viper-insert-point
(>= (point) viper-insert-point))
(setq viper-last-posn-while-in-insert-state (point-marker)))
(or (viper-overlay-p viper-replace-overlay)
(or (overlayp viper-replace-overlay)
(progn
(viper-set-replace-overlay (point-min) (point-min))
(viper-hide-replace-overlay)))
......@@ -603,7 +603,7 @@
(if (and viper-first-time (not (viper-is-in-minibuffer)))
(viper-mode)
(if overwrite-mode (overwrite-mode -1))
(or (viper-overlay-p viper-replace-overlay)
(or (overlayp viper-replace-overlay)
(viper-set-replace-overlay (point-min) (point-min)))
(viper-hide-replace-overlay)
;; Expand abbrevs iff the previous character has word syntax.
......@@ -639,7 +639,7 @@
(interactive)
(viper-change-state 'insert-state)
(or (viper-overlay-p viper-replace-overlay)
(or (overlayp viper-replace-overlay)
(viper-set-replace-overlay (point-min) (point-min)))
(viper-hide-replace-overlay)
......@@ -686,7 +686,7 @@
(defun viper-change-state-to-emacs (&rest _)
"Change Viper state to Emacs."
(interactive)
(or (viper-overlay-p viper-replace-overlay)
(or (overlayp viper-replace-overlay)
(viper-set-replace-overlay (point-min) (point-min)))
(viper-hide-replace-overlay)
......@@ -759,8 +759,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
;; this-command, last-command-char, last-command-event
(setq this-command com)
;; Emacs represents key sequences as sequences (str or vec)
(setq last-command-event
(viper-copy-event (viper-seq-last-elt key)))
(setq last-command-event (viper-seq-last-elt key))
(if (commandp com)
;; pretend that current state is the state we escaped to
......@@ -831,7 +830,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
(if (memq ch '(?\C-v ?\C-q))
(setq ch (aref (read-key-sequence nil) 0)))
(insert ch)))
(setq last-command-event (viper-copy-event ch))
(setq last-command-event ch)
) ; let
(error nil)
) ; condition-case
......@@ -941,7 +940,7 @@ as a Meta key and any number of multiple escapes are allowed."
(interactive)
(if (and (< viper-expert-level 2) (equal viper-toggle-key "\C-z"))
(if (viper-window-display-p)
(viper-iconify)
(iconify-or-deiconify-frame)
(suspend-emacs))
(viper-change-state-to-emacs)))
......@@ -1016,20 +1015,20 @@ as a Meta key and any number of multiple escapes are allowed."
(let ((viper-intermediate-command 'viper-digit-argument)
value func)
;; read while number
(while (and (viper-characterp event-char)
(while (and (characterp event-char)
(>= event-char ?0) (<= event-char ?9))
(setq value (+ (* (if (integerp value) value 0) 10) (- event-char ?0)))
(setq event-char (viper-read-event-convert-to-char)))
(setq event-char (read-event)))
(setq prefix-arg value)
(if com (setq prefix-arg (cons prefix-arg com)))
(while (eq event-char ?U)
(viper-describe-arg prefix-arg)
(setq event-char (viper-read-event-convert-to-char)))
(setq event-char (read-event)))
(if (or com (and (not (eq viper-current-state 'vi-state))
;; make sure it is a Vi command
(viper-characterp event-char)
(characterp event-char)
(viper-vi-command-p event-char)
))
;; If appears to be one of the vi commands,
......@@ -1154,7 +1153,7 @@ as a Meta key and any number of multiple escapes are allowed."
(if cmd-to-exec-at-end
(progn
(setq last-command-event (viper-copy-event char))
(setq last-command-event char)
(condition-case err
(funcall cmd-to-exec-at-end cmd-info)
(error
......@@ -1176,7 +1175,6 @@ as a Meta key and any number of multiple escapes are allowed."
(defun viper-digit-argument (arg)
"Begin numeric argument for the next command."
(interactive "P")
(viper-leave-region-active)
(viper-prefix-arg-value
(viper-last-command-char) (if (consp arg) (cdr arg) nil)))
......@@ -1197,7 +1195,7 @@ as a Meta key and any number of multiple escapes are allowed."
(t (error viper-InvalidCommandArgument))))
(quit (setq viper-use-register nil)
(signal 'quit nil)))
(viper-deactivate-mark)))
(deactivate-mark)))
;; repeat last destructive command
......@@ -1381,7 +1379,7 @@ as a Meta key and any number of multiple escapes are allowed."
(if (> lines-saved viper-change-notification-threshold)
(unless (viper-is-in-minibuffer)
(message "Saved %d lines" lines-saved)))))
(viper-deactivate-mark)
(deactivate-mark)
(goto-char viper-com-point))
(defun viper-exec-bang (_m-com com)
......@@ -1523,7 +1521,7 @@ If the prefix argument ARG is non-nil, it is used instead of `val'."
;; executed by `.' is already on the ring.
(if (eq last-command 'viper-display-current-destructive-command)
(viper-push-onto-ring viper-d-com 'viper-command-ring))
(viper-deactivate-mark)
(deactivate-mark)
))
(defun viper-repeat-from-history ()
......@@ -2532,7 +2530,6 @@ These keys are ESC, RET, and LineFeed."
"Move point right ARG characters (left if ARG negative).
On reaching end of line, stop and signal error."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2555,7 +2552,6 @@ On reaching end of line, stop and signal error."
"Move point left ARG characters (right if ARG negative).
On reaching beginning of line, stop and signal error."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2688,7 +2684,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-forward-word (arg)
"Forward word."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2709,7 +2704,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-forward-Word (arg)
"Forward word delimited by white characters."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2752,7 +2746,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-end-of-word (arg &optional _careful)
"Move point to end of current word."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2765,7 +2758,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-end-of-Word (arg)
"Forward to end of word delimited by white character."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2800,7 +2792,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-backward-word (arg)
"Backward word."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com
......@@ -2815,7 +2806,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-backward-Word (arg)
"Backward word delimited by white character."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com
......@@ -2836,7 +2826,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-beginning-of-line (arg)
"Go to beginning of line."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2846,7 +2835,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-bol-and-skip-white (arg)
"Beginning of line at first non-white character."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2856,7 +2844,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-goto-eol (arg)
"Go to end of line."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2873,7 +2860,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-goto-col (arg)
"Go to ARG's column."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getcom arg))
line-len)
......@@ -2895,7 +2881,6 @@ On reaching beginning of line, stop and signal error."
(defun viper-next-line (arg)
"Go to next line."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getCom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2930,7 +2915,6 @@ If point is on a widget or a button, simulate clicking on that widget/button."
(if (and (fboundp 'button-at) (fboundp 'push-button) (button-at (point)))
(push-button)
;; not a widget or a button
(viper-leave-region-active)
(save-excursion
(end-of-line)
(if (eobp) (error "Last line in buffer")))
......@@ -2945,7 +2929,6 @@ If point is on a widget or a button, simulate clicking on that widget/button."
(defun viper-previous-line (arg)
"Go to previous line."
(interactive "P")
(viper-leave-region-active)
(let ((val (viper-p-val arg))
(com (viper-getCom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point)))
......@@ -2963,7 +2946,6 @@ If point is on a widget or a button, simulate clicking on that widget/button."
(defun viper-previous-line-at-bol (arg)
"Previous line at beginning of line."
(interactive "P")
(viper-leave-region-active)
(save-excursion
(beginning-of-line)
(if (bobp) (error "First line in buffer")))
......@@ -2998,7 +2980,7 @@ If point is on a widget or a button, simulate clicking on that widget/button."
(let ((val (viper-P-val arg))
(com (viper-getCom arg)))
(viper-move-marker-locally 'viper-com-point (point))
(viper-deactivate-mark)
(deactivate-mark)
(push-mark nil t)
(if (null val)
(goto-char (point-max))
......@@ -3181,7 +3163,7 @@ controlled by the sign of prefix numeric value."
(interactive "P")
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(viper-deactivate-mark)
(deactivate-mark)
(if com (viper-move-marker-locally 'viper-com-point (point)))
(viper-find-char val viper-f-char viper-f-forward viper-f-offset)
(if com
......@@ -3194,7 +3176,7 @@ controlled by the sign of prefix numeric value."
(interactive "P")
(let ((val (viper-p-val arg))
(com (viper-getcom arg)))
(viper-deactivate-mark)
(deactivate-mark)
(if com (viper-move-marker-locally 'viper-com-point (point)))
(viper-find-char val viper-f-char (not viper-f-forward) viper-f-offset)
(if com
......@@ -3210,7 +3192,6 @@ controlled by the sign of prefix numeric value."
(interactive "P")
(let ((val (viper-p-val arg))
(com (viper-getCom arg)))
(viper-leave-region-active)
(if com (viper-move-marker-locally 'viper-com-point (point)))
(push-mark nil t)
(move-to-window-line (1- val))
......@@ -3230,7 +3211,6 @@ controlled by the sign of prefix numeric value."
(interactive "P")
(let ((val (viper-p-val arg))
(com (viper-getCom arg)))
(viper-leave-region-active)
(if com (viper-move-marker-locally 'viper-com-point (point)))
(push-mark nil t)
(move-to-window-line (+ (/ (1- (window-height)) 2) (1- val)))
......@@ -3250,7 +3230,6 @@ controlled by the sign of prefix numeric value."
(interactive "P")
(let ((val (viper-p-val arg))
(com (viper-getCom arg)))
(viper-leave-region-active)
(if com (viper-move-marker-locally 'viper-com-point (point)))
(push-mark nil t)
(move-to-window-line (- val))
......@@ -3316,7 +3295,6 @@ controlled by the sign of prefix numeric value."
(defun viper-paren-match (arg)
"Go to the matching parenthesis."
(interactive "P")
(viper-leave-region-active)
(let ((com (viper-getcom arg))
(parse-sexp-ignore-comments viper-parse-sexp-ignore-comments)
anchor-point)
......@@ -3723,7 +3701,7 @@ Null string will repeat previous search."
(offset (not no-offset))
(case-fold-search viper-case-fold-search)
(start-point (or init-point (point))))
(viper-deactivate-mark)
(deactivate-mark)
(if forward
(condition-case nil
(progn
......@@ -3832,7 +3810,7 @@ Null string will repeat previous search."
;; ?g acts as a default value for viper-buffer-search-char
(setq viper-buffer-search-char ?g)))
(define-key viper-vi-basic-map
(cond ((viper-characterp viper-buffer-search-char)
(cond ((characterp viper-buffer-search-char)
(char-to-string viper-buffer-search-char))
(t (error "viper-buffer-search-char: wrong value type, %S"
viper-buffer-search-char)))
......@@ -3938,7 +3916,7 @@ Null string will repeat previous search."
(forward-line 1))
(beginning-of-line))
(if (not (eolp)) (viper-forward-char-carefully)))
(set-marker (viper-mark-marker) (point) (current-buffer))
(set-marker (mark-marker) (point) (current-buffer))
(viper-set-destructive-command
(list 'viper-put-back val nil viper-use-register nil nil))
(setq sv-point (point))
......@@ -3958,7 +3936,7 @@ Null string will repeat previous search."
(exchange-point-and-mark)
(if (bolp)
(back-to-indentation)))
(viper-deactivate-mark))
(deactivate-mark))
(defun viper-Put-back (arg)
"Put back at point/above line."
......@@ -3983,7 +3961,7 @@ Null string will repeat previous search."
(if (viper-end-with-a-newline-p text) (beginning-of-line))
(viper-set-destructive-command
(list 'viper-Put-back val nil viper-use-register nil nil))
(set-marker (viper-mark-marker) (point) (current-buffer))
(set-marker (mark-marker) (point) (current-buffer))
(setq sv-point (point))
(viper-loop val (viper-yank text))
(setq chars-inserted (abs (- (point) sv-point))
......@@ -4001,7 +3979,7 @@ Null string will repeat previous search."
(exchange-point-and-mark)
(if (bolp)
(back-to-indentation)))
(viper-deactivate-mark))
(deactivate-mark))
;; Copy region to kill-ring.
......@@ -4286,7 +4264,7 @@ and regexp replace."
(interactive)
(let ((char (read-char)))
(cond ((and (<= ?a char) (<= char ?z))
(point-to-register (viper-int-to-char (1+ (- char ?a)))))
(point-to-register (1+ (- char ?a))))
((viper= char ?<) (viper-mark-beginning-of-buffer))
((viper= char ?>) (viper-mark-end-of-buffer))
((viper= char ?.) (viper-set-mark-if-necessary))
......@@ -4322,15 +4300,15 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 step back."
(if (eq last-command 'viper-cycle-through-mark-ring)
()
;; save current mark if the first iteration
(setq mark-ring (delete (viper-mark-marker) mark-ring))
(setq mark-ring (delete (mark-marker) mark-ring))
(if (mark t)
(push-mark (mark t) t)) )
(pop-mark)
(set-mark-command 1)
;; don't duplicate mark on the ring
(setq mark-ring (delete (viper-mark-marker) mark-ring))
(setq mark-ring (delete (mark-marker) mark-ring))
(push-mark sv-pt t)
(viper-deactivate-mark)
(deactivate-mark)
(setq this-command 'viper-cycle-through-mark-ring)
))
......@@ -4356,7 +4334,7 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 step back."
(backward-char 1)))
(cond ((viper-valid-register char '(letter))
(let* ((buff (current-buffer))
(reg (viper-int-to-char (1+ (- char ?a))))
(reg (1+ (- char ?a)))
(text-marker (get-register reg)))
;; If marker points to file that had markers set (and those markers
;; were saved (as e.g., in session.el), then restore those markers
......@@ -4519,7 +4497,7 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 step back."
((viper= ?\] reg)
(viper-heading-end arg))
((viper-valid-register reg '(letter))
(let* ((val (get-register (viper-int-to-char (1+ (- reg ?a)))))
(let* ((val (get-register (1+ (- reg ?a))))
(buf (if (not (markerp val))
(error viper-EmptyTextmarker reg)
(marker-buffer val)))
......@@ -4756,13 +4734,13 @@ Please, specify your level now: "))
(if (and enforce-buffer
(not (equal (current-buffer) (marker-buffer val))))
(error (concat viper-EmptyTextmarker " in this buffer")
(viper-int-to-char (1- (+ char ?a)))))
(1- (+ char ?a))))
(pop-to-buffer (marker-buffer val))
(goto-char val))
((and (consp val) (eq (car val) 'file))
(find-file (cdr val)))
(t
(error viper-EmptyTextmarker (viper-int-to-char (1- (+ char ?a))))))))
(error viper-EmptyTextmarker (1- (+ char ?a)))))))
(defun viper-save-kill-buffer ()
......@@ -4796,14 +4774,14 @@ Please, specify your level now: "))
(viper-frame-parameters (if (fboundp 'frame-parameters)
(frame-parameters (selected-frame))))
(viper-minibuffer-emacs-face (if (viper-has-face-support-p)
(viper-get-face
(facep
viper-minibuffer-emacs-face)
'non-x))
(viper-minibuffer-vi-face (if (viper-has-face-support-p)
(viper-get-face viper-minibuffer-vi-face)
(facep viper-minibuffer-vi-face)
'non-x))
(viper-minibuffer-insert-face (if (viper-has-face-support-p)
(viper-get-face
(facep
viper-minibuffer-insert-face)
'non-x))
varlist salutation window-config)
......
......@@ -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)
......
......@@ -47,34 +47,22 @@
(defalias 'viper-overlay-p
(if (featurep 'xemacs) 'extentp 'overlayp))
(defalias 'viper-make-overlay
(if (featurep 'xemacs) 'make-extent 'make-overlay))
(defalias 'viper-overlay-live-p
(if (featurep 'xemacs) 'extent-live-p 'overlayp))
(defalias 'viper-move-overlay
(if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay))
(defalias 'viper-overlay-start
(if (featurep 'xemacs) 'extent-start-position 'overlay-start))
(defalias 'viper-overlay-end
(if (featurep 'xemacs) 'extent-end-position 'overlay-end))
(defalias 'viper-overlay-get
(if (featurep 'xemacs) 'extent-property 'overlay-get))
(defalias 'viper-overlay-put
(if (featurep 'xemacs) 'set-extent-property 'overlay-put))
(defalias 'viper-read-event
(if (featurep 'xemacs) 'next-command-event 'read-event))
(defalias 'viper-characterp
(if (featurep 'xemacs) 'characterp 'integerp))
(defalias 'viper-int-to-char
(if (featurep 'xemacs) 'int-to-char 'identity))
(defalias 'viper-get-face
(if (featurep 'xemacs) 'get-face 'facep))
(defalias 'viper-color-defined-p
(if (featurep 'xemacs) 'valid-color-name-p 'x-color-defined-p))
(defalias 'viper-iconify
(if (featurep 'xemacs) 'iconify-frame 'iconify-or-deiconify-frame))
(define-obsolete-function-alias 'viper-overlay-p 'overlayp "27.1")
(define-obsolete-function-alias 'viper-make-overlay 'make-overlay "27.1")
(define-obsolete-function-alias 'viper-overlay-live-p 'overlayp "27.1")
(define-obsolete-function-alias 'viper-move-overlay 'move-overlay "27.1")
(define-obsolete-function-alias 'viper-overlay-start 'overlay-start "27.1")
(define-obsolete-function-alias 'viper-overlay-end 'overlay-end "27.1")
(define-obsolete-function-alias 'viper-overlay-get 'overlay-get "27.1")
(define-obsolete-function-alias 'viper-overlay-put 'overlay-put "27.1")
(define-obsolete-function-alias 'viper-read-event 'read-event "27.1")
(define-obsolete-function-alias 'viper-characterp 'integerp "27.1")
(define-obsolete-function-alias 'viper-int-to-char 'identity "27.1")
(define-obsolete-function-alias 'viper-get-face 'facep "27.1")
(define-obsolete-function-alias 'viper-color-defined-p
'x-color-defined-p "27.1")
(define-obsolete-function-alias 'viper-iconify
'iconify-or-deiconify-frame "27.1")
;; CHAR is supposed to be a char or an integer (positive or negative)
......@@ -84,60 +72,50 @@
;; chars.
(defun viper-memq-char (char list)
(cond ((and (integerp char) (>= char 0))
(memq (viper-int-to-char char) list))
(memq char list))
((memq char list))))
;; Check if char-or-int and char are the same as characters
(defun viper-char-equal (char-or-int char)
(cond ((and (integerp char-or-int) (>= char-or-int 0))
(= (viper-int-to-char char-or-int) char))
(= char-or-int char))
((eq char-or-int char))))
;; Like =, but accommodates null and also is t for eq-objects
(defun viper= (char char1)
(cond ((eq char char1) t)
((and (viper-characterp char) (viper-characterp char1))
((and (characterp char) (characterp char1))
(= char char1))
(t nil)))
(defsubst viper-color-display-p ()
(if (featurep 'xemacs) (eq (device-class (selected-device)) 'color)
(x-display-color-p)))
(x-display-color-p))
(defun viper-get-cursor-color (&optional frame)
(if (featurep 'xemacs)
(color-instance-name
(frame-property (or frame (selected-frame)) 'cursor-color))
(cdr (assoc 'cursor-color (frame-parameters)))))
(defun viper-get-cursor-color (&optional _frame)
(cdr (assoc 'cursor-color (frame-parameters))))
(defmacro viper-frame-value (variable)
"Return the value of VARIABLE local to the current frame, if there is one.