help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: matching parenthesis


From: Marc Tfardy
Subject: Re: matching parenthesis
Date: Tue, 26 Jul 2005 09:36:39 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Martin Slouf schrieb:
not exactly what you ask for, but i know this one:

(show-paren-mode 1)
;; define function to match a parenthesis otherwise insert a '~'
(defun goto-match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert '~'."
  (interactive "p")
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
        ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
        (t (self-insert-command (or arg 1)))))
(global-set-key (kbd "~") 'goto-match-paren)

copy to your .emacs and pressing '~' will jump to matching parenthesis instead
of inserting '~' if and only if your point is on the parenthesis

this is not mine function, it was stolen from somenone else by me.

(so i can thank him for it now :)

And I thank too! Very very useful function! It is already in
my .emacs :-)

regards

Marc


reply via email to

[Prev in Thread] Current Thread [Next in Thread]