# Help Implementing the "Opening Internal Links in The Same Window/Frame" Work-around Fix

**URL:** <https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151>\
**Category:** Troubleshooting\
**Created:** [January 8, 2021, 5:48pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151 "2021-01-08T17:48:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 8, 2021, 5:48pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/1 "2021-01-08T17:48:56Z")

</div>

Hi Org-Roam Discourse,

I need some help with implementing a work around to an org-roam issue with opening back-links. Currently, backlinks open up in a split window. This is a known issue that is tracked on github repo, and is talked about on this forum ( [Opening Internal Links in The Same Window/Frame](https://org-roam.discourse.group/t/opening-internal-links-in-the-same-window-frame/542)).

The workaround solution given on github for this issue is: [emacs - How to let Org-mode open a link like [[file://file.org]] in current window instead of default in other window? - Stack Overflow](https://stackoverflow.com/questions/17590784/how-to-let-org-mode-open-a-link-like-file-file-org-in-current-window-inste/49855491#49855491) :

(defun org-force-open-current-window ()  
(interactive)  
(let ((org-link-frame-setup (quote  
((vm . vm-visit-folder)  
(vm-imap . vm-visit-imap-folder)  
(gnus . gnus)  
(file . find-file)  
(wl . wl)))  
))  
(org-open-at-point)))  
;; Depending on universal argument try opening link  
(defun org-open-maybe (&optional arg)  
(interactive “P”)  
(if arg  
(org-open-at-point)  
(org-force-open-current-window)  
)  
)  
;; Redefine file opening without clobbering universal argumnet  
(define-key org-mode-map “\C-c\C-o” 'org-open-maybe)

I’m struggling to get this to work, given I’m new to emacs. My first problem, is that when I rebind C-c C-o to any command (e.g. i rebound it to so C-c C-o opens eshell), the rebind works when I go C-c C-o, but doesn’t get triggered when I just press the backlinks normally. Why is this? Is this because I use doom? If so how do I re-bind clicking on the backlinks to this org-force-open-current-window function?

Many thanks,  
Hope this was the appropriate place to ask,

Alex

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 8, 2021, 11:49pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/2 "2021-01-08T23:49:07Z")

</div>

Hi @lex,

Do you just want to move from Note A to Note B in Org-roam without opening a new split window? Like I am doing in this animation below?

By the way, I have kept the backlink side pane (window in Emacs jargon) open to prove that I was in Org-roam. If I have it closed, Emacs won’t open it. If it does, I think that’s Doom config.

 ![2021-01-09T004300_open-in-current-window](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/a1469c93265f6018f53c7ffa3b849e1f2d189375.gif)

If this is correct understanding, it’s much simpler. I think I have helped someone on Slack before.

You can just customize org-link-frame-setup.  
You can use `M-x customize-variable` and enter “org-link-frame-setup”.  
Change `(file . find-file-other-window)` to `(file . find-file)`

Your default (even in Doom) probably looks like this:

```auto
        ((vm . vm-visit-folder-other-frame)   
         (vm-imap . vm-visit-imap-folder-other-frame) 
         (gnus . org-gnus-no-new-news)  
         (file . find-file-other-window) ;;<- Change this to (file . find-file)                                            
         (wl . wl-other-frame))

```

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 8, 2021, 11:55pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/3 "2021-01-08T23:55:44Z")

</div>

The splitting of the window only occurs when I take a link from the backlink side pane (e.g. in your example, if I were to take the note B side link to note A).

If I take a normal link in the body of the note, e.g. just clicking on Note B link from within body of Note A, I don’t actually have any problems with the windows splitting.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 9, 2021, 12:00am UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/4 "2021-01-09T00:00:05Z")

</div>

I just closed my PC, but jumping from the backlink buffer does not open a new split window on my machine… Is that something Doom does? I’ll come back tomorrow my time to make sure what I’m saying is correct

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 9, 2021, 12:03am UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/5 "2021-01-09T00:03:23Z")

</div>

On the Github Repo, they say it is a problem with org-mode org-open-at-point function I think. I have the same problem as identified here [[Question] How to always open backlinks in full windows · Issue #920 · org-roam/org-roam · GitHub](https://github.com/org-roam/org-roam/issues/920)

I don’t think it is doom specific, they seemed to think it is org-mode specific problem.

Interesting that backlinks don’t split the window on your device… i wonder what is different :\

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 9, 2021, 12:04am UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/6 "2021-01-09T00:04:45Z")

</div>

I’d appreciate if you can check the value set for org-link-frame-setup in the mean tjme

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 9, 2021, 12:07am UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/7 "2021-01-09T00:07:39Z")

</div>

((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))

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 9, 2021, 12:10pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/8 "2021-01-09T12:10:41Z")

</div>

@lex thank you.

I looked. On my machine, it behaves as you want it to:

 ![2021-01-09T125300_open-in-current-window](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/d77df13ff430efe46873a57fcb4dda33c3863e80.gif)

Looking at the source code, this behaviour is achieved through `org-roam-open-at-point` function added to `org-open-at-point-functions` hook (variable). It is done locally, so if you wish to inspect it, you would need to put your cursor in the org-roam backlinks buffer.

It was [“fixed” 7 months ago](https://github.com/org-roam/org-roam/blame/master/org-roam.el#L996). …So if anything, I suspect Doom might do something for itself to override it (?).

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 9, 2021, 4:10pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/9 "2021-01-09T16:10:42Z")

</div>

My org-open-at-point-functions variable is set as:

~~(org-roam-open-id-at-point  
doom-set-jump-h)~~  
edit: wasn’t inspecting locally (d’oh)

Is it supposed to also contain org-roam-open-at-point function in there?

Also want to say thanks so much for helping me out with all this, I greatly appreciate it!

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 9, 2021, 5:38pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/10 "2021-01-09T17:38:34Z")

</div>

Oh wait, I’m idiot, wasn’t inspecting it locally. It is this:

(org-roam-open-at-point  
t)

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 9, 2021, 6:42pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/11 "2021-01-09T18:42:11Z")

</div>

Very strange. It’s the same as mine.  
I can think of three posibilities.

1. All my demos have been on terminal, so I am not using a mouse to click. Instead, I used `C-c C-o` and simply pressing the Enter key. The mouse click might have a different function bound to it. Try Enter key or C-c C-o?

2. You have some function set to the `org-roam-find-file-function` variable that opens a new window.

3. `find-file` in your system is advised – that is overridden to do something else. You should be able to see it via `C-h f RET find-file`. If there is an advice function to it, the help documentation will tell you that.

I inspected the program sequence in runtime, and mine went like this:  
`org-roam-open-at-point` -\> `org-roam-buffer--find-file` -\> `org-roam--find-file`

In the end, it will call a function either set to `org-roam-find-file-function`, or use the stock standard `find-file` (see the screen below). You may have some custom function set to this variable.

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/e37994283f045eadee78eac15afdb1e5cea97cd0.png)

---

<div class="post-metadata">

**Author:** ![danderzei](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/danderzei/32/59_2.png) [@danderzei](https://org-roam.discourse.group/u/danderzei)\
**Post date:** [January 9, 2021, 8:11pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/12 "2021-01-09T20:11:04Z")

</div>

Alternatively, you can add this to your init file:

`(setf (cdr (rassoc 'find-file-other-window org-link-frame-setup)) 'find-file)`

This code looks for `find-file-other-window` in the `org-link-frame-setup` variable and replaces it with `find-file`.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 9, 2021, 9:00pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/13 "2021-01-09T21:00:45Z")

</div>

@danderzei  
Thank you!

Does this solution work when the variable does not contain find-file-other-window?

> [@lex](#):
>
> ((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))

---

<div class="post-metadata">

**Author:** ![danderzei](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/danderzei/32/59_2.png) [@danderzei](https://org-roam.discourse.group/u/danderzei)\
**Post date:** [January 10, 2021, 12:39am UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/14 "2021-01-10T00:39:08Z")

</div>

> [@danderzei](#):
>
> org-link-frame-setup

No, the code finds the associated value of `find-file-other` in the`org-link-frame-setup` alist. It then changes the `cdr` of that cons to `find-file`.

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 10, 2021, 12:44am UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/15 "2021-01-10T00:44:24Z")

</div>

The window also splits if I use C-c C-o over the backlink too, its not just if I click with mouse. @nobiot

I’ll try and implement your fix tomorrow @danderzei  
I need to figure out how to insert it into the doom init.el, I’ll need to read the documentation, because it must be more than just copying and pasting it in at the bottom, since this causes an error.

---

<div class="post-metadata">

**Author:** ![danderzei](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/danderzei/32/59_2.png) [@danderzei](https://org-roam.discourse.group/u/danderzei)\
**Post date:** [January 10, 2021, 5:19am UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/16 "2021-01-10T05:19:59Z")

</div>

Can’t help you with Doom. I use Vanilla Emacs.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 10, 2021, 2:34pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/17 "2021-01-10T14:34:47Z")

</div>

I have a feeling that I somehow made it to work with Doom. I installed it to see it myself.

 ![2021-01-10T150700_Doom_open-in-current-window-2](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/8a34c435c4a8e03fc11be493fca2b576108296ca.gif)

Doom seems to put its own set of customizing (with +roam and standard). See below what I have done.

Initially the normal Org link errored with some doom-jump something missing. So I don’t fully get it.

If you really need full understanding, I would suggest you try the Doom related forum. I won’t be able to analyse how Doom really works (it is really frustrating to work with Doom; I don’t think that is its fault; it seems to take a lot of getting use to. Personally, I didn’t feel that I could tame it to my liking any more – I used to use it).

```auto
  (setq +org-roam-open-buffer-on-find-file nil) ;; with +roam, it defaults to t                                
  (setq org-roam-buffer-window-parameters nil) ;; with +roam, it has some value                 
  (setq org-open-at-point-functions '(org-roam-open-id-at-point)) ;; Looks like Doom puts something related to `jump` something, which I don't fully understand

```

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 10, 2021, 4:08pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/18 "2021-01-10T16:08:05Z")

</div>

I added  
(after! org  
(setf (alist-get 'file org-link-frame-setup) 'find-file))

to my config.el file @danderzei. Not sure if this is the same code as the one you wrote for me, i think it is. It didn’t make a difference though.

Something strange about the behaviour, something I should have mentioned, is that the first backlink I click on _doesn’t_ split the window in half. It is only from then on that clicking the back link splits the window.

---

<div class="post-metadata">

**Author:** ![lex](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lex](https://org-roam.discourse.group/u/lex)\
**Post date:** [January 10, 2021, 4:13pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/19 "2021-01-10T16:13:44Z")

</div>

I’ll have a look at this nobiot, thanks. I did just try throwing this in my config.el and see if it would make any difference, and it didn’t work, but I’ll have a little more of a look at it

> [@nobiot](#):
>
> ```auto
> (setq +org-roam-open-buffer-on-find-file nil) ;; with +roam, it defaults to t                                
> (setq org-roam-buffer-window-parameters nil) ;; with +roam, it has some value                 
> (setq org-open-at-point-functions '(org-roam-open-id-at-point)) ;; Looks like Doom puts something related to `jump` something, which I don't fully understand
> 
> ```

Will try asking some doom users who also use org-roam, see if they found a fix

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 10, 2021, 4:30pm UTC](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151/20 "2021-01-10T16:30:56Z")

</div>

Try toggling the backlinks buffer via org-roam or org-roam-buffer-toggle-display. There is certainly something there. See this GIF I have also taken. The first navigating on the link in the backlink buffer works as we want; the second one splits the window. This behaviour seems to disappear when you have toggle the backlink buffer.

 ![2021-01-10T150700_Doom_open-in-current-window](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/4ee124a5bce59dcf6ae3c4959b81e4aee910edd5.gif)

There is something going on behind the scene I cannot tell what. It’s an uncharted sea for me; very hard to navigate without an experienced guide in Doom.

[Next page](https://org-roam.discourse.group/t/help-implementing-the-opening-internal-links-in-the-same-window-frame-work-around-fix/1151.md?page=2)
