help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stdio access to the Emacs REPL


From: Thorsten Jolitz
Subject: Re: stdio access to the Emacs REPL
Date: Mon, 11 Nov 2013 14:45:21 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Alex Bennée <kernel-hacker@bennee.com> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]