[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-drill 1470bdb487 131/251: Remove org-drill-new-entries
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-drill 1470bdb487 131/251: Remove org-drill-new-entries |
Date: |
Mon, 17 Jan 2022 18:59:09 -0500 (EST) |
branch: elpa/org-drill
commit 1470bdb487a7b7e4dbaaa08f0e4661dc4c2dafbb
Author: Phillip Lord <phillip.lord@russet.org.uk>
Commit: Phillip Lord <phillip.lord@russet.org.uk>
Remove org-drill-new-entries
---
.gitignore | 1 +
org-drill.el | 99 +++++++++++++++++++++++++++++++-----------------------------
2 files changed, 52 insertions(+), 48 deletions(-)
diff --git a/.gitignore b/.gitignore
index e6e697f27b..4daa07af36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ org-drill.html
/robot/main-test-copy.org
/robot/failure.txt
/robot/messages.txt
+/robot/main-test-copy.org~
diff --git a/org-drill.el b/org-drill.el
index d2b4688353..d04ecdbe83 100644
--- a/org-drill.el
+++ b/org-drill.el
@@ -602,11 +602,12 @@ to preserve the formatting in a displayed table, for
example."
(cl-defstruct org-drill-session
(qualities nil)
- (start-time 0))
+ (start-time 0)
+ (new-entries nil)
+ )
(defvar org-drill-last-session nil)
-(defvar *org-drill-new-entries* nil)
(defvar *org-drill-dormant-entry-count* 0)
(defvar *org-drill-due-entry-count* 0)
(defvar *org-drill-overdue-entry-count* 0)
@@ -688,7 +689,7 @@ regardless of whether the test was successful.")
nil
(let ((,idx (cl-random (length ,place))))
(prog1 (nth ,idx ,place)
- (setq ,place (append (cl-subseq ,place 0 ,idx)
+ (setf ,place (append (cl-subseq ,place 0 ,idx)
(cl-subseq ,place (1+ ,idx)))))))))
@@ -1634,7 +1635,7 @@ the current topic."
'face `(:foreground ,org-drill-mature-count-color)
'help-echo "The number of old items due for review.")
(propertize
- (number-to-string (length *org-drill-new-entries*))
+ (number-to-string (length (org-drill-session-new-entries
session)))
'face `(:foreground ,org-drill-new-count-color)
'help-echo (concat "The number of new items that you "
"have never reviewed."))
@@ -2556,22 +2557,21 @@ See `org-drill' for more details."
rtn))))))
-(defun org-drill-entries-pending-p ()
+(defun org-drill-entries-pending-p (session)
(or *org-drill-again-entries*
*org-drill-current-item*
(and (not (org-drill-maximum-item-count-reached-p))
(not (org-drill-maximum-duration-reached-p session))
- (or *org-drill-new-entries*
+ (or (org-drill-session-new-entries session)
*org-drill-failed-entries*
*org-drill-young-mature-entries*
*org-drill-old-mature-entries*
*org-drill-overdue-entries*
*org-drill-again-entries*))))
-
-(defun org-drill-pending-entry-count ()
+(defun org-drill-pending-entry-count (session)
(+ (if (markerp *org-drill-current-item*) 1 0)
- (length *org-drill-new-entries*)
+ (length (org-drill-session-new-entries session))
(length *org-drill-failed-entries*)
(length *org-drill-young-mature-entries*)
(length *org-drill-old-mature-entries*)
@@ -2630,15 +2630,15 @@ maximum number of items."
(pop-random *org-drill-young-mature-entries*))
;; Next priority is newly added items, and older entries.
;; We pool these into a single group.
- ((and (or *org-drill-new-entries*
+ ((and (or (org-drill-session-new-entries session)
*org-drill-old-mature-entries*)
(not (org-drill-maximum-item-count-reached-p))
(not (org-drill-maximum-duration-reached-p session)))
(cond
- ((< (cl-random (+ (length *org-drill-new-entries*)
- (length *org-drill-old-mature-entries*)))
- (length *org-drill-new-entries*))
- (pop-random *org-drill-new-entries*))
+ ((< (cl-random (+ (length (org-drill-session-new-entries session))
+ (length *org-drill-old-mature-entries*)))
+ (length (org-drill-session-new-entries session)))
+ (pop-random (org-drill-session-new-entries session)))
(t
(pop-random *org-drill-old-mature-entries*))))
;; After all the above are done, last priority is items
@@ -2656,7 +2656,7 @@ maximum number of items."
RESUMING-P is true if we are resuming a suspended drill session."
(cl-block org-drill-entries
- (while (org-drill-entries-pending-p)
+ (while (org-drill-entries-pending-p session)
(let ((m (cond
((or (not resuming-p)
(null *org-drill-current-item*)
@@ -2747,8 +2747,8 @@ Session finished. Press a key to continue..."
(max 1 (length qualities)))
pass-percent
org-drill-failure-quality
- (org-drill-pending-entry-count)
- (+ (org-drill-pending-entry-count)
+ (org-drill-pending-entry-count session)
+ (+ (org-drill-pending-entry-count session)
*org-drill-dormant-entry-count*)
(propertize
(format "%d failed"
@@ -2761,7 +2761,7 @@ Session finished. Press a key to continue..."
'face `(:foreground ,org-drill-failed-count-color))
(propertize
(format "%d new"
- (length *org-drill-new-entries*))
+ (length (org-drill-session-new-entries session)))
'face `(:foreground ,org-drill-new-count-color))
(propertize
(format "%d young"
@@ -2800,14 +2800,13 @@ order to make items appear more frequently over time."
))))
-
-(defun org-drill-free-markers (markers)
+(defun org-drill-free-markers (session markers)
"MARKERS is a list of markers, all of which will be freed (set to
point nowhere). Alternatively, MARKERS can be 't', in which case
all the markers used by Org-Drill will be freed."
(dolist (m (if (eql t markers)
(append *org-drill-done-entries*
- *org-drill-new-entries*
+ (org-drill-session-new-entries session)
*org-drill-failed-entries*
*org-drill-again-entries*
*org-drill-overdue-entries*
@@ -2938,7 +2937,7 @@ STATUS is one of the following values:
(defun org-map-drill-entry-function ()
(org-drill-progress-message
- (+ (length *org-drill-new-entries*)
+ (+ (length (org-drill-session-new-entries session))
(length *org-drill-overdue-entries*)
(length *org-drill-young-mature-entries*)
(length *org-drill-old-mature-entries*)
@@ -2959,7 +2958,7 @@ STATUS is one of the following values:
(if (eq -1 due)
(cl-incf *org-drill-due-tomorrow-count*)))
(:new
- (push (point-marker) *org-drill-new-entries*))
+ (push (point-marker) (org-drill-session-new-entries session)))
(:failed
(push (point-marker) *org-drill-failed-entries*))
(:young
@@ -3036,20 +3035,20 @@ work correctly with older versions of org mode. Your
org mode version (%s) appea
(cnt 0))
(cl-block org-drill
(unless resume-p
- (org-drill-free-markers t)
- (setq *org-drill-current-item* nil
+ (org-drill-free-markers session t)
+ (setf *org-drill-current-item* nil
*org-drill-done-entries* nil
*org-drill-dormant-entry-count* 0
*org-drill-due-entry-count* 0
*org-drill-due-tomorrow-count* 0
*org-drill-overdue-entry-count* 0
- *org-drill-new-entries* nil
+ (org-drill-session-new-entries session) nil
*org-drill-overdue-entries* nil
*org-drill-young-mature-entries* nil
*org-drill-old-mature-entries* nil
*org-drill-failed-entries* nil
- *org-drill-again-entries* nil)
- (setf (org-drill-session-start-time session) (float-time
(current-time))))
+ *org-drill-again-entries* nil
+ (org-drill-session-start-time session) (float-time
(current-time))))
(setq *random-state* (cl-make-random-state t)) ; reseed RNG
(unwind-protect
(save-excursion
@@ -3062,10 +3061,11 @@ work correctly with older versions of org mode. Your
org mode version (%s) appea
(org-drill-order-overdue-entries overdue-data)
(setq *org-drill-overdue-entry-count*
(length *org-drill-overdue-entries*))))
- (setq *org-drill-due-entry-count* (org-drill-pending-entry-count))
+ (setq *org-drill-due-entry-count*
+ (org-drill-pending-entry-count session))
(cond
((and (null *org-drill-current-item*)
- (null *org-drill-new-entries*)
+ (null (org-drill-session-new-entries session))
(null *org-drill-failed-entries*)
(null *org-drill-overdue-entries*)
(null *org-drill-young-mature-entries*)
@@ -3080,7 +3080,7 @@ work correctly with older versions of org mode. Your org
mode version (%s) appea
(progn
(unless end-pos
(setq *org-drill-cram-mode* nil)
- (org-drill-free-markers *org-drill-done-entries*)))))
+ (org-drill-free-markers session *org-drill-done-entries*)))))
(cond
(end-pos
(when (markerp end-pos)
@@ -3144,18 +3144,19 @@ were not reviewed during the last session, rather than
scanning for
unreviewed items. If there are no leftover items in memory, a full
scan will be performed."
(interactive)
- (setq *org-drill-cram-mode* nil)
- (cond
- ((cl-plusp (org-drill-pending-entry-count))
- (org-drill-free-markers *org-drill-done-entries*)
- (if (markerp *org-drill-current-item*)
- (free-marker *org-drill-current-item*))
- (setf (org-drill-session-start-time session) (float-time (current-time)))
- (setq *org-drill-done-entries* nil
- *org-drill-current-item* nil)
- (org-drill scope drill-match t))
- (t
- (org-drill scope drill-match))))
+ (let ((session org-drill-last-session))
+ (setq *org-drill-cram-mode* nil)
+ (cond
+ ((cl-plusp (org-drill-pending-entry-count session))
+ (org-drill-free-markers session *org-drill-done-entries*)
+ (if (markerp *org-drill-current-item*)
+ (free-marker *org-drill-current-item*))
+ (setf (org-drill-session-start-time session) (float-time (current-time)))
+ (setq *org-drill-done-entries* nil
+ *org-drill-current-item* nil)
+ (org-drill scope drill-match t))
+ (t
+ (org-drill scope drill-match)))))
@@ -3163,16 +3164,17 @@ scan will be performed."
"Resume a suspended drill session. Sessions are suspended by
exiting them with the `edit' or `quit' options."
(interactive)
+ (let ((session org-drill-last-session)))
(cond
- ((org-drill-entries-pending-p)
+ ((org-drill-entries-pending-p session)
(org-drill nil nil t))
- ((and (cl-plusp (org-drill-pending-entry-count))
+ ((and (cl-plusp (org-drill-pending-entry-count session))
;; 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? "
- (org-drill-pending-entry-count))))
+ (org-drill-pending-entry-count session))))
(org-drill-again))
(t
(message "You have finished the drill session."))))
@@ -3790,7 +3792,8 @@ Returns a list of strings."
(interactive)
;; org-drill-again uses org-drill-pending-entry-count to decide
;; whether it needs to scan or not.
- (let ((pending (org-drill-pending-entry-count)))
+ (let* ((session org-drill-last-session)
+ (pending (org-drill-pending-entry-count session)))
(unless (cl-plusp pending)
(let ((warned-about-id-creation nil)
(cnt 0)
@@ -3800,7 +3803,7 @@ Returns a list of strings."
'org-map-drill-entry-function
nil nil)))
;; if the overdue entries are not ones we have just created
- (if (> (org-drill-pending-entry-count) org-drill-leitner-completed)
+ (if (> (org-drill-pending-entry-count session) org-drill-leitner-completed)
;; we should have scanned previously if we need to
(progn
(message "Org Drill: Starting SM learning")
- [nongnu] elpa/org-drill 2be993c6ce 037/251: Don't warn about a high percentage of failed items when the number of tested, (continued)
- [nongnu] elpa/org-drill 2be993c6ce 037/251: Don't warn about a high percentage of failed items when the number of tested, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 849be174b6 093/251: Added tag 2.4.10 for changeset 2d622b26469c, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 44289690b7 089/251: Added tag 2.4.9 for changeset 355c05642208, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill ddd9b056cd 106/251: Merge answer typing, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill a9d771052e 107/251: Fix matching of lock files, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 4d9bdb6836 115/251: Add org-learn, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 939f2a65b2 114/251: Enable cask testing, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 533a3a84ee 117/251: Add gitlab-ci.yml, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 54cde2dbf7 132/251: Move to eieio objects, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill be851b9eb4 142/251: Refactor robot testing, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 1470bdb487 131/251: Remove org-drill-new-entries,
ELPA Syncer <=
- [nongnu] elpa/org-drill 50885fbeea 146/251: Refactor robot testing to allow multiple tests, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill c58cb90ff0 123/251: Update gitignore, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 644b0a5cbc 126/251: Remove org-learn as a separate package, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 9aa3e98ea0 130/251: Remove org-drill-start-time, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill b161277f82 156/251: Replace more non-namespaced commands, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 61fe47deb8 152/251: Replace drill-answer, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 02b507b839 151/251: Add leitner robot test and fix, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 6533b73246 164/251: Support changing small sleep on command line, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill a949ece724 165/251: Remove more dynamic scoping errors, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 82c2ec8b1f 189/251: Replace call to gensym with cl-gensym, ELPA Syncer, 2022/01/17