I have a custom comment-dwim-line
command that I want to bind to the key combination C-M-;
(in other words, control
, meta
and ;
buttons pressed simultaneously). The built-in comment-dwim
command is bound to M-;
by default, and I want to keep this binding.
So far I have tried:
(global-set-key "\C-M-;" 'comment-dwim-line)
which throws global-set-key: Key sequence RET - ; starts with non-prefix key RET
.
(global-set-key "\C-\M-;" 'comment-dwim-line)
which throws load-with-code-conversion: Invalid modifier in string
.
(global-set-key "C-\M-;" 'comment-dwim-line)
which throws global-set-key: Key sequence C - M-; starts with non-prefix key C
.
(global-set-key [?\C-M-;] 'next-line)
which throws read--expression: Invalid read syntax: "?"
.
(global-set-key [?\C-\M-;] 'next-line)
which throws Symbol's value as variable is void: M-
.
Finally
(global-set-key (kbd "C-M-;") 'comment-dwim-line)
does not throw an error, but the key binding has no effect: when I actually press C-M-;
it behaves the same as M-;
(default comment-dwim
is called).
I am using Emacs 24.4 on Mac OS X 10.10, running in iTerm2.
(kbd "C-M-;")
. That's what I use - could you update with that error message?(global-set-key (kbd "C-M-;") 'comment-dwim-line
.