bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11883: shell-mode doesn't colorize the prompt


From: Stefan Monnier
Subject: bug#11883: shell-mode doesn't colorize the prompt
Date: Fri, 09 Nov 2012 14:05:47 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

severity 11883 wishlist
thanks

The behavior you see is due to the following:
- the prompt is highlighted with an overlay that uses
  a comint-highlight-prompt face.
- "the prompt" is determined dynamically as "the last
  non-line-terminated output of the process".
- the ansi-color escapes used to be applied using overlays but are now
  applied using text-properties.

When you use ansi escapes to color the prompt, you clearly have
a conflict with the comint-highlight-prompt face that is to be used for
the prompt.

If you do C-u C-x = on the "t" of "test" in your test case, you'll see
that it does have a `font-lock-face' text-property that stipulates the
use of a red foreground, but the overlay takes precedence.

Emacs-23's use of overlays for ansi colors worked better in this
respect, because those overlays took precedence by virtue of
being smaller.

You can by revert to the Emacs-23 behavior with the following hack:

   (add-hook 'shell-mode-hook
             (lambda ()
               (kill-local-variable 'ansi-color-apply-face-function)))

But the reason Emacs-24 stopped using overlays is because they can slow
things down significantly if you have many such colored chunks and your
shell buffer grows large.


        Stefan


PS: Yes, that's an implementation defect in Emacs which should use more
efficient algorithms for its overlays.  I have a pretty good idea how to
fix this, so if someone's interested, I'd be happy to help them write
a patch for it.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]