fix defer func

This commit is contained in:
Levi Neely 2024-09-15 20:07:54 +02:00
parent ea1eb8e50c
commit c67e8e82de
1 changed files with 11 additions and 8 deletions

View File

@ -53,14 +53,17 @@ FILENAME and NOERROR are passed to `require'."
Ensure FEATURE is installed first.
FILENAME, if non-nil, is the file to load to provide FEATURE.
If NOERROR is non-nil, don't signal an error if the file is not found."
`(progn
(pkg/ensure-installed ,feature)
(unless (featurep ',feature)
(autoload #',(intern (format "%s-autoloaded" feature))
,(or filename (symbol-name feature))
nil t)
(defalias ',feature #',(intern (format "%s-autoloaded" feature))))
',feature))
(let ((feature-sym (if (and (listp feature) (eq (car feature) 'quote))
(cadr feature)
feature)))
`(progn
(pkg/ensure-installed ',feature-sym)
(unless (featurep ',feature-sym)
(autoload #',(intern (format "%s-autoloaded" feature-sym))
,(or filename (symbol-name feature-sym))
nil t)
(defalias ',feature-sym #',(intern (format "%s-autoloaded" feature-sym))))
',feature-sym)))
(defun pkg/require-defer-load (feature)
"Check if a deferred FEATURE is already loaded."