OK, so I fixed this to be in it's own file, I can't really read what you did on kis_painter. It seems your emacs mode failed since it produce this monstrous diff between the 2 versions, replacing tabs with spaces.