all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* stdio access to the Emacs REPL
@ 2013-11-11 11:40 Alex Bennée
  2013-11-11 13:45 ` Thorsten Jolitz
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Bennée @ 2013-11-11 11:40 UTC (permalink / raw)
  To: GNU Emacs users list

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.

Any ideas?

-- 
Alex Bennée




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

* Re: stdio access to the Emacs REPL
  2013-11-11 11:40 stdio access to the Emacs REPL Alex Bennée
@ 2013-11-11 13:45 ` Thorsten Jolitz
  2013-11-15  9:04   ` Alex Bennée
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2013-11-11 13:45 UTC (permalink / raw)
  To: help-gnu-emacs

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




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

* Re: stdio access to the Emacs REPL
  2013-11-11 13:45 ` Thorsten Jolitz
@ 2013-11-15  9:04   ` Alex Bennée
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2013-11-15  9:04 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: help-gnu-emacs


tjolitz@gmail.com writes:

> 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)"
>>
<snip>
> 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

Thanks, that seems to work quite nicely. Unfortunatly I can't get the
Chrome side of stuff to work but that's not an Emacs problem ;-)


Cheers,

--
Alex Bennée
http://www.bennee.com/~alex




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

end of thread, other threads:[~2013-11-15  9:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 11:40 stdio access to the Emacs REPL Alex Bennée
2013-11-11 13:45 ` Thorsten Jolitz
2013-11-15  9:04   ` Alex Bennée

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.