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.
web-mode
itself, which should support generic commenting commands. Perhaps you can shoot the devs a message, I know they're very active.web-mode
itself. The error comes from an advice (indicatorad-
). But, the only advice I found in raw.githubusercontent.com/fxbois/web-mode/master/web-mode.el is that one ofac-start
(auto-complete) which does not have any arguments. Looks like this has something to do with somedevelock-mode
which I do not know. Terdon should look in his init files fordevelock-mode
and start without it.grep -R develock .emacs.d .emacs
returns nothing. It must be in the site-wide files.M-;
error right? My main objective here is to getM-x comment-region
and my associated shortcut to work. Also, the error seems to have gone away since the last time I tried this. The main issue is still being able to usecomment-region
in web-mode. Presumably by defining the open and close comment signs somewhere.