I am trying to configure an external editor for kmail, but the way the command line is parsed makes things overly difficult. What I found out, by trials and errors: I one enters xterm -fa 'Liberation Mono' ... it will not work because the program runs with argv[1]="-fa"; argv[2]="'Liberation"; argv[3]="Mono'" One should use xterm -fa "Liberation Mono" instead. Not intuitive. I didn't find a way to specify a line number for the vim family of editors. The command line argument is vim +42 foobar the following will also work in a shell vim "+ 42" foobar; vim '+ 42' foobar; vim +\ 42 foobar There is no way to make kmail generate one of those: vim +%l %f fails because some space is put between variable interpolations and one finally gets argv[1]="+" argv[2]="42". vim '+%l' %f fails because it gives argv[1]="'+" and argv[2]="42'". vim "+%l" %f fails because variables are not interpolated between double quotes: it gives argv[1]="+%l". This is really annoying and contradictory to what one might expect. Am I supposed to write a shell wrapper to send an external editor ? At some point, kmail should stop trying to parse the string too much. It should just replace %l %f and %w by their values, whereever they appear, and then simply call system() to interpolate the arguments, interpret the quotes, etc. It would be much less unexpected! (By the way, why not add a %c to specify a column number ?) Reproducible: Always
I can add %c For the others parsing pb will look at.
Git commit 9c08c812b5f990ba917a755cb1f7e181bfcba9ea by Montel Laurent. Committed on 04/12/2013 at 08:13. Pushed by mlaurent into branch 'KDE/4.12'. Fix Bug 327982 - external editor is too hard to configure FIXED-IN: 4.12 M +12 -51 messagecomposer/composer/kmeditor.cpp http://commits.kde.org/kdepim/9c08c812b5f990ba917a755cb1f7e181bfcba9ea
Now we use kde parsing code. So all is ok.