(fix): make graph--build error on non-string (#580)

* (fix): make graph--build error on non-string

* Replace let* with let

* Fix wording
This commit is contained in:
Leo Vivier
2020-05-07 20:38:17 +02:00
committed by GitHub
parent 9bc80ff9f7
commit c1bfa99ace

View File

@ -219,14 +219,13 @@ into a digraph."
(defun org-roam-graph--build (&optional node-query) (defun org-roam-graph--build (&optional node-query)
"Generate a graph showing the relations between nodes in NODE-QUERY." "Generate a graph showing the relations between nodes in NODE-QUERY."
(let* ((name org-roam-graph-executable) (let ((name org-roam-graph-executable))
(exec (ignore-errors (executable-find name)))) (unless (stringp name)
(unless exec (user-error "`org-roam-graph-executable' is not a string"))
(user-error (concat "Cannot find executable " (unless (executable-find org-roam-graph-executable)
(when name (user-error (concat "Cannot find executable \"%s\" to generate the graph. "
(format "\"%s\" " name)) "Please adjust `org-roam-graph-executable'")
"to generate the graph. " name))
"Please adjust `org-roam-graph-executable'")))
(let* ((node-query (or node-query (let* ((node-query (or node-query
`[:select [file titles] `[:select [file titles]
:from titles :from titles
@ -234,7 +233,7 @@ into a digraph."
(graph (org-roam-graph--dot node-query)) (graph (org-roam-graph--dot node-query))
(temp-dot (make-temp-file "graph." nil ".dot" graph)) (temp-dot (make-temp-file "graph." nil ".dot" graph))
(temp-graph (make-temp-file "graph." nil ".svg"))) (temp-graph (make-temp-file "graph." nil ".svg")))
(call-process exec nil 0 nil temp-dot "-Tsvg" "-o" temp-graph) (call-process name nil 0 nil temp-dot "-Tsvg" "-o" temp-graph)
temp-graph))) temp-graph)))
(defun org-roam-graph--open (file) (defun org-roam-graph--open (file)