开发者

Make emacs always close html tags

开发者 https://www.devze.com 2023-01-26 11:00 出处:网络
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.

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)))
0

精彩评论

暂无评论...
验证码 换一张
取 消