Skip to content

Conversation

technomancy
Copy link
Contributor

I would like to allow custom handlers for a given op; this patch shows one simple way that could be implemented.

One thing I don't understand about the current implementation is why monroe-make-response-handler exists since it always returns the exact same lambda. Why not just make that a top-level function and dispatch all incoming messages to it? Then we could check for custom ops inside that function instead.

However, this patch takes the approach that is least invasive and just falls back to a table of custom handlers if the ID is not found in monroe-requests.

@sanel
Copy link
Owner

sanel commented Jun 13, 2016

One thing I don't understand about the current implementation is why monroe-make-response-handler exists since it always returns the exact same lambda.

It did some magic in the past with different arguments, but I removed it since it required lexical binding, which is available since Emacs 24. I kept it for future expansion, if necessary...

Do you have example of custom responses you are using with this patch?

@technomancy
Copy link
Contributor Author

technomancy commented Jun 13, 2016 via email

@technomancy
Copy link
Contributor Author

Here's an example of client code that uses custom handlers: https://gitlab.com/technomancy/bussard/blob/master/bussard.el

@sanel sanel merged commit b770929 into sanel:master Jun 13, 2016
@sanel
Copy link
Owner

sanel commented Jun 13, 2016

Cool idea and cool game project! The main reason I asked for this is to, at some point, update documentation with real example. Also, I really like the idea to make it extensible for custom nREPL commands :)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants