# Getting Doom Emacs's doom/reload to work with Nushell

Doom Emacs has a command to reload your config into an existing Emacs session. It does this by calling the Doom executable ($HOME/.emacs.d/bin/doom). However, when using Nushell as your shell, we run into a problem:

-*- mode: compilation; default-directory: "~/.emacs.d/" -*- Comint started at Sun Dec 3 17:20:24 "/home/rose/.emacs.d/bin/doom" sync -e Error: nu::parser::parse_mismatch × Parse mismatch during operation. ╭─[source:1:1] 1"/home/rose/.emacs.d/bin/doom" sync -e · ──┬─ · ╰── expected operator ╰──── Comint exited abnormally with code 1 at Sun Dec 3 17:20:24
Other shells can run commands with quotes around them, but Nushell instead parses this as a string. When Doom calls the command, it directly passes in the doom-bin variable, which is a string:
(doom--if-compile (format "%S sync -e" doom-bin))
The %S format parameter causes the string to be formatted with quotes. We could fully override the reload function in order to replace. I chose a simpler/uglier route, which is simply changing doom-bin's value to not have quotations by making it a symbol. You can use this snippet to automatically do that:
(defun doom-reload-fix-bin (orig-fun) (if (stringp doom-bin) (setq doom-bin (intern doom-bin))) (funcall orig-fun)) (advice-add 'doom/reload :around #'doom-reload-fix-bin)
This snippet wraps any calls to doom/reload by checking if doom-bin is a string, and if so, changes it to a symbol. This fixes the issue, since the command is now called without quotation marks:
-*- mode: compilation; default-directory: "~/.emacs.d/" -*- Comint started at Sun Dec 3 19:53:21 /home/rose/.emacs.d/bin/doom sync -e > Synchronizing "default" profile... > Installing packages... [...]
However, this may not work if your .emacs.d directory has a parent directory with a space.

Generated by rose using scpaste at Fri Dec 15 11:23:39 2023. EST. (original)