diff --git a/core/core-lib.el b/core/core-lib.el index 35651ec6a..6ea104a31 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -751,45 +751,24 @@ See the docstrings of `defalias' and `make-obsolete' for more details." `(progn (defalias ,obsolete-name ,current-name ,docstring) (make-obsolete ,obsolete-name ,current-name ,when))) - (defadvice! doom--fix-wrong-number-of-args-during-byte-compile (recipe) + (defadvice! doom--byte-compile-in-same-session-a (recipe) + "Straight recompiles packages from an Emacs child process. This is sensible, +but many packages don't properly load their macro dependencies, causing errors, +which we can't possibly police, so I revert straight to its old strategy of +compiling in the same session." :override #'straight--build-compile - (let* ((package (plist-get recipe :package)) - (dir (straight--build-dir package)) - (program (concat invocation-directory invocation-name)) - (args - `("-Q" "-L" ,dir - ,@(apply #'append - (mapcar (lambda (d) - (let ((d (straight--build-dir d))) - (when (file-exists-p d) (list "-L" d)))) - (straight--get-dependencies package))) - "--batch" - "--eval" - ,(prin1-to-string - '(progn - (defmacro define-obsolete-face-alias (obsolete-face current-face &optional when) - `(progn (put ,obsolete-face 'face-alias ,current-face) - (put ,obsolete-face 'obsolete-face (or (purecopy ,when) t)))) - (defmacro define-obsolete-function-alias (obsolete-name current-name &optional when docstring) - `(progn (defalias ,obsolete-name ,current-name ,docstring) - (make-obsolete ,obsolete-name ,current-name ,when))) - (defmacro define-obsolete-variable-alias (obsolete-name current-name &optional when docstring) - `(progn (defvaralias ,obsolete-name ,current-name ,docstring) - (dolist (prop '(saved-value saved-variable-comment)) - (and (get ,obsolete-name prop) - (null (get ,current-name prop)) - (put ,current-name prop (get ,obsolete-name prop)))) - (make-obsolete-variable ,obsolete-name ,current-name ,when))))) - "--eval" - ,(format "(byte-recompile-directory %S 0 'force)" dir)))) - (when straight-byte-compilation-buffer - (with-current-buffer (get-buffer-create straight-byte-compilation-buffer) - (insert "\n$ " (replace-regexp-in-string - "\\(-L [^z-a]*? \\)" - "\\1\\\\ \n " - (string-join `(,program ,@args) " ")) - "\n"))) - (apply #'call-process program nil straight-byte-compilation-buffer nil args)))) + (straight--with-plist recipe (package) + ;; These two `let' forms try very, very hard to make byte-compilation an + ;; invisible process. Lots of packages have byte-compile warnings; I + ;; don't need to know about them and neither do straight.el users. + (letf! (;; Prevent Emacs from asking the user to save all their + ;; files before compiling. + (#'save-some-buffers #'ignore)) + (quiet! + ;; Note that there is in fact no `byte-compile-directory' function. + (byte-recompile-directory + (straight--build-dir package) + 0 'force)))))) (provide 'core-lib) ;;; core-lib.el ends here