nrepl-jack-in, lein with-profiles, and .dir-locals

56 views
Skip to first unread message

Charles Comstock

unread,
Apr 11, 2013, 12:43:09 AM4/11/13
to nrep...@googlegroups.com
I learned a new trick today, that seemed useful, and potentially should either be documented or easier to setup. I was working on a project using multiple profiles that adjusted the dependencies, but having difficulty using nrepl as it was not executing lein with-profiles dev,1.4 nrepl :headless. So I dug into nrepl.el and found lein-server-command. I considered changing it to add support for profiles, but then I remembered that emacs supports project local variables. So added the following .dir-locals.el file at the same level as the project.clj with the following content:

((nrepl-mode .
             ((nrepl-server-command . "lein with-profile dev,1.4 repl :headless"))))

Now when I run nrepl-jack-in it makes me confirm I want to use .dir-local overridden variables, but it always includes those profiles.

Anyway, not sure if any additional changes need to be made to the mode, but perhaps documenting this in the README for nrepl might be appropriate? I'm happy to write up the changes in a PR, but thought I would inquire if this was helpful for anyone else. It's also applicable for changing nrepl-ritz-server-command.

Charles Comstock

Charles Comstock

unread,
Apr 11, 2013, 7:11:20 PM4/11/13
to nrep...@googlegroups.com
I apparently spoke to soon on this. It appears that nrepl-server-command gets used by nrepl-jack-in prior to actually kicking off the nrepl-mode, so the variable isn't overridden until AFTER the mode has actually started. When I originally tested this I had overridden the variable manually so it wasn't apparent that the .dir-locals override occurred later. I'm not quite sure when this should be set as a result, or if there is a way to force nrepl-jack-in to check .dir-locals prior to kicking off the server command.

Anyone have any ideas?
  Charles Comstock
Reply all
Reply to author
Forward
0 new messages