After upgrading to V2 and migrating all notes (adding an automatic ID property with org-id-get-create) and moving the Aliases inside the property drawer, I get some strange behaviour:
Updating the db runs fine, no errors. All files are cached
org-roam buffer with backlinks works
newly created notes can be linked and traversed to
org-roam find node works
However, all previously exisiting notes cannot be retrieved when clicked on links. Emacs throws an "Cannot find entry with ID: “XXXXXX” error, which is clearly an org-id error.
I thought org-roam somehow overrides org-id link functionality? Where does this happen in the code?
Or am I mistaken here and I need to rely on org-id-locations and add the full org-roam folder to the org-id-extra-files?
I have the same exact problem, for old notes I need to delete the id and create it again for the links to work.
Pretty manual but I have to manually change all the file links for id links anyways. I guess I should try to create some elisp to perform this automatically
This worked. Now all IDs are cached and work independently of org-roam. This adds a second cache of all links and creates redundancy. This is good and bad at the same time: Good, because links will always work. Bad because two caches/databases need to be maintained.
I wonder if it would be faster to use the org-roam db for inter-file linking for simplicity and only fall back on org-id if the notes are used without org-roam.
This is the opposite to simplicity from the developer’s perspective. The new function is simpler than the old one and Org-roam does not have to care about how links work instead relying on the built-in mechanism, which is arguably more robust because a special effort is dedicated to it by Org maintainers. What Org-roam could do and I’m almost positive will do is provide a way to automatically update org-id database during initialization and whenever a note is created.
This is what V2 does from what I have seen. It uses org-id-get-create during the capture process, so the ID gets generated and cached in the Org-ID way.
You should not have had to update the ID locations for V1 org files, because the Org-ID cache would not have been influenced by going from Org-roam V1 to V2.
The only reasons I could think of why you had to do it are:
You used to generate Org-ID manually, without using the org-id-get-create command, and other Org-ID commands.
I’ve been trying to figure out why I’m getting errors when I run @jethro and @d12frosted 's conversion script, and after finding this thread I realize it’s because I’ve done both 1. and 2. above.
I have had capture templates that create file-level ID properties for while. Once I learned that org-roam v2 was going to make use of them, I started including them in all my new notes, but now I realize that org-id was unaware of them.
In order to achieve my desire to have some org-roam files of a non-work nature only on my personal laptop, some org-roam files of a work nature only on my work laptop, and a third category of files that are useful both at work and at home, I moved files around and into 3 different repos, thinking all I needed to do was re-synch the Roam DB and I would be good. But I guess I left org-id out of the loop, so it was missing all those changes too.
Hi All, I’m trying to follow this along and running into an error when setting the variable - (setq org-id-extra-files (find-lisp-find-files org-roam-directory "\.org$")) . Specifically - (void-function find-lisp-find-files). Is this a known issue? Trying to find the find-lisp-find-files function seems to result in an error on this end, am I missing a package? Is there a way around that? I’m running Doom emacs if that helps.
It’s an old built-in library so you should have it installed in your Emacs. You can check it by looking for find-lisp-find-dired (it’s flagged as autoload so you can see it before loading the library).
Require or load-library find-lisp. You should see the function you are looking for.
Alternatively, you could try directory-files-recursively. Refer below.
Edit: (2019) As mentioned in the answer by @mingwei-zhang and the comment by @xiaobing, find-lisp-find-files from find-lisp and directory-files-recursively also provides this functionality. However, please note in these cases the file name argument is a (greedy) regex. So something like (directory-files-recursively "~/my-dir" "org") will give you all Org files including backup files ( *.org~ ). To include only *.org files, you may use (directory-files-recursively "~/my-dir" "org$") .
Thanks very much for the solution, Nobiot! For those looking at this past Dec 28 2021, the function org-roam--list-all-files is now org-roam-list-files.