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.


        Stefan


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to