Gabriel Saldaña's blog

personal blog, photography and programming

Make Emacs yasnippet work with html-helper-mode

code
Yasnippet is a great emacs minor mode that lets you have lots of code snippets easily at hand. Also you can create your own snippets in a very easy way without needing to write them in emacs lisp. Basically, like textmate shortcuts for emacs.

I use html-helper-mode to edit all my html code, but yasnippet works with html-mode only out-of-the-box. To make it work with html-helper-mode, add ‘html-helper-mode-hook’ to yasnippet.el on line 121:

It should look like this:

'(ruby-mode-hook actionscript-mode-hook ox-mode-hook python-mode-hook html-helper-mode-hook))

Then make a symlink to html-mode on the snippets folder. Assuming you are on yasnippets snippets/text-mode/ directory, type:


ln -s html-mode/ html-helper-mode

And now all html snippets will be available on html-helper-mode too.

Image is Creative Commons byitspaulkelly

About the author

Gabriel Saldaña Gabriel Saldaña is a web developer, photographer and free software advocate. Connect with him on and Twitter

Posted Under
Tagged

Post navigation

2 thoughts on “Make Emacs yasnippet work with html-helper-mode

  1. Christos Trochalakis says:

    Hello, thanks for that!

    Why don’t you send a patch to the yasnippet?

  2. Christos Trochalakis,

    well, its not really a patch, its more like a hack or workaround. I don’t think it will be accepted since it needs a symlink. I’ll take a deeper look at the code to see if I can come up with a real patch.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: