Function: viper-paren-match
viper-paren-match is an interactive and byte-compiled function defined
in viper-cmd.el.gz.
Signature
(viper-paren-match ARG)
Documentation
Go to the matching parenthesis.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
;; paren match
;; must correct this to only match ( to ) etc. On the other hand
;; it is good that paren match gets confused, because that way you
;; catch _all_ imbalances.
(defun viper-paren-match (arg)
"Go to the matching parenthesis."
(interactive "P")
(let ((com (viper-getcom arg))
(parse-sexp-ignore-comments viper-parse-sexp-ignore-comments)
anchor-point)
(if (integerp arg)
(if (or (> arg 99) (< arg 1))
(error "Prefix must be between 1 and 99")
(goto-char
(if (> (point-max) 80000)
(* (/ (point-max) 100) arg)
(/ (* (point-max) arg) 100)))
(back-to-indentation))
(let (beg-lim end-lim)
(if (and (eolp) (not (bolp))) (forward-char -1))
(if (not (looking-at "[][(){}]"))
(setq anchor-point (point)))
(setq beg-lim (point-at-bol)
end-lim (point-at-eol))
(cond ((re-search-forward "[][(){}]" end-lim t)
(backward-char) )
((re-search-backward "[][(){}]" beg-lim t))
(t
(error "No matching character on line"))))
(cond ((looking-at "[([{]")
(if com (viper-move-marker-locally 'viper-com-point (point)))
(forward-sexp 1)
(if com
(viper-execute-com 'viper-paren-match nil com)
(backward-char)))
(anchor-point
(if com
(progn
(viper-move-marker-locally 'viper-com-point anchor-point)
(forward-char 1)
(viper-execute-com 'viper-paren-match nil com)
)))
((looking-at "[])}]")
(forward-char)
(if com (viper-move-marker-locally 'viper-com-point (point)))
(backward-sexp 1)
(if com (viper-execute-com 'viper-paren-match nil com)))
(t (user-error viper-ViperBell))))))