Some ideas for Pymacs

François Pinard pinard at iro.umontreal.ca
Tue Sep 11 10:42:24 EDT 2001


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!

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.


The second idea, quickly sketched in this paragraph, is to improve how the
`*Pymacs*' communication buffer looks.  Yet I'm not sure how worth this is.
It might be turned into a more fully featured Emacs mode, so it can benefit
from highlighting and colourisation, and other goodies.  The first thing
would be to install font-lock definitions.  The second thing would be to
use indenting to show the proper nesting of calls between Emacs and Python,
in both directions.  I would prefer this to be done as a display feature,
not as part of the communication protocol.  A third thing would be to
automatically interpret object numbers on both sides, replacing them with
clearer text whenever possible -- this information may often be deduced
from earlier communications.  Finally, that mode could allow for some
inspection on Pymacs object and status, and maybe also to control the
external Python server described above, if it ever gets implemented.


All operational details are still fuzzy, I'm not sure if everything can
really be worked out.  In any case, that's food for background thoughts! :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Python-list mailing list