0

I'd like to embed a link to a file in say Python code, is there a way to let emacs know to look for org style links outside of org files? Or is there a better way of achieving this? Cheers

2

An Org mode link is just text (although its appearance may be modified using text properties), so you can add it to any text file, including a python file:

def main(options, args):
    # [[file:/path/to/some/file][some file]]
    print options
    print args
    return 0

For external links, you can open the link using M-x org-open-at-point. Internal links probably will not work: they probably require that the underlying buffer is an Org mode buffer. This is just a guess however, so feel free to amend the answer if your experiments prove otherwise.

Unless you muck around with text properties in the python buffer, it just won't look pretty, but it will (mostly) work.

| improve this answer | |
0

You could try going in the other direction and embed your python code in an org file.

There's a good introduction to Literate Programming with Org-mode and if you need further details the section on Evaluating Code Blocks in the org manual could help.

| improve this answer | |
  • yeah i'm familiar with org-babel but it is not what i'm after, thanks anyway. – chris Jul 3 at 14:02
  • how about using overlays? – zzkt Jul 3 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.