Merge from emacs--devo--0
[bpt/emacs.git] / lisp / eshell / esh-mode.el
index c185e88..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
@@ -281,8 +282,11 @@ This is used by `eshell-watch-for-password-prompt'."
        (map-char-table
         (function
          (lambda (key val)
-           (and (>= key 256)
-                (/= (char-syntax key) ?w)
+           (and (if (consp key)
+                    (and (>= (car key) 128)
+                         (/= (char-syntax (car key)) ?w))
+                  (and (>= key 256)
+                       (/= (char-syntax key) ?w)))
                 (modify-syntax-entry key "_   "
                                      eshell-mode-syntax-table))))
         (standard-syntax-table)))))
@@ -880,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)
@@ -1078,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