You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I want to run custom logic inside the REPL when it starts up, and binding to cider-connected-hook runs outside of the REPL even when using cider-interactive-eval. E.g., I have a hook defined like:
Which does run the function, but at a different time and place than when I run (go) in the REPL. Specifically, I want to print a startup message in the REPL, but using this I get all printed logs in the nrepl-server buffer and don't show up in the REPL (even though running cider-interactive-eval manually afterwards does show up in the REPL buffer). Also, I'm doing some monkeypatching to print-method which works well when I run it after cider-nrepl is up but when run with the hook as shown above CIDER's own work with print-method happens after my custom function is run and overrides it.
Describe the solution you'd like
There's multiple ways of solving this, but I think the cleanest one would be to have some var cider-repl-startup-sexp which would default to nil and when it exists then the first REPL prompt after startup should yank that variable and run it, or else an appropriate hook (cider-repl-mode-hook?) and some function to do this (cider-interactive-eval I suppose, but I couldn't get it to work for this and it only shows the result in the REPL and not the command). Or else to do smth convoluted like storing the startup command as a macro and hooking that to idle REPL buffers or something, but overall this feels like something that should be simple to do and documented somewhere.
How would this be best approached? Is this already solvable with CIDER? I'd love to put a PR together but I'm not sure where to start.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed soon if no further activity occurs. Thank you for your contribution and understanding!
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
I want to run custom logic inside the REPL when it starts up, and binding to
cider-connected-hook
runs outside of the REPL even when usingcider-interactive-eval
. E.g., I have a hook defined like:Which does run the function, but at a different time and place than when I run
(go)
in the REPL. Specifically, I want to print a startup message in the REPL, but using this I get all printed logs in thenrepl-server
buffer and don't show up in the REPL (even though runningcider-interactive-eval
manually afterwards does show up in the REPL buffer). Also, I'm doing some monkeypatching toprint-method
which works well when I run it after cider-nrepl is up but when run with the hook as shown above CIDER's own work withprint-method
happens after my custom function is run and overrides it.Describe the solution you'd like
There's multiple ways of solving this, but I think the cleanest one would be to have some var
cider-repl-startup-sexp
which would default tonil
and when it exists then the first REPL prompt after startup should yank that variable and run it, or else an appropriate hook (cider-repl-mode-hook
?) and some function to do this (cider-interactive-eval
I suppose, but I couldn't get it to work for this and it only shows the result in the REPL and not the command). Or else to do smth convoluted like storing the startup command as a macro and hooking that to idle REPL buffers or something, but overall this feels like something that should be simple to do and documented somewhere.How would this be best approached? Is this already solvable with CIDER? I'd love to put a PR together but I'm not sure where to start.
The text was updated successfully, but these errors were encountered: