During review, there are two times user input / keys is read, once to flip the card and once to rate it.
Currently that's implemented using two hydras.
Because there is no way to block and return a value from a hydra (e.g. the rating), org-fc-review-next-card
opens the flip hydra, this hydra calls org-fc-review-flip
which executes the cards flip-function and then opens the rating hydra. The rating hydra calls org-fc-review-rate
which calls org-fc-review-next-card
to review the next card.
So the "review loop" is actually a sequence of four functions calling each other.
My main problem with this is that it's not very elegant and parts of the review logic are spread out over multiple functions.
It also prevents me from implementing two features I have planned:
- card types with different review types per position, e.g. a double card where one position requires text input (no flipping) while the other position is flipped normally
- audio for cards that's played either when the card is presented or flipped.
A key for replaying the audio file is hard to implement because hydras are not designed to have their keymaps changed after they are defined.
I've tried using two minor-modes instead of the hydras, but that requires a bunch of hacks to make sure the keys work with evil-mode enabled.
Another problem is that EmacsLisp has no TCO, and while I haven't run into this yet, I'm pretty sure that reviewing enough cards in a row (estimate: ~600) could trigger an "Variable binding depth exceeds max-specpdl-size" error.
My proposed solution is to replace the hydras with read-key
and a nicely formatted prompt,
which would allow rewriting org-fc-review-next-card
to use a while
-loop.