orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

Cannot follow an in-file link to a headline with colon in title

Open seflue opened this issue 1 year ago • 1 comments

Describe the bug

When a headline includes a colon, the minimal example (see below) gives the error message:

Unsupported link protocol: "*Example"

Steps to reproduce

Copy the minimal example into an agenda file and try to follow the link:

* Example: a headline with colon

* another headline
Opening [[*Example: a headline with colon][this link]] will not work

Expected behavior

Following the link should jump to the expected headline.

Emacs functionality

Not tried, but if it doesn't work in emacs, I consider this also a bug.

Minimal init.lua

Not relevant for reproducing the bug.

Screenshots and recordings

No response

OS / Distro

Manjaro Linux

Neovim version/commit

0.10

Additional context

I would tackle the bug on my own as soon as I have time.

seflue avatar Jun 29 '24 12:06 seflue

I was about to create a similar issue. ID links ([[id:][description]]) are unable to use isoformat (YYYY-MM-DDTHH:MM:SS.ffffff) due to colons : being stripped from the ID parsing. I believe it is likely this is from the same problem.

Example: '2019-05-18T15:17:08.132263' does not in nvim-orgmode, but does work in emacs. Was this a terrible format to use for my IDs? Maybe, but it seemed more natural than timeslugs, which are the more common alternative.

iicurtis avatar Jun 29 '24 20:06 iicurtis

@iicurtis I actually tested your case and that works for me. Maybe @kristijanhusak fixed the bug during the recent work on hyperlinks. The original bug - no support for internal links to headlines with colons in the name - remains.

seflue avatar Oct 20 '24 17:10 seflue

@kristijanhusak This bug interferes with the support for more protocols. I remember, that @SlayerOfTheBad had invested a lot of effort into this topic but in the end you couldn't get to an agreement how to implement that and the PR #793 was closed. Did you take the effort further or what is the current state on this?

I took a look at the code and the issue can be shortly described like this: The parsing function searches for the non-whitespace characters directly before the first colon and treats this as protocol - and if this string is not a supported protocol, the user get's an error message.

What should be done instead: The string should be checked, if it is a supported protocol and then be assigned to the protocol property. Otherwise the link should be treated as internal link.

seflue avatar Oct 20 '24 18:10 seflue

I can confirm that following a link to an ID with colons in it is fixed as of 0.3.7. It didn't work on 0.3.4.

iicurtis avatar Oct 20 '24 18:10 iicurtis

As @iicurtis stated, I think this issue is fixed with the recent refactor. Let me know if you can still reproduce similar issue and I'll take a look.

kristijanhusak avatar Oct 28 '24 19:10 kristijanhusak

As @iicurtis stated, I think this issue is fixed with the recent refactor. Let me know if you can still reproduce similar issue and I'll take a look.

@kristijanhusak Did you try my minimal example? For headlines containing a colon prefixed by non-whitespace (e.g. a character) I cannot follow the link.

seflue avatar Oct 28 '24 23:10 seflue

@seflue Yeah, I tested the example from the description:

https://github.com/user-attachments/assets/105dea3b-0255-4838-8d5e-5362a8f7efdd

This is with master. Which version are you testing with?

kristijanhusak avatar Oct 29 '24 12:10 kristijanhusak

Ah, I just saw, that I was already some commits behind again. Tested it again and now it is working. We can close this issue, thanks!

seflue avatar Oct 30 '24 00:10 seflue