Some ideas for Pymacs
brianmce at crosswinds.net
Wed Sep 12 16:54:11 CEST 2001
pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) wrote in message news:<mailman.1000218975.5916.python-list at python.org>...
> Hi, people.
> I guess the most important improvement we could think to Pymacs would
> be some machinery by which Python programs, started outside Emacs, could
> access Pymacs, once it started. That could be useful at least for testing
> or debugging, and maybe for more serious work as well. These are mere
> thoughts, I do not plan working at this soon, unless I have an actual need.
> But if the challenge interests someone, please go ahead!
This would raise the almost blasphemous possibility of driving Vim (with
python scripting) in emacs. I'm not sure if that's possible without the
universe exploding in a storm of antimatter - but the idea does have a
certain appeal :-)
> Here is how it could go. Pymacs has a Python interpreter running as a
> sub-process of Emacs. In fact, Emacs loads `pymacs.el', which in turn
> gets Python to execute `pymacs.py', and both communicate afterwards.
> `pymacs.py' is only active whenever `pymacs.el' calls it, otherwise it
> is blocked. `pymacs.py' could, under some option, start another thread
> within itself. The initial thread would block waiting for Emacs, as usual.
> The second thread would block waiting to serve any Python client wanting to
> access Emacs. When this occurs, the second thread would queue a request
> for the first thread, and then send a signal to Emacs so it triggers a
> Pymacs communication. At each communication opportunity, the first thread
> on the Python side might fully service the queue from the second thread.
I think this should be possible, but some of the details may be very tricky.
Probably the trickiest part is signalling emacs to deal with pending python
requests - this could maybe be done with a timeout, or some kind of external
signal, but in either case there needs to be a check that you are not in the
middle of processing other requests!
This could be a very cool feature though - remotely drive emacs using
More information about the Python-list