summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-26 07:15:41 +0200
committerThanos Apollo <[email protected]>2024-01-26 07:15:41 +0200
commite0f7d2887ab2de6e021356053fdc5c88aa6a3243 (patch)
tree1c2def7e30f9f7063aeccb75e21cd127559c9062 /gnosis.el
parenta01d6df4187d1127f6586084e5172e4fe1061971 (diff)
Redo initialization & Update version header
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el19
1 files changed, 7 insertions, 12 deletions
diff --git a/gnosis.el b/gnosis.el
index 8dc05a5..5e1a841 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -5,7 +5,7 @@
;; Author: Thanos Apollo <[email protected]>
;; Keywords: extensions
;; URL: https://git.thanosapollo.org/gnosis
-;; Version: 0.0.1
+;; Version: 0.1.0-alpha
;; Package-Requires: ((emacs "27.2") (compat "29.1.4.2") (emacsql "20230228"))
@@ -67,14 +67,15 @@
:type 'string
:group 'gnosis)
-
(defvar gnosis-images-dir (expand-file-name "images" gnosis-dir)
"Gnosis images directory.")
+(unless (file-directory-p gnosis-dir)
+ (make-directory gnosis-dir)
+ (make-directory gnosis-images-dir))
+
(defconst gnosis-db
- (if (not (file-directory-p gnosis-dir))
- (gnosis-db-init)
- (emacsql-sqlite (expand-file-name "gnosis.db" gnosis-dir)))
+ (emacsql-sqlite (expand-file-name "gnosis.db" gnosis-dir))
"Gnosis database file.")
(defvar gnosis-testing nil
@@ -1375,13 +1376,6 @@ review."
(defun gnosis-db-init ()
"Create gnosis essential directories & database."
- ;; Create gnosis-dir
- (unless (file-exists-p gnosis-dir)
- (make-directory gnosis-dir)
- (make-directory gnosis-images-dir)
- ;; Make sure gnosis-db is initialized
- (setf gnosis-db (emacsql-sqlite (concat (file-name-as-directory gnosis-dir) "gnosis.db"))))
- ;; Create database tables
(unless (length= (emacsql gnosis-db [:select name :from sqlite-master :where (= type table)]) 6)
;; Enable foreign keys
(emacsql gnosis-db "PRAGMA foreign_keys = ON")
@@ -1408,6 +1402,7 @@ review."
(display-line-numbers-mode 0)
:lighter " gnosis-mode")
+(gnosis-db-init)
(provide 'gnosis)
;;; gnosis.el ends here