Cannot (initially) change font-lock-keywords in mhtml-mode-hook

Frank Steiner <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Hi,

I'm trying to redefine sgml-font-lock-keywords as I prefer
some different font locking for my html files. I do so by

(add-hook
  'mhtml-mode-hook
  (lambda () (progn
   (setq sgml-font-lock-keywords ... (do  some stuff))
   (setq sgml-font-lock-keywords-1 sgml-font-lock-keywords)
   (setq sgml-font-lock-keywords-2 sgml-font-lock-keywords)
   )))


Now when I load a html file, it choses the html+ (mhtml) mode
but shows the font locking (colors and classes, e.g. <head>
with function-name-face) as defined in sgml-mode.el.

Re-fontifying the buffer doesn't change it. But when I do
"M-x mhtml-mode", emacs again chooses the same "HTML+" mode,
but now the buffer is immediately fontified according to my
own sgml-font-lock-keywords, e.g. <head> is now html-helper-
significant-face.

Anything else that I define in mhtml-mode-hook is already
loaded initially, e.g. key definitions etc.
Just the sgml-font-lock-keywords is ignored when loading
a html file until I manually chose the same html+ mode again.

However, for all subsequent html files the fontifying is
using my function. It only fails for the first html file.

Looks like when loading the first html file the hook would
run before the defaults from sgml-mode.el are defined. But
once the sgml-font-lock-keywords is redefined by my hook,
it stays for the rest of the session.

Has anyone an idea how that can happen or how I could try to
debug it?

cu,
Frank
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.