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.
This commit is contained in:
parent
b5baeb81a7
commit
02caf4eeac
1 changed files with 1 additions and 0 deletions
|
@ -112,6 +112,7 @@ must be non-read-only, empty, and there must be a rule in
|
||||||
`+file-templates-alist' that applies to it."
|
`+file-templates-alist' that applies to it."
|
||||||
(when (and (not buffer-read-only)
|
(when (and (not buffer-read-only)
|
||||||
(bobp) (eobp)
|
(bobp) (eobp)
|
||||||
|
(get-buffer-window)
|
||||||
(not (string-match-p "^ *\\*" (buffer-name))))
|
(not (string-match-p "^ *\\*" (buffer-name))))
|
||||||
(when-let* ((rule (cl-find-if #'+file-template-p +file-templates-alist)))
|
(when-let* ((rule (cl-find-if #'+file-template-p +file-templates-alist)))
|
||||||
(apply #'+file-templates--expand rule))))
|
(apply #'+file-templates--expand rule))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue