Bug 489600 - Some .kateconfig settings are applied only after file reload (pressing F5)
Summary: Some .kateconfig settings are applied only after file reload (pressing F5)
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 23.08.5
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-02 12:19 UTC by Chris K
Modified: 2024-10-01 07:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris K 2024-07-02 12:19:27 UTC
SUMMARY
After having used a .kateconfig file for a long time (mostly for file type-dependent tab-related settings), I wanted to also use it to change the font for some file types. First I was happy to see that there is in fact a documented variable for this but then I was disappointed to see that it had no effect. Only by chance did I notice that after reloading the file (by pressing F5) the setting was actually applied.

STEPS TO REPRODUCE
1. If you do not have one already, create a .kateconfig file in your home directory. (Learn about [kateconfig-files](https://kate-editor.org/2006/02/09/kateconfig-files/) if you want to.
2. Add a modeline like the following `kate-wildcard(*.txt): word-wrap-column 20; font-size 18; font Noto Sans;`. The `word-wrap-column 20` is just for testing (this should work), the specific `font` does not matter -- pick any font you have installed (non-mono for more obvious effect). Learn about [kate-modelines](https://kate-editor.org/2006/02/09/kate-modelines/) if you want to.
3. Open a file ending in `.txt`.

OBSERVED RESULT
You will see your default font (and the marker line after 20 columns).

EXPECTED RESULT
You will see a large non-mono font.

SOFTWARE/OS VERSIONS
Linux: openSUSE 15.6
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Comment 1 TraceyC 2024-07-08 18:11:46 UTC
The bug says some settings are applied after a reload. Can you let me know one or two settings that are applied without a reload for testing purposes? I want to confirm if this is behavior by design or inconsistent behavior.

Note: The current documentation doesn't mention whether it's expected that the user needs to reload a document to reflect changes in the .kateconfig file
https://docs.kde.org/stable5/en/kate/katepart/config-variables.html
Comment 2 Chris K 2024-07-09 11:18:56 UTC
(In reply to TraceyC from comment #1)
> The bug says some settings are applied after a reload. Can you let me know
> one or two settings that are applied without a reload for testing purposes?
> I want to confirm if this is behavior by design or inconsistent behavior.
> 
> Note: The current documentation doesn't mention whether it's expected that
> the user needs to reload a document to reflect changes in the .kateconfig
> file
> https://docs.kde.org/stable5/en/kate/katepart/config-variables.html

One thing that works directly (after opening a fitting file) is the *word-wrap-column* variable (as given in the original report). Another example is *replace-tabs* (off/on). This is definitely the intention; you cannot expect people to open a file and then immediately manually reload it, just to get the settings applied.
The inconsistent behavior is the font family and size, which requires this kind of reload.
Comment 3 TraceyC 2024-07-09 15:19:27 UTC
Thank you for replying. I was able to replicate the inconsistent behavior you're seeing by creating a new .kateconfig file and experimenting with the values you mentioned.

kate: word-wrap-column 20;
This is applied right away to the .kateconfig file itself but not other files in a session
It is applied when opening a file, as you observed, and also if reloading the file with F5

kate-wildcard(*.txt): word-wrap-column 20; font-size 18; font Noto Sans;
When opening a text file, I observed
- The word wrap is correctly at 20 columns  without needing to reload the file
- The font is *not* set to Noto Sans, it is using the same font as other files
- Reloading the file with F5 changes the font to the one specified
Comment 4 Waqar Ahmed 2024-09-29 18:00:45 UTC
Git commit 58a165c5e067b780a260bb0e10a0b50e2b7f3715 by Waqar Ahmed.
Committed on 29/09/2024 at 17:55.
Pushed by cullmann into branch 'master'.

Read dir kateconfig on view creation

M  +43   -30   src/document/katedocument.cpp
M  +14   -4    src/document/katedocument.h

https://invent.kde.org/frameworks/ktexteditor/-/commit/58a165c5e067b780a260bb0e10a0b50e2b7f3715
Comment 5 Chris K 2024-10-01 07:18:49 UTC
Thank you! :-)