What happened?
Hello! This is not particular Doom Emacs problem, although I use Doom! I am looking for some seasoned emacs users to point me how to customize quite a complex mode: web-mode.
I am using web-mode to edit Elixir HEEX files, which allow a special syntax for “component tags”, where tag name starts with a dot “.”:
Right now they are not recognized as tags, so all kinds of things are messed up: indent, tag-auto-closing, and so on.
I was trying to find customization options to change how the tag is detected:
- My first bet was to customize these two variables and allow a dot and letter as first tag letter (
[.[:alpha]]
):
In my ~/.doom.d/config.el
:
(setq web-mode-start-tag-regexp "<\\([.[:alpha:]][[:alnum:].:_-]*\\|>\\)")
(setq web-mode-tag-regexp "</?\\([.[:alpha:]][[:alnum:].:_-]*\\)")
I also tried to wrap it in (after! web-mode ... )
or (after! web ... )
.
And this did not work at all.
- I tried to use
web-mode-engine-*
variables which already define Elixir’s<%= ... %>
pair as a block, so I’ve added<. ... >
in a similar way, but that did not work either, and I also suspect that this kind of block might not be treated the same as a HTML tag.
What did you expect to happen?
I’d love the <.link>
and other tags behave like normal html tags!
Steps to reproduce
Create a test.html.heex file and type in the content:
<div>
<p>Would be great to open <.link to={/}>this tag and auto close it</
the last </
will close the </p>
tag, not </.link>
one.
System information
Loading data dump...