branch: externals/org-gnosis
commit 2895b3810593cf60f842bf28fb556da2e2fbcf71
Author: Thanos Apollo <pub...@thanosapollo.org>
Commit: Thanos Apollo <pub...@thanosapollo.org>

    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 f7a0e5570d..cc3129f3f7 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

Reply via email to