What is the best code template facility for Emacs? [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 01:30:42
jfs

TextMate's snippets are the most closest match but it is not a cross-platform solution and not for Emacs.

The second closest thing is yasnippet (screencast shows main capabilities). But it interferes with hippie-expand package in my setup and the embedded language is EmacsLisp which I'm not comfortable with outside .emacs.

EDIT: Posted my answer here to allow voting on yasnippet.

Personally, I've been using Dmacro for years (ftp://ftp.sgi.com/other/dmacro/dmacro.tar.gz).

Here's a review of it that also mentions some alternatives: http://linuxgazette.net/issue39/marsden.html

The EmacsWiki has a page of template engines.

Of these, I've used tempo in the (distant) past to add table support to html-helper-mode, but don't know how it has progressed in the last 15 years.

I'd add my vote for tempo snippets ... easy to setup, powerful (you can run arbitrary elisp in your template - so that you can downcase things, lookup filenames & classes, count things, etc), set the indentation, integrate with abbrevs ... I use it a lot ;)

I vote for http://cedet.sourceforge.net/srecode.shtml

It have very clean syntax and has access to code environment through Semantic.

Also it is a part of large well supported CEDET distribution (which was built into Emacs for 24.x version series).

UPDATE https://github.com/capitaomorte/yasnippet is also powerful template engine. But it uses ugly file naming schema (your file name === template name) for you can't put several templates into single file and have issues with national character sets...

You can try a lightweight solution muban.el

It is written completely in Elisp and has a very simple syntax.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!