radian-software / apheleia

🌷 Run code formatter on buffer contents without moving point, using RCS patches and dynamic programming.
MIT License
558 stars 75 forks source link

apheleia-npx fails silently on Windows #285

Closed ItsHoff closed 6 months ago

ItsHoff commented 7 months ago

Emacs on Windows does not recognize apheleia-npx as an executable which causes the formatting to fail silently. A potential solution would be to add a Windows wrapper apheleia-npx.bat along the lines of

@echo OFF
pushd %~dp0

sh apheleia-npx %*

popd

This still requires sh to be installed, but personally I find that to be a reasonable requirement.

raxod502 commented 7 months ago

Presumably this would be an issue for every other shell script shipped with Apheleia, not just that one. I would personally argue that a utility function should be created that executes an arbitrary command. If the operating system is Windows, then it would check the first line of the file to see if a shebang is used, and if so, prepend that to the command line.

ItsHoff commented 7 months ago

Yeah, this should affect all the scripts.

I like that solution. I'll see if I can implement that once I get the time.