[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywor
Re: (add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords
Mon, 05 Sep 2005 11:54:37 -0400
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)
Stefan> font-lock-mode-hook is called both when turning the mode ON and
Stefan> when turning the mode OFF.
> But I didn't turn it off.
No, but it still means your hook code is wrong: you should check that
font-lock-mode is non-nil before calling your `show-tabs'.
Stefan> font-lock-keywords should not be modified as you do. Instead you
> Is that documented somewhere. I've seen similar constructs used quite a few
> times (e.g. emacs wiki page).
Not really, but it's always been that way. Take a look at what
font-lock-compile-keywords does. It has partly changed over time, but some
form of it has existed for "ever".
Also the docstring suggests using font-lock-add-keywords:
contained expressions. You can also alter it by calling
`font-lock-add-keywords' or `font-lock-remove-keywords' with MODE = nil.
> and now it looks better, but it still looks a bit odd to me:
Only to you. Not to Emacs.