restart-emacs
restart-emacs copied to clipboard
Doesn't work with Nix
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 that restart-emacs
executes the Emacs binary (obtained via invocation-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.
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
.