I'm hoping this is possible. I work in a variety of environments and languages. Right now it's mostly django and Node.js, but there have been others. What I would like to do is set the
web-mode engine based on the project I am currently working on, and not the file extension. I know I could use
.djhtml as the file extension, but that messes things up for others who aren't using Emacs because, for example, Pycharm doesn't know what to do with a
.djhtml file. I would prefer to keep my
.html if at all possible.
I am wondering if there is any way to set the
web-mode engine based on the project I'm working in. I'd rather not have to put
-*- engine: django -*- into each of my files either, if I can avoid it.
I've tried adding the following to a
.dir-locals.el file, but it doesn't seem to make a difference. I get prompted to allow the variable change, and the value of the variable
web-mode-engines-alist has changed to
(("django" . "\\.html\\'")), but
django is not set as the template engine when I open a
((web-mode . ((web-mode-engines-alist . (("django" . "\\.html\\'"))))))
To clarify, I can set all
.html files to open with the django engine by putting the following in my
(setq web-mode-engines-alist '(("django" . "\\.html\\'")))
That works just fine, but sets it globally, meaning I'll get the django engine in any
.html file, regardless if it's a django project or another language.
- Emacs: 25.2.1
- OS: Windows 10
I found this bug reported in
web-mode (https://github.com/fxbois/web-mode/issues/799), but it's just referred to be asked as a question here.