From 360fa413a3dd2c690604ac1c06d2e791a668fe2a Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 4 Jan 2024 09:20:39 +0200 Subject: gnosis-db: Redo as defconst --- gnosis.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gnosis.el b/gnosis.el index bc6318f..f84b34a 100644 --- a/gnosis.el +++ b/gnosis.el @@ -54,10 +54,11 @@ (defvar gnosis-images-dir (concat (file-name-as-directory gnosis-dir) "images") "Gnosis images directory.") -(defvar gnosis-db (emacsql-sqlite (concat (file-name-as-directory gnosis-dir) "gnosis.db")) - "Gnosis database file. - -WARNING: Do not change this value!") +(defconst gnosis-db + (if (not (file-directory-p gnosis-dir)) + (gnosis-db-init) + (emacsql-sqlite (concat (file-name-as-directory gnosis-dir) "gnosis.db"))) + "Gnosis database file. WARNING: Do not change this value!") (defvar gnosis-testing nil "When t, warn user he is in a testing environment.") @@ -1175,7 +1176,7 @@ review." (plist-get note :answer) (plist-get note :extra-notes) (plist-get note :tags) - 0 + suspended (plist-get note :image) (plist-get note :second-image))))) @@ -1188,7 +1189,7 @@ review." (let ((review-type (completing-read "Review: " '("Due notes" "Due notes of deck" "Due notes of specified tag(s)" - "Notes with tag(s)")))) + "All notes of tag(s)")))) (pcase review-type ("Due notes" (gnosis-review--session (gnosis-review-get-due-notes))) ("Due notes of deck" (gnosis-review--session (gnosis-get-deck-due-notes))) -- cgit v1.2.3