mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
feat(file-templates): add apply method
Factor template application code into command file-templates-apply. This allows it to be invoked by the user.
This commit is contained in:
@ -146,9 +146,13 @@ must be non-read-only, empty, and there must be a rule in
|
|||||||
(not (file-exists-p buffer-file-name)) ; ...is a new file
|
(not (file-exists-p buffer-file-name)) ; ...is a new file
|
||||||
(not (buffer-modified-p)) ; ...hasn't been modified
|
(not (buffer-modified-p)) ; ...hasn't been modified
|
||||||
(null (buffer-base-buffer)) ; ...isn't an indirect clone
|
(null (buffer-base-buffer)) ; ...isn't an indirect clone
|
||||||
(when-let (rule (cl-find-if #'+file-template-p +file-templates-alist))
|
(+file-templates/apply)))
|
||||||
(apply #'+file-templates--expand rule))))
|
|
||||||
|
|
||||||
|
(defun +file-templates/apply ()
|
||||||
|
"Actually expand a file template if one exists"
|
||||||
|
(interactive)
|
||||||
|
(when-let* ((rule (cl-find-if #'+file-template-p +file-templates-alist)))
|
||||||
|
(apply #'+file-templates--expand rule)))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Bootstrap
|
;;; Bootstrap
|
||||||
|
Reference in New Issue
Block a user