From fb619bdb0f419e4f19f917041504ec19c4c50d51 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 19 Aug 2019 14:18:17 -0400 Subject: [PATCH] Only trigger file-templates for non-existent files #1682 Possibly addresses #1401 too --- modules/editor/file-templates/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/editor/file-templates/config.el b/modules/editor/file-templates/config.el index 5afaede71..787c31fc6 100644 --- a/modules/editor/file-templates/config.el +++ b/modules/editor/file-templates/config.el @@ -118,7 +118,8 @@ information.") "Check if the current buffer is a candidate for file template expansion. It must be non-read-only, empty, and there must be a rule in `+file-templates-alist' that applies to it." - (when (and (not buffer-read-only) + (when (and (not (file-exists-p (buffer-file-name))) + (not buffer-read-only) (bobp) (eobp) (not (string-match-p "^ *\\*" (buffer-name)))) (when-let (rule (cl-find-if #'+file-template-p +file-templates-alist))