Posts Tagged ‘ KDE ’

Open Files With Long Lines in KWrite, Kate and Kile

In a recent KDE upgrade, the katepart text editor, which powers, kwrite, kile and kate, has been modified to open files with long lines as read only.
Sometimes it will tell you about this in a warning, sometimes you’ll just notice that you cannot modify the file.
It also turns out that the maximum line length is actually very short: 1024 characters. You will have no trouble finding log files with lines longer than this.

After some poking around we’ve figured out that the maximum line length is configurable:
Go to
settings > configure editor > open/save

There you can change the

line length limit

The value 0 means that there is no maximum.
Hit Ok and you’re good to go again.

As a side note: this is a very annoying change. Kate was working fine for us. This new change might fix some bug somewhere, but made the software unusable for our scenario, with absolutely no documentation or hint on how restore the previous behavior. Sometimes you don’t even get a warning that the file was loaded read only (many keyboards have suffered because of this)

Edit: Apparently Kile remembers the read only state of a document. It will keep a document read only if it was previously read only, even after you made the change in the settings. You can turn off read only mode for the active mode by deselecting it in the Tools menu. Kate and KWrite do have this issue.


Fix matlab and latex file associations on KDE

KDE (and linux) in general has a very elaborate system of guessing the file type of your file, that depends on both the file extension and the file contents. In 99% of the cases these rules work, unfortunately the other 1% has been annoying me for quite some time.
If you create a matlab m-file that starts with comments (% some comment), KDE will think the file is a latex file and insist on opening it with a dedicated latex editor.
This behaviour can be changed by modifying the mime type definitions.
Open /usr/share/mime/packages/ in your favourite text editor as root.
Find the node <mime-type type="text/x-tex">. This will have a subnode that looks like:

<magic priority="10">
   <match value="%" type="string" offset="0"/>

Change the priority to something smaller than 10, so it has a lower priority than the matlab magic rule.
Now run

sudo update-mime-database /usr/share/mime

And that’s it. KDE will now see all your m-files as matlab scripts even if they start with a comment.

Mendeley and KDE

Mendeley is a very convenient bibliography tool. It keeps track of all your references, you can easily import from tons of sites and it backs up your collection on their servers. It also works on all major operating systems thanks to the Qt library.

Their latest builds had a bug on KDE systems though: you can’t open a pdf in an external viewer, which is rather annoying because the internal one is rather limited.

Now it appears that you can solve this bug by remove the Qt library files that come with the mendeley installation. Just add .bak to all files that have “Qt” in their name in the mendeley install folder.
Mendeley will now use your systems Qt libraries and “open in external viewer” will work. As an added benefit Mendeley will now also better integrate in your desktop visualy.