summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2023-05-14 13:41:04 +0200
committerLeon Rische <leon.rische@me.com>2023-05-14 13:41:04 +0200
commit7ab1791dfa6aa6ca252a69d8f43d5b5e8c841190 (patch)
treea97e956a41f87d8dab3e37dacec9bcdd5720409c
parent0d4ac6eb7740fb6bfe470cec0e18ee7158171ee8 (diff)
Remove suspended cards from review sessionHEADmainalgo-tn
-rw-r--r--org-fc-core.el15
-rw-r--r--org-fc-review.el7
2 files changed, 13 insertions, 9 deletions
diff --git a/org-fc-core.el b/org-fc-core.el
index 50d34f4..1033cf1 100644
--- a/org-fc-core.el
+++ b/org-fc-core.el
@@ -31,6 +31,7 @@
(require 'org-element)
(require 'subr-x)
+(require 'cl)
;;; Customization
@@ -480,10 +481,20 @@ Other useful values are:
;;;###autoload
(defun org-fc-suspend-card ()
- "Suspend the headline at point if it is a flashcard."
+ "Suspend the headline at point if it is a flashcard.
+If there is an active review session, all positions of
+the now suspended card are removed from it."
(interactive)
(org-fc-with-point-at-entry
- (org-fc--add-tag org-fc-suspended-tag)))
+ (org-fc--add-tag org-fc-suspended-tag)
+
+ (when org-fc-review--session
+ (let ((id (org-id-get)))
+ (with-slots (cards) org-fc-review--session
+ (setf cards
+ (cl-remove-if
+ (lambda (card)
+ (string= id (plist-get card :id))) cards)))))))
;;;###autoload
(defun org-fc-suspend-tree ()
diff --git a/org-fc-review.el b/org-fc-review.el
index d539439..eaa29cf 100644
--- a/org-fc-review.el
+++ b/org-fc-review.el
@@ -268,13 +268,6 @@ same ID as the current card in the session."
"Suspend card and proceed to next."
(interactive)
(org-fc-suspend-card)
- ;; Remove all other positions from review session
- (with-slots (current-item cards) org-fc-review--session
- (let ((id (plist-get current-item :id)))
- (setf cards
- (cl-remove-if
- (lambda (card)
- (string= id (plist-get card :id))) cards))))
(org-fc-review-reset)
(org-fc-review-next-card))