config/literate: earlier check & no byte-compile
Making the compile check happen earlier fixes an edge case where the resulting files from a literate config being tangled into multiple files aren't recognized by Doom's package management or autoload generation systems. Disabling byte-compiling fixes an all too common issue where packages and macros are undefined at compile time, causing a plethora of invalid function errors. Leave byte-compilation to `bin/doom compile`!
This commit is contained in:
parent
1e2fc4227a
commit
0ec4d6ee43
1 changed files with 10 additions and 10 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
;;; config/literate/init.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;;; config/literate/config.el -*- lexical-binding: t; -*-
|
;;; config/literate/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +literate-config-file
|
(defvar +literate-config-file
|
||||||
|
@ -15,21 +17,19 @@ byte-compiled from.")
|
||||||
"Tangles & compiles `+literate-config-file' if it has changed. If LOAD is
|
"Tangles & compiles `+literate-config-file' if it has changed. If LOAD is
|
||||||
non-nil, load it too!"
|
non-nil, load it too!"
|
||||||
(let ((org +literate-config-file)
|
(let ((org +literate-config-file)
|
||||||
(elc (concat +literate-config-dest-file "c")))
|
(el +literate-config-dest-file))
|
||||||
;; If config is pre-compiled, then load that
|
(when (file-newer-than-file-p org el)
|
||||||
(when (file-newer-than-file-p org elc)
|
|
||||||
(message "Compiling your literate config...")
|
(message "Compiling your literate config...")
|
||||||
;; We tangle in a separate, blank process because loading it here would load
|
|
||||||
;; all of :lang org, which will be more expensive than it needs to be.
|
;; We tangle in a separate, blank process because loading it here would
|
||||||
|
;; load all of :lang org (very expensive!). We only need ob-tangle.
|
||||||
(or (zerop (call-process
|
(or (zerop (call-process
|
||||||
"emacs" nil nil nil
|
"emacs" nil nil nil
|
||||||
"-q" "--batch" "-l" "ob-tangle" "--eval"
|
"-q" "--batch" "-l" "ob-tangle" "--eval"
|
||||||
(format "(org-babel-tangle-file \"%s\" \"%s\" \"emacs-lisp\")"
|
(format "(org-babel-tangle-file \"%s\" \"%s\" \"emacs-lisp\")"
|
||||||
org +literate-config-dest-file)))
|
org el)))
|
||||||
(error "There was a problem tangling your literate config!"))
|
(warn "There was a problem tangling your literate config!"))
|
||||||
;; Then byte-compile it!
|
|
||||||
(require 'bytecomp)
|
|
||||||
(byte-compile-file +literate-config-dest-file load)
|
|
||||||
(message "Done!"))))
|
(message "Done!"))))
|
||||||
|
|
||||||
;; Let 'er rip!
|
;; Let 'er rip!
|
Loading…
Add table
Add a link
Reference in a new issue