Reputation: 23749
I have the following code in .emacs:
;yasnippet
;;{{{
(load (concat *my-emacs-lib-dir* "plugins/yasnippet/yasnippet"))
(setq yas/snippet-dirs nil)
(yas/initialize)
;; Develop and keep personal snippets under ~/emacs.d/yasnippets
(setq yas/root-directory (concat *my-emacs-lib-dir* "yasnippets"))
(yas/load-directory yas/root-directory)
;;}}}
(add-hook 'javascript-mode-hook (lambda () (yas/minor-mode-on)))
I have snippet files in *my-emacs-lib-dir* "yasnippets/javascript-mode"
and in *my-emacs-lib-dir* "yasnippets/php-mode"
.
It works well for php-mode and doesn't work for javascript-mode. The settings are identical, the files are ok. What can be the reason?
Upvotes: 2
Views: 1050
Reputation: 87229
Are you sure that javascript files are opened in javascript-mode
? Look to the value of major-mode
variable (with C-h v
), and if it's different from javascript-mode
, then create new directory with name of this mode, and add the file .yas-parents
inside this directory. Put javascript-mode
inside this file, and save...
Upvotes: 4