all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: stdio access to the Emacs REPL
Date: Mon, 11 Nov 2013 14:45:21 +0100	[thread overview]
Message-ID: <877gcft5la.fsf@gmail.com> (raw)
In-Reply-To: p1txfj5fpr.fsf@linaro.org

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	other threads:[~2013-11-11 13:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 11:40 stdio access to the Emacs REPL Alex Bennée
2013-11-11 13:45 ` Thorsten Jolitz [this message]
2013-11-15  9:04   ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877gcft5la.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.