mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
feat(lib): add doom-compile-function
To be used in some autoloaded libraries, in case they haven't been byte-compiled and contain especially expensive functions.
This commit is contained in:
@ -241,6 +241,15 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions."
|
|||||||
((add-hook hook fn -101)))
|
((add-hook hook fn -101)))
|
||||||
fn)))
|
fn)))
|
||||||
|
|
||||||
|
(defun doom-compile-function (fn &optional level)
|
||||||
|
"Compile FN, and natively, if possible."
|
||||||
|
(if (featurep 'native-compile)
|
||||||
|
(let ((native-comp-speed (or level native-comp-speed)))
|
||||||
|
(unless (subr-native-elisp-p (symbol-function fn))
|
||||||
|
(native-compile fn)))
|
||||||
|
(unless (byte-code-function-p (symbol-function fn))
|
||||||
|
(with-no-warnings (byte-compile fn)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Sugars
|
;;; Sugars
|
||||||
|
Reference in New Issue
Block a user