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

follow-link-at-point can't follow some wikilinks in incomplete tasks #44

Open
herschelrs opened this issue May 31, 2023 · 8 comments
Open
Labels
bug Something isn't working

Comments

@herschelrs
Copy link

herschelrs commented May 31, 2023

I get an error trying to use obsidian-follow-link-at-point to follow wikilinks when they're in an incomplete task that begins with a link, like this:

- [ ] [[some project page]]

I get this error: Wrong type argument: arrayp, nil.

However, links like this work fine:

- [ ] go do [[some project]]

Appending words to the first example doesn't fix the problem.
Note that obsidian-follow-wiki-link-at-point actually still works.

I'm running emacs 28.2 (in particular obsidian-nox on ubuntu 23.04), I got obsidian.el from MELPA.

@licht1stein licht1stein added the bug Something isn't working label Jun 12, 2023
@jayemar
Copy link
Collaborator

jayemar commented Jul 14, 2023

I dug into this a bit and see that the issue is that the function markdown-link-p recognizes the two sets of square brackets as a markdown reference link even though there's a space between them. Note that if you make it two spaces then things work as expected.

I didn't think that spaces were allowed between sets of brackets in markdown reference links, so I filed issue 774 with the markdown-mode library that supplies that function. The regex they're using to recognize markdown reference links allows for a single space between the brackets which is what is causing the issue here. That said, there may be a reason for that regex allowing the space that I'm not aware of.

A possible solution that doesn't rely on changes to markdown-mode would be to modify obsidian-follow-link-at-point by swapping the order that it checks for markdown links and wiki links. Markdown links are checked first, and since the link referenced in this issue is mistakenly recognized as a markdown link, the operation results in an error. If wiki links were checked first, then this link would first be recognized as a wiki link and handled correctly. I don't know if such a swap would cause issues elsewhere.

@licht1stein
Copy link
Owner

That sounds like a simple and elegant solution

@jayemar
Copy link
Collaborator

jayemar commented Jul 16, 2023

The necessary regex changes were made in markdown-mode pull #776 to resolve this issue

@licht1stein
Copy link
Owner

So all we need is updating the markdown-mode version?

@jayemar
Copy link
Collaborator

jayemar commented Jul 16, 2023

Yes, we only need to update markdown-mode, no changes are necessary to obsidian.el.

Unfortunately, it doesn't look like the version of markdown-mode was bumped as it was 2.6-alpha was I created the issue, and it's still showing as 2.6-alpha today after I updated from elpa. But I can verify that the latest code in melpa fixes the issue. Looks like it's version 20230716.1308 in melpa.

@licht1stein
Copy link
Owner

Let's copy the function then

@jayemar
Copy link
Collaborator

jayemar commented Jul 17, 2023

Maybe my last message was confusing. Once a user updates to the latest version of markdown-mode, this issue will be resolved; no changes are required in obsidiain.el.

Are you suggesting we copy the markdown-link-p function from markdown-mode into obisidian.el?

@licht1stein
Copy link
Owner

We can increase the required version of the markdown-mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants