mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
default title to file-relative-name for file-nodes if title is empty
This commit is contained in:
@ -278,8 +278,9 @@ first encapsulating ID."
|
|||||||
(org-with-point-at 1
|
(org-with-point-at 1
|
||||||
(when-let ((id (org-id-get)))
|
(when-let ((id (org-id-get)))
|
||||||
(let ((file (buffer-file-name (buffer-base-buffer)))
|
(let ((file (buffer-file-name (buffer-base-buffer)))
|
||||||
(title (cadr (assoc "TITLE" (org-collect-keywords '("title"))
|
(title (or (cadr (assoc "TITLE" (org-collect-keywords '("title"))
|
||||||
#'string-equal)))
|
#'string-equal))
|
||||||
|
(file-relative-name file org-roam-directory)))
|
||||||
(pos (point))
|
(pos (point))
|
||||||
(todo nil)
|
(todo nil)
|
||||||
(priority nil)
|
(priority nil)
|
||||||
|
@ -158,13 +158,12 @@ 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 (or title fname)
|
:title title
|
||||||
:point pos
|
:point pos
|
||||||
:tags (gethash id tags-table))))
|
:tags (gethash id tags-table))))
|
||||||
(cons (propertize (or alias fname) 'node node) node)))))
|
(cons (propertize alias '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'.
|
||||||
|
Reference in New Issue
Block a user