summaryrefslogtreecommitdiff
path: root/org-fc-core.el
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 /org-fc-core.el
parent0d4ac6eb7740fb6bfe470cec0e18ee7158171ee8 (diff)
Remove suspended cards from review sessionHEADmainalgo-tn
Diffstat (limited to 'org-fc-core.el')
-rw-r--r--org-fc-core.el15
1 files changed, 13 insertions, 2 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 ()