all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tomas Nordin <tomasn@posteo.net>
To: Brian Merchant <bhmerchant@gmail.com>, help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <8760qky8od.fsf@flaptop.tomnor.org> (raw)
In-Reply-To: <CAMt_P4=LFb6dLS=Yv4o6zX_+VMPJ-MjjVbKq8+t81d2NNOsxNA@mail.gmail.com>

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.



      parent reply	other threads:[~2016-08-28 19:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 22:18 How to pass messages between emacs and a Python program? (goal: trying to use emacs as a UI) Brian Merchant
2016-08-26  8:05 ` Michael Albinus
2016-08-26  8:14 ` Thien-Thi Nguyen
2016-08-26 11:51 ` Alexis Roda
2016-08-28 17:10 ` Pascal J. Bourguignon
2016-08-28 19:50 ` Tomas Nordin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760qky8od.fsf@flaptop.tomnor.org \
    --to=tomasn@posteo.net \
    --cc=bhmerchant@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.