emacs에서 goto-matching parenthesis

happibum의 이미지

(defun my-match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %.
   This one respects show-paren-mode's matching style."
  (interactive "p")
  (cond ((looking-at "\\s\(")
	 (forward-list 1))
        ((save-excursion (backward-char 1) (looking-at "\\s\)"))
	 (backward-list 1))
        (t
	 (self-insert-command (or arg 1)))))
(global-set-key (kbd "%") 'my-match-paren)

http://www.emacswiki.org/cgi-bin/wiki/MatchParenthesis에 있는걸 show-paren-mode가 highlight해서 보여주는 거에 맞게 동작하도록 살짝 고친 것입니다. 허접 tip 이었습니다. ^^;;

Forums: 
madman93의 이미지

이게 무슨 기능을 하는 건지 초보자를 위해서 간략하게
설명좀 부탁 드릴게요

---------------------------------------------
git init
git add .
git commit -am "project init"
---------------------------------------------

wafe의 이미지

vim에서는 괄호 (), {}, [] 위에 커서를 두고 '%'를 누르면 매칭되는 괄호로 커서를 움직여 줍니다. 이맥스에 이런 기능을 구현해주는 elisp 코드이군요.

Heejoon Lee

madman93의 이미지

감사합니다...

---------------------------------------------
git init
git add .
git commit -am "project init"
---------------------------------------------