Make emacs always close html tags
How can I make emacs always close a sgml-tag (C-c-C-t)?
For example div
, h2
tags work fine but p
or li
do not.
Basically I'm looking for a way of specifin开发者_开发知识库g that I'm always using xhtml when I insert a tag.
You need to turn on sgml-xml-mode
:
When non-nil, tag insertion functions will be XML-compliant.
sgml-mode
attempts to guess whether your buffer is in XHTML (and so turn on sgml-xml-mode
automatically) by looking at the doctype. See the function sgml-xml-guess
. It's expecting to find the string "XHTML"
somewhere in the DTD name.
If you can't get sgml-xml-guess
to work, then you could turn on sgml-xml-mode
explicitly. Perhaps like this:
(add-hook 'html-mode-hook #'(lambda nil (setq sgml-xml-mode t)))
精彩评论