1
0
Fork 0

Fix error in setting up xterm-color in eshell

Apparently when the ‘oni-eshell’ library gets loaded neither
‘eshell-preoutput-filter-functions’ nor ‘eshell-output-filter-functions’ are
ready to be used, even though they are defined in the ‘esh-mode’ libary, which
is loaded at this point in time.
This commit is contained in:
Tom Willemse 2019-09-20 09:34:43 -07:00
parent 3ec966634b
commit 11f53711a4

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2019.0919.172336 ;; Version: 2019.0920.093304
;; Package-Requires: (eshell-fringe-status esh-autosuggest xterm-color) ;; Package-Requires: (eshell-fringe-status esh-autosuggest xterm-color)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -46,6 +46,15 @@
"Add `eshell-truncate-buffer' to `eshell-output-filter-functions'." "Add `eshell-truncate-buffer' to `eshell-output-filter-functions'."
(add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)) (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer))
(defun oni-eshell--enable-xterm-filter ()
"Add xterm-color-filter to eshell-preoutput-filter-functions."
(add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter))
(defun oni-eshell--disable-ansi-color-handling ()
"Remove eshell-handle-ansi-color from eshell-output-filter-functions."
(setq eshell-output-filter-functions
(remove 'eshell-handle-ansi-color eshell-output-filter-functions)))
(defun oni-eshell--set-eshell-C-d () (defun oni-eshell--set-eshell-C-d ()
"Set `C-d' to quit eshell if used at end of prompt." "Set `C-d' to quit eshell if used at end of prompt."
(define-key eshell-mode-map (kbd "C-d") #'oni-eshell--C-d)) (define-key eshell-mode-map (kbd "C-d") #'oni-eshell--C-d))
@ -56,6 +65,8 @@
(add-hook 'eshell-first-time-mode-hook #'oni-eshell--set-eshell-C-d) (add-hook 'eshell-first-time-mode-hook #'oni-eshell--set-eshell-C-d)
(add-hook 'eshell-load-hook #'oni-eshell--enable-truncating-buffers) (add-hook 'eshell-load-hook #'oni-eshell--enable-truncating-buffers)
(add-hook 'eshell-load-hook #'oni-eshell--enable-xterm-filter)
(add-hook 'eshell-load-hook #'oni-eshell--disable-ansi-color-handling)
(add-hook 'eshell-mode-hook 'esh-autosuggest-mode) (add-hook 'eshell-mode-hook 'esh-autosuggest-mode)
(add-hook 'eshell-mode-hook 'goto-address-mode) (add-hook 'eshell-mode-hook 'goto-address-mode)
(add-hook 'eshell-before-prompt-hook #'oni-eshell--set-xterm-variables) (add-hook 'eshell-before-prompt-hook #'oni-eshell--set-xterm-variables)
@ -63,11 +74,6 @@
(when (display-graphic-p) (when (display-graphic-p)
(add-hook 'eshell-mode-hook 'eshell-fringe-status-mode)) (add-hook 'eshell-mode-hook 'eshell-fringe-status-mode))
(add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)
(setq eshell-output-filter-functions
(remove 'eshell-handle-ansi-color eshell-output-filter-functions))
(setenv "TERM" "xterm-256color") (setenv "TERM" "xterm-256color")
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist