From 037bcf3c127c54d653b03618a850e1edbd1d3b36 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 20 Feb 2020 17:24:16 -0500 Subject: [PATCH] Fix #2568: change when file-templates are expanded --- modules/editor/file-templates/config.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/editor/file-templates/config.el b/modules/editor/file-templates/config.el index 8c19ab61d..537cd1afd 100644 --- a/modules/editor/file-templates/config.el +++ b/modules/editor/file-templates/config.el @@ -137,10 +137,7 @@ 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))) + (not (buffer-modified-p)) (when-let (rule (cl-find-if #'+file-template-p +file-templates-alist)) (apply #'+file-templates--expand rule)))) @@ -159,4 +156,4 @@ must be non-read-only, empty, and there must be a rule in (yas-reload-all))) ;; -(add-hook 'find-file-hook #'+file-templates-check-h) +(add-hook 'doom-switch-buffer-hook #'+file-templates-check-h)