Codebase list org-drill / 2d7ea5d
add helper fn to check cards without killing emacs Brandon Webster 3 years ago
1 changed file(s) with 14 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
5454
5555 (run-with-timer 1 1 #'robot-dump-messages)
5656
57 (defun robot-check-cards-seen-and-die (n)
57 (defun robot-check-cards-seen (n)
58 "N is number of cards we expect to have seen this session.
59 Returns a number representing an exit status code"
5860 (if (= n org-drill-cards-in-this-emacs)
5961 (progn
6062 (princ
6163 (format "Succeeded: Saw %s cards as expected\n" n)
6264 'external-debugging-output)
63 (kill-emacs 0))
64 (princ
65 (format "Failed: Saw %s cards, expecting %s\n"
66 org-drill-cards-in-this-emacs n)
67 'external-debugging-output)
68 (kill-emacs -1)))
65 0)
66 (progn
67 (princ
68 (format "Failed: Saw %s cards, expecting %s\n"
69 org-drill-cards-in-this-emacs n)
70 'external-debugging-output)
71 -1)))
72
73 (defun robot-check-cards-seen-and-die (n)
74 "N is number of cards we expect to have seen this session."
75 (kill-emacs (robot-check-cards-seen n)))
6976
7077 ;; Move the package-user-dir somewhere local
7178 (require 'package)