GNU bug report logs -
#11883
24.1.50; shell-mode doesn't colorize the prompt
Previous Next
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 #35 received at 11883 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Stefan Monnier <monnier <at> 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)))
>
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
--- 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
- (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?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
[signature.asc (application/pgp-signature, inline)]
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.