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 ;; 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