From 1a8636056051ad52c8df33adc898699451c425a7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 10 Jan 2025 11:51:01 -0500 Subject: [PATCH] docs: warn users about nushell issues Like Fish, using nushell as your shell-file-name can cause downstream issues wherever Emacs (or Emacs packages) spawn child processes via a shell command and rely on its output. For example: diff-hl users may not see a git gutter if nushell (or fish) is their $SHELL. --- lisp/cli/doctor.el | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lisp/cli/doctor.el b/lisp/cli/doctor.el index 788527eea..f9bccfe33 100644 --- a/lisp/cli/doctor.el +++ b/lisp/cli/doctor.el @@ -170,21 +170,19 @@ in." (print! (start "Checking for common environmental issues...")) (print-group! - (when (string-match-p "/fish$" shell-file-name) - (print! (warn "Detected Fish as your $SHELL")) - (explain! "Fish (and possibly other non-POSIX shells) is known to inject garbage " - "output into some of the child processes that Emacs spawns. Many Emacs " - "packages/utilities will choke on this output, causing unpredictable issues. " - "To get around this, either:\n\n" - " - Add the following to $DOOMDIR/config.el:\n\n" - " (setq shell-file-name (executable-find \"bash\"))\n\n" - " - Or change your default shell to a POSIX shell (like bash or zsh) " - " and explicitly configure your terminal apps to use the shell you " - " want.\n\n" - "If you opt for option 1 and use one of Emacs' terminal emulators, you " - "will also need to configure them to use Fish, e.g.\n\n" - " (setq-default vterm-shell (executable-find \"fish\"))\n\n" - " (setq-default explicit-shell-file-name (executable-find \"fish\"))\n")) + (when (or (string-match-p "/fish$" shell-file-name) + (string-match-p "/nu$" shell-file-name)) + (print! (warn "Detected a non-POSIX $SHELL")) + (explain! "Non-POSIX shells (particularly Fish and Nushell) can cause unpredictable issues " + "with any Emacs utilities that spawn child processes from shell commands (like " + "diff-hl and in-Emacs terminals). To get around this, configure Emacs to use a " + "POSIX shell internally, e.g.\n\n" + " ;;; add to $DOOMDIR/config.el:\n" + " (setq shell-file-name (executable-find \"bash\"))\n\n" + "Emacs' terminal emulators can be safely configured to use your original $SHELL:\n\n" + " ;;; add to $DOOMDIR/config.el:\n" + (format " (setq-default vterm-shell \"%s\")\n" shell-file-name) + (format " (setq-default explicit-shell-file-name \"%s\")\n" shell-file-name))) (condition-case e (when (featurep :system 'windows)