-
-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enhance file: link support #112
Enhance file: link support #112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now lets just move resolution to the links
context instead of having a separate orgfile
context, and that should generally move some things around.
Have to head out for now and hopefully didn't miss much (other than some notes I've left myself), but let me know what you think about these updates @kristijanhusak. I'll also look at fixing the CI checks before I move it past a draft. |
Looks like I have some tests to fix @kristijanhusak but otherwise let me know what you think. I'll remove the draft label for now. |
@levouh Everything looks ok to me for now. Just address the tests, and run the formatter ( |
@kristijanhusak fixed the old tests, but it turns out that they were actually pointing out a seemingly important flaw. Moving The regex was getting a bit out of hand, so I added an optional Also I started adding some tests for hyperlinks, however I'm not 100% sure which style you'd prefer. I went full unit-style (mocking out |
@levouh since we moved Regarding the tests, if you can do the same thing it's done for other tests in that file, that would be great. If it's too tricky, mocking is also fine. |
This is "undone" now; there is no change to the order of the contexts.
Per above, the order is back to where it started. The problem is that In the latest implementation then, the order is the same as it originally was, I just prevent Make sense? |
An alternative solution might be to not match on a |
Thanks, everything looks good for now. I'll give it a test manually today or tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave this a test. It's working mostly fine, but I would like to also have more filtering after user starts typing the file.
For example, if you have ~/orgmodes/todos.org
, ~/orgmodes/test.org
and ~/orgmodes/work.org
, and if you type [[file:/home/user/orgmodes/t]]
I would expect to get only files that start with t
. I explained more in the review comments.
Rebased it into a single commit @kristijanhusak, in hindsight that makes it a bit harder to review "net new" changes so apologies for that. Versus what existed before (that you'd reviewed), I've added the changes from your comments above and one other small change to ensure we modify the filename to be an absolute path before handing it off to |
Everything looks good. Thanks for contributing! |
Thanks for this important contribution, file links are most useful. I wonder if you could extend the functionality so that some more variants for file/general links are supported, as seen in the examples here. In particular, for my use case the possibility to use custom-id and/or id (globally unique in Orgmode) for the links is fundamental, since those links can be made unique and persistent (whereas the title of the header may be changed often, rendering the link broken). There doesn't seem to be a way to link using ‘file:projects.org::#custom-id’ or complete the custom-id or id strings. By the way, thanks very much @kristijanhusak for making this totally awesome plugin, I have been thinking to use Orgmode for quite some time but did not want to switch editor, now I got the chance and it is great. Your plugin works very well, it is very smooth and quick to work with, splendid work! |
This would be relatively easy to add, can you make a new issue with the specific request @cands (and mark it as an enhancement)? I can take a look from there. |
Thanks for the bug fix @kristijanhusak It fixed the possibility to use custom-id, which is great! I don't think the possibility to use id strings (by Orgmode default is an UUID string that becomes globally unique and can be found even when the headline is moved around in the different org files) is supported yet. Also, we would need the ability to store links, see 'M-x org-store-link' Handling Links (The Org Manual) to easily retrieve links by custom-id and id (from org files and agendas). Do you want me to open a new issue for this? |
@cands yeah, open up a separate issue, and please write an explanation how it exactly works in emacs orgmode. I never used it, and it's a bit hard to understand it from this documentation. I managed to store the links and insert it via prompt, but I didn't see any UUIDs or anything. |
As a summary:
org_complete_file-2021-10-24_16.59.21.mp4
org_complete_in_file-2021-10-24_17.00.11.mp4
org_jump_to_file_position-2021-10-24_17.00.53.mp4
For original Emacs functionality, see here. I still have some things to review myself and clean up before I would consider this "non-WIP", but the main functionality is there.