dengste / org-caldav

Caldav sync for Emacs orgmode
GNU General Public License v3.0
724 stars 105 forks source link

Prevent "Could not find UID" error (#230) #250

Closed jackkamm closed 2 years ago

jackkamm commented 2 years ago

Sometimes, org-caldav-files is missing from org-id-files, which causes an error "Could not find UID" (#230).

This PR prevents the error by updating the org-id locations before searching for any IDs.

Note, upstream org-mode has also pushed a patch that should prevent the problem:

https://list.orgmode.org/87r11un9in.fsf@localhost/T/#t

But, that fix is only on the bleeding-edge of Org, not yet on the stable release. Also, I think this PR would be useful anyways, to protect against unforeseen edge cases where the needed files are missing from the org-id database.

jackkamm commented 2 years ago

After further testing, I found that the latest changes to the upstream Org-mode development branch would sometimes find IDs in the org-caldav-backup.org file instead of the correct location in org-caldav-files. This could cause problems like failing to sync changes from the remote.

To avoid this, I updated the PR, so org-caldav-backup.org is not opened when backing up entries to it. Then, org-find-id won't erroneously find IDs there.

Also, I found the commit in 2019 that changed how org-id-find works, and I think was the original cause of #230. It was released in Org 9.4 in late 2020, which corresponds with the timing of the bug. See the mail list link above for more discussion.

jackkamm commented 2 years ago

Closed in favor of https://github.com/dengste/org-caldav/pull/252.