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

Allow linking directly to source blocks #173

Open
ParetoOptimalDev opened this issue Mar 6, 2023 · 1 comment
Open

Allow linking directly to source blocks #173

ParetoOptimalDev opened this issue Mar 6, 2023 · 1 comment

Comments

@ParetoOptimalDev
Copy link

ParetoOptimalDev commented Mar 6, 2023

This would make it easier than it currently is without live sync for source blocks because jumping to them would be easier.

Currently I just jump to the headline transcluded calling org-transclusion-open-source and then call org-babel-next-src-block.

It could be done by supporting #31 and using (ref:some-name) links like in this somewhat(?) contrived example:

* core packages
** git

#+name: src
#+begin_src nix -r
git  (ref:git-src)
#+end_src

* emacs
** magit
*** depends on

#+transclude: [[(git-src)]] :level 4

* nix
** depends on

#+transclude: [[(git-src)]] :level 3

* local vars
# Local Variables:
# org-id-method: org
# org-open-link-functions: nil
# End:

Note the -r is from https://orgmode.org/manual/Literal-Examples.html and strips out the ref syntax.

@nobiot
Copy link
Owner

nobiot commented Mar 8, 2023

I think #+transclude: [[./file-name.org::src]] would work for your case. It looks like the same case as this issue; the only difference is that it is about LaTeX equation block whereas your case is a source code block.

But if you do this, :level property will be meaningless as you would directly transclude a source block, not a subtree -- you would need to add a headline separately in the target file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants