joaotavora / yasnippet

A template system for Emacs
http://joaotavora.github.io/yasnippet/
2.81k stars 311 forks source link

How to prevent create `snippets` dir directly under `.emacs.d`? #1155

Open AlynxZhou opened 1 year ago

AlynxZhou commented 1 year ago

I'd like to move this dir to .emacs.d/.local/snippets, but every time it creates .emacs.d/snippets, I tried following config:

(use-package yasnippet
  :ensure t
  :custom
  (yas-snippet-dirs `(,(locate-user-emacs-file ".local/snippets"))))

it accepts this path, but still create the .emacs.d/snippets.

I tried to read the code and I found yas--load-snippet-dirs will create .emacs.d/snippets if it exists in yas-snippet-dirs (https://github.com/joaotavora/yasnippet/blob/master/yasnippet.el#L1983-L1999), though I modified it to exclude .emacs.d/snippets, I think this may be called before user customize yas-snippet-dirs?

Another solution may be that let user custom yas--default-user-snippets-dir instead of making it a constant.