Open nosewings opened 2 years ago
For what it's worth, I was able to get this working with something like the following:
(defun nosewings/restart-emacs-advice (function &rest args)
(let ((invocation-directory "~/.nix-profile/bin/"))
(apply function args)))
(advice-add #'restart-emacs :around #'nosewings/restart-emacs-advice)
However, this relies on the implementation detail that restart-emacs
uses invocation-directory
.
When running an Emacs built with
emacsWithPackages
from Nix,restart-emacs
picks the wrong Emacs binary to start.emacsWithPackages
creates a wrapper script that sets up the Emacs load path before running the Emacs binary. So what ends up happening is thatrestart-emacs
executes the Emacs binary (obtained viainvocation-directory
), but without the load-path set properly.The easiest solution I can see would be to allow the user to configure the command used to start a new Emacs instance.