I am using web-mode.el
to edit my CSS and HTML files. I am 90% sure that I haven't touched it but, just in case I modified it in the past, you can find the actual web-mode.el
file I'm using here.
I have mapped the shortcut C-cc
to comment-region
in my ~/.emacs
:
(global-set-key "\C-cc" 'comment-region)
This works fine in all other modes but if I try to use it in web-mode I get No comment syntax is defined. Use:
. So, presumably, I need to tell web-mode to use <!--
and -->
for HTML and /*
and */
for CSS. I checked some other mode files and I'm guessing I need something like this for CSS:
(let ((deactivate-mark nil) (comment-start "/*") (comment-end "*/"))
How should I go about editing my web-mode.el
to get my comments to work? Is the above line correct and, if so, where should I add it? Presumably, I would need to add the above (or something like it) to a CSS section of the file and the equivalent to an HTML one.
In the meantime, I would also appreciate a pointer explaining how I can give /*
and */
or <!--
and -->
as answers to the No comment syntax is defined. Use:
prompt.
I am aware of the M-;
shortcut from Web mode but I would rather have the same shortcut since I am very used to it from the various other modes I use where it works. In any case, I want the comment-region
function to work as it does in other modes.