如何制作 emacs' zencoding-mode 使用单引号代替双引号

发布于 2024-12-15 18:57:27 字数 187 浏览 4 评论 0原文

我在编写html时使用单引号,但是zencoding-mode的扩展代码使用双引号。

我找不到关于此的自定义选项,我的 zencoding-mode 来自 https://github.com/rooney/禅编码

I use single quote when writing html, but zencoding-mode's expanding code use double quote.

I can't find a customize option about this, my zencoding-mode comes from https://github.com/rooney/zencoding

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

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

发布评论

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

评论(1

黯然 2024-12-22 18:57:27

看起来 " 被硬编码到源代码中,因此没有直接的方法来自定义它。这很容易做到,所以也许您可以向维护者提交功能请求。

在同时,看起来您需要的是 zencoding-make-html-tag 的修改版本,将 "\"" 的所有实例替换为 "'"。您可以将函数的自定义版本添加到 .emacs 中,并使用挂钩在 zencoding 后加载它。像下面这样的事情可能会做到这一点:

(defun my-zencoding-hook ()
    (zencoding-mode))
(eval-after-load "zencoding-mode"
    '(defun zencoding-make-html-tag ()
       "Insert your modified version of zencoding-make-html-tag here"
       ...))

(add-hook 'sgml-mode-hook 'my-zencoding-hook)

更简单但更容易出现意外的是在 zencoding-mode.el 本身的源代码中进行搜索和替换,因为它从您下载到的任何地方运行。每当您更新版本时,这都会中断,并且可能会中断其他标记语言的行为,但它既快速又简单。

It looks like the " is hard-coded into the source, so there's not direct way to customize it. It would be easy to do, so perhaps you could submit a feature request to the maintainer.

In the meantime, it looks like what you need is a modified version of zencoding-make-html-tag, replacing all instances of "\"" with "'". You could add a custom version of the function to your .emacs, with a hook to load it after zencoding. Something like the following might do it:

(defun my-zencoding-hook ()
    (zencoding-mode))
(eval-after-load "zencoding-mode"
    '(defun zencoding-make-html-tag ()
       "Insert your modified version of zencoding-make-html-tag here"
       ...))

(add-hook 'sgml-mode-hook 'my-zencoding-hook)

Easier but more prone to surprises would be to do a search-and-replace in the source of zencoding-mode.el itself, since it runs from wherever you downloaded it to. This will break whenever you update your version, and might break behaviour for other markup languages, but it's quick and easy.

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