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