0

Caveat: I am a complete and total noob to e-macs.

Background: I've set up Emacs to open with one frame and two windows sized the way I want and to open an initial Org file every time in the left-hand window of the frame and a blank buffer in the right-hand window of the frame, just like I wanted.

Problem: In the left window of the frame, I have an Org file with links. Link A (for example) should open an Org file in the right window of the frame. Link B should open an Org file in the left window of the frame. I distinguish A from B by use of the word Main in my Org file names. Ex. MainList.org, MainShoppingList.org, GroceryShopList.org, HardwareShopList.org etc. So Emacs upon startup opens MainList.org (left window), I could follow a link to MainShoppingList (opens in left window) then select GroceryShopList (opens in right window). At least that's what I'd like.

What I've Tried:

(both attempts inside init.d file)

 ;; This gets EVERY link to open in another window
  (setq org-link-frame-setup
      '((file . find-file-other-window)
        (wl . wl-other-frame)))
 ;; this opens every link in the same window
 ;; I think I have the wrong "regexp" or variable (link)
  (setq org-link-frame-setup
    '(if (string-match "MAIN" link)
         (file . find-file)
       (file . find-file-other-window)))

Could anyone help me out here, point me in the right direction?

1
  • I think it would be easier to define different link types for the different behaviors, so instead of having links like [[file:/path/to/MainList.Org]] you would have [[fileA:/path/to/file.org]] - do C-h f org-link-set-parameters and see the Adding Hyperlink Types section in the manual.
    – NickD
    Nov 2 '20 at 12:35

This site is temporarily in read only mode and not accepting new answers.

Browse other questions tagged .