Closed vkar-hub closed 6 months ago
It might be possible to start a timer in the org-fc-after-setup-hook
and
have it delete the timer and flip the card.
To avoid having the timer of one card flip a different one when you flip it manually,
you could add a org-fc-after-flip-hook
(maybe also a org-fc-after-review-hook
) that checks if the timer is still running and deletes it.
org-fc-audio.el
uses a similar approach to play audio files and stop the playback if the card if flipped or the review ends.
That's a great starting point. Thanks. I'll give that a go.
Did you get it to work as expected? If you want to share your code, there's a new https://github.com/l3kn/org-fc-extras repository I'm using for some extensions to org-fc. Alternatively, I can also add a link to your own repository if you'd prefer that.
Mostly. What I have right now is this:
(defvar recall-timer nil)
(defun cancel-recall-timer ()
"Cancel the recall timer if it is running."
(when recall-timer
(cancel-function-timers recall-timer)
(setq recall-timer nil)))
(defun autoflip-flashcard (seconds)
"Automatically flip a card after x seconds."
(cancel-recall-timer)
(setq recall-timer (run-at-time seconds nil
(lambda ()
(org-fc-review-flip)))))
(add-hook 'org-fc-after-setup-hook (lambda () (autoflip-flashcard 30)))
(add-hook 'org-fc-after-flip-hook 'cancel-recall-timer)
This works fine except org-fc-review-flip flips to another instance of flip mode instead of rate mode and I'm not quite sure how to resolve that.
Disclaimer: I am very new to this so I'm not very familiar with writing or sharing code.
Hi, Is there a way I can flip a card after x seconds?