I'm using web-mode and I want yasnippet to use the modes according to (web-mode-language-at-pos)?
is that possible?
This is what I tried (in .emacs):
(defun expand-for-web-mode ()
(when (equal mode-name "Web") ; not sure if that's the preffered way
(setq yas-extra-modes
(let ((web-lang (web-mode-language-at-pos)))
(when (equal web-lang "html") '(html-mode))
(when (equal web-lang "css") '(css-mode))
(when (equal web-lang "javascript") '(js-mode) '(js2-mode))
))
))
(add-hook 'yas-before-expand-snippet-hook 'expand-for-web-mode)
it only works the first time a snippet is expanded, is there some other hook I haven't seen, or should I use another keybinding for <TAB> in web-mode and set the variable there (and then call yasnippet/expand-snippet)?