diff options
author | Thanos Apollo <[email protected]> | 2024-03-03 02:16:58 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-03-03 02:16:58 +0200 |
commit | 892735c7fa2215b4902f8d993f0b6c85083de768 (patch) | |
tree | bc86cc273b70525055c453c86f87752373621186 /gnosis.el | |
parent | 4c43f94dec497dc967f7ecee88a49f185ff3d9cf (diff) |
gnosis--get-deck-name: Add optional id arg
If id is given, return the name for deck id
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -394,11 +394,13 @@ Set SPLIT to t to split all input given." (gnosis--insert-into 'decks `([nil ,name nil nil nil nil])) (message "Created deck '%s'" name))) -(defun gnosis--get-deck-name () +(defun gnosis--get-deck-name (&optional id) "Return name from table DECKS." (when (equal (gnosis-select 'name 'decks) nil) (error "No decks found")) - (funcall gnosis-completing-read-function "Deck: " (gnosis-select 'name 'decks))) + (if id + (gnosis-get 'name 'decks `(= id ,id)) + (funcall gnosis-completing-read-function "Deck: " (gnosis-select 'name 'decks)))) (cl-defun gnosis--get-deck-id (&optional (deck (gnosis--get-deck-name))) "Return id for DECK name." |