radian-software / apheleia

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

Invalid argument #276

Open arijit-gogoi opened 6 months ago

arijit-gogoi commented 6 months ago

Apheleia gives exits with exit code 2 on Windows 11 with doom emacs:

Thu Dec 28 23:23:22 2023 :: c:/Users/hp/workspace/waiig/monkey-lang/token/
$ "diff" "--rcs" "--strip-trailing-cr" "--" "c:/Users/hp/workspace/waiig/monkey-lang/token/token.go" "-"

diff.exe: -: Invalid argument

Command succeeded with exit code 2.
raxod502 commented 6 months ago

Sounds like a Windows problem. If you can suggest an alternative command line syntax for diff that'll work in this environment, I could implement it.

yukiteruamano commented 4 months ago

Hi @raxod502 !

This issue is very similar to what happens to me. You will see in OpenBSD the "diff" command that comes with it does not have the "--rcs" "--strip-trailing-cr" options and therefore fails with the same error code.

One way I see to solve this issue is to create a defcustom in which we can define the correct diff binary command (in my case gdiff, from GNU Coreutils, in the case of Windows to the correct diff binary).

In this link there is an idea of how this change would be implemented.

raxod502 commented 4 months ago

Right, that makes sense. I'll have the default value be gdiff if available, diff otherwise. And the user can customize. On the first invocation, it will check to verify that the necessary options are supported, and report a better error if they aren't.