Fix "Select a root directory" prompts

Occurs when :feature snippets is disabled, but :feature file-templates
is enabled.
This commit is contained in:
Henrik Lissner 2018-08-20 00:31:48 +02:00
parent f9b06bd3a8
commit 40eda029ab
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -124,22 +124,15 @@ must be non-read-only, empty, and there must be a rule in
;; Bootstrap
;;
(def-package! yasnippet
:unless (featurep! :feature snippets)
:config
(setq yas-verbosity (if doom-debug-mode 3 0)
yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions)
yas-snippet-dirs nil)
(after! yasnippet
(if (featurep! :feature snippets)
(add-to-list 'yas-snippet-dirs '+file-templates-dir 'append #'eq)
(setq yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions)
yas-snippet-dirs '(+file-templates-dir))
;; Exit snippets on ESC from normal mode
(add-hook 'doom-escape-hook #'yas-abort-snippet)
;; Ensure file templates in `+file-templates-dir' are visible
(yas-reload-all)))
;;
(yas-reload-all))
(defun +file-templates|init ()
(after! yasnippet
(add-to-list 'yas-snippet-dirs '+file-templates-dir 'append #'eq))
(add-hook 'find-file-hook #'+file-templates|check))
(add-hook 'doom-post-init-hook #'+file-templates|init)
(add-hook 'find-file-hook #'+file-templates|check)