From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11883: shell-mode doesn't colorize the prompt Date: Fri, 09 Nov 2012 14:05:47 -0500 Message-ID: References: <87a9z9ec3k.fsf@shorty.local.i-did-not-set--mail-host-address--so-tickle-me> <20121106111243.3b2d7965@fatty> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1352488020 25800 80.91.229.3 (9 Nov 2012 19:07:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Nov 2012 19:07:00 +0000 (UTC) Cc: 11883@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 09 20:07:10 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TWtv0-0001Tt-QP for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Nov 2012 20:07:06 +0100 Original-Received: from localhost ([::1]:41027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWtur-0003J8-B7 for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Nov 2012 14:06:57 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWtup-0003IJ-3x for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 14:06:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWtuo-0002xu-2T for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 14:06:55 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWtun-0002xp-VT for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 14:06:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TWtuw-0001e8-83 for bug-gnu-emacs@gnu.org; Fri, 09 Nov 2012 14:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Nov 2012 19:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11883 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11883-submit@debbugs.gnu.org id=B11883.13524879686261 (code B ref 11883); Fri, 09 Nov 2012 19:07:02 +0000 Original-Received: (at 11883) by debbugs.gnu.org; 9 Nov 2012 19:06:08 +0000 Original-Received: from localhost ([127.0.0.1]:58324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWtu3-0001cs-Ft for submit@debbugs.gnu.org; Fri, 09 Nov 2012 14:06:07 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:51148) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TWttv-0001cG-5S; Fri, 09 Nov 2012 14:06:01 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id qA9J5lRB017317; Fri, 9 Nov 2012 14:05:47 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id B8C53B4278; Fri, 9 Nov 2012 14:05:47 -0500 (EST) In-Reply-To: <20121106111243.3b2d7965@fatty> (Dima Kogan's message of "Tue, 6 Nov 2012 11:12:43 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4396=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4396> : streams <854619> : uri <1263854> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66705 Archived-At: 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.