fix(lib): doom-compile-function throwing native-compiler-error
This commit is contained in:
parent
559229c250
commit
c5e88d229f
2 changed files with 22 additions and 13 deletions
|
@ -249,14 +249,22 @@ 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)
|
(defun doom-compile-functions (&rest fns)
|
||||||
"Compile FN, and natively, if possible."
|
"Queue FNS to be byte/natively-compiled after a brief delay."
|
||||||
(if (featurep 'native-compile)
|
(with-memoization (get 'doom-compile-function 'timer)
|
||||||
(let ((native-comp-speed (or level native-comp-speed)))
|
(run-with-idle-timer
|
||||||
(unless (subr-native-elisp-p (symbol-function fn))
|
1 t (fn! (when-let ((fn (pop fns))
|
||||||
(native-compile fn)))
|
(fndef (indirect-function fn)))
|
||||||
(unless (byte-code-function-p (symbol-function fn))
|
(if (featurep 'native-compile)
|
||||||
(with-no-warnings (byte-compile fn)))))
|
(unless (subr-native-elisp-p fndef)
|
||||||
|
(doom-log "native-compile: Compiling %s" fn)
|
||||||
|
(native-compile fn))
|
||||||
|
(unless (byte-code-function-p fndef)
|
||||||
|
(doom-log "byte-compile: Compiling %s" fn)
|
||||||
|
(byte-compile fn))))
|
||||||
|
(unless fns
|
||||||
|
(cancel-timer (get 'doom-compile-function 'timer))
|
||||||
|
(put 'doom-compile-function 'timer nil))))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -601,10 +601,11 @@ Adapted from 'https://www.reddit.com/r/emacs/comments/d7x7x8/finally_fixing_inde
|
||||||
(desired-indent)
|
(desired-indent)
|
||||||
(normal-indent))))))
|
(normal-indent))))))
|
||||||
|
|
||||||
;; HACK: These functions are called often and as part of performance-sensitive
|
;; HACK: Quite a few functions here are called often, and so are especially
|
||||||
;; processes, so we compile them if the file isn't already compiled.
|
;; performance sensitive, so we compile this file on-demand, at least, until
|
||||||
(mapc #'doom-compile-function '(+emacs-lisp-highlight-vars-and-faces
|
;; Doom adds a formal compile step to 'doom sync'.
|
||||||
+emacs-lisp-truncate-pin
|
(doom-compile-functions #'+emacs-lisp-highlight-vars-and-faces
|
||||||
+emacs-lisp--calculate-lisp-indent-a))
|
#'+emacs-lisp-truncate-pin
|
||||||
|
#'+emacs-lisp--calculate-lisp-indent-a)
|
||||||
|
|
||||||
;;; autoload.el ends here
|
;;; autoload.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue