On 5/14/25 10:46 PM, Darrell Anderson via tde-users wrote:
For some time a quirk in Kate has been haunting me. Kate seems unable to remember my syntax highlighting selections.
This happens with two different user accounts on two different computers.
I have Kate configured to store meta data for 180 days. Browsing the meta data file finds all affected files are stored and the 'Highlighting=' key is correct.
As soon as I launch Kate the highlighting is plain text and the meta data file 'Highlighting=' key is empty.
Deleting the meta file and starting from scratch has no effect.
I don't use KWrite and can't offer any related observations.
Any ideas?
You are talking about the entries in your user config, e.g.
~/.tde/share/apps/kate/sessions/<hexstring>.session
and then, e.g.:
[Document 2] Bookmarks= Encoding=UTF-8 Highlighting=C++ ^^^^^^^^^^^^^^^^ Indentation Mode=1 URL=file:///home/david/dev/src-cpp/io/pipe/graphics-vencor-lspci.cpp
One question, is the "Highlighting=xyz" the native highlighting chosen for the file by katepart or is it manually set via Tools->Highlight->foo?
If I recall from earlier discussions this would be for a file that doesn't register the correct highlight (for whatever reason) and the highlighting was manually set via the Tools->Highlighting menu?
At least with kde3, I've not had any luck with the session setting non-standard highlight syntax from the .session file unless I've also edited the Settings->Editor->Highlighting->File extensions: and set a file glob (not necessarily the extension) to match the file.
Now I agree in cases like this is shouldn't be required and on open then .session Highlighting= should simply be restored, but I've not had luck with that. I've tried with various config files that I'll choose either xorg or apache highlighting (or similar syntax) just because that does a decent job matching whatever config file I'm working with. I have never had any luck opening a file assigned a non-native sytax file and then reopening.
Now I can't recall if saving as a .session makes a different, but I know simply reopening the without it being saves as part of a kate .session has no chance in getting custom syntax reloaded correctly. But, all of the standard language file types, e.g. .c, .cpp, .s, .php, .html, .css, .js, .rs, .ru, etc... always seems to get the syntax set correctly.
I always viewed it as one of those things that would take tearing the code apart to find out where the load-file code is (whether in the kate source, or more likely katepart, or maybe even a open routine being called by katepart from kdebase or kdelibs - change k/t as necessary). I've never made it that far from the stand point of if I ran across it doing something else, I'd take a look, but never justified spending the time to start a "hunt-and-peck" through the code just for that reason.
This is where somebody knowing where to look can cut hours (or days) off the search.
We used to have some of the original kde3 devs that would visit the list from time to time -- that kind of knowledge is worth its weight in gold for issues like this. Once I know where to look I can figure things out, but starting from 0 and wading though all the multiple inheritance issues to locate that point was always painful. Grepping the source tree on terms like "syntax" can narrow things down, but "highlight" is equivalent to entering "the" in google and searing....
If Slavek or somebody else has run across that code and made a not of where it lives -- that's another potential option.
Good luck with the needle in the rather large haystack :)