3

I am running through the Bottle tutorial, and the YAsnippet mode for HTML would get me a large share of the productivity bonuses I am used to when crafting Bottle template files (.tpl).

Is there a way to tell YAsnippet to look at the existing entries under html-mode when opening filetypes of the extension .tpl?

yurisich
  • 6,991
  • 7
  • 42
  • 63

3 Answers3

7

Given that the Bottle template files are in bottle-mode, create a file in your snippets folder: /my/snippets/bottle-mode/.yas-parents with this as contents:

html-mode

This will make yasnippet load html-mode snippets for bottle-mode.

Magnar
  • 28,550
  • 8
  • 60
  • 65
  • Couldn't find anything for `bottle-mode`...ended up going with another solution. – yurisich Nov 03 '12 at 01:09
  • FYI @Droogans it's assumed that you'd create the folder `bottle-mode` where you keep your user defined snippets. – ocodo Feb 10 '13 at 22:22
3

One possible solution: associate tpl files with html-mode:

(add-to-list 'auto-mode-alist '("\\.tpl\\'" . html-mode))

Another: copy the directory html-mode in snippets to a directory which has the same name as the mode you use for tpl files.

Oleg Pavliv
  • 20,462
  • 7
  • 59
  • 75
1

Not sure if it is simpler then others, but what I did: created a symlink with the name of the target mode pointing to the snippets directory of the source mode. Eg:

$ ln -s ~/.emacs.d/yasnippets/js-mode ~/.emacs.d/yasnippets/javascript-mode