[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-drill 361aa53a14 069/251: Very overdue items are consi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-drill 361aa53a14 069/251: Very overdue items are considered "lapsed" and are presented in the order they |
Date: |
Mon, 17 Jan 2022 18:59:02 -0500 (EST) |
branch: elpa/org-drill
commit 361aa53a14e0dd031b4c559449b9ed4aa6fd5f98
Author: eeeickythump <devnull@localhost>
Commit: eeeickythump <devnull@localhost>
Very overdue items are considered "lapsed" and are presented in the order
they
were originally added, rather than by how overdue they are.
DRILL_LAST_REVIEWED now uses an inactive timestamp (previously active).
Fix for rendering of latex fragments.
---
org-drill.el | 114 +++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 75 insertions(+), 39 deletions(-)
diff --git a/org-drill.el b/org-drill.el
index e5b0d49780..a467bc6864 100644
--- a/org-drill.el
+++ b/org-drill.el
@@ -2,7 +2,7 @@
;;; org-drill.el - Self-testing using spaced repetition
;;;
;;; Author: Paul Sexton <eeeickythump@gmail.com>
-;;; Version: 2.4.1
+;;; Version: 2.4.2
;;; Repository at http://bitbucket.org/eeeickythump/org-drill/
;;;
;;;
@@ -1363,7 +1363,7 @@ How well did you do? (0-5, ?=help, e=edit, t=tags,
q=quit)"
(sit-for 0.5)))))
(org-set-property "DRILL_LAST_QUALITY" (format "%d" quality))
(org-set-property "DRILL_LAST_REVIEWED"
- (time-to-active-org-timestamp (current-time))))
+ (time-to-inactive-org-timestamp (current-time))))
quality))
((= ch ?e)
'edit)
@@ -1720,12 +1720,13 @@ Note: does not actually alter the item."
;; topic, and should return t if the user chose to see the answer and rate
their
;; recall, nil if they chose to quit.
+
(defun org-drill-present-simple-card ()
(with-hidden-comments
(with-hidden-cloze-hints
(with-hidden-cloze-text
(org-drill-hide-all-subheadings-except nil)
- (org-preview-latex-fragment) ; overlay all LaTeX fragments with
images
+ (org-drill--show-latex-fragments) ; overlay all LaTeX fragments with
images
(ignore-errors
(org-display-inline-images t))
(org-cycle-hide-drawers 'all)
@@ -1744,7 +1745,7 @@ Note: does not actually alter the item."
(t
(org-drill-hide-subheadings-if 'org-drill-entry-p)
(org-drill-unhide-clozed-text)
- (org-preview-latex-fragment)
+ (org-drill--show-latex-fragments)
(ignore-errors
(org-display-inline-images t))
(org-cycle-hide-drawers 'all)
@@ -1752,6 +1753,11 @@ Note: does not actually alter the item."
(funcall reschedule-fn)))))
+(defun org-drill--show-latex-fragments ()
+ (org-remove-latex-fragment-image-overlays)
+ (org-toggle-latex-fragment '(4)))
+
+
(defun org-drill-present-two-sided-card ()
(with-hidden-comments
(with-hidden-cloze-hints
@@ -1762,7 +1768,7 @@ Note: does not actually alter the item."
(goto-char (nth (random* (min 2 (length drill-sections)))
drill-sections))
(org-show-subtree)))
- (org-preview-latex-fragment)
+ (org-drill--show-latex-fragments)
(ignore-errors
(org-display-inline-images t))
(org-cycle-hide-drawers 'all)
@@ -1780,7 +1786,7 @@ Note: does not actually alter the item."
(save-excursion
(goto-char (nth (random* (length drill-sections)) drill-sections))
(org-show-subtree)))
- (org-preview-latex-fragment)
+ (org-drill--show-latex-fragments)
(ignore-errors
(org-display-inline-images t))
(org-cycle-hide-drawers 'all)
@@ -1862,7 +1868,7 @@ items if FORCE-SHOW-FIRST or FORCE-SHOW-LAST is non-nil)."
;; while (org-pos-in-regexp (match-beginning 0)
;; org-bracket-link-regexp 1))
;; (org-drill-hide-matched-cloze-text)))))
- (org-preview-latex-fragment)
+ (org-drill--show-latex-fragments)
(ignore-errors
(org-display-inline-images t))
(org-cycle-hide-drawers 'all)
@@ -1911,12 +1917,12 @@ the second to last, etc."
;; org link, or if it occurs inside a LaTeX math
;; fragment
(or (org-pos-in-regexp (match-beginning 0)
- org-bracket-link-regexp 1)
+ org-bracket-link-regexp 1)
(org-inside-LaTeX-fragment-p)))
(incf cnt)
(if (= cnt to-hide)
(org-drill-hide-matched-cloze-text)))))))
- (org-preview-latex-fragment)
+ (org-drill--show-latex-fragments)
(ignore-errors
(org-display-inline-images t))
(org-cycle-hide-drawers 'all)
@@ -2111,26 +2117,28 @@ See `org-drill' for more details."
'org-drill-present-default-answer)
present-empty-cards (third presentation-fn)
presentation-fn (first presentation-fn)))
- (cond
- ((null presentation-fn)
- (message "%s:%d: Unrecognised card type '%s', skipping..."
- (buffer-name) (point) card-type)
- (sit-for 0.5)
- 'skip)
- (t
- (setq cont (funcall presentation-fn))
- (cond
- ((not cont)
- (message "Quit")
- nil)
- ((eql cont 'edit)
- 'edit)
- ((eql cont 'skip)
- 'skip)
- (t
- (save-excursion
- (funcall answer-fn
- (lambda () (org-drill-reschedule)))))))))))))
+ (prog1
+ (cond
+ ((null presentation-fn)
+ (message "%s:%d: Unrecognised card type '%s', skipping..."
+ (buffer-name) (point) card-type)
+ (sit-for 0.5)
+ 'skip)
+ (t
+ (setq cont (funcall presentation-fn))
+ (cond
+ ((not cont)
+ (message "Quit")
+ nil)
+ ((eql cont 'edit)
+ 'edit)
+ ((eql cont 'skip)
+ 'skip)
+ (t
+ (save-excursion
+ (funcall answer-fn
+ (lambda () (org-drill-reschedule))))))))
+ (org-remove-latex-fragment-image-overlays)))))))
(defun org-drill-entries-pending-p ()
@@ -2384,17 +2392,43 @@ all the markers used by Org-Drill will be freed."
(free-marker m)))
+;;; overdue-data is a list of entries, each entry has the form (POS DUE AGE)
+;;; where POS is a marker pointing to the start of the entry, and
+;;; DUE is a number indicating how many days ago the entry was due.
+;;; AGE is the number of days elapsed since item creation (nil if unknown).
+;;; if age > 60, sort by age (oldest first)
+;;; if age < 60, sort by due (biggest first)
+
+;;; if (age a) <= 60 and (age b) <= 60, sort by due
+;;; else sort by age
+
+
(defun org-drill-order-overdue-entries (overdue-data)
- (setq *org-drill-overdue-entries*
- (mapcar 'car
- (sort (shuffle-list overdue-data)
- (lambda (a b) (> (cdr a) (cdr b)))))))
+ (let* ((lapsed-days 60)
+ (not-lapsed (remove-if (lambda (a) (> (or (third a) 0) lapsed-days))
+ overdue-data))
+ (lapsed (remove-if-not (lambda (a) (> (or (third a) 0)
+ lapsed-days)) overdue-data)))
+ (setq *org-drill-overdue-entries*
+ (mapcar 'first
+ (append
+ (sort (shuffle-list not-lapsed)
+ (lambda (a b) (> (second a) (second b))))
+ (sort lapsed
+ (lambda (a b) (> (third a) (third b)))))))))
+
+
+(defun org-drill-entry-days-since-creation ()
+ (let ((timestamp (org-entry-get (point) "DATE_ADDED")))
+ (if timestamp
+ (- (org-time-stamp-to-now timestamp)))))
(defun org-drill-entry-status ()
- "Returns a list (STATUS DUE) where DUE is the number of days overdue,
-zero being due today, -1 being scheduled 1 day in the future. STATUS is
-one of the following values:
+ "Returns a list (STATUS DUE AGE) where DUE is the number of days overdue,
+zero being due today, -1 being scheduled 1 day in the future.
+AGE is the number of days elapsed since the item was created (nil if unknown).
+STATUS is one of the following values:
- nil, if the item is not a drill entry, or has an empty body
- :unscheduled
- :future
@@ -2408,6 +2442,7 @@ one of the following values:
(unless (org-at-heading-p)
(org-back-to-heading))
(let ((due (org-drill-entry-days-overdue))
+ (age (org-drill-entry-days-since-creation))
(last-int (org-drill-entry-last-interval 1)))
(list
(cond
@@ -2446,7 +2481,7 @@ one of the following values:
:young)
(t
:old))
- due))))
+ due age))))
(defun org-drill-progress-message (collected scanned)
@@ -2554,7 +2589,8 @@ work correctly with older versions of org mode. Your org
mode version (%s) appea
(sit-for 0.5)
(setq warned-about-id-creation t))
(org-id-get-create) ; ensure drill entry has unique ID
- (destructuring-bind (status due) (org-drill-entry-status)
+ (destructuring-bind (status due age)
+ (org-drill-entry-status)
(case status
(:unscheduled
(incf *org-drill-dormant-entry-count*))
@@ -2572,7 +2608,7 @@ work correctly with older versions of org mode. Your org
mode version (%s) appea
(:young
(push (point-marker)
*org-drill-young-mature-entries*))
(:overdue
- (push (cons (point-marker) due) overdue-data))
+ (push (list (point-marker) due age) overdue-data))
(:old
(push (point-marker) *org-drill-old-mature-entries*))
)))))
- [nongnu] elpa/org-drill 8b72dfbded 024/251: - Can now resume drill sessions after exiting with (e)dit or (q)uit commands!, (continued)
- [nongnu] elpa/org-drill 8b72dfbded 024/251: - Can now resume drill sessions after exiting with (e)dit or (q)uit commands!, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 2d039d0429 027/251: Added tag 2.1.1 for changeset 60b0a80ce97a, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill c27d9035ef 030/251: - Added new example card types, more useful than 'spanish_verb':, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill ce3e540b00 035/251: Added tag 2.3.1 for changeset 566cf446fdae, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 0aeff8516d 032/251: - All drill items now receive unique IDs (using the org-id module). This allows, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 1c77d6cf3a 041/251: Removed old doc files (renamed)., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill ca5231b9b4 043/251: Cloze text is now correctly identified in items whose bodies contain [[bracketed links]]., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 8133a8c566 044/251: Added tag 2.3.3 for changeset e68b52fe88ac, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill c410f8dcb0 042/251: Added tag 2.3.2 for changeset 4e43f149ea97, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 7301c9ea71 073/251: Fixed calculation of 'org-drill-entry-days-since-creation' for cases where 'org-drill-entry-days-overdue' returns NIL., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 361aa53a14 069/251: Very overdue items are considered "lapsed" and are presented in the order they,
ELPA Syncer <=
- [nongnu] elpa/org-drill 612848a840 068/251: Added tag 2.4.1 for changeset 97f51d64df45, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill d987e8d734 081/251: Added tag 2.5.0 for changeset 9b098bf2648d, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill ec7b5a0cf0 048/251: Added tag 2.3.4 for changeset e472512f0be7, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill d5c55b69f4 061/251: Any LaTeX math fragments in an item will now be rendered inline (if possible), ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill c71a218c68 074/251: Added tag 2.4.4 for changeset 0571437aa238, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill eb95d9415a 059/251: New global variable 'org-drill-match'. Now possible to specify a tags/property/, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill ce1a76c6c9 076/251: Added tag 2.4.5 for changeset 69dde321b38c, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 45237da768 046/251: Added tag 2.3.3 for changeset 1b0cc92cbb6a, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill bd452b9fe1 054/251: The string which separates a hint from the rest of the contents of a cloze is, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill b2f4874178 051/251: - Fixes to try and force display of images during drill sessions., ELPA Syncer, 2022/01/17