diff --git a/layers/+tools/shell/funcs.el b/layers/+tools/shell/funcs.el index fa2d6bbde..11b1611c6 100644 --- a/layers/+tools/shell/funcs.el +++ b/layers/+tools/shell/funcs.el @@ -19,3 +19,12 @@ "Locally disable global-hl-line-mode" (interactive) (setq-local global-hl-line-mode nil)) + +(defun spacemacs/init-eshell-xterm-color () + "Initialize xterm coloring for eshell" + (setq-local xterm-color-preserve-properties t) + (make-local-variable 'eshell-preoutput-filter-functions) + (add-hook 'eshell-preoutput-filter-functions 'xterm-color-filter) + (setq-local eshell-output-filter-functions + (remove 'eshell-handle-ansi-color + eshell-output-filter-functions))) diff --git a/layers/+tools/shell/packages.el b/layers/+tools/shell/packages.el index 0fc0b63d9..1b9e2ad7b 100644 --- a/layers/+tools/shell/packages.el +++ b/layers/+tools/shell/packages.el @@ -375,10 +375,4 @@ is achieved by adding the relevant text properties." (setq comint-output-filter-functions (remove 'ansi-color-process-output comint-output-filter-functions)) (setq font-lock-unfontify-region-function 'xterm-color-unfontify-region) - (with-eval-after-load 'esh-mode - (add-hook 'eshell-mode-hook - (lambda () (setq xterm-color-preserve-properties t))) - (add-hook 'eshell-preoutput-filter-functions 'xterm-color-filter) - (setq eshell-output-filter-functions - (remove 'eshell-handle-ansi-color - eshell-output-filter-functions)))))) + (add-hook 'eshell-mode-hook 'spacemacs/init-eshell-xterm-color))))