Merge from emacs--devo--0
[bpt/emacs.git] / lisp / eshell / esh-mode.el
index 0c565ed..2da8199 100644 (file)
@@ -9,7 +9,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -165,7 +165,8 @@ number, if the function `eshell-truncate-buffer' is on
   :group 'eshell-mode)
 
 (defcustom eshell-output-filter-functions
-  '(eshell-handle-control-codes
+  '(eshell-postoutput-scroll-to-bottom
+    eshell-handle-control-codes
     eshell-watch-for-password-prompt)
   "*Functions to call before output is displayed.
 These functions are only called for output that is displayed
@@ -883,9 +884,6 @@ This function should be in the list `eshell-output-filter-functions'."
         nil t)
       (set-buffer current))))
 
-(custom-add-option 'eshell-output-filter-functions
-                  'eshell-postoutput-scroll-to-bottom)
-
 (defun eshell-beginning-of-input ()
   "Return the location of the start of the previous input."
   eshell-last-input-start)
@@ -1081,6 +1079,15 @@ This function could be in the list `eshell-output-filter-functions'."
 (custom-add-option 'eshell-output-filter-functions
                   'eshell-handle-control-codes)
 
+(defun eshell-handle-ansi-color ()
+  "Handle ANSI color codes."
+  (require 'ansi-color)
+  (ansi-color-apply-on-region eshell-last-output-start
+                              eshell-last-output-end))
+
+(custom-add-option 'eshell-output-filter-functions
+                  'eshell-handle-ansi-color)
+
 ;;; Code:
 
 ;;; arch-tag: ec65bc2b-da14-4547-81d3-a32af3a4dc57