brunoarine / org-similarity

Emacs package that helps org-mode users (re)discover similar documents
GNU General Public License v3.0
88 stars 12 forks source link

Remove leading space in org IDs #31

Closed brunoarine closed 1 year ago

brunoarine commented 1 year ago

org-roam creates some notes whose ID contains leading whitespace. When this happens, org-similarity will copy those spaces into the link, and the link won't work.

Example

This property drawer:

:PROPERTIES:
:ID:       9b197dc4-9c11-471f-91b4-da30f49e078a
:END:

Will become this link in the org-similarity list:

[id:      9b197dc4-9c11-471f-91b4-da30f49e078a][Note Title]]

Suggestion: create a function that removes the leading whitespace from ID before creating the link.

brunoarine commented 1 year ago

By default, the org.el package in Emacs adds leading whitespace to the :ID: property in the Org mode property drawer. This is part of the standard formatting that Org mode uses should not affect the functionality of Org mode or any packages that use Org mode properties.

However, links to ID that include the leading white-space won't work. Therefore, I fixed the link generation part of org-similarity to trim that whitespace.

Fixed by 5f20aeb8d9d3b0af5c41096f768493b3f740808e