add helper fn to check cards without killing emacs
Brandon Webster
3 years ago
54 | 54 | |
55 | 55 | (run-with-timer 1 1 #'robot-dump-messages) |
56 | 56 | |
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" | |
58 | 60 | (if (= n org-drill-cards-in-this-emacs) |
59 | 61 | (progn |
60 | 62 | (princ |
61 | 63 | (format "Succeeded: Saw %s cards as expected\n" n) |
62 | 64 | '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))) | |
69 | 76 | |
70 | 77 | ;; Move the package-user-dir somewhere local |
71 | 78 | (require 'package) |