我希望键绑定C-;
打印console.log();
,然后返回两个字符,以便将光标放在括号的中间。这是我编写的代码:
(global-set-key (kbd "C-;") 'print-command)
(defun print-command ()
(interactive)
"console.log();"
(backward-char)
(backward-char)
)
[执行时,光标确实返回了两个字符,但未打印console.log();
。我该如何解决?
(defun insert-console-log ()
(interactive)
(insert "console.log();")
(backward-char 2))