diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-05 05:12:25 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-05 05:12:25 -0500 |
| commit | 88b7fb502c0317ac29b3c7f3eb3f4c0617c87c02 (patch) | |
| tree | f9cf670b800d2e303c26277e437d6f9cbfce0178 /org-drill.el | |
| parent | 8bbb6d30529abd5350884e822b308da917966e73 (diff) | |
| download | org-drill-88b7fb502c0317ac29b3c7f3eb3f4c0617c87c02.tar.gz org-drill-88b7fb502c0317ac29b3c7f3eb3f4c0617c87c02.zip | |
fix: default DRILL_LEITNER_BOX to 0 in leitner-rebox
When the property is absent, org-entry-get returns nil and
string-to-number errors with wrong-type-argument. Reachable when a
user removes the property mid-session, or when a Leitner-tagged
entry is rebox'd before its DRILL_LEITNER_BOX has been set.
Wrapped the org-entry-get with (or ... "0"). Box 0 makes the rating
semantics still sensible: a downgrade stays at 0, a promotion goes
to 1.
Diffstat (limited to 'org-drill.el')
| -rw-r--r-- | org-drill.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/org-drill.el b/org-drill.el index f98bbfe..5037d73 100644 --- a/org-drill.el +++ b/org-drill.el @@ -3986,8 +3986,13 @@ shuffling is done in place." (cond ((and (>= ch ?0) (<= ch ?5)) (let ((current-box + ;; Default to 0 if the property isn't set — `org-entry-get' + ;; returns nil and `string-to-number' would error on nil. + ;; Box 0 is sensible: a downgrade stays at 0, a promotion + ;; goes to 1. (string-to-number - (org-entry-get (point) "DRILL_LEITNER_BOX" nil)))) + (or (org-entry-get (point) "DRILL_LEITNER_BOX" nil) + "0")))) (cond ((or (= ch ?0)) (message "Refiled down to box: 1") |
