Fork me on GitHub

@ahmed1hsn @mauricio.szabo i can highly recommend using to access REPLs running on non-transient infrastructure, eg on office machines. for example i have beefy dev machine (8cores i9, 80GB RAM) in an office on a gigabit internet connection and running zerotier. i have this nREPL config:

% cat .nrepl.edn
{:bind "" :port 5555}
so anyone in the office can connect to my REPL. i run zerotier on my home dev machines, which places them virtually onto the office network. this way i can just ssh or connect with an nrepl client to my machine with: ssh -A -t my-office-machine.local or lein repl --connect my-office-machine.local:5555 the cool thing about this is that these commands work regardless being physically on the office network or elsewhere, because these *.local hostnames are resolved via multi-cast DNS, which is enabled by default on macOS and zerotier does not disrupt this protocol! u might need to wait a minute though before it starts to work after changing your internet connection, but sudo pkill mDNSResponder might speed it up. on linux u need some avahi daemon for mdns to work. i only set it up under nixos and iirc i had to change some of the default options to make sure that the hostname is discoverable.

👍 4

now since im using the cursive / remote repl / nrepl run configurations to connect to my office repl, when i do a load file (cmd-shift-l) or sync changed files (cmd-shift-m), it seems to use the files on my my nrepl-client machine, so it works as i expected it. i was a bit surprised to see that chlorine is actually reading files from the filesystem of the nrepl-server. it doesn't seem to be a very useful feature to me. i've used this setup just by myself alone, so i guess a collaborative use of 1 repl process might cause a lot of tricky issues. still, during the current pandemic, when many of us are recommended to work from home, it's good to know how to have such a convenient setup


By the way, I forgot to ask: how do you think we could change this behavior? How to make it better to work in a remote environment, considering you're editing the code locally and sending it to another server? 🙂


The way - as I described above - how Cursive works makes sense to me at the moment, BUT I'm not confident that my workflow is a good approach, so I would rather not propose any change, but revise my workflow instead and use either individual form evaluations, or I can just always Select All, then eval. It results in some extra output (like the names of vars being defined) on the REPL, but I don't mind that too much. What's more concerning is that certain editors - including Atom - forgets the current cursor position when I do a Select All operation, so I can't just press Esc afterwards...


It is quite simple to add a "Send editor contents to REPL" with custom commands, to be honest...


Here's the full documentation: On init.js, you could for example add the following snippet:

atom.packages.activatePackage('chlorine').then(package => {
  const pkg = package.mainModule
  atom.commands.add('atom-text-editor', 'chlorine:send-editor-contents-to-repl', () => {
    const txt = atom.workspace.getActiveTextEditor.getText()
    pkg.ext.evaluate_and_present(txt, pkg.ext.get_block().range)

👍 4

Well, Load file just uses the built-in function (load-file ...) of Clojure, so that's the reason is reading from the filesystem the current REPL is running

👍 4