>> Hmm... AFAICT the problem here is that the implementation of >> `global-font-lock-mode` ends up trying to enable `font-lock-mode` in >> that file's buffer during execution of the >> `after-major-mode-change-hook` of *another* buffer while querying >> whether to obey those file-local settings, and then fails to try again >> when the hook is run in the desired buffer. >> >> I suspect the patch below might help (requires recompiling >> `font-core.el` and re-dumping Emacs), but as the comment in there >> explains it might not always be sufficient either. > > I tried the patch via make extraclean; make bootstrap > I can still reproduce the original recipe. I pushed that patch to m`aster` because it fixed other cases (e.g. bug#69431) but I think to fix bug#58888 we need the next step, which is the patch below. Can you confirm that it fixes it for you as well? It will remove support for globalized minor modes in those few remaining major modes which don't use `run-mode-hooks`. `run-mode-hooks` was introduced in Emacs-22 and for many years it was really important to support modes which don't use it, but nowadays those modes are vanishingly rare and really should get fixed, so I think it's time to get rid of those ugly hacks. Stefan