50
  1. Is there a way to link to specific topic (*) in a different org-file?
  2. How can I quickly find and copy the relative path from the current org-file to the file that I want to link to?

Probably both straight forward but I couldn't figure it out. Thanks your help.

3 Answers 3

50

For #2, first you'll want to add a couple of keybindings to your init file (these are the suggested keys in the Org manual) -

(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c C-l") 'org-insert-link)

then you can hit C-c l somewhere in or on the item you want to link to, then C-c C-l where you want to place the link. It'll ask you to confirm the location and then enter a link name - you can just hit enter to accept the defaults. It will create a link like [[file:foo.org::*bar][link-name]], which displays as link-name.

See http://orgmode.org/manual/Handling-links.html for more details.

7
  • C-c l you mean in dired? Commented Jan 17, 2016 at 18:22
  • No, you hit C-c l in the org file you want to link to - it'll copy the link, then you can paste it with C-c C-l. Commented Jan 17, 2016 at 18:41
  • On C-c l I get an is undefined ... error. Commented Jan 17, 2016 at 18:45
  • Ah, sorry I forgot you need to create this binding yourself, though it's the standard - I'll amend the answer. Commented Jan 17, 2016 at 19:01
  • 1
    @PaulBissex hmm, it works okay for me - it puts an absolute path to the originating file in the link. Commented Jan 24, 2019 at 22:30
14
  1. you can reference this topic http://orgmode.org/manual/External-links.html#External-links

    file:projects.org::some words text search in Org file

    file:projects.org::*task title heading search in Org file

  2. sorry, I don't know what you mean.

1
  • 1
    Thank you for the reply. With number 2 I mean how can I easily get the path to the file that I want to link to paste it into the link. Commented Jan 17, 2016 at 16:10
2

For 1, insert a link to a header (topic), inspired by @BrianBurns' answer, I found a more convenient solution:

  1. Go to the header of org-file, that you want to link to, M-x org-store-link (SPC n l)
  2. Go to the position, where you want to insert the link to the above mentioned header, M-X org-insert-last-stored-link (SPC m l S)

The bindings are from doom/emacs.

1
  • Also C-c C-l (org-insert-link) can be used for 2.
    – crocefisso
    Commented May 1, 2023 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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