all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 11883@debbugs.gnu.org, Dima Kogan <dima@secretsauce.net>
Subject: bug#11883: 24.1.50; shell-mode doesn't colorize the prompt
Date: Fri, 16 Jul 2021 01:06:53 +0200	[thread overview]
Message-ID: <878s27dvn6.fsf_-_@gnus.org> (raw)
In-Reply-To: <jwv7gpu4o40.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 09 Nov 2012 14:05:47 -0500")

Stefan Monnier <monnier@IRO.UMontreal.CA> 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)))

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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2021-07-15 23:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09  5:29 bug#11883: 24.1.50; shell-mode doesn't colorize the prompt Dima Kogan
2012-11-06 19:12 ` bug#11883: Hints Dima Kogan
2012-11-09 19:05   ` bug#11883: shell-mode doesn't colorize the prompt Stefan Monnier
2021-07-15 23:06     ` Lars Ingebrigtsen [this message]
2021-07-30 12:04       ` bug#11883: 24.1.50; " Lars Ingebrigtsen
2021-07-30 18:38         ` Dima Kogan
2021-12-19  9:48       ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-19 11:02         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878s27dvn6.fsf_-_@gnus.org \
    --to=larsi@gnus.org \
    --cc=11883@debbugs.gnu.org \
    --cc=dima@secretsauce.net \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.