Open chrt opened 2 years ago
How did you set up the find
command on windows? Maybe it doesn't support the -L
flag and gets confused.
I use emacs 28 native-comp in MSYS2 and ran into the same issue. I can confirm that for me the problem was with find
in windows. Adding a setq find-program [msys2 or git path]
in my init file, as usually suggested, didn't work for me. "C:\Windows\System32\find.exe" is first in the path if I type where find
in eshell and I didn't find how to remove it, only how to add others, which doesn't solve the problem.
So I went for the more radical, but working solution (also in Powershell) of replacing the find.exe in "C:\Windows\System32\" with the one from "C:\msys64\usr\bin\". I kept the old file in case, but so far so good. You need to change the permissions for this operation (see here how to gain full control, but I suggest only applying this to the file, not the whole folder, and putting things back after ;)).
I don't have a windows installation to test this on but it seems like the problem could also be solved by explicitly telling org-fc which version of find
to use.
Invoking find
is handled through the org-fc-awk--find
function. A fix might be to overwrite it like this:
(defun org-fc-awk--find (paths)
(format
"C:\mysys64\usr\bin\find -L %s -name \"*.org\" -not -name \".*\" -print0"
(mapconcat
(lambda (path) (shell-quote-argument (expand-file-name path)))
paths " ")))
The exact path depends on how and where a compatible find
was installed.
If this works, I can add configuration variables for the paths of the find
and gawk
programs.
Maybe we can also put together a list of paths to use for different installation methods.
Is there also a 32bit version of MYSYS2 with a path of mysys32\usr\bin
?
And are there other common methods for installing unix tools on windows?
To be clear, from my point of view, this issue is solved (but can't close myself). It's nice from you to give an ad-hoc fix, but I think it's a more general problem, which has actually nothing to do with org-fc itself. So I think you shouldn't waste time with a list of path or any else. There are many answers on that on SO (like my link above) or other places. That's also why I prefer a global fix to it, as I proposed, cause it's anyway a problem for me if find
is unusable in eshell, for instance.
To answer your last question, there are 3 main ways of getting unix tools on Windows to my knowledge (I don't count virtualization, like WSL) :
I am using Emacs 27.2 and gawk 5.0.0 in Windows.
I failed to review the demo, and the error messages were as follows:
My
.emacs.d/init.el
is as follows:I tried to review my own cards, but the result is similar.
Any help is appreciated. Thanks!