Skip to content

Instantly share code, notes, and snippets.

View aborn's full-sized avatar

Aborn Jiang aborn

View GitHub Profile
;; 查找匹配的括号
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %.
If position just right in middle of (), only insert %."
(interactive "p")
(cond
((and (char-equal (char-after) ?\))
(char-equal (char-before) ?\()) (self-insert-command (or arg 1)))
((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))