kembed-emacs /

#!/usr/bin/env python
# encoding: utf-8

"""A test-program for embedding emacs in KDE."""

from PyQt4.QtGui import QX11EmbedContainer
from PyQt4.QtGui import QApplication
from PyQt4.QtCore import QProcess, SIGNAL, SLOT

from sys import argv, version_info

if version_info > (2,7,0, 'final', 0): 
    from subprocess import check_output
    out = check_output(["emacs", "--version"])
    n = len("GNU Emacs ")
    vers = float(out[n:n+4])
    vers = None

app = QApplication(argv)

container = QX11EmbedContainer()
container.resize(670, 630)

process = QProcess(container)
args = ["--parent-id", str(container.winId())]
if vers >= 24: 
    process.start("emacsclient", args)
elif vers is None or vers >= 23.1: 
    process.start("emacs", args)
    print "You need at least emacs 23.1 for embedding emacs via XEmbed."
container.connect(container, SIGNAL("clientClosed()"), app.quit)
#container.connect(container, SIGNAL("clientIsEmbedded()"), container.resize_)
container.connect(container, SIGNAL("error(QX11EmbedContainer::Error)"), app.quit)
status = app.exec_()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.