7

When I follow from one Org file to another via a link, the new file appears in alternative window if there is one. Is there a way to follow links staying in the same window?

For example, I use a frame with two horizontally split windows. Left is for code, right is for docs in Org format. If I follow a link in the right window, the new Org file is opened on the left side, and I do not see the buffer with a code anymore.

2 Answers 2

9

The behaviour for opening files is set in org-link-frame-setup.

By default, the behaviour for opening files is file-find-other-window.

The following two alternative commands will change that so that find-file is executed instead of find-file-other-window:

(setf (cdr (assoc 'file org-link-frame-setup)) 'find-file)
(setf (cdr (rassoc 'find-file-other-window org-link-frame-setup)) 'find-file)
2
  • That works, thanks a lot! Jan 13, 2021 at 0:06
  • Maybe it would be good to add that if you want the default behavior sometimes, you can use C-x 4 C-o or C-x 5 C-o with the cursor on a link, respectively. Jul 1 at 14:35
7

This works for me:

  (setq org-link-frame-setup
   '((vm . vm-visit-folder-other-frame)
     (vm-imap . vm-visit-imap-folder-other-frame)
     (gnus . org-gnus-no-new-news)
     (file . find-file)
     (wl . wl-other-frame)))

The above code was automatically generated by Emacs when I customized the variable. I merely recast it using setq.

4
  • please explain/reason a little your response
    – Muihlinn
    Jan 14, 2021 at 16:32
  • enough, add it to response and it's good.
    – Muihlinn
    Jan 14, 2021 at 17:02
  • 2
    In the end I also changed it via customization, but I decided to leave it where it is and do not use setq for it. Jan 15, 2021 at 12:06
  • There is no problem with that. I use setq because it helps me to better organize my configurations together.
    – Edman
    Jan 15, 2021 at 16:44

Your Answer

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

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