l3kn/org-el-cache

Using find makes org-el-cache exclusive to Unix environments

jethrokuan opened this issue · 6 comments

(defun org-el-cache--find (paths &optional include-archives)

l3kn commented

I think we can use something like sha1sum directory/**.org instead, I'll try that later today.

l3kn commented

It seems like shasum instead of sha1sum should work on both macOS and unix systems.

Not sure if something similar would be possible for windows systems.

I think OS compatibility is important for a low-level library like this. I want to start using this in org-roam, but that would mean windows users can no longer use org-roam ):

That includes utilities like sha1sum, awk etc.

l3kn commented

With the Windows Subsystem for Linux, a **.org style glob with shasum should work,
however I don't have a way to test this at the moment.

An alternative would be to provide a slow polyfill that uses directory-files-recursively and Emacs' buffer hashing.

Looks like dired also assumes that Windows users install replacement find utilities, but in their case find is not crucial to the operation of the buffer. A fallback option would be nice, given that this is only really important for the initial cache building.

l3kn commented

The most flexible solution might be moving the "given these folders, calculate the hashes for all files in them" logic to a small bash script and call that from emacs.
Then someone could write a powershell version of that.

An alternative fallback would be to disable cache persistence altogether,
so caches are re-created each time emacs is started.

With asynchronous cache creation / updating, this wouldn't even affect the startup time.