Emacs SLIME是否有在SLIME模式下注释Lisp代码块的快捷键?
我不想在每一行都手动添加分号 规格: Aquamacs 2.1(Emacs 23.2) 黏液2010-11-16 MacPorts CLISP 2.49 Mac OS X 10.6.4 MacBook Pro 5,1看看这里:Emacs SLIME是否有在SLIME模式下注释Lisp代码块的快捷键?,emacs,keyboard-shortcuts,comments,common-lisp,slime,Emacs,Keyboard Shortcuts,Comments,Common Lisp,Slime,我不想在每一行都手动添加分号 规格: Aquamacs 2.1(Emacs 23.2) 黏液2010-11-16 MacPorts CLISP 2.49 Mac OS X 10.6.4 MacBook Pro 5,1看看这里: 它是M-x注释区域,但没有默认的键绑定。如果代码块是Lisp表单,并且您想注释掉该表单,您可以使用slime insert balanced comments(我使用M-xs-I-b-c,slime会自动扩展该命令)。 要取消注释,请使用slime remove b
它是
M-x注释区域
,但没有默认的键绑定。如果代码块是Lisp表单,并且您想注释掉该表单,您可以使用slime insert balanced comments
(我使用M-xs-I-b-c,slime会自动扩展该命令)。
要取消注释,请使用slime remove balanced comments
(M-xs-r-b-c)
我发现这些命令非常有用
此外,我还在.emacs文件中放入了以下块:
;; Comment function
(defun comment-or-uncomment-this (&optional lines)
(interactive "P")
(if mark-active
(if (< (mark) (point))
(comment-or-uncomment-region (mark) (point))
(comment-or-uncomment-region (point) (mark)))
(comment-or-uncomment-region
(line-beginning-position)
(line-end-position lines))))
(global-set-key (kbd "C-;") 'comment-or-uncomment-this)
(其中|
表示点),我首先按)
必要的次数,在正确的位置断开该行,并从该行中分离外圆括号(在这种情况下,将是两次)。Paredit在这里提供了帮助:它重新组织了s-exp,以便将右括号分为两部分,这样您就可以在不打断外部s-exp的情况下对行进行注释。在最后一个示例中,该行变为:
((blah-blah))
|)))))
第一行可以用C-安全地注释掉我相信类似的函数
comment dwim
一定会M-在当前版本的Emacs中,默认情况下为code>。(如果区域处于活动状态,则此操作与注释区域的操作相同,否则会在当前行的末尾添加注释。)
((blah-blah))
|)))))