让 emacs 始终关闭 html 标签

发布于 2024-10-04 07:42:49 字数 165 浏览 7 评论 0原文

如何让 emacs 始终关闭 sgml 标签 (CcCt)?

例如 divh2 标签可以正常工作,但 pli 则不行。 基本上,我正在寻找一种指定在插入标签时始终使用 xhtml 的方法。

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 specifing that I'm always using xhtml when I insert a tag.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长不大的小祸害 2024-10-11 07:42:49

您需要打开sgml-xml-mode

当非 nil 时,标签插入函数将符合 XML 标准。

sgml-mode 尝试通过查看文档类型来猜测您的缓冲区是否采用 XHTML(因此自动打开 sgml-xml-mode)。请参阅函数 sgml-xml-guess。它期望在 DTD 名称中的某处找到字符串 "XHTML"

如果您无法使 sgml-xml-guess 工作,那么您可以显式打开 sgml-xml-mode。也许像这样:

(add-hook 'html-mode-hook #'(lambda nil (setq sgml-xml-mode t)))

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)))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文