1

Is it possible to activate syntax highlighting for strings in compilation mode?

Sometimes the compilation error output of some C++ linter is quite unreadable. Lengthy types and function definitions are printed with some small explanation in between. For example:

foo.cpp:147:60: info 1764: parameter 'foo' of type '`NamespaceA::NamespaceB::NamespaceC::CFoo &' of function 'NamespaceA::NamespaceB::NamespaceC::CBar::setAs(const unsigned int, const NamespaceX::NamespaceY::CFoobar &, const NamespaceX::NamespaceZ::Cbarbaz &, NamespaceA::NamespaceB::NamespaceC::CFoo &, const NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &)' of type '_Bool (unsigned int, const NamespaceX::NamespaceY::CNamespaceY &, const NamespaceX::NamespaceZ::Cbarbaz &, NamespaceA::NamespaceB::NamespaceC::CFoo &, const NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &)' could be reference to const

If those '' strings would be highlighted with font-lock-string-face, then the relevant information could be spotted more easily.

foo.cpp:147:60: info 1764: parameter 'foo' of type 'NamespaceA::NamespaceB::NamespaceC::CFoo &' of function 'NamespaceA::NamespaceB::NamespaceC::CBar::setAs(const unsigned int, const NamespaceX::NamespaceY::CFoobar &, const NamespaceX::NamespaceZ::Cbarbaz &, NamespaceA::NamespaceB::NamespaceC::CFoo &, const NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &)' of type '_Bool (unsigned int, const NamespaceX::NamespaceY::CNamespaceY &, const NamespaceX::NamespaceZ::Cbarbaz &, NamespaceA::NamespaceB::NamespaceC::CFoo &, const NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &, NamespaceA::NamespaceB::NamespaceC::CFoo &)' could be reference to const

Is there a way to activate that? Could it probably be done by changing the syntax-table used by compilation mode (if that is used)?

Or is there a minor mode available that I could activate?

  • 1
    You may wish to add a custom regexp to the compilation-error-regexp-alist; or, parse the buffer again when it finishes; or, add a second parsing after or before compilation-parse-errors. – lawlist Oct 12 '18 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.