[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: match if-then-else, brackets etc.
From: |
Francois Fleuret |
Subject: |
Re: match if-then-else, brackets etc. |
Date: |
10 Apr 2003 17:33:02 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
Hi,
Detlef Jockheck wrote on 10 Apr 2003 16:26:20 MET:
> whenever I analyze a programm in c, perl or pythen I have some
> problems to find the matching statement. Thant means I'm looking for
> the end of an if-declaration. Or where does this bracket belong
> to. Is there a plugin to hilight this dependencies in emacs?
This will highlight the matching parenthesis/curly bracket/whatever:
,----
| (setq show-paren-delay 0)
| (show-paren-mode t)
`----
And this will make control-right to move the cursor to the matching
parenthesis/curly bracket/whatever
,----
| (defun match-paren (arg)
| "Go to the matching parenthesis"
| (interactive "p")
| (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
| ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
| (t (condition-case nil (progn (re-search-forward "\\s\(")
(backward-char 1)) (error nil)))
| ))
|
| (define-key global-map [(control right)] 'match-paren)
`----
Regards,
FF