From 02caf4eeaca2cbc33ad8077b3ee6f5cb5083e9f7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 16 Jun 2018 12:23:47 +0200 Subject: [PATCH] Fix file templates expanding non-interactively #553 File templates should not expand unless the current file was opened interactively. We use a simple heuristic to detect this: if the opened buffer's is visible or not. --- modules/feature/file-templates/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/feature/file-templates/config.el b/modules/feature/file-templates/config.el index d54679be4..7edda6d9c 100644 --- a/modules/feature/file-templates/config.el +++ b/modules/feature/file-templates/config.el @@ -112,6 +112,7 @@ 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) (bobp) (eobp) + (get-buffer-window) (not (string-match-p "^ *\\*" (buffer-name)))) (when-let* ((rule (cl-find-if #'+file-template-p +file-templates-alist))) (apply #'+file-templates--expand rule))))