unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to pass messages between emacs and a Python program? (goal: trying to use emacs as a UI)
@ 2016-08-25 22:18 Brian Merchant
  2016-08-26  8:05 ` Michael Albinus
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Brian Merchant @ 2016-08-25 22:18 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

Say I have opened up a file in emacs, and I type in something like:

`x \and \top`

Then, a Python program reads that file, and:

* replaces all `\and` to `∧`
* replaces all `\top` to `T`
* it does some thinking on the expression `x \and \top` and decides that
that is the same as `x`, so will append an `= x`

The final result of all the changes made by the program to the file will
leave it like so:

`x ∧ T = x`

Okay, so much for what I want. For getting there though:

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).

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.

Could this be done?

A bit of background on my goal: I'd like to make a proof editor/"IDE", and
while I have the programming know-how (at least in Python and C++, not in
emacs Lisp) to code the background analyzers/proof-engines, I am horrible
at putting pixels on a screen. I have experimented a bit with putting
pixels on a screen, and writing my own simple editor, but suffice it to say
that I have come to appreciate the immense amount of effort it takes to
build something as smooth as emacs. I think it would be much better for me
to take advantage of emacs' capabilities in terms of showing stuff on a
screen, and manipulating/editing that stuff. I worry though that there
might not be any easy way to do this...

Anyway, would love to hear your thoughts and guidance!

Kind regards,
Brian


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-28 19:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).