Up to KDE 4.9, Kate Part had support to remove trailing spaces in two ways:
- Remove trailing spaces while editing
- Remove trailing spaces on save
The reasoning behind removing trailing spaces while editing is that when working on a document, we want to keep our own changes clean of trailing spaces. This way, we can for instance provide patches that are not cluttered with whitespace changes, and we just change lines that we really want to change.
The implementation of this feature unfortunately had quite some regressions that we were able to “fix” over time. For instance, you do not want to remove trailing spaces if the cursor is currently in the trailing spaces area. This alone means we have to kind of remember that we touched this line, and then remove it later. This was always hacky, and in fact, there are still corner cases that did not work.
For KDE 4.10, the both options were merged into just one option Remove trailing spaces with three possible values:
So we only support removing trailing spaces on save from KDE 4.10 on. The implementation is now very clean and based on the line modification system available since KDE 4.8: Thanks to this system we know exactly which lines in the document were changed. So if you choose “Modified Lines” in the configuration, trailing spaces of these modified lines are removed, and other lines remain untouched. If you choose “Entire Document”, then all trailing spaces in the document will be removed. And, needless to say, “Never” implies that trailing spaces are never removed.
For compatibility, the old mode-lines “remove-trailing-space” and “replace-trailing-spaces-save” are still supported, but you’ll get a kWarning() on the console. All these changes are also documented in the Kate handbook (once KDE 4.10 is released). From KDE 4.10 on, you should switch to the modelines
– remove-trailing-spaces none;
– remove-trailing-spaces modified;
– remove-trailing-spaces all;
Hope you like it…
KDE has all these little nifty features, and – guess what – Kate has them, too. Here, we’ll have a look at how to delete a file with Kate. We’ll start with opening the file we want to delete. Example:
Next, we open the menu File > Open With and choose Other… as follows:
We’re almost done: Type ‘rm’ in the Open With dialog:
Now click OK to perform the action, et voila:
Now as you can see, Kate notifies you about the successful deletion. In case you change your mind, you can write it to disk again by clicking Overwrite. Reloading will tell you, that the file can indeed not be found, proving that Kate did exactly what you want. You can also ignore what you just did, which is probably the best choice. Don’t tell anyone
PS: This tip comes from the KDevelop developers. So all Kudos and Cake go to them!
PPS: We are working hard at the Kate/KDevelop sprint in Vienna to provide the best tools for our users!
Recently I’ve blogged about the usage of KMessageWidget in the data recovery process in Kate Part. Finally, we decided to stick with KMessageWidget, since it is a standard kdelibs widget, used by a lot of KDE applications. Besides, it is visually appealing and attracts the user’s attention. In KDE SC 4.10, it will look like this:
Now if you recover the data, it may happen that the swap file is broken, e.g. because it was accidently manipulated for whatever reason. Then you get notified like this:
Besides that, we are currently at our Kate/KDevelop meeting in Vienna. Lots of exciting stuff is happening, so expect more in the next days
Its nice to be here in Vienna with all the other hackers 😉
Most have already arrived and are busy fixing issues in Kate & KDevelop, some more will arrive tomorrow.
Already got bit work done on existing bugs, one bug was really nasty: a nearly 8 year old typo by myself messing around with highlighting in combination with line continuation.
But a guy did a really perfect bug report: Bug 300009
He wrote even a example highlighting file + test to trigger the issue, with that help, the fix was trivial to do, after I got time to read the bug 😉
Thanks to all people reporting bugs in such a useful way!