我是 emacs 的新手,使用 emacs 24 并尝试将 Cc Cc 绑定到一个函数以注释掉一行。我的 init.el 文件中有以下内容,但它似乎不适用于 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++ 键绑定,但我不知道什么或如何修复它?有没有人有任何想法?