fix(el-patch): properly load patched functions

This commit is contained in:
Kiana Sheibani 2026-02-04 16:37:30 -05:00
parent d16c371f10
commit 41d12e5f3c
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -2195,8 +2195,8 @@ 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)
;; Ensure function is loaded
(autoload-do-load (symbol-function #'+snippets/new))
(defpatch! nil
(defun +snippets/new) (&optional all-modes)
@ -2238,8 +2238,8 @@ 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 resolve 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!)
;; Ensure function loads during validation
(autoload-do-load (symbol-function #'set-file-template!))
(defpatch! nil
(defun +file-templates--set) (pred plist)