diff options
| author | Phillip Lord <phillip.lord@russet.org.uk> | 2019-06-25 17:47:53 +0100 |
|---|---|---|
| committer | Phillip Lord <phillip.lord@russet.org.uk> | 2019-06-25 17:47:53 +0100 |
| commit | 502961433b28e8146c92ebbaa5a180f7f09e334d (patch) | |
| tree | 509112ee54fb0258b66e55c88b8722d1e0a5aab0 | |
| parent | c65634b454980746e09c514c8c2df09f82e536bc (diff) | |
| download | org-drill-502961433b28e8146c92ebbaa5a180f7f09e334d.tar.gz org-drill-502961433b28e8146c92ebbaa5a180f7f09e334d.zip | |
Remove savehist dependency
savehist involves switching on a minor mode which does not seem
optimal.
| -rw-r--r-- | org-drill.el | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/org-drill.el b/org-drill.el index 69a8f74..5f64d39 100644 --- a/org-drill.el +++ b/org-drill.el @@ -51,12 +51,11 @@ ;;; Code: -(require 'eieio) (require 'cl-lib) +(require 'eieio) (require 'org) (require 'org-agenda) (require 'org-id) -(require 'savehist) (require 'seq) (defgroup org-drill nil @@ -437,16 +436,20 @@ 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.") +(defvar org-drill-persist-location + (concat user-emacs-directory "org-drill-sm5-optimal-factor-matrix")) -(add-to-list 'savehist-additional-variables - 'org-drill-sm5-optimal-factor-matrix) - -;; TODO This is used to save -- org-drill-sm5-optimal-factor-matrix -;; but clearly saves everything else as well. We need a better -;; solution here. -(unless savehist-mode - (savehist-mode 1)) +(when (file-exists-p org-drill-persist-location) + (with-temp-buffer + (insert-file-contents org-drill-persist-location) + (setq org-drill-sm5-optimal-factor-matrix + (read (current-buffer))))) +(defun org-drill-persist () + (with-temp-buffer + (print org-drill-sm5-optimal-factor-matrix (current-buffer)) + (write-region (point-min) (point-max) org-drill-persist-location + nil 'quiet))) (defun org-drill--transfer-optimal-factor-matrix () (if (and org-drill-optimal-factor-matrix @@ -3068,10 +3071,8 @@ work correctly with older versions of org mode. Your org mode version (%s) appea (message nil) )))) - (defun org-drill-save-optimal-factor-matrix () - (savehist-autosave)) - + (org-drill-persist)) (defun org-drill-cram (&optional scope drill-match) "Run an interactive drill session in 'cram mode'. In cram mode, |
