Archive for April, 2008

Mmm… Tasty…

10th April 2008

The wolf is looking mighty good. There are obviously still quite a few missing features, rough edges and things that make it crash (it is pre-alpha software, after all). But it plays music, and it looks good.

A screenshot of Amarok

Edit: I’m not an Amarok dev. My entire contribution to Amarok has been a single three-line patch (and that was to the Plasma-based part of it). I’m just a bleeding-edge junkie.

Vim helper script

9th April 2008

I decided to post this after reading Adriaan’s blog on licensing.

My editor of choice is vim. It has a steep learning curve, but once passed it allows speedy editing. It has more features than I have any hope of discovering, let alone mastering. I’ve more than once wished I had a simple way of doing something, then accidentally stumbled across just such a feature in vim.

All this is besides the point, however. I’m not here to convince you to use vim if you are currently happy with Kate or Emacs (or any of the dozens of other editors out there). For those that do use vim, however, kdesdk has a very handy vim script: kde-devel-vim.vim. Simply copy it (or create a link) from kdesdk/scripts/kde-devel-vim.vim to ~/.vim/plugin. Or put a line like source ~/src/KDE/kdesdk/scripts/kde-devel-vim.vim in to your ~/.vimrc.

After this you get several neat features. One of them is that spaces at the end of lines, and all tabs, are marked with a dot, so you can see excess whitespace or tabs where there should be spaces (if you are following the KDE coding style). It has a few helper functions that automatically adjust spaces around parentheses and insert braces in the correct place depending on the coding style of the module you are working on.

All this is very useful, but why did Adriaan’s post trigger this one? Well, I discovered a few more useful features it provides recently. If you type ,i, for example, it inserts include guards in the file you are editing based on the file name. ,h will switch between the header and the main cpp file, and ,p will do the same for the private header and the implementation file. And, incredibly usefully, there are similar keysequences that insert license headers.

You need to do a little bit of set-up for this. You need to create some files in your home directory. GPLHEADER should contain the text to insert for a GPL header. Such as the following:

 * Copyright 2008  Name <>
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA

This will be inserted at the top of the file when you type the sequence ,lg. Likewise ,ll will insert the contents of ~/LGPLHEADER, and ,lm will insert ~/MITHEADER. The script is trivial to extend to do the same for BSD headers, for instance.