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

Enable link opening from agenda #361

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jgollenz
Copy link
Contributor

@jgollenz jgollenz commented Jul 3, 2022

The Agenda:open_link function is almost identical to OrgMappings:open_at_point. Any suggestions on how to (and where) to de-duplicate it are appreciated. The moving of get_link_under_cursor to Hyperlinks.lua is a proposal.

@jgollenz jgollenz force-pushed the feat/open-link-from-agenda branch from 8907992 to a793c7e Compare July 3, 2022 22:30
@kristijanhusak
Copy link
Member

Emacs orgmode functionality is actually a bit more complicated than this:

C-c C-o (org-agenda-open-link)
Follow a link in the entry. This offers a selection of any links in the text belonging to the referenced Org node. If there is only one link, follow it without a selection prompt.

This means that it will find all the links under the headline, and show you something like inputlist() to select which one you want to open, or just default to first one if it's the only one.
This can be maybe done differently:

  • Find the headline from the org state
  • Add a method to it called getHyperlinks()
  • Show the list or go to first if single

Regarding finding hyperlinks, we could try using a tree-sitter query with custom predicate which I'm using for highlighting (https://github.com/nvim-orgmode/orgmode/blob/master/queries/org/markup.scm#L14). I'm not sure if that would work though, would need to give it a test.

@jgollenz
Copy link
Contributor Author

jgollenz commented Aug 22, 2022

Some questions:

  1. If I recall correctly I was concerned about links that are part of the headline. Emacs also allows you to open headlines with links in the body, correct? In as: any heading with links is applicable for org-agenda-open-link?
  2. Does Emacs go down recursively into child headings or is it just the body of this one heading?

@kristijanhusak
Copy link
Member

  1. Yes
  2. I haven't tested this scenario. I can get back to you on this tomorrow

@kristijanhusak
Copy link
Member

kristijanhusak commented Aug 24, 2022

I haven't tested this scenario. I can get back to you on this tomorrow

It doesn't go recursive. It takes only that specific headline, at least by default. I don't know if there's some specific setting for it, I didn't find any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-feature Feature is in orgmode core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants