Category Archives: Common

Kate Project Plugin

It is not a secret that removing Kate’s project manager in KDE 3.5 was not the right thing to do. It seems a lot of people used it and we got many complaints about this decision. That also shows that it is hard go get feedback about what users are really using. If a feature is done well, noone will ever talk about it. This is paradox, as we thought the project manager was not well integrated :) (I still think that)

Ok, let’s come to the interesting part: Three developers wrote a new Kate Project Manager Plugin and published an initial release on sourceforge.net and on kde-apps.org. It works quite well already and reading the comments on kde-apps.org gives me the impression that there are more features to come with the next release. — If you are interested maybe you want to join the project…

PS: I have the secret hope the plugin will be ported to KDE4 using Qt’s model/view architecture, so that it has good support for multiple mainwindows :)

Kate Part in upcoming KDE 3.5.4

The last week was highly productive for Kate Part, as the following bugs were fixed:

  • 89042 while pressing “del” key kate crashes (crash, bt)
  • 103648 Codefolding Crash – Reproducable
  • 118584 scroll position not upgrading (dynamic word wrap)
  • 119435 kate crash when a file is saved
  • 123315 kwrite/kate crashes randomly after save
  • 124102 changing syntax highlighting when code is folded crashes katepart
  • 127928 kate crashes deleting a block of text
  • 128690 Dynamic word wrap makes text input slow
  • 129853 Horizontal scrollbar and view not synced, if dynamic and static word wrap are off
  • and some minor issues

That are 6 crash fixes. Kate Part in KDE 3.5.4 will be more stable than ever :) That’s especially cool for KDevelop, Quanta+, Kile – well and Kate.
Special thanks to Andreas Kling for initiating the bug squashing sessions! You are like a blackbox: The input is a bug and your output is the fix ;)

Kate Modes & Filetypes

Modes allow the user to override the default configuration for documents of specified mimetypes or file extensions. When the editor loads a document and the mimetype or file extensions match for one of the defined filetypes, KatePart will read the configuration from the mode and apply the modelines defined. If more filetypes match, the one with the highest priority will be used.

To create a filetype, go into the settings dialog available in Kate via Settings > Configure Kate > Open/Save > Modes/Filetypes, then press the New button and fill in the properties. To remove an existing filetype, select it from the dropdown list and press the Delete button. To edit an existing mode, select it from the dropdown list.

Some Available Properties

  • Name
    This is a user friendly name that will be displayed in the menu Tools > Mode.
  • Section
    A submenu of Tools > Mode in which to place this filetype. If the section does not already exist, it will automatically be created.
  • Variables
    This is where the actual configuration goes. Variables set here will overwrite the default configuration values. Be aware that this line must begin with kate: and end with a semicolon. For a full list of available variables refer to modelines.
  • File Extensions
    A semicolon separated list of filename globs used to determine if a document matches this filetype.
  • Mimetypes
    A semicolon separated list of mime types used to determine if a document matches this filetype.
  • Priority
    If a document matches several filetypes, the one with the highest priority will be chosen.

Example

As an example we will create a new mode configuration for C++ and Java files. It should use the C Style indenter and indent with 4 spaces (no tabs). The configuration could look like this:

Name: C++ and Java settings
Section: Sources
Variables: kate: space-indent on; indent-width 4; mixed-indent off; indent-mode cstyle;
File Extensions: *.cpp;*.java
Mimetypes: text/x-c++hdr;text/x-c++src;text/x-java
Priority: 10

.kateconfig Files

Kate allows you to specify local document variables by setting the corresponding modelines. The hidden file .kateconfig provides exactly the same functionality, but for all files in the directory.

Enable the Feature

To use a .kateconfig file you first have to enable the feature by invoking Settings > Configure Kate. In the config page Open/Save you can find the option Search depth for config file, which defaults to Do not use a config file. Change the value to an appropriate number,

  • 0 means look in the current folder
  • 1 means look in the current folder, and if there is no .kateconfig file, look in the parent folder
  • etc…

In short – Kate will search the number of given folder levels upwards for a .kateconfig file and load the settings from it.

Fill the .kateconfig File

The .kateconfig file simply contains modelines.

The following example will cause all documents to indent with 4 spaces with a tab width of 4. Tabs will be replaced during editing text and the end-of-line symbol is a linefeed (\n).

kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;

Final Note

Right now it is not possible to specify different settings for different filetypes/mimetypes. We are aware of this problem and hope to provide a fix in near future, perhaps for KDE 4.