Bug 255008 - external editor: string replace for the window id to be used with xembed
Summary: external editor: string replace for the window id to be used with xembed
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: composer (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-23 00:05 UTC by Arne Babenhauserheide
Modified: 2013-03-19 10:37 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arne Babenhauserheide 2010-10-23 00:05:02 UTC
Version:           1.13.5 (using KDE 4.5.2) 
OS:                Linux

I’ve been experimenting with emacs as standard-editor for the composer, and I stumbled upon xembed: http://www.emacswiki.org/emacs/EmacsXembed

By passing emacs the window ID of the parent window, it seems that it can be embedded in the window. 

So I’d like to see an option to not only add the file to the command via %f, but also to add the window ID of the composer text-area (or an overlay) via %w or similar. 

With that, any external editor should be embeddable as if it were the native one. 

Well, I could also spell this bug as „I’d like to embed emacs directly into kmail instead of opening it in a seperate window or switching to a running emacs window“ :)

Reproducible: Didn't try




OS: Linux (x86_64) release 2.6.34-gentoo-r6
Compiler: x86_64-pc-linux-gnu-gcc
Comment 1 Arne Babenhauserheide 2010-11-23 16:34:27 UTC
Some info I found: 

Discussion in the emacs list: 

- http://osdir.com/ml/general/2010-04/msg38048.html
- http://osdir.com/ml/general/2010-04/msg36121.html

qtxembeddedcontainer: 

- http://doc.trolltech.com/solutions/qtxembed/qtxembedcontainer.html

A more general solution would be an emacs kpart. Possible TODO on the emacs-side: xembed also for emacsclient.

Best wishes, 
Arne
Comment 2 Arne Babenhauserheide 2010-11-23 19:05:31 UTC
I wrote a proof of concept embedding script. It’s very simple (only opens a qt window and embeds emacs), but it works: http://bitbucket.org/ArneBab/kembed-emacs/src/tip/qxembed-emacs.py
Comment 3 Myriam Schweingruber 2012-08-18 08:58:27 UTC
Thank you for your feature request. Kmail1 is currently unmaintained so we are closing all wishes. Please feel free to reopen a feature request for Kmail2 if it has not already been implemented.
Thank you for your understanding.
Comment 4 Luigi Toscano 2012-08-18 23:50:31 UTC
Instead of creating a new feature request, please confirm here if the wishlist is still valid for kmail2
Comment 5 Arne Babenhauserheide 2012-08-20 23:07:39 UTC
The bug is still valid: 

currently I can only specify “emacsclient -c %f”. That means a new Window gets opened.

With the implemented wish I would be able to specify “emacsclient --parent-id=%w -c %f”. That would mean, that emacs would be opened inside the text frame of the kmail editor window. 

xembed for emacsclient has been implemented in the meantime (in emacs 24.x), so embedding is fast (if you run an emacs server - as recommended).
Comment 6 Laurent Montel 2012-08-21 09:09:02 UTC
--parent-id is just define for 24.x ?

I will add %w as windowId but I will not able to test it.
I don't have emacs 24.x just 23.3

Regards
Comment 7 Laurent Montel 2012-08-21 11:04:14 UTC
Git commit ae25540ae4ebc5dcdd88bb30860501eddc004b87 by Montel Laurent.
Committed on 21/08/2012 at 12:53.
Pushed by mlaurent into branch 'KDE/4.9'.

Fix Bug 255008 - external editor: string replace for the window id to be

used with xembed

use %w for windows id.

and fix command line parsing when we have "emacs --toto=%w"

FIXED-IN: 4.9.1

M  +10   -3    messagecomposer/kmeditor.cpp

http://commits.kde.org/kdepim/ae25540ae4ebc5dcdd88bb30860501eddc004b87
Comment 8 Arne Babenhauserheide 2012-08-21 14:17:25 UTC
That’s great! Thank you!

You can test the embedding with emacs 23 by using emacs proper instead of emacsclient:

emacs --parent-id %w %f

that should embed emacs directly in the editor-window. The only advantages of emacsclient is that it starts faster and that it has all the open files I used in other editing sessions.

I don’t see in the diff if you create a QX11EmbedContainer for generating the winid. It looks as if you just give it the ID of the editor window, and I don’t know if that can be used for embedding via xembed.

(I hope my example python code helped a bit :) )
Comment 9 Laurent Montel 2012-08-21 15:15:51 UTC
I success to test it and windId is enough.
emacs is embedded in composer.
Not necessary to use a QX11EmbedContainer
Comment 10 Arne Babenhauserheide 2012-08-21 16:29:10 UTC
Nice! 

I’m really anxious to test it in KDE 4.9.1!

A thousand times thank you!
Comment 11 Arne Babenhauserheide 2013-01-16 20:58:30 UTC
Strangely it does not work for me… 

I set emacs via

emacs --parent-id=%w %f 

And it still openes a new emacs window instead of embedding it.

How exactly do you define emacs as editor? 
Viesion is 4.9.5
Comment 12 Arne Babenhauserheide 2013-01-16 21:01:51 UTC
… there I write and the next moment I find the answer myself: The correct command line is

emacs --parent-id %w %f 

Thank you very much!
Comment 13 Arne Babenhauserheide 2013-03-19 10:37:36 UTC
Note: The embedded emacs still has issues, but these seem to come from emacs, not KMail: http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-01/msg00623.html