Subject: bug#56637: 28.1.90; [FR] Allow a way around font-lock-mode being unconditionally disabled in " *hidden*" buffers

From: Ihor Radchenko <[email-masked]>
Date: Tue, 26 Jul 2022 13:21:44 +0800

Stefan Monnier <[email-masked]> writes:

>> In my case, the main difference is in org-src-font-lock-fontify-block.
>> Its purpose is copying the text fontification from major mode buffer to
>> Org mode buffer. The copying is done by checking 'face and
>> font-lock-extra-managed-props properties, which is sufficient as long as
>> font-lock-mode is activated. When font-lock-mode is not activated,
>> copying 'face is not enough, and we have to copy 'font-lock-face.
>
> You're slowly inching toward a concrete case, but it would be much
> simpler and faster to just give a recipe telling what you do, what you
> see, and what you'd like to see instead.
> You know: a normal bug report.

I am sorry, but there is no useful bug to report here.

I had an actual bug report along the lines:

1. Install web-mode
2. Configure Org mode to use web-mode for html
3. Create html src block in Org mode
5. Fontification does not work

The issue was disabled font-lock-mode in temporary buffer + web-mode
directly setting font-lock-face.

I have fixed this on Org side by explicitly copying font-lock-face
property instead of relying on font-lock-face being remapped to face.

Then, I posted the bug to emacs-devel because (1) I was not sure if
copying face-lock-face is a reliable option (it is, as we figured); (2)
Similar issues might popup as a result of font-lock-mode being disabled
in temporary buffers/noninteractive mode.

Best,
Ihor