Subject: Re: bug#7771: 23.1; can't turn off font-lock-mode globally

From: Stefan Monnier <[email-masked]>
Date: Sun, 02 Jan 2011 22:55:52 -0500

close 3628
thanks

>>> (global-font-lock-mode 0) doesn't seem to work.
>> It should work.  So please tell us the cases where it doesn't work, so
>> we can try and figure out where's the problem.
> M-x grep

OK, that one is a known problem: compile.el (used for M-x compile and
M-x grep) uses font-lock internally, so it forces font-lock to
be enabled.

> When I call (global-font-lock-mode 0) in my .emacs.el, python mode isn't
> font locked.  But if I ever M-x python-shell, then files visited afterward
> will be font locked, even though global-ton-lock-mode's value is nil.
> At this point I have to restart emacs in order to see anything.

I'm not sure I understand why you see different results before and after
python-shell, but indeed I see that python.el incorrectly forces
font-lock-mode to be enabled in emacs-23.  I've just installed a patch
which should fix it.

> Visit a binary file, the nonprintable ascii is colored.

This is not controlled by font-lock.  IIUC this just unconditionally
receives the `escape-glyph' face, so you can only "turn it off" by
configuring this face.

> M-x compile

As mentioned above, this is the same issue as M-x grep.  I hope we can
fix it for Emacs-24 (by making compile.el use syntax-propertize-function
rather than font-lock), but for Emacs-23 the only solution I can offer
is to configure the relevant faces so they look the same as default.

        Stefan