From 7ab1791dfa6aa6ca252a69d8f43d5b5e8c841190 Mon Sep 17 00:00:00 2001 From: Leon Rische Date: Sun, 14 May 2023 13:41:04 +0200 Subject: Remove suspended cards from review session --- org-fc-core.el | 15 +++++++++++++-- org-fc-review.el | 7 ------- 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)) -- cgit v1.2.3