Bug 327982 - external editor is too hard to configure
Summary: external editor is too hard to configure
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: config dialog (show other bugs)
Version: 4.11.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-23 16:59 UTC by Éric Brunet
Modified: 2013-12-04 08:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Éric Brunet 2013-11-23 16:59:51 UTC
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
Comment 1 Laurent Montel 2013-12-04 07:11:30 UTC
I can add %c
For the others parsing pb will look at.
Comment 2 Laurent Montel 2013-12-04 08:14:17 UTC
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
Comment 3 Laurent Montel 2013-12-04 08:15:48 UTC
Now we use kde parsing code.
So all is ok.