l3kn / org-fc

Spaced Repetition System for Emacs org-mode
https://www.leonrische.me/fc/index.html
GNU General Public License v3.0
259 stars 31 forks source link

Some cards ignored if too many files with flash cards #68

Closed mithraen closed 8 months ago

mithraen commented 2 years ago

I use org-fc with org-roam, and have more than 2000 files now. Any note can contain some flash cards.

org-fc-awk-index-path function use find + xargs, and when I have too many files, xargs run awk/index.awk multiple times.

As a result, output contain multiple S-expressions.

But 'read' function from string read only first, and all other cards ignored.

It can be fixed by using 'read-from-string' function and 'append' to concatenate this lists.

l3kn commented 2 years ago

Interesting, I've got a collecton of ~2700 files and never noticed this, from the manpage it looks like there is a system dependent limit to how many files xargs can pass as arguments to another command.

Do I understand correctly that your solution would be to keep running read-from-string until the FINAL-STRING-INDEX it returns is at the end of the string?

mithraen commented 2 years ago

I make some tests:

ELISP> (read-from-string "a b    " 0)
(a . 1)

ELISP> (read-from-string "a b    " 1)
(b . 3)

ELISP> (read-from-string "a b    " 3)
*** Eval error ***  End of file during parsing

In this sampe FINAL-STRING-INDEX never at the end of string.

With ignore-errors it would be:

ELISP> (ignore-errors (read-from-string "a b " 0)) (a . 1)

ELISP> (ignore-errors (read-from-string "a b " 1)) (b . 3)

ELISP> (ignore-errors (read-from-string "a b " 3)) nil



I think comparing result with 'nil' would be correct solution.