How to rename a note with everything updated at the same time?

For example, I have a note named AAA. It was linked by a note BBB. And now I want to rename AAA to ABC. But if I rename it in the file manger. It will not be updated in the org-roam-find-file buffer.

What is the correct way to rename the note and update the filename and the links together?

Rename it within emacs using eg. dired. Org-roam notices when renaming happens within emacs and will update your links accordingly. If you do it through a file editor, it has no idea!

Thank you for your reply. I tried your way.

  1. I rename a file AAA to BBB in Dired.
  2. I org-roam-db-build-cache.
  3. I org-roam-find-file. There still the is AAA listed.\

I don’t know why.

Is this because the title is still AAA?

Rename the #+TITLE in your file and you should see the change in org-roam-find-file. You shouldn’t need to run org-roam-db-build-cache.

If you want the description of links in all of your org-roam files to reflect the TITLE change as well as the filename change – [[file:AAA.org][AAA]] to [[file:ABC.org][ABC]] – looking in the code I think if you rename TITLE first, and then rename the file through dired, your link descriptions should be updated also.

1 Like

Yes, it works. Thank you very much for the help. And I wish it will be mentioned in the future documentation.

1 Like

Yes. I do not know I need to rename the tiltle. So, I think the recommended rename procedure is as follows:

  1. Rename the #+TITLE
  2. Rename the filename in Emacs(such as dired)

Can it truly change the Link Description to reflect the TITLE? I can’t get it to work when I rename TITLE + rename filename. It only changes the Link Filename.

I have links in my index and basically want their descriptions to update anytime I change the corresponding file’s TITLE. Am I missing something?

That’s what it looked like when I went through the code awhile ago. Maybe something has changed or maybe I just didn’t read it correctly. I don’t have any time to go through it now, though – maybe @jethro or someone else could clarify?

Is there a way to rename the file automatically together with the title, instead of separating it into 2 steps?

The reason I ask is that my org-roam notes are always created through the capture, and the title of the file is created automatically based on the title of the note. It would be nice if the two were always linked, so that when the title is renamed, the file name is also renamed in the same way.

1 Like

If this is true, why you need to care about the name of the file?

From my experience, I do not need to access the file name.

Using capture, or org-roam-find-file is sufficient to navigate the roam notes.

Could you share your idea?

Well, searching with org-roam-find-file has also been sufficient for the most part. But I like the organization, and having things behave nicely with more common buffer- and file- searching functions would be nice. It certainly doesn’t hurt to have these things behave consistently.

I’ve tried looking at other file based implementations like Srid’s neuron, and oddly enough this doesn’t seem to come up at all. It seems nobody is renaming the files, just editing the titles. I wonder what’s causing this discrepancy.

This is not too difficult, but will always be brittle.

I think this is mainly because the default template contains the -${slug} part, in:

:file-name "%<%Y%m%d%H%M%S>-${slug}"

I name my notes with " <%Y%m%d%H%M%S>; I have no desire to align the note’s filename with its title. For me, the timestamp in the filename is still useful to sort, search, and retrieve a specific note when needed, without the title.

Srid is explicit about his choice of how neuron generates ZettelID

Why does neuron use random alphameric IDs by default ? Because then you are not forced to think of a suitable slug when writing a new note. A note’s title may change in future, so could a slug.

@jethro, I believe you could steer users’ behaviour by changing the default template, if you would like.

This PR fixes it all for good:

Title updates reflect immediately on file save (but add some processing time to file save).

So the process goes like:

  1. Change title and save
  2. Rename file within Emacs.