I'm using web-mode and yasnippet for coding PHP and HTML.
To use yasnippet in web-mode, will have to install php-mode, php-auto-yasnippets, emmet-mode and ac-emmet as suggested in web-mode.org. But I prefer to make it happen just with web-mode and yasnippet.
Part of my web-mode configuration is like this:
(defadvice yas-expand-from-trigger-key (before web-mode-before-yas-expand activate) (run-hooks 'web-mode-cur-language-mode-hook)) (add-hook 'web-mode-cur-language-mode-hook '(lambda () (let ((web-mode-cur-language (web-mode-language-at-pos))) (if (string= web-mode-cur-language "php") (yas-activate-extra-mode 'php-mode) (yas-deactivate-extra-mode 'php-mode)) (if (string= web-mode-cur-language "html") (yas-activate-extra-mode 'html-mode) (yas-deactivate-extra-mode 'html-mode)) )))
And following is my yasnippet configuration:
(add-to-list 'load-path (expand-file-name "elpa/yasnippet" user-emacs-directory)) (require 'yasnippet) (yas-global-mode 1)
It works very well when edit php file in web-mode.
Then open a html file in emacs, input "form" then "tab", everything works fine. But if input "href" then "tab", nothing happened. It supposed to call the "href" snippet in nxml-mode as written in html-mode's .yas-parents.
How could I make this right? I really don't want copy all those snippets from nxml-mode to html-mode.