使emacs始终关闭html标签 [英] Make emacs always close html tags

查看:185
本文介绍了使emacs始终关闭html标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使emacs总是关闭sgml标签(CcCt)?

How can I make emacs always close a sgml-tag (C-c-C-t)?

例如 div h2 标签工作正常,但 p li 不要。
基本上我正在寻找一种指定我在插入标签时总是使用xhtml的方法。

For example div, h2 tags work fine but p or li do not. Basically I'm looking for a way of specifing that I'm always using xhtml when I insert a tag.

推荐答案

p>您需要打开 sgml-xml-mode


-nil,标签插入功能将符合XML标准。

When non-nil, tag insertion functions will be XML-compliant.

sgml-mode sgml-xml-mode 。请参阅函数 sgml-xml-guess 。它希望在DTD名称的某处找到字符串XHTML

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.

如果您无法获得 sgml-xml-guess 工作,那么你可以明确地打开 sgml-xml-mode 。也许是这样的:

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

这篇关于使emacs始终关闭html标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆