Plugins for nrepl.el?

94 views
Skip to first unread message

Hugo Duncan

unread,
Aug 28, 2012, 12:43:26 PM8/28/12
to nrepl-el

Hi,

One of the ideas or nrepl is that functionality can be provided by
middleware libraries. On the clojure side, this just necessitates adding
the middleware to the nrepl server's handler function. On the nrepl.el
side of things however, any new functionality can not be activated
without some form of elisp code.

I'm wondering if you have already given some thought to providing a
standard way of plugging elisp functionality into nrepl.el. Maybe
something related to swank-cloure's jack-in injection of elisp?

Hugo

Tim King

unread,
Aug 28, 2012, 10:45:25 PM8/28/12
to nrep...@googlegroups.com
On Tue, Aug 28, 2012 at 9:43 AM, Hugo Duncan <hu...@hugoduncan.org> wrote:

I'm wondering if you have already given some thought to providing a
standard way of plugging elisp functionality into nrepl.el. Maybe
something related to swank-cloure's jack-in injection of elisp?

Hi Hugo,
I hadn't given it much thought yet, since I have been focused on getting the core functionality working.

You are talking about the bootstrapping elisp that are sent from swank-clojure to emacs, right?
Seems like we could take a similar approach.

Another idea off the top of my head is to use the eval-in-emacs approach that Sam Aaron was talking about in earlier post.
I have started thinking about implementing that but I don't have anything working yet.

I am totally open to suggestions...
Cheers,
Tim

Hugo Duncan

unread,
Aug 29, 2012, 3:15:20 PM8/29/12
to nrep...@googlegroups.com
Tim King <kin...@gmail.com> writes:

> On Tue, Aug 28, 2012 at 9:43 AM, Hugo Duncan <hu...@hugoduncan.org> wrote:
>
>>
>> I'm wondering if you have already given some thought to providing a
>> standard way of plugging elisp functionality into nrepl.el. Maybe
>> something related to swank-cloure's jack-in injection of elisp?
>>
> You are talking about the bootstrapping elisp that are sent from
> swank-clojure to emacs, right?
> Seems like we could take a similar approach.

jack-in works by having elisp launch the java process and then parse the
output for text marker guards around the elisp to load. This has the
advantage of isolating the point at which code injection can occur.

> Another idea off the top of my head is to use the eval-in-emacs approach
> that Sam Aaron was talking about in earlier post.
> I have started thinking about implementing that but I don't have anything
> working yet.

eval-in-emacs would probably be the simplest solution. There are perhaps
security implications on having that enabled by default though (in slime
it defaults to disabled).

One way might be to have a nrepl op that can request setup info
middleware. e.g. sending a "client-setup" op with "client" "nrepl.el"
key could cause a reply from every middleware with an "elisp" key with
code to eval. This would require pass-through of the op by every
middleware, so might require some support in the base nrepl server to
avoid the command being reported as unsupported.

Hugo

Hugo Duncan

unread,
Sep 2, 2012, 12:30:51 PM9/2/12
to nrep...@googlegroups.com


Hugo Duncan writes:

> One way might be to have a nrepl op that can request setup info
> middleware. e.g. sending a "client-setup" op with "client" "nrepl.el"
> key could cause a reply from every middleware with an "elisp" key with
> code to eval. This would require pass-through of the op by every
> middleware, so might require some support in the base nrepl server to
> avoid the command being reported as unsupported.

Another may be to add a `:elisp` key to the results returned by the
"describe" op. Are you planning on using the "describe" op in the latest
nREPL?

Hugo

Tim King

unread,
Sep 4, 2012, 10:43:06 AM9/4/12
to nrep...@googlegroups.com
2012 at 9:30 AM, Hugo Duncan <dunca...@gmail.com> wrote:


Another may be to add a `:elisp` key to the results returned by the
"describe" op. Are you planning on using the "describe" op in the latest
nREPL?


Yes, I think we should add support for the describe op.
Among other things, I think we will need it to figure out what operations are available on the server.
I also want to look at using the load-file op.

Cheers,
Tim

Nelson Morris

unread,
Sep 4, 2012, 10:48:47 AM9/4/12
to nrep...@googlegroups.com
I've got a local copy of master using :op load-file. I had to do it
to get C-c C-k working for clojurescript w/ piggieback. An additional
benefit is that since I started using it I've not seen
https://github.com/kingtim/nrepl.el/issues/86, even with a normal clj
repl.

I had plans to finish cleanup and make it into a pull request, but
won't be able to get to it until saturday.

Tim King

unread,
Sep 4, 2012, 10:52:04 AM9/4/12
to nrep...@googlegroups.com
On Tue, Sep 4, 2012 at 7:48 AM, Nelson Morris <nmo...@nelsonmorris.net> wrote:
I've got a local copy of master using :op load-file.  I had to do it
to get C-c C-k working for clojurescript w/ piggieback.  An additional
benefit is that since I started using it I've not seen
https://github.com/kingtim/nrepl.el/issues/86, even with a normal clj
repl.

I had plans to finish cleanup and make it into a pull request, but
won't be able to get to it until saturday.


Most excellent, thanks Nelson.
Cheers,
Tim
Reply all
Reply to author
Forward
0 new messages