Version: 4.1.3 (KDE 4.1.3) "release 4.9" (using 4.1.3 (KDE 4.1.3) "release 4.9", openSUSE 11.1) Compiler: gcc OS: Linux (x86_64) release 2.6.27.7-9-default For .cpp and .h and for many other files types, kwrite displays a vertical bar on the left, with yellow parts where you can hide or show for example the lines of a comment or a function. (I don't know how this feature is called.) It would be great to have this feature also for .spec files. It would be very practical to be able to hide and show a block of conditional compiling. So it would be about blocks of lines who start with a line that starts with "%if" (including "%ifarch", %ifos"...) and who end with a line that starts with "%endif". This would especially be very helpfull because in .spec files you can't do indeting.
It would also be usefull to highlight the beginn of sections (%description, %prep, %build, %install, %clean, %files, %changelog) more. Actually these words are just painted in red color, just like everything else that starts with %. But as they have a special function (=starting a new section in the spec file), they could be highlighted much more.
I don't think it would be very difficult to implemnt your ideas, and AFAICS they are good! Did you look insde the xml file: $(kde-config --path data)/katepart/syntax/rpmspec.xml ? It is not extremely difficult to understand!
Yes, I've looked into this file. However I didn't understand it really good. Is there any documentation available for the file format?
There is documentation in the maual, and at http://www.kate-editor.org. http://www.kate-editor.org/article/writing_a_kate_highlighting_xml_file The relevant manual chapter is here: http://docs.kde.org/kde3/en/kdebase/kate/katehighlight-xml-format.html
Created attachment 29836 [details] Experimental support for %if... and section headers I have no good test spec file and I don't know enough about the syntax, so please try this and give feedback. If it is okay, I'll commit it
Created attachment 29862 [details] rpmspec.xml Okay, I've tried it - it's working. But finally, I've spend some hours and made a new XML description for .spec files from scratch. While not perfect, it's IMHO much better than the previous one - highlighting is much more exact and fits better the meaning in the .spec file. Folding blocks are not supported for sections, but implemented only for %if/%endif blocks (because %if blocks can span over several (parts of) sections - it would not work fine to support folding blocks for both.) I'll attach test files for trying out the XML description...
Created attachment 29863 [details] template.spec example .spec file, showing some features of the new XML description
Created attachment 29864 [details] kdevelop3.spec A (quite big and complex) real word example from openSUSE build service
SVN commit 905702 by jowenn: New RPM Spec file highlighting and two testcases, created / uploaded by Tim Fechtner as attachments to bug 179295. BUG: 179295 M +129 -60 syntax/data/rpmspec.xml A tests/highlight.spec A tests/highlight1.spec WebSVN link: http://websvn.kde.org/?view=rev&revision=905702
Verified in 4.2 RC.