Fix eshell setup for xterm-color

This makes sure that all the setup happens at the same time. Previously
some setup happened at loading time of esh-mode while some happened in
eshell-mode-hook. Everything output between this (the first prompt)
looks different.
This commit is contained in:
Eivind Fonn 2016-04-06 14:41:19 +02:00 committed by syl20bnr
parent 09ff77fbd4
commit 64392e3fa5
No known key found for this signature in database
GPG Key ID: 1FA7B219DA91A396
2 changed files with 10 additions and 7 deletions

View File

@ -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)))

View File

@ -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))))