From 2895b3810593cf60f842bf28fb556da2e2fbcf71 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 23 Jan 2025 06:42:58 +0200 Subject: update-file: Add error handling for duplicate titles. --- org-gnosis.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org-gnosis.el b/org-gnosis.el index f7a0e55..cc3129f 100644 --- a/org-gnosis.el +++ b/org-gnosis.el @@ -249,7 +249,8 @@ If JOURNAL is non-nil, update file as a journal entry." (data (butlast info)) (table (if journal 'journal 'nodes)) (filename (file-name-nondirectory file)) - (links (and (> (length info) 1) (apply #'append (last info))))) + (links (and (> (length info) 1) (apply #'append (last info)))) + (titles (org-gnosis-select 'title table '1=1 t))) ;; Add gnosis topic (message "Parsing: %s" filename) (cl-loop for item in data @@ -259,6 +260,7 @@ If JOURNAL is non-nil, update file as a journal entry." (master (plist-get item :master)) (tags (plist-get item :tags)) (level (plist-get item :level))) + (when (member title titles) (error "Title for node already exists")) (org-gnosis--insert-into table `([,id ,filename ,title ,level ,tags])) (cl-loop for tag in tags do -- cgit v1.2.3