GNU bug report logs - #11883
24.1.50; shell-mode doesn't colorize the prompt

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Mon, 9 Jul 2012 06:52:02 UTC

Severity: wishlist

Tags: moreinfo, patch

Found in version 24.1.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 11883 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 11883 <at> debbugs.gnu.org
Subject: Re: bug#11883: shell-mode doesn't colorize the prompt
Date: Fri, 09 Nov 2012 14:05:47 -0500
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.




This bug report was last modified 3 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.