diff options
| author | Paul Sexton <eeeickythump@gmail.com> | 2014-11-09 14:00:40 +1300 |
|---|---|---|
| committer | Paul Sexton <eeeickythump@gmail.com> | 2014-11-09 14:00:40 +1300 |
| commit | 063e8035a875b67557762b935567f9c0b97cafda (patch) | |
| tree | 03e33d0c3c50c37fb9cdc41cad5412a44f1f96ad /org-drill.el | |
| parent | 396b3078b729c1ef2850ecc2b8eff72235d18052 (diff) | |
| download | org-drill-2.4.3.tar.gz org-drill-2.4.3.zip | |
- Ignore cloze markings if they occur inside Org source blocks2.4.3
(#+BEGIN_SRC ... #+END_SRC).
- Handle the old version of org-toggle-latex-fragment (org-preview-latex-fragment)
as Org 8.2.10 still uses the old name.
- Fix prioritisation of 'lapsed' items when choosing drill order.
- Try to guess the age of items that lack the DATE_ADDED property.
- Converted org-drill.org into Markdown, to serve as a README.
Diffstat (limited to 'org-drill.el')
| -rwxr-xr-x[-rw-r--r--] | org-drill.el | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/org-drill.el b/org-drill.el index a467bc6..93c37e3 100644..100755 --- 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.2 +;;; Version: 2.4.3 ;;; Repository at http://bitbucket.org/eeeickythump/org-drill/ ;;; ;;; @@ -1343,8 +1343,9 @@ How well did you do? (0-5, ?=help, e=edit, t=tags, q=quit)" (failures (org-drill-entry-failure-count))) (unless *org-drill-cram-mode* (save-excursion - (org-drill-smart-reschedule quality - (nth quality next-review-dates))) + (let ((quality (if (org-drill--entry-lapsed-p) 2 quality))) + (org-drill-smart-reschedule quality + (nth quality next-review-dates)))) (push quality *org-drill-session-qualities*) (cond ((<= quality org-drill-failure-quality) @@ -1548,12 +1549,15 @@ visual overlay, or with the string TEXT if it is supplied." (defun org-drill-hide-clozed-text () (save-excursion (while (re-search-forward org-drill-cloze-regexp nil t) - ;; Don't hide org links, partly because they might contain inline - ;; images which we want to keep visible. - ;; And don't hide LaTeX math fragments. + ;; Don't hide: + ;; - org links, partly because they might contain inline + ;; images which we want to keep visible. + ;; - LaTeX math fragments + ;; - the contents of SRC blocks (unless (save-match-data (or (org-pos-in-regexp (match-beginning 0) org-bracket-link-regexp 1) + (org-in-src-block-p) (org-inside-LaTeX-fragment-p))) (org-drill-hide-matched-cloze-text))))) @@ -1755,7 +1759,9 @@ Note: does not actually alter the item." (defun org-drill--show-latex-fragments () (org-remove-latex-fragment-image-overlays) - (org-toggle-latex-fragment '(4))) + (if (fboundp 'org-toggle-latex-fragment) + (org-toggle-latex-fragment '(4)) + (org-preview-latex-fragment '(4)))) (defun org-drill-present-two-sided-card () @@ -2402,12 +2408,11 @@ all the markers used by Org-Drill will be freed." ;;; if (age a) <= 60 and (age b) <= 60, sort by due ;;; else sort by age - (defun org-drill-order-overdue-entries (overdue-data) (let* ((lapsed-days 60) - (not-lapsed (remove-if (lambda (a) (> (or (third a) 0) lapsed-days)) + (not-lapsed (remove-if (lambda (a) (> (or (second a) 0) lapsed-days)) overdue-data)) - (lapsed (remove-if-not (lambda (a) (> (or (third a) 0) + (lapsed (remove-if-not (lambda (a) (> (or (second a) 0) lapsed-days)) overdue-data))) (setq *org-drill-overdue-entries* (mapcar 'first @@ -2418,10 +2423,25 @@ all the markers used by Org-Drill will be freed." (lambda (a b) (> (third a) (third b))))))))) -(defun org-drill-entry-days-since-creation () +(defun org-drill--entry-lapsed-p () + (let ((lapsed-days 60)) + (> (or (org-drill-entry-days-overdue) 0) lapsed-days))) + + + + +(defun org-drill-entry-days-since-creation (&optional use-last-interval-p) + "If USE-LAST-INTERVAL-P is non-nil, and DATE_ADDED is missing, use the +value of DRILL_LAST_INTERVAL instead (as the item's age must be at least +that many days)." (let ((timestamp (org-entry-get (point) "DATE_ADDED"))) - (if timestamp - (- (org-time-stamp-to-now timestamp))))) + (cond + (timestamp + (- (org-time-stamp-to-now timestamp))) + (use-last-interval-p + (+ (org-drill-entry-days-overdue) + (read (or (org-entry-get (point) "DRILL_LAST_INTERVAL") "0")))) + (t nil)))) (defun org-drill-entry-status () @@ -2442,7 +2462,7 @@ STATUS is 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)) + (age (org-drill-entry-days-since-creation t)) (last-int (org-drill-entry-last-interval 1))) (list (cond |
