From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: stdio access to the Emacs REPL Date: Mon, 11 Nov 2013 14:45:21 +0100 Message-ID: <877gcft5la.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1384177575 22049 80.91.229.3 (11 Nov 2013 13:46:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Nov 2013 13:46:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 11 14:46:20 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vfrod-0003Hw-C1 for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Nov 2013 14:46:07 +0100 Original-Received: from localhost ([::1]:37452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vfroc-0007MS-UA for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Nov 2013 08:46:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VfroO-0007MK-Fn for help-gnu-emacs@gnu.org; Mon, 11 Nov 2013 08:45:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VfroJ-0002CT-8R for help-gnu-emacs@gnu.org; Mon, 11 Nov 2013 08:45:52 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:36907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VfroJ-0002CJ-1O for help-gnu-emacs@gnu.org; Mon, 11 Nov 2013 08:45:47 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VfroA-0002kR-KC for help-gnu-emacs@gnu.org; Mon, 11 Nov 2013 14:45:38 +0100 Original-Received: from e178189216.adsl.alicedsl.de ([85.178.189.216]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Nov 2013 14:45:38 +0100 Original-Received: from tjolitz by e178189216.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Nov 2013 14:45:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178189216.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:g8p0fCOHkLEkOVelVuRrdDcxgfc= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94445 Archived-At: Alex Bennée writes: > Hi, > > I'm looking at replacing/augmenting the current xmlrpc method used by > Edit with Emacs on Chrome to communicate with the edit-server. > Chrome(ium) now provides a new native message API which offers a simpler > stdio based access: > > http://developer.chrome.com/extensions/messaging.html#native-messaging > > I was wondering if there is anyway to hook a line based stdio link into > a running emacs session. Something like: > > emacsclient -t -e "(eshell)" > > But without any of the extra display gubbins. All I want is something > that I can write an sexp to and then process the response on stdout. In PicoLisp you can define a function like this #+begin_src picolisp (de emc (Exe . @) (in (cons 'emacsclient "-s" "my-server" "-e" (rest) ) (eval Exe) ) ) #+end_src and then e.g. use the PicoLisp REPL to communicate with Emacs via stdin/stdout #+begin_src picolisp : (emc '(read) "(princ \"Hello World\")") -> "Hello World" : (emc '(read) "server-name") -> "my-server" : (emc '(line) "server-name") -> ("\"" "m" "y" "-" "s" "e" "r" "v" "e" "r" "\"") : (emc '(line T) "server-name") -> "\"my-server\"" #+end_src -- cheers, Thorsten