SUMMARY In data/syntax/makefile.xml the language tag's priority attribute's value is 11 since https://commits.kde.org/syntax-highlighting/f5c28a08c23c4d8b0ca76dcc3e9127142cdbfe86. This is a very high priority, which trumps the extensions of C++ (priority=9), C (priority=5) and many other languages. /usr/share/mime/globs2 assigns separate priorities to different patterns belonging to the same MIME type. For example: 50:text/x-makefile:makefile 50:text/x-makefile:gnumakefile 50:text/x-makefile:*.mak 10:text/x-makefile:makefile.* This makes it easy to assign lower priorities to unusual patterns like "makefile.*". "10" is the lowest priority in my system globs2 file. Although the commit that introduced the high priority into makefile.xml did so for the sake of this very pattern in order to assign the Makefile syntax to a file named "Makefile.inc". Note also the related revision history comment close to the top of makefile.xml: <!-- small priority to allow for example Makefile.cpp to be detected as cpp file --> This comment must have been missed by the author and the reviewer of the commit that re-increased the priority. The easiest fix is to set the priority in makefile.xml to a sufficiently low value. But doing so would reintroduce the "Makefile.inc" issue fixed by the aforementioned commit. The easy fix would also lower the priority of unambiguous literal Makefile patterns, such as "GNUmakefile", "Makefile", "makefile", as well as the "*.mk" pattern, which might cause certain makefiles to be highlighted as some other language. STEPS TO REPRODUCE 1. Create a file named "Makefile.cpp" or rename an existing C++ file to "Makefile.cpp". 2. Open the file "Makefile.cpp" in Kate. OBSERVED RESULT The opened file is highlighted as "Makefile". EXPECTED RESULT The opened file is highlighted as "C++". SOFTWARE/OS VERSIONS Manjaro GNU/Linux, Xfce KDE Frameworks Version: 5.84.0 Qt Version: 5.15.2+kde
Perhaps we could just have a more restricted makefile.* wildcard, there are not that many real life suffixes in use like .in and .am and .inc. Patches welcome.
(In reply to Christoph Cullmann from comment #1) > Perhaps we could just have a more restricted makefile.* wildcard, there are > not that many real life suffixes in use like .in and .am and .inc. > > Patches welcome. Searched "Makefile" on GitHub and immediately found lots of makefile extensions in use: https://github.com/LIVE-EMPIRE/LITZLERTOTO/blob/e6a17324850b7b85233e6f20fcaba4af8a99a493/Engine/Source/ThirdParty/libPNG/libPNG-1.5.2/scripts/README.txt. Can some Makefile extensions (i.e. C and C++ header/source extensions) be excluded somehow instead?
(In reply to Igor Kushnir from comment #2) > (In reply to Christoph Cullmann from comment #1) > > Perhaps we could just have a more restricted makefile.* wildcard, there are > > not that many real life suffixes in use like .in and .am and .inc. > > > > Patches welcome. > Searched "Makefile" on GitHub and immediately found lots of makefile > extensions in use: > https://github.com/LIVE-EMPIRE/LITZLERTOTO/blob/ > e6a17324850b7b85233e6f20fcaba4af8a99a493/Engine/Source/ThirdParty/libPNG/ > libPNG-1.5.2/scripts/README.txt. Can some Makefile extensions (i.e. C and > C++ header/source extensions) be excluded somehow instead? That is not feasible with the current wildcard syntax.