Home     My Faqts     Contributors     About     Help    

faqts : Computers : Programming : Languages : Python

FAQTs repaired & updated!
Thanks for your patience...
Entry Add Entry Alert - Edit this Entry

Did You Find This Entry Useful?

11 of 11 people (100%) answered Yes
Recently 8 of 8 people (100%) answered Yes

Can I script or access the internal of (X)Emacs with Python?

Jun 10th, 2002 08:03

Alain Tesio, Alastair Burt, Shae Erisson


If this question means "Can I use Python instead of Emacs Lisp to add
extra modules to Emacs?", have a look at PyMacs : 
http://www.emacswiki.org/cgi-bin/wiki.pl?PyMacs
If this question means "Can a running Python process control a running 
Emacs process?", then you probably want to use gnuserv.  This comes
standard with XEmacs. I do not know about the other Emacs.  You need to
get (X)Emacs to call the Elisp function "gnuserv-start", and then access
this process through the "gnuclient" program.  Here is an example:
 $ xemacs -f gnuserv-start &
 [1] 15069
 $ python
 Python 1.5.2 (#4, Feb  3 2000, 16:21:22)  [GCC 2.8.1] on sunos5
 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 >>> import commands
 >>> commands.getoutput('gnuclient -batch -eval "(+ 1 1)"')
 '2'



© 1999-2004 Synop Pty Ltd