From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#11883: 24.1.50; shell-mode doesn't colorize the prompt Date: Sun, 19 Dec 2021 10:48:29 +0100 Message-ID: <87lf0hncwi.fsf@miha-pc> References: <87a9z9ec3k.fsf@shorty.local.i-did-not-set--mail-host-address--so-tickle-me> <20121106111243.3b2d7965@fatty> <878s27dvn6.fsf_-_@gnus.org> Reply-To: miha@kamnitnik.top Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39892"; mail-complaints-to="usenet@ciao.gmane.io" To: 11883@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 19 10:44:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mysjh-000AEZ-Ou for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 10:44:10 +0100 Original-Received: from localhost ([::1]:44412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mysjg-000588-Kn for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 04:44:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mysja-00057z-Mz for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 04:44:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mysja-0008KW-EV for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 04:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mysja-0003Wt-6O for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 04:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: miha@kamnitnik.top Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Dec 2021 09:44: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: moreinfo patch Original-Received: via spool by 11883-submit@debbugs.gnu.org id=B11883.163990698513484 (code B ref 11883); Sun, 19 Dec 2021 09:44:02 +0000 Original-Received: (at 11883) by debbugs.gnu.org; 19 Dec 2021 09:43:05 +0000 Original-Received: from localhost ([127.0.0.1]:44820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mysie-0003VQ-LD for submit@debbugs.gnu.org; Sun, 19 Dec 2021 04:43:04 -0500 Original-Received: from kamnitnik.top ([209.250.245.214]:44352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mysic-0003V8-Tc for 11883@debbugs.gnu.org; Sun, 19 Dec 2021 04:43:03 -0500 Original-Received: from localhost (BSN-77-156-43.static.siol.net [193.77.156.43]) by kamnitnik.top (Postfix) with ESMTPSA id 50A0B9CA87 for <11883@debbugs.gnu.org>; Sun, 19 Dec 2021 09:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1639906981; bh=MlW9j+TWdssv2WcQhW7I1EyqtNzwnnXBGIdo9U67AZo=; h=From:To:Subject:In-Reply-To:References:Date:From; b=lJjRLdiAYYVyBOKEkkwimyJpcDMlK4y3kQYEBJwlbp7ie4jHELXq9g+xaaWF8eanW /F0DoyNoC5rsffRIsWNRtSJHB6LtbzbmkY3roPK3kSOrqEn/ubDwJF3gfguUhGL7HZ X5ipxCQHP5Dz4XUrLt1Lgwn+C89GYMwxkE1Wdqj6tfqOkMdfTJooKz1ZA0StqLRbVQ NLD6aGb2BOJzKm32s40SNus4Hk1evmrgZwZAE2HZAFL/LLhjBHTlTAtMLZOyw7uqwC 4X3kRI7VFanpZ1L89rbw8kiwktqQ+c7sIPb/Vme8IefcnaZqqNws8Yd/1Lxw99bxwn cwxeC4d9Gj2KQ== In-Reply-To: <878s27dvn6.fsf_-_@gnus.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222636 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Lars Ingebrigtsen writes: > Stefan Monnier writes: > >> 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. > > The following simple tweak seems to fix the reported issue: > > diff --git a/lisp/comint.el b/lisp/comint.el > index 9e406614b9..3dfb269de4 100644 > --- a/lisp/comint.el > +++ b/lisp/comint.el > @@ -2157,9 +2157,9 @@ comint-output-filter > 'comint-highlight-prompt)) > (setq comint-last-prompt > (cons (copy-marker prompt-start) (point-marker))) > - (font-lock-prepend-text-property prompt-start (point) > - 'font-lock-face > - 'comint-highlight-prompt) > + (font-lock-append-text-property prompt-start (point) > + 'font-lock-face > + 'comint-highlight-prompt) > (add-text-properties prompt-start (point) > `(rear-nonsticky > ,comint--prompt-rear-nonsticky))) > Sorry for late reply. I believe an analogous change should be made in the function comint-snapshot-last-prompt: diff --git a/lisp/comint.el b/lisp/comint.el index 5f99f560cf..3decb80ff0 100644 =2D-- a/lisp/comint.el +++ b/lisp/comint.el @@ -2036,7 +2036,7 @@ comint-snapshot-last-prompt Freezes the `font-lock-face' text property in place." (when comint-last-prompt (with-silent-modifications =2D (font-lock-prepend-text-property + (font-lock-append-text-property (car comint-last-prompt) (cdr comint-last-prompt) 'font-lock-face 'comint-highlight-prompt)) > That is, we don't overwrite the ANSI face properties. > > I guess this might also avoid overwriting properties in prompts that use > ANSI codes? Which might also be nice. > > Would this regress anything? Anybody got an opinion? > > --=20 > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmG+/+0THG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZPy++D/4hnqql2Zi3W1sQMK7FBcv+16NROA1C K0jjyplHZO65CzveUuzm6KKgCP7O+heZ3FlpUMQXpOgsqmdWX/8mD9mL2LCiviOo EwjuTtKL5jscfLjb5gn1KA0HmHspFSE4AgXEwUwI6abq7smvSISZ7OZOIbCZ6foe uHG/FnxHFamPcC2QAUmrWXkpuD4oAFJdkUvV0oIU2K17cqceuDmG2GNSq2aQvm9a CKuVeXlfdfEvAgKJUWesaAh85eqeQ7UVV58S9Un2UIMF42e621+aNPf40EFsjvIp hStQ9bvtaWPLwlWVNyd0xb4qH8GpuctnJcnYoq4U6HCDTT6/ISvYAuw2FPd/bOOG Q5ImbXxueCBYjxSycvDJzinlOt0eqEFqre5iccvVK0rzLiCv3gRHvarMXY+1PrDR Ak/SPL0n/qrtEwJ0KrwStlqs1oFT3nfrqJvnqnDv1ewCd2RmVh4XYCrVFLjkCQb0 VDGF6+3qpltE9I/CI1rDuAOLebuq7kb0fiWyEaqLYmYBAEPtPs7TCxwQULNlFkAs dfrotkeb2Lq0fbWMH/AyRHDiO+B2KWpV//0PrLdxkUf2i1dnWExuY4Wr6gyiMBdX TfGSw38PDyBvTffFcKR/JOw0ssXQxF1FsEE6JEq5cFGc3uSTbWXrekPGg+F6te6m dorMf7AsoLkO4w== =SEVr -----END PGP SIGNATURE----- --=-=-=--