fix: default to filename if no title or alias

fix #1450
This commit is contained in:
Jethro Kuan
2021-03-23 12:49:11 +08:00
parent 9b0a45f105
commit e238c6d766

View File

@ -161,12 +161,13 @@ is the `org-roam-node'."
:left-join nodes :left-join nodes
:on (= aliases:node-id nodes:id)])) :on (= aliases:node-id nodes:id)]))
collect (pcase-let* ((`(,file ,pos ,alias ,title ,id) row) collect (pcase-let* ((`(,file ,pos ,alias ,title ,id) row)
(fname (file-name-nondirectory file))
(node (org-roam-node-create :id id (node (org-roam-node-create :id id
:file file :file file
:title title :title (or title fname)
:point pos :point pos
:tags (gethash id tags-table)))) :tags (gethash id tags-table))))
(cons (propertize alias 'node node) node))))) (cons (propertize (or alias fname) 'node node) node)))))
(defun org-roam-node-read (&optional initial-input filter-fn require-match) (defun org-roam-node-read (&optional initial-input filter-fn require-match)
"Read and return an `org-roam-node'. "Read and return an `org-roam-node'.