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:
major-mode
. But it always returns compilation-mode
, since that is enabled on the *compilation*
buffer. (I found a filter function in the source code of grep+
, and they did check the value of major-mode
. I can't figure out how can it work correctly.)It sounds like you can advise smgl-validate so that it performs the filtering before it performs all it's other operations. For example:
(defadvice sgml-validate (around fix-filtering command activate) (let ((return-value ad-do-it)) (filter-function return-value))))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With