Some yasnippet loading tweaks
- Don't enable yasnippet before setting folders (avoid explicitly loading them) - Require yasnippet manually to get the yas-snippet-dirs value - Don't include yas--default-user-snippet-dir (this is ~/.emacs.d/snippets) - Allow `auto-completion-private-snippets-directory` to also be a list of directories
This commit is contained in:
parent
c034acaa4b
commit
0a1b6f5690
2 changed files with 9 additions and 7 deletions
|
@ -57,8 +57,9 @@ layer variables:
|
|||
as been entered quickly enough. If its value is =nil= then the feature is
|
||||
disabled.
|
||||
|
||||
4. =auto-completion-private-snippets-directory= is a path to your private
|
||||
snippets directory. If its value is =nil= then the spacemacs default is used.
|
||||
4. =auto-completion-private-snippets-directory= is a path or list of paths to
|
||||
your private snippets directory. If its value is =nil= then the spacemacs
|
||||
default (=~/.emacs.d/private/snippets=) is used.
|
||||
|
||||
The default configuration of the layer is:
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@
|
|||
(defun spacemacs/load-yasnippet ()
|
||||
(unless yas-global-mode
|
||||
(progn
|
||||
(yas-global-mode 1)
|
||||
(require 'yasnippet)
|
||||
(let ((private-yas-dir (if auto-completion-private-snippets-directory
|
||||
auto-completion-private-snippets-directory
|
||||
(concat
|
||||
|
@ -236,12 +236,13 @@
|
|||
"snippets"
|
||||
spacemacs--auto-completion-dir)))
|
||||
(setq yas-snippet-dirs
|
||||
(append (list private-yas-dir)
|
||||
(append (if (listp private-yas-dir)
|
||||
private-yas-dir
|
||||
(list private-yas-dir))
|
||||
(when (boundp 'yas-snippet-dirs)
|
||||
yas-snippet-dirs)
|
||||
(remove yas--default-user-snippets-dir yas-snippet-dirs))
|
||||
(list spacemacs-snippets-dir)))
|
||||
(yas-load-directory spacemacs-snippets-dir t)
|
||||
(yas-load-directory private-yas-dir t)
|
||||
(yas-global-mode 1)
|
||||
(setq yas-wrap-around-region t))))
|
||||
(yas-minor-mode 1))
|
||||
|
||||
|
|
Reference in a new issue