From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Brian Merchant Newsgroups: gmane.emacs.help Subject: How to pass messages between emacs and a Python program? (goal: trying to use emacs as a UI) Date: Thu, 25 Aug 2016 15:18:19 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1472175281 23256 195.159.176.226 (26 Aug 2016 01:34:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 26 Aug 2016 01:34:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 26 03:34:38 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bd62X-0005d5-EB for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Aug 2016 03:34:37 +0200 Original-Received: from localhost ([::1]:58647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bd62U-0005na-Iu for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Aug 2016 21:34:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bd2yd-00036d-2U for help-gnu-emacs@gnu.org; Thu, 25 Aug 2016 18:18:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bd2ya-0008SB-P3 for help-gnu-emacs@gnu.org; Thu, 25 Aug 2016 18:18:21 -0400 Original-Received: from mail-ua0-x22d.google.com ([2607:f8b0:400c:c08::22d]:33676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bd2ya-0008Rh-Iw for help-gnu-emacs@gnu.org; Thu, 25 Aug 2016 18:18:20 -0400 Original-Received: by mail-ua0-x22d.google.com with SMTP id l94so45549300ual.0 for ; Thu, 25 Aug 2016 15:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=4kGAq2D0m3tsVg0VbD0rGNrGVX/WvgH+KKNYEwRej2A=; b=b3FoXGHpl1yPB0YsNrnNvFP7+7+apnLVI/JmdlWFIuM9JmIbC0yLh4qnvtvz/+5Dm4 QeIuQkyK5cnDu7aSowxxpWIQ8Od8LjOdox47d+4LABN7eI7FS49j7PLhMtbYfu6SlTtk rcAbsShMRjC+ekiMb68c0SlfblRNjnXlVtptIIvDrimhBW0K7Z67GoER4gILwkkZ1a2M 3nSYpMXagbINuP3eNeTUVPdyWzU67VP7uDyKNZT3IinbYtQ/m4ennbYLRqDW1j1uwpb8 Ncor9R6m1/LEU84AYc5wYimsfVtVoYa2wDyaQ27FVJ2sojM29Nhn03arI7h218z8s6Ep u/UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=4kGAq2D0m3tsVg0VbD0rGNrGVX/WvgH+KKNYEwRej2A=; b=Hm/85My44S7p3du/7t9/UQijlBSeHve36BSa1I781xmn0g9nMuQvjrBet2UdLYsin8 SJJ7jPiZDQqLlECKDqENW+HrhgNn87WJhCGAhTNfDM6VWBLkHvRu65AF6UI3xSSPCxhK ROYqwKskvMEYxIJSnMWDrrMgLVAqhZGgZusxgP1dngG9vhvlp+YXCpDaLeV3xuxqkMYw 6ddOa/8wmGDn7d8ph6BboDTT4Z35Mg3zYEZt8YMQIjUg5TrLETZpKXH7RG3a+QWXz7rK L/a1kF4JNGk6g+AfxUN9IPeOCmEpZSctPHC4g3sAJw5fSxdplsWNvPogZ7wN4KOEcTZ4 Py2w== X-Gm-Message-State: AEkoouvQnDD5/3Q1bFKNHxRnd360MphfpClc5P40z3qgM8gKDi6cAr2zgfaY7BYfT6SnHhxuYA0rk+AOZbFUSQ== X-Received: by 10.176.65.1 with SMTP id j1mr6133571uad.6.1472163499843; Thu, 25 Aug 2016 15:18:19 -0700 (PDT) Original-Received: by 10.31.82.129 with HTTP; Thu, 25 Aug 2016 15:18:19 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c08::22d X-Mailman-Approved-At: Thu, 25 Aug 2016 21:33:48 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111200 Archived-At: 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 `=E2=88=A7` * 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 `=3D x` The final result of all the changes made by the program to the file will leave it like so: `x =E2=88=A7 T =3D 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