   "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."
-  (and buffer-file-name
+  (and (not +file-templates-inhibit)
+       buffer-file-name
        (not buffer-read-only)
        (bobp) (eobp)
        (not (member (substring (buffer-name) 0 1) '("*" " ")))

(defvar +file-templates-default-trigger "__"
  "The default yasnippet trigger key (a string) for file template rules that
don't have a :trigger property in `+file-templates-alist'.")

(defvar +file-templates-alist
  '(;; General

       (not (buffer-modified-p))
       (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 (orig-fn &rest args)
  :around #'org-capture
  (let ((+file-templates-inhibit t))
    (apply orig-fn args)))


;;
