我是新来的Emacs和使用emacs 24并试图与C-C C-C绑定功能注释掉一行。我在我的init.el文件中有以下内容,但似乎在C++中不起作用。为什么我的C-c C-c键盘图工作在C++中?
(defun toggle-comment-on-line()
"comment or uncomment current line"
(interactive)
(comment-or-uncomment-region (line-beginning-position) (line-end-position))
(next-line))
(global-set-key (kbd "C-c C-c") 'toggle-comment-on-line)
当我玩弄在暂存页面它工作正常,当我C-h k C-c C-c
检查显示右功能,但是当我在C++中相同的命令显示我的文字:
C-c C-c runs the command comment-region, which is an interactive
compiled Lisp function in `newcomment.el'.
It is bound to C-c C-c, <menu-bar> <C++> <Comment Out Region>.
(comment-region BEG END &optional ARG)
Comment or uncomment each line in the region.
With just C-u prefix arg, uncomment each line in region BEG .. END.
Numeric prefix ARG means use ARG comment characters.
If ARG is negative, delete that many comment characters instead.
The strings used as comment starts are built from `comment-start'
and `comment-padding'; the strings used as comment ends are built
from `comment-end' and `comment-padding'.
By default, the `comment-start' markers are inserted at the
current indentation of the region, and comments are terminated on
each line (even for syntaxes in which newline does not end the
comment and blank lines do not get comments). This can be
changed with `comment-style'.
我认为别的东西是压倒C++的按键组合,但我不知道是什么或如何解决呢?有没有人有任何想法?
你尝试内置的命令'评论-dwim',可在'M-;'在所有模式? – lunaryorn