Commit b10ae70eff5d

Vincent Demeester <vincent@sbr.pm>
2019-01-27 13:45:03
setup-shells: add xterm-color 🍵
… and set TERM appropriatly Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 7966ca2
Changed files (2)
lisp/setup-shells.el
@@ -217,6 +217,33 @@ The EShell is renamed to match that directory to make multiple windows easier."
   :config
   (add-hook 'eshell-mode-hook 'eshell-bookmark-setup))
 
+
+(use-package xterm-color
+  :init
+  (add-hook 'eshell-before-prompt-hook
+            (lambda ()
+              (setenv "TERM" "xterm-256color")
+              (setq xterm-color-preserve-properties t)))
+
+  (add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)
+  (setq eshell-output-filter-functions (remove 'eshell-handle-ansi-color eshell-output-filter-functions))
+  
+  (setq compilation-environment '("TERM=xterm-256color"))
+
+  (add-hook 'compilation-start-hook
+            (lambda (proc)
+              ;; We need to differentiate between compilation-mode buffers
+              ;; and running as part of comint (which at this point we assume
+              ;; has been configured separately for xterm-color)
+              (when (eq (process-filter proc) 'compilation-filter)
+                ;; This is a process associated with a compilation-mode buffer.
+                ;; We may call `xterm-color-filter' before its own filter function.
+                (set-process-filter
+                 proc
+                 (lambda (proc string)
+                   (funcall 'compilation-filter proc
+                            (xterm-color-filter string))))))))
+
 ;; for fish in ansi-term
 (add-hook 'term-mode-hook 'toggle-truncate-lines)
 
init.el
@@ -137,7 +137,7 @@
    `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
 
 (setenv "PAGER" "cat")
-(setenv "TERM" "eterm-color")
+(setenv "TERM" "xterm-256color")
 
 (use-package server                     ; The server of `emacsclient'
   :config (or (server-running-p) (server-mode)))