aboutsummaryrefslogtreecommitdiffstats
path: root/oni-eshell.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-09-20 09:34:43 -0700
committerGravatar Tom Willemse2019-09-20 09:34:43 -0700
commit11f53711a41e4e1f09b054c28c5792135475e18a (patch)
tree874d3b6166ca18adbef90bd0fde592bbd6e78752 /oni-eshell.el
parent3ec966634b551b3eb09b144700ae77c95eeb60f9 (diff)
downloademacs-config-11f53711a41e4e1f09b054c28c5792135475e18a.tar.gz
emacs-config-11f53711a41e4e1f09b054c28c5792135475e18a.zip
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.
Diffstat (limited to 'oni-eshell.el')
-rw-r--r--oni-eshell.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/oni-eshell.el b/oni-eshell.el
index 3126a1d..1dd5e65 100644
--- a/oni-eshell.el
+++ b/oni-eshell.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2019.0919.172336
+;; Version: 2019.0920.093304
;; Package-Requires: (eshell-fringe-status esh-autosuggest xterm-color)
;; 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-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 ()
"Set `C-d' to quit eshell if used at end of prompt."
(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-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 'goto-address-mode)
(add-hook 'eshell-before-prompt-hook #'oni-eshell--set-xterm-variables)
@@ -63,11 +74,6 @@
(when (display-graphic-p)
(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")
(add-to-list 'display-buffer-alist