Emacs Delete Match Lisp Language

xiaoxiao2021-03-05  17

Just written LISP, the most headache is that the match between () is unclear.

Although there is a (Show-Paren-Mode 1), only the cursor is valid on ().

Try to write a function, C-0 deletes the statement where the cursor is located, and then restore it.

(Defun Kill-Paren ()

"Kill Matched Paren in Elisp, Repeat Undo the Kill"

(Interactive "*")

(if (EQ Last-Command 'Kill-Paren)

(Undo)

(LET (START END)

(Save-ExcURSION

(RE-Search-backward "// s / (")

(SetQ Start (Point))

(Forward-List)

(setq end (point))

(Kill-Region Start End)

(setq this-command 'kill-paren)))))))))))))

(global-set-key [(Control? 0)] 'Kill-Paren

转载请注明原文地址:https://www.9cbs.com/read-38616.html

New Post(0)