From 8cf9c7e0c86ca616de860d0f68816e965ecba161 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 3 Jan 2025 19:57:10 +0200 Subject: [fix] get-deck-name: If no deck exists, create it. --- gnosis.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gnosis.el b/gnosis.el index 854b1d9..0b5f88f 100644 --- a/gnosis.el +++ b/gnosis.el @@ -701,8 +701,9 @@ Set SPLIT to t to split all input given." (defun gnosis--get-deck-name (&optional id) "Get deck name for ID, or prompt for deck name when ID is nil." - (when (equal (gnosis-select 'name 'decks) nil) - (error "No decks found. Please create a deck first with `gnosis-add-deck'")) + (when (and (equal (gnosis-select 'name 'decks) nil) + (y-or-n-p "No decks found, create deck?")) + (gnosis-add-deck (read-string "Deck name: "))) (if id (gnosis-get 'name 'decks `(= id ,id)) (funcall gnosis-completing-read-function "Deck: " (gnosis-select 'name 'decks)))) -- cgit v1.2.3