Open localauthor opened 2 years ago
Ooh this is great, and looks like a neat solution too. Thanks for submitting, I'll try to take a closer look and merge soon
Finally was able to take a look at this. Thanks, I've made some changes so the new code is included in zetteldeft.org
(which zetteldeft.el
is tangled from).
I'm still wondering about one edge case though: if a user has a zetteldeft-custom-id-function
that generates text-based IDs rather than number-based IDs, the (1+
won't work. But then again, that's such an edge case that it might not be needed to take into account at this moment...
I accidentally pushed an update before I saw your changes to zetteldeft.org. I've added them back in a separate commit. Sorry about that.
The update accounts for the use of dashes in the default zetteldeft-id-format
.
And I think you're right about edge cases. Perhaps best to consider them if/when anyone raises an issue.
I worked around the clashing ID problem by saying (setq zetteldeft-id-format "%Y-%m-%d-%H%M%S")
but this is obviously better. (I also went through older notes and added 00
to make everything line up.)
An easy way to test this change, then, would be to temporarily use something ridiculously clash-prone, eg just "%Y-%m-%d"
.
Fix #71
Adds a loop to check if ID is unavailable, incrementing ID until it is unique.
Avoids error message and the need to wait for time to change in order to create a unique ID.