refactor(file-templates): suppress in indirect buffers

Change how we detect and suppress file template expansion in org-capture
buffers (which are indirect clones). Since 99.99% of the time, an
indirect clone means we're doing something special in that buffer, it
seemed sensible to always suppress file templates in them. Hopefully
this will be more robust than the former advice.
This commit is contained in:
Henrik Lissner 2022-03-19 19:45:46 +01:00
parent 17f457edf7
commit 54d8c49d8b
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -142,14 +142,10 @@ must be non-read-only, empty, and there must be a rule in
(not (member (substring (buffer-name) 0 1) '("*" " ")))
(not (file-exists-p buffer-file-name))
(not (buffer-modified-p))
(null (buffer-base-buffer))
(when-let (rule (cl-find-if #'+file-template-p +file-templates-alist))
(apply #'+file-templates--expand rule))))
(defadvice! +file-templates-inhibit-in-org-capture-a (fn &rest args)
:around #'org-capture
(let ((+file-templates-inhibit t))
(apply fn args)))
;;
;;; Bootstrap