如何使emacs的zencoding-mode使用单引号双引号 [英] how to make emacs' zencoding-mode use single quote insted of double quote

查看:280
本文介绍了如何使emacs的zencoding-mode使用单引号双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我找不到关于这个的自定义选项,我的zencoding模式来自 https://github.com/rooney/zencoding

解决方案

它看起来像被硬编码到源代码中,所以没有直接的方法来定制它,这很容易,所以也许你可以向维护者提交一个功能请求。 / p>

在此期间,您需要的是修改版本的 zencoding-make-html-tag \的所有实例替换为。您可以将自定义版本的函数添加到.emacs中,并在Zencoding之后加载它。如下所示:

 (defun my-zencoding-hook()
(zencoding-mode) )
(eval-after-loadzencoding-mode
'(defun zencoding-make-html-tag()
在这里插入您修改后的zencoding-make-html-tag版本
...))

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

更容易出现意外的是,在zencoding-mode.el本身的源代码中进行搜索替换,因为它可以从任何下载到。每当您更新版本时,这将会中断,并可能会破坏其他标记语言的行为,但这样做很简单。


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

解决方案

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.

这篇关于如何使emacs的zencoding-mode使用单引号双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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