Point existing YAsnippet mode to a new filetype

330 Views Asked by At

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?

3

There are 3 best solutions below

0
On BEST ANSWER

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.

2
On

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.

0
On

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