fix: load autoloaded functions before patching

This commit is contained in:
Kiana Sheibani 2025-10-22 13:19:47 -04:00
parent e7e4e1fad9
commit eb6b4b9b9c
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -2239,6 +2239,9 @@ When editing a snippet, the binding =C-c C-t= can be used to test it in a fresh
Doom's command to create a new snippet, ~+snippets/new~, defines a template inside of itself purely for when creating a snippet through this command. This doesn't make much sense to me when file templates already exist as a standard system in Doom, and snippets are stored inside files!
#+begin_src emacs-lisp
;; HACK: Force snippet function to load
(autoload-do-load #'+snippets/new)
(defpatch! nil
(defun +snippets/new) (&optional all-modes)
"Create a new snippet in `+snippets-dir'.
@ -2275,6 +2278,9 @@ Doom's =file-templates= module extends =yasnippet= to provide a nice file templa
This system works well for the most part, but there's a serious issue with its UI: the function that registers file templates, ~set-file-templates!~, takes a plist to configure the template. If this list is empty, an existing template is removed instead. This is not only unintuitive, but it prevents you from having an empty property list, which is often necessary! We'll patch the function to remove this issue with a =:remove= key, as well as to have templates appended to the alist instead of prepended to make the order of templates more clear.
#+begin_src emacs-lisp
;; HACK: Force templates function to load
(autoload-do-load #'set-file-template!)
(defpatch! nil
(defun +file-templates--set) (pred plist)
(if (el-patch-swap (null (car-safe plist))