All posts by Dominik

Dominik is a PhD student at the Control Theory and Robotics Lab, TU Darmstadt, as part of the Research Training Group GKMM (GRK1362). My research focuses on state estimation in distributed systems. As hobby, I contribute to the KDE project and work on the Kate application and editor component.

Improving Syntax Highlighting Files

When building the KSyntaxHighlighting framework, the syntax highlighting xml files are compiled into the KSyntaxHighlighting library. In order to do so, we have a small little helper program that generates an index of all xml files. This indexer also validates the xml files against the XML Schema, and performs some more sanity checks.

Review request D10621 tries to extend the indexer even further and suggest optimizations for our highlighting files. For instance, the rule

 <AnyChar context="#stay" String="&space;" attribute="Normal Text" />

should be replaced by the faster rule

 <DetectChar context="#stay" char="&space;" attribute="Normal Text" />

Similarly, the rule

 <RegExpr attribute="Normal" context="conditionNot" String="\bnot\b" lookAhead="true" insensitive="true"/>

should be replaced by the much faster rule

 <WordDetect attribute="Normal" context="conditionNot" String="not" lookAhead="true" insensitive="true"/>

The proposed patch above generates more than 1500 suggestions to improve our highlighting files, so a lot of work. Help would be very much appreciated. So if you would like to contribute to KDE and are looking for simple work to do, then feel free to get started by sending improved highlighting files to us via phabricator.kde.org (click “Code Review” on the left, and then “Create Diff” on the top right – or even better use arc to automatically manage your patches). Oh, and please increase the version number in the xml files whenever you provide a patch 🙂

Fancy Terminal Prompt

By default, the terminal looks as follows on my Linux distribution:

However, if you are working a lot on the terminal, there are a lot of scripts and tricks available in the net that improve the information displayed in the terminal in many ways. For instance, since many many years, I have the following at the end of my ~/.bashrc:

# use a fancy prompt
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]"
PS1="$PS1 \`if [ \$? = 0 ]; then echo -e '\[\033[01;32m\]:-)';"
PS1="$PS1 else echo -e '\[\033[01;31m\]:-(' \$?; fi\`\[\033[00m\]"
PS1="$PS1 \$(__git_ps1 \"(%s)\") \$ "

Once you open a new terminal, then the appearance is as follows:

As you can see, now I have nice colors: The hostname is green, the folder is blue, the return value of the last executed command is a green 🙂 in case of success (exit code = 0), and a red 🙁 in case of errors (exit code != 0). In addition, the last part shows the current git branch (master). Showing the git branch is very useful especially if you are using arc a lot and work with many branches.

I am sure there are many more cool additions to the terminal. If you have some nice additions, please share – maybe also as a new blog?

Tracking KDE Development

A central place to track KDE development is the kde-commits@kde.org mailing list. To this mailing list, all code changes are sent, containing the log message as well as the diff that quickly shows what really changed. In the early days of KDE development, the changes were maintained by the CVS version control system. Later, this was changed to subversion. Nowadays, KDE mostly uses git, but some svn modules are still around.

Since KDE is developed by many contributors, the  kde-commits@kde.org mailing list obviously has high traffic, ranging from ~100 mails up to 400 mails a day (see marc.info for statistics).

Many developers are subscribed to this mailing list. However, due to high traffic and possibly many changes that are unrelated to your pet project, a commit filter was invented, which was available on https://commitfilter.kde.org for a long time. Essentially, this commit filter allowed to easily setup filters in terms of regular expressions, such that you’d only get mails for changes you are interested in. While this was convenient, the commit filter also had its drawbacks: Instead of getting all KDE changes, you missed a lot possibly interesting conversations: Since post-code reviews are often done by others through email conversation directly on the code changes.

Nowadays, the commit filter is not available anymore, mostly for security reasons since it was unmaintained for a long time.

What does that mean? I’m subscribed to kde-commits@kde.org again, getting all changes. In fact, I am enjoying skimming quickly through the changes, even doing a code review here and there.

I recommend every KDE contributor to subscribe to this mailing list, since it is very interesting to see which projects are actively developed and who really contributes to KDE in person. Even better, sometimes there are discussions on this list, helping you to learn things you didn’t know. Of course, nowadays we also have many code reviews on phabricator, but still the commit mailing list is a nice addon to track KDE development.