summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog.org6
-rw-r--r--org-fc.el18
2 files changed, 20 insertions, 4 deletions
diff --git a/Changelog.org b/Changelog.org
index 08b1a4d..f3b3f03 100644
--- a/Changelog.org
+++ b/Changelog.org
@@ -5,6 +5,12 @@ upcoming changes.
In case a update to the org sources is needed, I'll add a changelog
entry with updating instructions.
+** [2020-06-29 Mon]
+*** Added
+- Shuffling of positions for the review can be disabled
+ by setting ~org-fc-shuffle-positions~ to ~nil~
+*** Changed
+- Error messages from shell commands are promoted
** [2020-06-28 Sun]
*** Added
- ~org-fc-before-review-hook~ that runs when a review session is started
diff --git a/org-fc.el b/org-fc.el
index 2659eab..6cf48a8 100644
--- a/org-fc.el
+++ b/org-fc.el
@@ -64,6 +64,11 @@ Used to generate absolute paths to the awk scripts.")
:type 'float
:group 'org-fc)
+(defcustom org-fc-shuffle-positions t
+ "Shuffle positions before review."
+ :type 'boolean
+ :group 'org-fc)
+
;;;; Org Tags / Properties
(defcustom org-fc-type-property "FC_TYPE"
@@ -1405,8 +1410,12 @@ Cards with no positions are removed from the index."
(push card res)))))
res))
+(defun org-fc-index-positions (index)
+ "Return all positions in INDEX."
+ (mapcan (lambda (card) (org-fc-index-flatten-card card)) index))
+
(defun org-fc-index-shuffled-positions (index)
- "Return a positions in INDEX in random order.
+ "Return all positions in INDEX in random order.
Positions are shuffled in a way that preserves the order of the
positions for each card."
;; 1. assign each position a random number
@@ -1743,9 +1752,10 @@ Valid contexts:
(if org-fc-review--current-session
(message "Flashcards are already being reviewed")
(let* ((index (org-fc-index context))
- (cards
- (org-fc-index-shuffled-positions
- (org-fc-index-filter-due index))))
+ (cards (org-fc-index-filter-due index)))
+ (if org-fc-shuffle-positions
+ (setq cards (org-fc-index-shuffled-positions cards))
+ (setq cards (org-fc-index-positions cards)))
(if (null cards)
(message "No cards due right now")
(progn