From 21cf1c2da6ddd554e01158cb4a635111b5652c78 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 18 Jun 2019 00:20:00 +0200 Subject: [PATCH] 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. --- modules/editor/file-templates/config.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/editor/file-templates/config.el b/modules/editor/file-templates/config.el index 47fc04127..c99ae4965 100644 --- a/modules/editor/file-templates/config.el +++ b/modules/editor/file-templates/config.el @@ -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)