[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
First fontification of a buffer happens before font lock is fully initia
First fontification of a buffer happens before font lock is fully initialised.
Wed, 25 Jan 2012 12:48:04 +0000
(define-minor-mode font-lock-mode ....), calls
font-lock-default-function which calls
font-lock-mode-internal which calls
This call of f-l-fontify-buffer happens before font-lock-mode-hook is
run, since the defined-minor-mode runs the hook as the _very_ last
thing. Thus the buffer's f-l-stuff is potentially not fully initialised
at this first call of f-l-fontify-buffer.
This situation was found and analysed by Hannu Koivisto after CC Mode
crashed for this reason on a C++ buffer. Why it doesn't happen for
every CC Mode buffer is not yet clear.
(i) Amend define-minor-mode to have an extra parameter :run-hooks with
(ii) Set it to nil for f-l-mode, and explicitly write the hook run in
the appropriate place.
Incidentally, XEmacs does run this hook in the correct place.
Alan Mackenzie (Nuremberg, Germany.
- First fontification of a buffer happens before font lock is fully initialised.,
Alan Mackenzie <=