branch: elpa/gnosis
commit 8003b074e6dfae2e3c6c54dea8a3506ff615d94b
Author: Thanos Apollo <pub...@thanosapollo.org>
Commit: Thanos Apollo <pub...@thanosapollo.org>

    [Feature] update-note: Add support for links.
---
 gnosis.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnosis.el b/gnosis.el
index 61096be24d..026adf910a 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1604,15 +1604,17 @@ LINKS: List of id links."
 
 (defun gnosis-update-note (id keimenon hypothesis answer parathema tags links)
   "Update note entry for ID."
-  (let ((id (if (stringp id) (string-to-number id) id))) ;; Make sure we 
provided the id as a number.
+  ;; Make sure we provided the id as a number.
+  (let ((id (if (stringp id) (string-to-number id) id)))
     (emacsql-with-transaction gnosis-db
       (gnosis-update 'notes `(= keimenon ,keimenon) `(= id ,id))
       (gnosis-update 'notes `(= hypothesis ',hypothesis) `(= id ,id))
       (gnosis-update 'notes `(= answer ',answer) `(= id ,id))
       (gnosis-update 'extras `(= parathema ,parathema) `(= id ,id))
       (gnosis-update 'notes `(= tags ',tags) `(= id ,id))
+      (gnosis--delete 'links `(= source ,id))
       (cl-loop for link in links
-              do (gnosis-update 'links `(= dest ,link) `(= source ,id))))))
+              do (gnosis--insert-into 'links `([,id ,link]))))))
 
 ;;;;;;;;;;;;;;;;;;;;;; NOTE HELPERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; These functions provide assertions depending on the type of note.

Reply via email to