I believe this accomplished by modifying compilation-mode-font-lock-keywords
and compilation-error-regexp-alist(-alist)?
. If py-test is running in a raw compilation-mode
than the appropriate alists need to be added to the global font-lock-keywords & error-regexp-alists for compilation-mode.
However I believe when defining a compilation derived mode with define-compilation-mode
, it automatically references a variable for deriving mode specific error and font-lock information. IE
(define-compilation-mode pytest-compilation-mode "Pytest Compilation" "docs.")
Automatically generates a references to variables like:
pytest-compilation-error-regexp-alist
pytest-compilation-error-regexp-alist-alist
pytest-compilation-mode-font-lock-keywords
I believe for this example it would be a pytest-compilation-mode-font-lock-keywords
which would cover metadata about the buffer like number of errors, if it finished, the same as compilation-mode-font-lock-keywords
does in the compile
library. Similarly compilation-error-regexp-alist
defines what errors look like (as well as hyperlink formatting, etc). Finally compilation-error-regexp-alist-alist
defines how to map to lines referenced within a given error. I recommend reading through the documentation for compile
using M-x locate-library compile
for more details.