From b4e76ebbaba226b3df984177139b92185af5bcf4 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 14 Dec 2023 20:52:01 +0200 Subject: gnosis-init: Fix repetitive code --- gnosis.el | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/gnosis.el b/gnosis.el index fa67683..214ecf7 100644 --- a/gnosis.el +++ b/gnosis.el @@ -240,15 +240,10 @@ TAGS are used to organize questions." "Create notes content table." (interactive) ;;(make-directory (concat user-emacs-directory "gnosis")) - (condition-case nil - (gnosis--drop-table 'notes) - (error (message "No NOTES table to drop."))) - (condition-case nil - (gnosis--drop-table 'decks) - (error (message "No DECKS table to drop."))) - (condition-case nil - (gnosis--drop-table 'review) - (error (message "No REVIEW table to drop."))) + (dolist (table '(notes decks review review-log)) + (condition-case nil + (gnosis--drop-table table) + (error (message "No %s table to drop." table)))) ;; Enable foreign_keys (emacsql gnosis-db "PRAGMA foreign_keys = ON") ;; Create decks table @@ -273,7 +268,7 @@ TAGS are used to organize questions." ;; Gnosis Algorithm ;; ;;;;;;;;;;;;;;;;;;;;;; -(defun gnosis-current-date (&optional offset) +(defun gnosis-date-current (&optional offset) "Return the current date in a list (year month day). Optional integer OFFSET is a number of days from the current date." (let* ((now (decode-time)) -- cgit v1.2.3