Open clearwily opened 4 years ago
Thanks for bringing this up. I'll take a closer look next week.
There's defcustom cider-clojure-cli-command
. It currently can default to "powershell"
on Windows.
It seems likely that it would work if customized to "powershell foo bar baz"
.
Please let us know if that's not the case.
Cheers - V
This should not be closed.
This does not work in the latest stable version 1.7.0. The first error reported is: "The powershell -noprofile -executionpolicy bypass executable isn’t on your ‘exec-path’" More generally it would fail other places where there are hard-coded string compares of command to "powershell".
Reading related code in the latest master branch of cider.el, this will not work without other significant changes to the code. I looked into your approach initially and decided an additional customization variable would require the least amount of code change and would be the easiest to understand how it affects other things.
Thanks for looking at this.
Thanks for having a look!
"The powershell -noprofile -executionpolicy bypass executable isn’t on your ‘exec-path’"
Could it be simply a matter of handling whitespace (between command and params) in a different manner? It's a usual problem in Unix too.
I'll try giving it a shot.
Attached is the diff of my changes to the cider.el file in the 1.7.0 release to implement this functionality. I do this every time I upgrade to a new cider. The changes are simpler than my code submitted originally with issue. Basically, the changes are:
Reading (but not testing) the code in the latest commit on master, I believe these would be all the changes needed in that code as well. cider.el.patch
It LGTM. A PR is welcome after you have tested locally the changes.
Is your feature request related to a problem? Please describe.
When I switched from lein to Clojure CLI on MS Windows 10, cider-jack-in failed. The reason was unclear (to me anyway) from the error messaging. I found Alex Miller's documentation at Install fails due to permission errors useful in figuring out the problem.
Describe the solution you'd like
I'd like to be able to set a variable in my init.el like this: (custom-set-variables '(cider-clojure-cli-powershell-options "-noprofile -executionpolicy bypass"))
which would result in the cider-jack-in command line to be: ;; Startup: "c:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe" -noprofile -executionpolicy bypass -encodedCommand
This would need to be documented at Customizing the Jack-in Command Behaviour
Describe alternatives you've considered
Additional context
MS OS Version: 10.0.19041 N/A Build 19041 GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29 CIDER 0.26.0snapshot (package: 20200718.1908), nREPL 0.8.0-alpha5 Clojure 1.10.1, Java 1.8.0_202-ea
I have attached my version of cider.el that implements this enhancement. It works for me, with the caveat that I am not an everyday Clojure developer. I only use this occasionally.
cider.el.txt
Basically, this code
Adds the variable "(defcustom cider-clojure-cli-powershell-options ...)" I do not really care what the variable name is; I just picked this.
And modifies "(defun cider--update-jack-in-cmd ...)" to use the new variable. With apologies, my code seems inelegant to me but minimizes the changes to existing code.