[gnu.emacs] Parenthesis matching when positioned over curser

todd@WHEATIES.AI.MIT.EDU (Todd Cooper) (03/13/89)

>   Has anyone tried to create a lisp mode where the cursor temporarily
>   blinks over the matching parenthesis when POSITIONED over a paren?  I

I have globally set the "%" key so that it will do a match otherwise insert
the paren asked for.  This is like vi mode, except the "%" key is very
overloaded.

(defun vi-type-paren-match (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %."
  (interactive "p")
  (cond ((looking-at "[([{]") (forward-sexp 1) (backward-char))
	((looking-at "[])}]") (forward-char) (backward-sexp 1))
	(t (self-insert-command (or arg 1)))))

---------
Todd Cooper (...!buita!ptltd!todd)
Phoenix Technologies Ltd. (617 551 4107)