summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-06-29 16:25:08 +0200
committerLeon Rische <leon.rische@me.com>2020-06-29 16:25:08 +0200
commitbf9dd33cc90942e6822fe778c3d660e03f8d7bb3 (patch)
treeacd767d19e609696dbcd3eea48a0629cd57e9c53
parentf7a07b1acb50e58bda6f580ef37ddc3fcc0c9fc0 (diff)
Make suffling of positions configurable
-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