(fix): fix org-roam graph building with new db schema (#914)

This commit is contained in:
Jethro Kuan
2020-07-10 19:23:38 +08:00
committed by GitHub
parent efba3c2bf0
commit f1dbe3fdf9

View File

@ -192,7 +192,7 @@ into a digraph."
","))))
(dolist (node nodes)
(let* ((file (xml-escape-string (car node)))
(title (or (caadr node)
(title (or (cadr node)
(org-roam--path-to-slug file)))
(shortened-title (pcase org-roam-graph-shorten-titles
(`truncate (s-truncate org-roam-graph-max-title-length title))
@ -232,8 +232,9 @@ CALLBACK is passed the graph file as its sole argument."
"Please adjust `org-roam-graph-executable'")
org-roam-graph-executable))
(let* ((node-query (or node-query
`[:select [file titles] :from titles
,@(org-roam-graph--expand-matcher 'file t)]))
`[:select [file title] :from titles
,@(org-roam-graph--expand-matcher 'file t)
:group :by file]))
(graph (org-roam-graph--dot node-query))
(temp-dot (make-temp-file "graph." nil ".dot" graph))
(temp-graph (make-temp-file "graph." nil ".svg")))
@ -269,7 +270,7 @@ CALLBACK is passed to `org-roam-graph--build'."
(org-roam-db--links-with-max-distance file max-distance)
(org-roam-db--connected-component file))
(list file)))
(query `[:select [file titles]
(query `[:select [file title]
:from titles
:where (in file [,@files])]))
(org-roam-graph--build query callback)))