(if (null mode-cmd)
(with-output-to-temp-buffer "*Help*"
(princ (substitute-command-keys "Possible major modes to switch to: \\{vi-tilde-map}"))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode)))
(setq prefix-arg arg) ; prefix arg will be passed down
(command-execute mode-cmd nil) ; may need to save mode-line-format etc
;; (cond ((string-match "s"))))
(with-output-to-temp-buffer "*Help*"
(princ (documentation 'vi-ex-cmd))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode))))
(defun vi-undefined ()
(interactive)
(message "Command key \"%s\" is undefined in Evi."
- (single-key-description last-command-char))
+ (single-key-description last-command-event))
(ding))
(defun vi-unimplemented ()
(interactive)
(message "Command key \"%s\" is not implemented in Evi."
- (single-key-description last-command-char))
+ (single-key-description last-command-event))
(ding))
;;;;;
(if (null (vi-raw-numeric-prefix arg))
(with-no-warnings
(end-of-buffer))
- (goto-line (vi-prefix-numeric-value arg))))
+ (with-no-warnings (goto-line (vi-prefix-numeric-value arg)))))
(defun vi-beginning-of-buffer ()
"Move point to the beginning of current buffer."
"Go down count lines, try to keep at the same column."
(interactive "p")
(setq this-command 'next-line) ; this is a needed trick
- (if (= (point) (or (line-move count) (point)))
+ (if (= (point) (progn (line-move count) (point)))
(ding) ; no moving, already at end of buffer
(setq last-command 'next-line)))
(defun vi-previous-line-first-nonwhite (count)
"Go up COUNT lines. Stop at first non-white."
(interactive "p")
- (previous-line count)
+ (forward-line (- count))
(back-to-indentation))
(defun vi-scroll-up-window (count)
(defun vi-goto-mark (mark-char &optional line-flag)
"Go to marked position or line (if line-flag is given).
Goto mark '@' means jump into and pop the top mark on the mark ring."
- (cond ((char-equal mark-char last-command-char) ; `` or ''
+ (cond ((char-equal mark-char last-command-event) ; `` or ''
(exchange-point-and-mark) (if line-flag (back-to-indentation)))
((char-equal mark-char ?@) ; jump and pop mark
(set-mark-command t) (if line-flag (back-to-indentation)))
"Replace char after point by CHAR. Repeat COUNT times."
(interactive "p\nc")
(delete-char count nil) ; don't save in kill ring
- (setq last-command-char char)
+ (setq last-command-event char)
(self-insert-command count)
(vi-set-last-change-command 'vi-replace-1-char count char))
the key bindings of the operators being fixed."
(interactive "P")
(catch 'vi-exit-op
- (let ((this-op-char last-command-char))
- (setq last-command-char (read-char))
- (setq this-command (lookup-key vi-com-map (char-to-string last-command-char)))
+ (let ((this-op-char last-command-event))
+ (setq last-command-event (read-char))
+ (setq this-command (lookup-key vi-com-map (char-to-string last-command-event)))
(if (not (eq this-command 'vi-digit-argument))
(setq prefix-arg arg)
(vi-digit-argument arg)
- (setq last-command-char (read-char))
- (setq this-command (lookup-key vi-com-map (char-to-string last-command-char))))
- (cond ((char-equal this-op-char last-command-char) ; line op
+ (setq last-command-event (read-char))
+ (setq this-command (lookup-key vi-com-map (char-to-string last-command-event))))
+ (cond ((char-equal this-op-char last-command-event) ; line op
(vi-execute-op this-op-char 'next-line
(cons (1- (vi-prefix-numeric-value prefix-arg))
(vi-prefix-char-value prefix-arg))))
(setq end (1+ end)))
((eq moving-unit 'line)
(goto-char begin) (beginning-of-line) (setq begin (point))
- (goto-char end) (next-line 1) (beginning-of-line) (setq end (point))))
+ (goto-char end) (forward-line 1) (beginning-of-line) (setq end (point))))
(if (> end (point-max)) (setq end (point-max))) ; force in buffer region
(cons begin end)))))
(t (error "Register %c is not containing text string" reg))))
(if (vi-string-end-with-nl-p put-text) ; put back text as lines
(if after-p
- (progn (next-line 1) (beginning-of-line))
+ (progn (forward-line 1) (beginning-of-line))
(beginning-of-line))
(if after-p (forward-char 1)))
(push-mark (point))
(setq char (read-char))
(vi-ask-for-info char))))
+(declare-function c-mark-function "cc-cmds" ())
+
(defun vi-mark-region (arg region)
"Mark region appropriately. The next char REGION is d(efun),s(-exp),b(uffer),
p(aragraph), P(age), f(unction in C/Pascal etc.), w(ord), e(nd of sentence),