This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 查找匹配的括号 | |
(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)) |