diff options
author | Thanos Apollo <[email protected]> | 2025-01-23 06:42:58 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2025-01-23 06:42:58 +0200 |
commit | 2895b3810593cf60f842bf28fb556da2e2fbcf71 (patch) | |
tree | f5a7145d97cd51c2d936198bbd50d726a4e13201 | |
parent | bf81cdd64a65b067bc98bdfa784c42a414cc5688 (diff) |
update-file: Add error handling for duplicate titles.
-rw-r--r-- | org-gnosis.el | 4 |
1 files changed, 3 insertions, 1 deletions
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 |