editor/file-templates: fix #1401

org-capture, when used on a target that doesn't exist, will invisibly
expand a file template, leaving a hang yasnippet active. After
org-capture initializes, the yasnippet will attempt to operate on
overlays that don't exist, throwing overlayp errors.
This commit is contained in:
Henrik Lissner 2019-06-18 00:20:00 +02:00
parent e2869c62a1
commit 21cf1c2da6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -122,6 +122,10 @@ must be non-read-only, empty, and there must be a rule in
;; Bootstrap
(after! yasnippet
;; Prevent file-templates from breaking org-capture when target file doesn't
;; exist and has a file template.
(add-hook 'org-capture-mode-hook #'yas-abort-snippet)
(if (featurep! :editor snippets)
(add-to-list 'yas-snippet-dirs '+file-templates-dir 'append #'eq)
(setq yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions)