-
Notifications
You must be signed in to change notification settings - Fork 49
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
Transclusion of a heading within an org file won't work for ID-type links #237
Comments
Can you try ID without the “::*Sime heading” part, please? [[id:4a3fc3b3-caef-47d7-8e2d-ee0d246b63de][Some heading]] |
Ah, I forgot to specify that ID-type links are transcluded just fine! There are only errors when the "::*Some heading" part is added. (The reason I'd rather not give the heading I want to reference an ID is that I'm using org roam and I use headings within a node to organize notes on the topic. I'd rather not have headings within nodes become nodes themselves) |
This is a custom feature that Doom Emacs has added, and has yet to be incorporated in the upstream Org. I am not able to test this with Doom-specific syntax because I am not a Doom user. But perhaps you can add a customizing by using the same technique discussed in #160. I am not against adding it to the code base if this can be done cleanly. Will you be willing to do try? |
I did not know of this functionality before -- it is very helpful indeed I do not have to worry about creating separate id's for sub headings -- the procedure is rather simple -- but it modifies the open-id functions only, I will look into extending it for org-transclusion - seems to be rather simple from the example cited, we need to on the fly convert id to file type link I think. I will get back if I manage to write it. I need this feature too.
This is the code that non-doom users can simply run to get the functionality. Its extremely simple. Update
|
I was previously treating the link as a string -- this was a very costly mistake as it took me a lot of time to learn from trial and error how to properly parse propertized links. This will work -- tested it on my end
removing the default org-transclusion function for org-id is not strictly necessary as our custom function is added to the front of the list and takes precedence -- but they try to do the same thing, so redundant.
|
Thank you @akashpal-21! I can confirm that the function is added to the I'll look into this these days; it's probably Doom-related, since it works on your end. |
An alternative is to use This is probably easier given the error you are experiencing, @axbweiss . It works on my end. |
The function is a simple translation layer that when detects and 'ID' link is being parsed converts it to a file link of equivalent type, so it doesn't rely on the fuzzy parsing that doom introduces -- but rather on the fuzzy parsing of file links that emacs supports by default. Can you confirm that you are using the latest version of the function -- I fixed the problem when the translation failed if it had a space in it -- i did a silly mistake when parsing the link earlier. The error you indicate lets me believe its the old function -- that is failing to pick up on the "heading" of "some heading" We can debug this more if problem persists, fix will be trivial whatever is happening. Let know when you have free time, |
@akashpal-21 Yes, I was using that function and it actually does work!! Thank you so much for your help! I think it'd be a great extension for Doom users, or anyone who has search syntax set up for ID links. #52 was the actual issue; while testing the function, I'd had the source for the transclusion open in the same buffer as well. It still slips my mind to close source buffers before transcluding.
Thank you @nobiot! I'll be sure to remember that functionality for the future. |
I've also added your workaround from #52 to my config, nobiot:
It works. Thank you for this as well! |
@axbweiss Will you close the issue, or do you prefer to keep it open? |
@nobiot I opted to keep it open in case @akashpal-21 would like to make a merge request to add their function as an extension. If they'd rather not, I'll close the issue but might still make a request myself (crediting them, of course) |
We could add something like this to the Manual instead of creating an extension -- we need to circumvent the id resolution, creating an extension could be an overkill in my opinion and would require complications which we should avoid. Also we should use a more generalised file-path resolution than taking for granted that a more simplified but generalised equivalent would be the following
Error handling do not need to be handled by this function -- since |
PROBLEM One problem with current implementation is that - this just borks links to headline nodes (contra file nodes) My solution is to get the headline name if we are dealing with a headline node within a file -- but let ::search get priority if provided explicitly by user
This implementation works for all cases I have tested. Update
Problems for the Future/ Known Limitations
Currently I do not know how to solve this -- one way is to use |
If we add support for line numbers for FILE Type links as documented in #241
|
This is also org-mode feature not doom emacs only (at least from org-mode 9.7 version). I came to this issue because I also tried the tranclusion with the link For reference org-mode 9.7:
Also the terse description in the manual:
|
I realize Org 9.7 has added this new feature at some point. 9.7 was released in June 2024; the original conversation happened 1-2 months prior to it in April 2024. I am not certain when I can work to adjust |
For any org file containing an ID, the content of headings referenced by file type links can be transcluded, but this doesn't happen for ID-type links.
(Following the link itself works, so the link isn't broken.)
[[file:somenode.org::*Some heading][Some heading]]
Is transcluded with no problems
[[id:4a3fc3b3-caef-47d7-8e2d-ee0d246b63de::*Some heading][Some heading]]
Causes the error
I am using Doom (on Linux), in case it could be a related issue.
The text was updated successfully, but these errors were encountered: