Does renaming title no longer renames the filename?

Earlier in v1 when titles were basically notes, vs title with ID is a note, one could rename the title and the filename used to change. After v2 implementation when I change title I see the filename is still the same.

Can someone suggest on how to achieve this?



I am also asking about this and like to know if anyone has achieved this.

I wrote this function to update backlinks and file names on a node-name change. It’s messy and I haven’t tested it much, but maybe it’s a start:

  (defun azr/org-roam-modify-title ()
    "Modify title of org-roam current node and update all backlinks in roam database."
    (unless (org-roam-buffer-p) (error "Not in an org-roam buffer."))
    (save-some-buffers t)
    (let* ((old-title (org-roam-get-keyword "title"))
           (ID (org-entry-get (point) "ID"))
           (new-title (read-string "Enter new title: " old-title)))
      (org-roam-set-keyword "title" new-title)
      (let* ((new-slug (org-roam-node-slug (org-roam-node-at-point)))
             (new-file-name (replace-regexp-in-string "-.*\\.org" (format "" new-slug) (buffer-file-name)))
             (new-buffer-name (file-name-nondirectory new-file-name)))
	(rename-buffer new-buffer-name)
	(rename-file (buffer-file-name) new-file-name 1)
	(set-visited-file-name new-file-name)) ; I don't know why this last command is necessary. Getting it from here:
      ;; Rename backlinks in the rest of the Org-roam database.
      (let* ((search (format "[[id:%s][%s]]" ID old-title))
             (replace (format "[[id:%s][%s]]" ID new-title))
             (rg-command (format "rg -t org -lF %s ~/Org/roam/" search))
             (file-list (split-string (shell-command-to-string rg-command))))
	(dolist (file file-list)
          (let ((file-open (get-file-buffer file)))
	    (find-file file)
            (while (search-forward search nil t)
              (replace-match replace))
            (unless file-open

Thanks @arozbiz .
I just have a test and it works!
BTW, I adjust the rg-command a little bit, to make ‘org-roam-directory’ not hardcoded.


(rg-command (format “rg -t org -lF %s ~/Org/roam/” search)


(rg-command (format (concat "rg -t org -lF %s " org-roam-directory) search)

Thank you!

Awesome guys! thanks a lot