Bug 514797 - File "kate-swp" is not removed after application closed with "Discard".
Summary: File "kate-swp" is not removed after application closed with "Discard".
Status: REPORTED
Alias: None
Product: kate
Classification: Applications
Component: application (other bugs)
Version First Reported In: 25.12.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 515346 (view as bug list)
Depends on:
Blocks:
 
Reported: 2026-01-18 17:31 UTC by Martin Schnitkemper
Modified: 2026-01-31 14:07 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schnitkemper 2026-01-18 17:31:41 UTC
SUMMARY
When opening a file for editing in Kate, a hidden swap file with the extension .kate-swp is created in the same directory, for example:  test.txt -> .test.txt.kate-swp

This swap file appears to store unsaved changes in a binary format and is updated periodically. When the document is saved and closed normally, the corresponding .kate-swp file is removed as expected. However, for some time now, the following behavior can be observed:

STEPS TO REPRODUCE
1. Open an existing file in Kate.
2. Make some changes to the file and wait a few seconds until kate-swp has been updated.
3. Close Kate or close the document.
4. In the dialog asking whether to save the changes, choose “Discard”.

OBSERVED RESULT
    • The .kate-swp file is not removed.
    • When opening the same file again, Kate shows the message: “The file was not closed properly.”
    • The user is then asked to choose between:
        ◦ Show changes
        ◦ Recover file
        ◦ Discard

EXPECTED RESULT
If the user explicitly chooses “Discard” when closing the document, the swap file should be removed, just as it is when the document is saved and closed normally.
In this case, the file was closed correctly — the user intentionally chose not to save the changes. Therefore:
    • No recovery prompt should appear on the next open.
    • The message “The file was not closed properly” is misleading in this situation.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.5.5
KDE Frameworks Version: 6.22.0
Qt Version: 6.10.1
Kernel Version: 6.18.5-arch1-1 (64-bit)

ADDITIONAL INFORMATION
The swap file mechanism makes sense to protect against crashes or unexpected termination, allowing recovery of unsaved work.
However, when the user explicitly discards changes, the remaining .kate-swp file causes unnecessary and confusing recovery prompts, even though there was no crash or improper shutdown.
Comment 1 marcus.typ.johansson 2026-01-31 14:07:12 UTC
*** Bug 515346 has been marked as a duplicate of this bug. ***