I've been brainstorming some ideas towards developing some IDE support for developing with the Ruby programming language and Emacs. I was considering a possibility of using an Emacs frame as a UI widget in a Ruby application on X Windows platforms. I wonder if there may be any particular support for this, with Emacs builds using a GTK widget toolkit?

I've read of the Xembed support for Emacs. I assume that this might be available to an Emacs build with Athena or Lucid widgets. Maybe it would also apply to an Emacs build using a GTK toolkit?

Outside of the Xembed linking, is it possible to use an Emacs frame as a GTK widget, in a GTK application?

There is a bit of documentation in the Emacs manual about using GTK resources in Emacs. I understand that for some Emacs builds, it may even be possible to use GTK WebKit under browse-url, in Emacs.

Conversely, if it may be possible to use an Emacs frame as a GTK widget, then perhaps it could be used as such in the GTK bindings for Ruby or any other general programming language?


So to speak, maybe Xembed is the way to go, with this. There may be some additional GTK support available for Xembed, e.g with Gtk.Plug in the embedded Emacs process and Gtk.Socket in the embedding application.

As a point of reference, @bert at GitHub has posted a gist illustrating how to use Gtk.Socket in an application. The C code in the gist uses gVim as an embedded client application.

Presumably, the Gtk.Plug handling could be managed within Emacs, using a special-purpose Emacs module for this or e.g emacs-ffi. Maybe it's managed already, under Emacs with GTK widgets - e.g in Emacs gtkutil.c.

Towards using Emacs as an embedded text editor for source-oriented text editing, whether in Ruby applications or otherwise, the Xembed support might be the thing?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.