EmacsXWidgets

The xwidget patch enables embedding of gtk widgets inside emacs buffers.

mplayer could be embeded in emacs, using mplayers -wid flag, emacs and uzbl are other xembed compatible apps.

Currently im investigating if its possible to embed generic gtk widgets in a buffer. Then xembed would be solved as well, because of gtk_socket. This is probably rather difficult, but even more interesting than plain xembed support. The interface is currently similar to the image support, ie, one puts a display property with an “xwidget” spec on it, on some text. The interface would be toolkit neutral:

(xwidget :type embed …) etc, different types for different interesting widgets.

Im now able to have a gtk button move with the text in emacs, just like an image!

EmacsXembedScreenshot

Its very cool!

Embedded webkit displaying an emacs elnode web app! yay!

WebkitElnodeScreenshot

getting the code

I’ve now created an “xwidget” branch in the savannah emacs bzr repo, and the code will live there now.

http://bzr.savannah.gnu.org/lh/emacs/xwidget/files

bug reporting and tracker

 emacs xwidgets uses the same tracker as mainline emacs, but a
 different package.
 
 M-x report-emacs-bug
 
 Change the address to:
 submit@debbugs.gnu.org
 
 Include this line early in the body:
 Package: emacs-xwidgets

To view current bugs, follow this link: http://debbugs.gnu.org/cgi/pkgreport.cgi?package=emacs-xwidgets

The interface

Heres stuff from my elisp test code:

(insert “xwidgetdemo<<< a button. another button\n”) (goto-char (point-min)) (put-text-property (point) (+ 1 (point)) ‘display ‘(xwidget :xwidget-id 1 :type ‘webkit-osr :title “1” :width 40 :height 50))

xwidget-id must be a unique integer. type identifies the widget class.

Callbacks are handled with the Emacs even system.

Notes and Status

Xwidgets is a concept similar to the Java AWT toolkit, but instead for Elisp. The current implementation of Xwidgets targets GTK as the native peer widget set, but aims to be toolkit agnostic. I dont aim to make every GTK widget an Xwidget, just a small subset suitable to implement certain types of GUI:s currently difficult to do with Emacs, for instance slider widgets, embedded applications, etc.

Currently the patch allows for:

Current issues:

These issues appear difficult but not unsolveable.

I seem to code on this on yearly sprints. 2011 has been fruitful for xwidgets.

I presented this work during GHM 2011: http://www.gnu.org/ghm/2011/paris/#sec-2-11

there is a video of the presentation where you can see the branch in action.

JoakimVerona