向 nXhtml 添加子模式
最近从 XEmacs 跳转到 GNU Emacs,我真的很喜欢使用 nXhtml 模式来编写 Web 代码。不过,我希望能够向其中添加子模式,但我不确定如何添加。似乎没有一个很好的参考这样做。
我有 Perl 模板工具包的模式,加载为 tt-mode 和 .tmpl 文件的默认模式,并且我想对我的 .tmpl 文件使用 nXhtml,tt-mode 仅在 [% 之间接管%]
标签。
Having made the jump just recently from XEmacs to GNU Emacs, I'm really loving nXhtml mode for writing web code. I'd like to be able to add a sub mode to it, though, and I'm not sure how. There doesn't seem to be a good reference to do so.
I have a mode for Perl's Template Toolkit, loaded as tt-mode and the default for .tmpl files, and I'd like to use nXhtml for my .tmpl files, with tt-mode taking over only between the [% %]
tags.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,看来(经过一番挖掘),模式是在 util/mumamo-fun.el 中定义的,并且已经定义了 Template Toolkit 模式。
编辑:拿出我关于自动加载问题的原始笔记,因为我做了一些愚蠢的事情。 :P)
自动设置非常简单:
瞧!
看起来设置其他新模式是一个相当简单的过程。 util/mumamo-fun.el 包含所有子模式的模板。按照该格式,它定义了用于查找定义特定子模式的缓冲区块的函数,然后将它们与其他块(如内联 css 和 javascript 等)构建成 mumamo 可以理解的内容。不过,我实际上并没有尝试构建不同的模式,所以我不确定是否需要完成任何额外的工作,但一旦定义,它们似乎会自动注册到 mumamo。
Well, it appears (after some digging), that modes are defined in util/mumamo-fun.el, and there is already a Template Toolkit mode defined.
EDIT: Took out my original notes about having a problem with automatically loading it, because I was doing something dumb. :P)
Setting it up automatically was pretty simple:
Voila!
It looks like setting up other new modes is a fairly simple process. util/mumamo-fun.el contains the templates for all of the submodes. Following that format, it defines functions for finding chunks of the buffer that define a certain submode, and then builds them with other chunks (like the inline css and javascript, etc) into something that mumamo understands. I haven't actually tried to build a different mode, though, so I'm not sure if there is any additional work that needs to be done, but once defined, they seem to be registered with mumamo automatically.