aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--org-drill.el21
-rwxr-xr-xrobot/all-card-run.sh2
-rw-r--r--robot/all-card.org65
-rw-r--r--test/one-two-three.org2
-rw-r--r--test/org-drill-test.el18
6 files changed, 96 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 2725150..458a6f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ org-drill.html
/robot/basic-run-copy.org
/robot/leitner-run-copy.org
/robot/spanish-robot-copy.org
+/robot/explainer-run-copy.org
diff --git a/org-drill.el b/org-drill.el
index e6743e2..30a2583 100644
--- a/org-drill.el
+++ b/org-drill.el
@@ -66,8 +66,7 @@
(defcustom org-drill-question-tag
"drill"
- "Tag which topics must possess in order to be identified as review topics
-by `org-drill'."
+ "Tag for topics which are review topics."
:group 'org-drill
:type 'string)
@@ -725,7 +724,7 @@ CMD is bound, or nil if it is not bound to a key."
(apply 'org-map-entries func
(concat "+" org-drill-question-tag
(if (and (stringp org-drill-match)
- (not (member '(?+ ?- ?|) (elt org-drill-match 0))))
+ (not (member (elt org-drill-match 0) '(?+ ?- ?|))))
"+" "")
(or org-drill-match ""))
(org-drill-current-scope scope)
@@ -1104,15 +1103,18 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN TOTAL-REPEATS OFMATRIX), wher
;;; SM5 Algorithm =============================================================
(defun org-drill-modify-e-factor (ef quality)
+ "Return new e-factor given existing EF and QUALITY."
(if (< ef 1.3)
1.3
(+ ef (- 0.1 (* (- 5 quality) (+ 0.08 (* (- 5 quality) 0.02)))))))
(defun org-drill-modify-of (of q fraction)
+ "Return modify of."
(let ((temp (* of (+ 0.72 (* q 0.07)))))
(+ (* (- 1 fraction) of) (* fraction temp))))
(defun org-drill-set-optimal-factor (n ef of-matrix of)
+ "Set the optimal factor."
(let ((factors (assoc n of-matrix)))
(if factors
(let ((ef-of (assoc ef (cdr factors))))
@@ -1123,11 +1125,13 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN TOTAL-REPEATS OFMATRIX), wher
of-matrix)
(defun org-drill-initial-optimal-factor-sm5 (n ef)
+ "Return initial optimal factor."
(if (= 1 n)
org-drill-sm5-initial-interval
ef))
(defun org-drill-get-optimal-factor-sm5 (n ef of-matrix)
+ "Return optimal factor."
(let ((factors (assoc n of-matrix)))
(or (and factors
(let ((ef-of (assoc ef (cdr factors))))
@@ -1135,6 +1139,7 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN TOTAL-REPEATS OFMATRIX), wher
(org-drill-initial-optimal-factor-sm5 n ef))))
(defun org-drill-inter-repetition-interval-sm5 (last-interval n ef &optional of-matrix)
+ "Return repetition interval."
(let ((of (org-drill-get-optimal-factor-sm5 n ef (or of-matrix
org-drill-sm5-optimal-factor-matrix))))
(if (= 1 n)
@@ -1144,6 +1149,7 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN TOTAL-REPEATS OFMATRIX), wher
(defun org-drill-determine-next-interval-sm5 (last-interval n ef quality
failures meanq total-repeats
of-matrix &optional delta-days)
+ "Return next interval."
(if (zerop n) (setq n 1))
(if (null ef) (setq ef 2.5))
(cl-assert (> n 0))
@@ -1388,6 +1394,7 @@ of QUALITY."
next-interval))))))
(defun org-drill-hypothetical-next-review-dates ()
+ "Return hypothetical next review dates."
(let ((intervals nil))
(dotimes (q 6)
(push (max (or (car intervals) 0)
@@ -1539,11 +1546,13 @@ the current topic."
(reverse drill-sections)))
(defun org-drill-hide-all-subheadings-except (heading-list)
+ "Hide all subheadings except HEADING-LIST."
(org-drill-hide-subheadings-if
(lambda () (let ((drill-heading (org-get-heading t)))
(not (member drill-heading heading-list))))))
(defun org-drill--make-minibuffer-prompt (session prompt)
+ "Make a mini-buffer for the SESSION, with PROMPT."
(let ((status (cl-first (org-drill-entry-status session)))
(mature-entry-count (+ (length (oref session young-mature-entries))
(length (oref session old-mature-entries))
@@ -1811,7 +1820,7 @@ visual overlay, or with the string TEXT if it is supplied."
(defun org-drill-hide-heading-at-point (&optional text)
(unless (org-at-heading-p)
- (error "Point is not on a heading."))
+ (error "Point is not on a heading"))
(save-excursion
(let ((beg (point)))
(end-of-line)
@@ -3004,8 +3013,8 @@ exiting them with the `edit' or `quit' options."
;; Current drill session is finished, but there are still
;; more items which need to be reviewed.
(y-or-n-p (format
- "You have finished the drill session. However, %d items still
-need reviewing. Start a new drill session? "
+ "You have finished the drill session. However, %d items still
+need reviewing. Start a new drill session? "
(org-drill-pending-entry-count session))))
(org-drill-again))
(t
diff --git a/robot/all-card-run.sh b/robot/all-card-run.sh
index 25d560d..78de056 100755
--- a/robot/all-card-run.sh
+++ b/robot/all-card-run.sh
@@ -6,7 +6,7 @@ this_dir="$(dirname "$0")"
source $this_dir/robot.sh
-card_no=12
+card_no=18
function run_drill {
## Org-drill should be running at this point, so give three answers
diff --git a/robot/all-card.org b/robot/all-card.org
index c056287..01498a2 100644
--- a/robot/all-card.org
+++ b/robot/all-card.org
@@ -131,3 +131,68 @@ This is the body of a multiclozed card:
show1_lastmore
+
+* Readme
+
+** Simple Items
+
+*** Item :drill:
+What is the capital city of Estonia?
+
+**** The Answer
+Tallinn.
+
+*** Item :drill:
+
+The capital city of Estonia is [Tallinn].
+
+*** Multi-Close :drill:
+
+Type 1 hypersensitivity reactions are mediated by [immunoglobulin E||molecule]
+and [mast cells||cell type].
+
+
+*** Twosided :drill:
+ :PROPERTIES:
+ :DRILL_CARD_TYPE: twosided
+ :END:
+
+ Translate this word.
+
+**** Spanish
+ la mujer
+
+**** English
+ the woman
+
+**** Example sentence
+ ¿Quién fue esa mujer?
+ Who was that woman?
+
+
+*** Multisided :drill:
+ :PROPERTIES:
+ :DRILL_CARD_TYPE: multisided
+ :END:
+
+ Translate.
+
+**** Spanish
+ la mesa
+
+**** English
+ the table
+
+**** Picture
+ PICTURE
+
+
+*** Fact :drill:
+ :PROPERTIES:
+ :DRILL_CARD_TYPE: hide1cloze
+ :END:
+
+ The capital city of [New Zealand] is [Wellington], which is located in
+ the [North||North/South] Island and has a population of about
+ [400,000].
+
diff --git a/test/one-two-three.org b/test/one-two-three.org
index a34f905..c1120b6 100644
--- a/test/one-two-three.org
+++ b/test/one-two-three.org
@@ -1,5 +1,5 @@
-* One :drill:
+* One :drill:tagtest:
Body of One
diff --git a/test/org-drill-test.el b/test/org-drill-test.el
index 529d411..eb3c527 100644
--- a/test/org-drill-test.el
+++ b/test/org-drill-test.el
@@ -38,8 +38,16 @@
(ert-deftest find-entries ()
(should
- (equal '(2 30 58)
- (assess-with-find-file
- (assess-make-related-file
- (concat this-directory "one-two-three.org"))
- (org-drill-map-entries (lambda () (point)) 'file nil)))))
+ (equal '(2 38 66)
+ (assess-with-find-file
+ (assess-make-related-file
+ (concat this-directory "one-two-three.org"))
+ (org-drill-map-entries (lambda () (point)) 'file nil)))))
+
+(ert-deftest find-tagged-entries ()
+ (should
+ (equal '(2)
+ (assess-with-find-file
+ (assess-make-related-file
+ (concat this-directory "one-two-three.org"))
+ (org-drill-map-entries (lambda () (point)) 'file "tagtest")))))