help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to pass messages between emacs and a Python program? (goal: tryi


From: Tomas Nordin
Subject: Re: How to pass messages between emacs and a Python program? (goal: trying to use emacs as a UI)
Date: Sun, 28 Aug 2016 21:50:42 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu)

Brian Merchant <bhmerchant@gmail.com> writes:

> I don't want the Python program to be constantly polling the file for
> changes (using a `while` loop), and I probably don't want emacs to be
> constantly polling the file for updates (which I know how to do using the
> `auto-revert` command).

Make the python code callable from command line.

>
> Maybe I press some key combination, and then that sends a message to a
> Python script that its time to read the file and make updates and then the
> Python script would message emacs and ask it to update what it is
> displaying in its buffer.

Then have a key combination calling your python parser. There is
built-in support in elisp for synchronous process calls for example. You
can receive return value and process output into emacs. If the python
code is prepared for it (import fileinput?), the (unsaved) buffer could
be sent as stdin to your program.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]