From 367bce4bd172da4f4db36c173d13a225cb241ab1 Mon Sep 17 00:00:00 2001 From: Marien Zwart Date: Sun, 7 Apr 2024 18:56:32 +1000 Subject: [PATCH] Fix phpactor leaking /build/ into init.elc Fixes doom-full build. --- README.md | 18 +----------- elisp-packages.nix | 6 ++++ ...ocate-user-emacs-file-when-compiling.patch | 29 +++++++++++++++++++ 3 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 elisp-patches/0001-Do-not-call-locate-user-emacs-file-when-compiling.patch diff --git a/README.md b/README.md index ebebfef..06cfd07 100644 --- a/README.md +++ b/README.md @@ -94,23 +94,7 @@ I am open to suggestions for how this should work: - If we try to use home-manager, I would expect to hit the same problems and/or collisions on activation, but I have not experimented with this. -### `php` module without `+lsp` breaks the build - -Enabling the `php` module without enabling the `+lsp` flag currently breaks the -build with: - -``` - > Doom profile contains a forbidden reference to /build/ -``` - -This is triggered by -[emacs-php](https://github.com/emacs-php/phpactor.el/blob/8733fef84b458457c1bfd188cfb861fc3150ee1c/phpactor.el#L71-L72) -determining the location of the user's Emacs directory at byte-compile time. I -do not know why it does this yet (it seems undesirable). - -Upstream recommends migrating to LSP. - -### Other flag-controlled packages may be broken +### Flag-controlled packages may be broken Doom supports listing all packages (including ones pulled in by modules that are not currently enabled). Unstraightened uses this to build-test them. However, diff --git a/elisp-packages.nix b/elisp-packages.nix index 13e6a08..f557d95 100644 --- a/elisp-packages.nix +++ b/elisp-packages.nix @@ -145,6 +145,12 @@ done ''; }; + # Fix /build/ leaking into byte-compiled files (patch accepted upstream). + phpactor = esuper.phpactor.overrideAttrs (attrs: { + patches = (attrs.patches or [ ]) ++ [ + ./elisp-patches/0001-Do-not-call-locate-user-emacs-file-when-compiling.patch + ]; + }); # Make it byte-compile properly. code-review = esuper.code-review.overrideAttrs (attrs: { nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ [ git ]; diff --git a/elisp-patches/0001-Do-not-call-locate-user-emacs-file-when-compiling.patch b/elisp-patches/0001-Do-not-call-locate-user-emacs-file-when-compiling.patch new file mode 100644 index 0000000..e02c2c3 --- /dev/null +++ b/elisp-patches/0001-Do-not-call-locate-user-emacs-file-when-compiling.patch @@ -0,0 +1,29 @@ +From 9d0a3eb98982c38bfe1e1872498538b103ad06cd Mon Sep 17 00:00:00 2001 +From: Marien Zwart +Date: Sun, 7 Apr 2024 17:46:36 +1000 +Subject: [PATCH] Do not call locate-user-emacs-file when compiling + +The default value of phpactor-install-directory is relative to the +user's user-emacs-directory. Using eval-when-compile here hardcodes the +wrong directory if a separate build user is used. +--- + phpactor.el | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/phpactor.el b/phpactor.el +index 7e7c036..96de425 100644 +--- a/phpactor.el ++++ b/phpactor.el +@@ -68,8 +68,7 @@ + + ;;;###autoload + (defcustom phpactor-install-directory +- (eval-when-compile +- (expand-file-name (locate-user-emacs-file "phpactor/"))) ++ (expand-file-name (locate-user-emacs-file "phpactor/")) + "Directory for setup Phactor. (default `~/.emacs.d/phpactor/')." + :type 'directory) + +-- +2.42.0 +