New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable some sgml dom-specific feature #64
Comments
Are you sure this is an sgml-mode feature? I don't have it on Emacs 25.3 |
sgml-mode does this for me in Emacs 26. web-mode does this as well |
I don't have this in sgml-mode on Emacs 26 -- is it possible it's one of your minor modes? |
Yes, you're right. I did an experiment with But for some reason it doesn't work with |
Great -- I was able to find how this works in sgml mode. The key difference is that the sgml syntax table sets I looked at how web-mode handles this, and they're using their own post-command handler. I think it would be a great addition to rjsx if someone wanted to add something like that. The relevant bit from web mode (slightly edited) is below in case anyone wants to adapt this for use in rjsx. We'd have to add text properties to the (cond
((and web-mode-enable-auto-opening
(member this-command '(newline electric-newline-and-maybe-indent newline-and-indent))
(and (not (eobp))
(eq (char-after) ?\<)
(eq (get-text-property (point) 'tag-type) 'end)
(looking-back ">\n[ \t]*" (point-min))
(setq n (length (match-string-no-properties 0)))
(eq (get-text-property (- (point) n) 'tag-type) 'start)
(string= (get-text-property (- (point) n) 'tag-name)
(get-text-property (point) 'tag-name))))
(newline-and-indent)
(forward-line -1)
(indent-according-to-mode))) |
IMHO, all these paren matching/filling/point positioning facilities are best done using smartparens. Smartparens is best-in-class in its ability to navigate and manipulate mixed "parens". Instead of reinventing some of these bit by bit, might as well look into how best to leverage the other library. |
Can smartparens handle this electric indent behavior? I've been thinking about adding a section to the README about "suggested other modes" or similar |
Expect to add some dom feature related to sgml-mode
The text was updated successfully, but these errors were encountered: