From fd00870ae8a7296cace96c62ecaf4d0c69993c2b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 31 Oct 2019 20:45:04 -0400 Subject: [PATCH] Fix #1401 --- modules/editor/file-templates/config.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/editor/file-templates/config.el b/modules/editor/file-templates/config.el index fdb9d8f8d..46248b5c7 100644 --- a/modules/editor/file-templates/config.el +++ b/modules/editor/file-templates/config.el @@ -134,18 +134,18 @@ must be non-read-only, empty, and there must be a rule in (bobp) (eobp) (not (member (substring (buffer-name) 0 1) '("*" " "))) (not (file-exists-p buffer-file-name)) + ;; Prevent file-templates from breaking org-capture when target file + ;; doesn't exist and has a file template. + (or (not (fboundp 'org-capture-get)) + (not (org-capture-get :new-buffer))) (when-let (rule (cl-find-if #'+file-template-p +file-templates-alist)) (apply #'+file-templates--expand rule)))) ;; -;; Bootstrap +;;; 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)