Subject: Re: 26.1; Re-running shell wipes font-lock from xterm-color

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 30 Oct 2019 20:18:13 +0100

Allen Li <[email-masked]> writes:

> The `shell' command will call `make-comint-in-buffer' and `shell-mode'.
>
> `shell-mode' will then call `comint-mode' as a derived mode.
>
> `comint-mode' will call `kill-all-local-variables'.
>
> `comint-mode' also adds `font-lock-defontify' to
> `change-major-mode-hook'.  Since we're already in `shell-mode' derived
> from `comint-mode', switching "back" to `shell-mode' wipes font-lock.
>
> I can work around this pretty easily in my personal config, by removing
> `font-lock-defontify' from `change-major-mode-hook' with a well-placed
> advice, but the current behavior doesn't seem comfortable to me.

Yes, that seems odd.  Unfortunately the commit log for this just says:

commit 3dd4c1c5af3cdf77ba98b7255ec4034051107c6f
Author: Richard M. Stallman <[email-masked]>
Date:   Tue Sep 10 16:44:58 2002 +0000

    (comint-mode): Add font-lock-defontify to change-major-mode-hook.

So I have no idea what this was supposed to fix.  Richard, do you
remember, by any chance?

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