From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tomas Nordin Newsgroups: gmane.emacs.help 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 Message-ID: <8760qky8od.fsf@flaptop.tomnor.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1472434051 13223 195.159.176.226 (29 Aug 2016 01:27:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Aug 2016 01:27:31 +0000 (UTC) User-Agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) To: Brian Merchant , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 29 03:27:28 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 1beBMF-00034i-Up for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Aug 2016 03:27:28 +0200 Original-Received: from localhost ([::1]:41412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beBMD-0000nw-H6 for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Aug 2016 21:27:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1be66n-0003vB-FI for help-gnu-emacs@gnu.org; Sun, 28 Aug 2016 15:51:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1be66i-00074C-GU for help-gnu-emacs@gnu.org; Sun, 28 Aug 2016 15:51:09 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:43280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1be66i-000744-9V for help-gnu-emacs@gnu.org; Sun, 28 Aug 2016 15:51:04 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id EA1B320AC9 for ; Sun, 28 Aug 2016 21:50:58 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3sMlkt5msqz1097; Sun, 28 Aug 2016 21:50:46 +0200 (CEST) Original-Received: from tomas by flaptop with local (Exim 4.84_2) (envelope-from ) id 1be66M-0001d6-1t; Sun, 28 Aug 2016 21:50:42 +0200 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.67.36.66 X-Mailman-Approved-At: Sun, 28 Aug 2016 21:26:54 -0400 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:111224 Archived-At: Brian Merchant 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.