I have a HTML page, with html-mode
enabled. I call function sgml-validate
to check for any markup errors. It's based on compilation-mode
. I want to remove some warnings from the compilation output, so I wrote a function and hooked it to compilation-filter-hook
(this variable is not documented, but compilation-filter
invokes it). Everything works. My problem is that how can I ensure my filter function only gets called when I started the compilation process on a HTML page (via sgml-validate
)?
I see two methods, but none of them worked:
- First, I can check the value of
major-mode
. But it always returnscompilation-mode
, since that is enabled on the*compilation*
buffer. (I found a filter function in the source code ofgrep+
, and they did check the value ofmajor-mode
. I can't figure out how can it work correctly.) - The other idea was than to only hook my filter function to the HTML file's buffer, but for similar reasons it couldn't work as the output of compilation process goes to a seperate buffer.