web-mode
web-mode copied to clipboard
Setting web-mode-content-type correctly in suffix-less shebang nodejs file
I have a nodejs script which I'd like to edit as per my other javascript, in web-mode
.
The script has no .js
suffix - i.e. it's called myscript
rather than myscript.js
. It begins with a shebang, i.e.:
#!/bin/env node
Consequentially, although I can configure emacs to associate this with web-mode
using:
(add-to-list 'interpreter-mode-alist '("node" . web-mode))
(add-to-list 'interpreter-mode-alist '("nodejs" . web-mode))
...When web-mode
starts, it seems unable to infer the content type, and my indentation and syntax highlighting are left at some default, making editing worse than it would be without web-mode.
I can correct this by manually invoking M-x web-mode-set-content-type
and setting it to javascript
. However, there seems to be no way to do this automatically based on the interpreter-mode-alist detection.
Is there some way I've missed to do this? Or if not could something be implemented?
Thanks!