Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of fragile links instead of IDs like it's shown in the README #20

Closed
novoid opened this issue Jul 9, 2020 · 4 comments
Closed

Comments

@novoid
Copy link

novoid commented Jul 9, 2020

Hi,

I tested org-super-links using your example headings from the README. Unfortunately, my result with version 20200611.1550 is different.

My process:

  1. Copy and paste of your headings
  2. Removing BACKLINKS drawer
  3. Place curson or second heading
  4. Invoke C-s s s and search for previous heading
*** TODO Test heading target
  :PROPERTIES:
  :ID:       02a5da87-46e5-4ae0-85c1-ee63a570270a
  :END:
:BACKLINKS:
[2020-07-09 Thu 17:02] <- [[*This has a link][This has a link]]
:END:

This has a backlink as you can see from the BACKLINKS drawer above.

*** TODO This has a link
  :PROPERTIES:
  :ID:       3835d3d0-931a-4a45-a015-a3d6a0baa99a
  :END:
:RELATED:
[2020-07-09 Thu 17:02] -> [[*Test heading target][Test heading target]]
:END:

This has a link pointing to the heading above

In contrast to my result above, the README shows:

  :BACKLINKS:
  [2020-04-11 Sat 00:26] <- [[id:3835d3d0-931a-4a45-a015-a3d6a0baa99a][This has a link]]
  :END:

The second thing that differs is the :RELATED: link which is a good thing to have in my opinion. So I don't mind.

Even though both headings do feature :ID: properties, the link was made using relative links according to the heading title. I can not use those kind of links since they break when heading titles get renamed.

@toshism
Copy link
Owner

toshism commented Jul 9, 2020

The related drawer is a recent change and I need to update the readme. This is configurable through sl-related-into-drawer, by the way.

The relative links is strange if you typically use ids for links. What is the value of org-id-link-to-org-use-id?

I use this.

(require 'org-id)
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)

@novoid
Copy link
Author

novoid commented Jul 9, 2020

The relative links is strange if you typically use ids for links. What is the value of org-id-link-to-org-use-id?

Thanks for the pointer. I'm using only IDs to link headings. However, I wrote my own function to generate human-readable IDs as described in this article.

org-id-link-to-org-use-id was set to nil. After setting it to use-existing, C-c s s is now using IDs instead of relative links based on the titles.

By the way, I'd prefer org-id-link-to-org-use-id to be set to a self-defined function that returns an ID instead of the random looking hashes Org generates by itself. However, this is an Org feature yet to be developed.

While my issue was certainly caused by my particular setup, you might want to mention the implications not only for creating IDs (as the README already states) but also the usage of "externally" created IDs. I know that this seems to be nitpicking but others might fall into this trap as well, when they do not understand the circumstances just as I did.

Thanks again for your time and help!

@novoid novoid closed this as completed Jul 9, 2020
@toshism
Copy link
Owner

toshism commented Jul 10, 2020

The relative links is strange if you typically use ids for links. What is the value of org-id-link-to-org-use-id?

Thanks for the pointer. I'm using only IDs to link headings. However, I wrote my own function to generate human-readable IDs as described in this article.

org-id-link-to-org-use-id was set to nil. After setting it to use-existing, C-c s s is now using IDs instead of relative links based on the titles.

By the way, I'd prefer org-id-link-to-org-use-id to be set to a self-defined function that returns an ID instead of the random looking hashes Org generates by itself. However, this is an Org feature yet to be developed.

This is probably possible using the (undocumented) sl-pre-link-hook and sl-pre-backlink-hooks. There is a little info here that may be helpful. https://github.com/toshism/org-super-links/blob/develop/org-super-links.el#L101-L107

While my issue was certainly caused by my particular setup, you might want to mention the implications not only for creating IDs (as the README already states) but also the usage of "externally" created IDs. I know that this seems to be nitpicking but others might fall into this trap as well, when they do not understand the circumstances just as I did.

Yes, it seems like the documentation could be improved a lot. The general philosophy i tried to abide by though is to not modify anyone's existing org set up by default. org-super-links should respect any standard org link configurations etc.

Thanks again for your time and help!

Thank you, it's nice to get feedback from someone else. This was essentially extracted from my already existing personal note system so it's easy for me to miss things that may have been specific to my personal setup.

@novoid
Copy link
Author

novoid commented Jul 10, 2020

This is probably possible using the (undocumented) sl-pre-link-hook and sl-pre-backlink-hooks. There is a little info here that may be helpful. https://github.com/toshism/org-super-links/blob/develop/org-super-links.el#L101-L107

I just tested the hooks and they seem to do what I desired:

(add-hook 'sl-pre-link-hook 'my-id-get-or-generate)
(add-hook 'sl-pre-backlink-hook 'my-id-get-or-generate)

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants