From 6e3892b8044fc918a5231a79963d0560adea2403 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 17 Jun 2017 12:06:37 -0400 Subject: [PATCH v1] Let ansi-color overlay hooks work in eshell (Bug#27407) * lisp/ansi-color.el (ansi-color-make-extent): Add `ansi-color-freeze-overlay' to `insert-behind-hooks' as well. * lisp/eshell/esh-mode.el (eshell-output-filter): Let-bind `inhibit-modification-hooks' to nil while inserting the string. --- lisp/ansi-color.el | 1 + lisp/eshell/esh-mode.el | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index a1b4933175..72d70c2102 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -481,6 +481,7 @@ (defun ansi-color-make-extent (from to &optional object) ;; property to make sure it works. (let ((overlay (make-overlay from to object))) (overlay-put overlay 'modification-hooks '(ansi-color-freeze-overlay)) + (overlay-put overlay 'insert-behind-hooks '(ansi-color-freeze-overlay)) overlay))) (defun ansi-color-freeze-overlay (overlay is-after begin end &optional len) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 0fd0c18301..0999f9c4a8 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -726,7 +726,9 @@ (defun eshell-output-filter (process string) (setq obeg (+ obeg nchars))) (if (<= (point) oend) (setq oend (+ oend nchars))) - (insert-before-markers string) + ;; Let the ansi-color overlay hooks run. + (let ((inhibit-modification-hooks nil)) + (insert-before-markers string)) (if (= (window-start) (point)) (set-window-start (selected-window) (- (point) nchars))) -- 2.11.1