[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-drill 8a9192cc2f 080/251: Persistence of the optimal f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-drill 8a9192cc2f 080/251: Persistence of the optimal factor matrix across application sessions is now |
Date: |
Mon, 17 Jan 2022 18:59:03 -0500 (EST) |
branch: elpa/org-drill
commit 8a9192cc2f7872f6d95646920876375a31e789ea
Author: Paul Sexton <eeeickythump@gmail.com>
Commit: Paul Sexton <eeeickythump@gmail.com>
Persistence of the optimal factor matrix across application sessions is now
accomplished via 'savehist' rather than 'customize'.
---
org-drill.el | 52 ++++++++++++++++++++++++++++++++++++----------------
1 file changed, 36 insertions(+), 16 deletions(-)
diff --git a/org-drill.el b/org-drill.el
index 78575242fb..95b192a02e 100755
--- a/org-drill.el
+++ b/org-drill.el
@@ -49,6 +49,7 @@
(require 'org)
(require 'org-id)
(require 'org-learn)
+(require 'savehist)
(defgroup org-drill nil
@@ -368,17 +369,38 @@ Available choices are:
(defcustom org-drill-optimal-factor-matrix
+ nil
+ "Obsolete and will be removed in future. The SM5 optimal factor
+matrix data is now stored in the variable
+`org-drill-sm5-optimal-factor-matrix'."
+ :group 'org-drill
+ :type 'sexp)
+
+
+(defvar org-drill-sm5-optimal-factor-matrix
nil
"DO NOT CHANGE THE VALUE OF THIS VARIABLE.
-Persistent matrix of optimal factors, used by the SuperMemo SM5 algorithm.
-The matrix is saved (using the 'customize' facility) at the end of each
-drill session.
+Persistent matrix of optimal factors, used by the SuperMemo SM5
+algorithm. The matrix is saved at the end of each drill session.
Over time, values in the matrix will adapt to the individual user's
-pace of learning."
- :group 'org-drill
- :type 'sexp)
+pace of learning.")
+
+
+(add-to-list 'savehist-additional-variables
+ 'org-drill-sm5-optimal-factor-matrix)
+(unless savehist-mode
+ (savehist-mode 1))
+
+
+(defun org-drill--transfer-optimal-factor-matrix ()
+ (if (and org-drill-optimal-factor-matrix
+ (null org-drill-sm5-optimal-factor-matrix))
+ (setq org-drill-sm5-optimal-factor-matrix
+ org-drill-optimal-factor-matrix)))
+
+(add-hook 'after-init-hook 'org-drill--transfer-optimal-factor-matrix)
(defcustom org-drill-sm5-initial-interval
@@ -999,7 +1021,7 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN
TOTAL-REPEATS OFMATRIX), wher
;; When an item is failed, its interval is reset to 0,
;; but its EF is unchanged
(list -1 1 ef (1+ failures) meanq (1+ total-repeats)
- org-drill-optimal-factor-matrix)
+ org-drill-sm5-optimal-factor-matrix)
;; else:
(let* ((next-ef (modify-e-factor ef quality))
(interval
@@ -1023,7 +1045,7 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN
TOTAL-REPEATS OFMATRIX), wher
(1+ n)
next-ef
failures meanq (1+ total-repeats)
- org-drill-optimal-factor-matrix))))
+ org-drill-sm5-optimal-factor-matrix))))
;;; SM5 Algorithm =============================================================
@@ -1045,7 +1067,7 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN
TOTAL-REPEATS OFMATRIX), wher
(defun inter-repetition-interval-sm5 (last-interval n ef &optional of-matrix)
(let ((of (get-optimal-factor-sm5 n ef (or of-matrix
-
org-drill-optimal-factor-matrix))))
+
org-drill-sm5-optimal-factor-matrix))))
(if (= 1 n)
of
(* of last-interval))))
@@ -1059,7 +1081,7 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN
TOTAL-REPEATS OFMATRIX), wher
(assert (> n 0))
(assert (and (>= quality 0) (<= quality 5)))
(unless of-matrix
- (setq of-matrix org-drill-optimal-factor-matrix))
+ (setq of-matrix org-drill-sm5-optimal-factor-matrix))
(setq of-matrix (cl-copy-tree of-matrix))
(setq meanq (if meanq
@@ -1225,7 +1247,7 @@ item will be scheduled exactly this many days into the
future."
(let ((delta-days (- (time-to-days (current-time))
(time-to-days (or (org-get-scheduled-time (point))
(current-time)))))
- (ofmatrix org-drill-optimal-factor-matrix)
+ (ofmatrix org-drill-sm5-optimal-factor-matrix)
;; Entries can have weights, 1 by default. Intervals are divided by the
;; item's weight, so an item with a weight of 2 will have all intervals
;; halved, meaning you will end up reviewing it twice as often.
@@ -1264,7 +1286,7 @@ item will be scheduled exactly this many days into the
future."
total-repeats meanq ease)
(if (eql 'sm5 org-drill-spaced-repetition-algorithm)
- (setq org-drill-optimal-factor-matrix new-ofmatrix))
+ (setq org-drill-sm5-optimal-factor-matrix new-ofmatrix))
(cond
((= 0 days-ahead)
@@ -1294,7 +1316,7 @@ of QUALITY."
(sm5 (determine-next-interval-sm5 last-interval repetitions
ease quality failures
meanq total-repeats
- org-drill-optimal-factor-matrix))
+
org-drill-sm5-optimal-factor-matrix))
(sm2 (determine-next-interval-sm2 last-interval repetitions
ease quality failures
meanq total-repeats))
@@ -2704,9 +2726,7 @@ work correctly with older versions of org mode. Your org
mode version (%s) appea
(defun org-drill-save-optimal-factor-matrix ()
- (message "Saving optimal factor matrix...")
- (customize-save-variable 'org-drill-optimal-factor-matrix
- org-drill-optimal-factor-matrix))
+ (savehist-autosave))
(defun org-drill-cram (&optional scope drill-match)
- [nongnu] elpa/org-drill 79a0ac93ae 058/251: Hide entry drawers when showing answers for verb conjugation and noun, (continued)
- [nongnu] elpa/org-drill 79a0ac93ae 058/251: Hide entry drawers when showing answers for verb conjugation and noun, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 93545edb91 063/251: Added tag 2.3.8 for changeset a8cade42f59c, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 8b6e230886 065/251: Added ability to define arbitrary left and right cloze delimiters (strings),, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill b17bf579bd 039/251: - New card types: show2cloze, hide1_firstmore, show1_firstless, show1_lastmore. See docs for details., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 9487fd21f8 002/251: Added special card type for spanish verbs, to demonstrate custom card types., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 5040d0e6d2 014/251: Added tag 1.4 for changeset 2e4735840112, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill e698616493 026/251: - More robust handling of the situation where we resume a drill session but, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill e7ffd8e6eb 040/251: Renamed documentation file and fixed a few typos., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 063e8035a8 071/251: - Ignore cloze markings if they occur inside Org source blocks, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 663a1ee3f3 079/251: Clarified that org-drill is licensed under GPL v3., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 8a9192cc2f 080/251: Persistence of the optimal factor matrix across application sessions is now,
ELPA Syncer <=
- [nongnu] elpa/org-drill cfe271d824 062/251: Fixed: org-drill-strip-all-data now works again (was using obsolete arguments, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 09f7bc5c9b 083/251: Backout changeset 5d9b61ea5a181eb282e4069c17cbdf00e4325726, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill f9a217faa1 052/251: Wrapped all calls to 'org-display-inline-images' in 'ignore-errors', to prevent, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill d0405e9311 060/251: Fixed bug with scheduling failed cards, caused by changes to 'org-schedule' in, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill e43199b988 056/251: Changed permissions on some files., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 4114c541a7 082/251: You can now customise the keys for the 'quit', 'edit', 'tags', 'help' and, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 8c374c0998 091/251: Merged in Fuco/org-drill/fix-input (pull request #3), ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill c62093fad3 095/251: Added tag 2.5 for changeset 97921372f286, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 201e6991df 100/251: Added tag 2.6 for changeset f96493b0ba4a, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 66d74724d7 090/251: Turn off input method while reading events, ELPA Syncer, 2022/01/17