[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
font-lock-fontify-buffer removes highlighting in non font-lock buffers
From: |
Juri Linkov |
Subject: |
font-lock-fontify-buffer removes highlighting in non font-lock buffers |
Date: |
Tue, 20 Dec 2005 23:55:21 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
font-lock-fontify-buffer is an interactive command and when it is invoked
as a buffer not intended for font-lock fontification, this breaks
highlighting in all other non font-lock buffers.
A simple way to reproduce:
C-h i M-x font-lock-fontify-buffer RET
and after this to see that highlighting is broken in all other buffers:
M-x list-colors-display RET
M-x list-faces-display RET
...
That's because font-lock-default-fontify-buffer doesn't make the variable
font-lock-keywords buffer-local, and its global value gets compiled to
`(t nil)'.
After creating new buffers, font-lock-default-function checks
font-lock-keywords for nil, and since its global value is now
`(t nil)', it calls font-lock-mode-internal which removes all
highlighting from every non font-lock buffer.
This bug was responsible for removing highlighting from Gnus buffers,
and now it is avoided but not calling font-lock-fontify-buffer
from hi-lock mode. But I think it should be fixed no matter
if it called from hi-lock or not.
I see at least three solutions:
* check font-lock-keywords in font-lock-default-function for the compiled
empty value `(t nil)' and don't call font-lock-mode-internal for this
value;
* make the variable font-lock-keywords automatically buffer-local;
* in font-lock-default-fontify-buffer call font-lock-set-defaults
regardless of the value of font-lock-mode, or depending on some other
condition, e.g. if (local-variable-p 'font-lock-keywords).
--
Juri Linkov
http://www.jurta.org/emacs/
- font-lock-fontify-buffer removes highlighting in non font-lock buffers,
Juri Linkov <=