How to force org-id links to open in other-window?

In relation to ideas regarding the use of org-id in Org-roam major redesign, I have a question that I seem unable to solve myself.

Usually, I work with a frame that has two windows. If I use org-open-at-point on a link that starts with LINK:file:... the link is open in other-window, e.g. not the currently active one. This is the desired behaviour.

If, however, I use org-open-at-point on a link that starts with LINK:id:... the link is open in current-window.

Is there a way to change this behaviour via org-link-frame-setup? Any help here would be greatly appreciated.

There is already an issue #1340 about this problem on GitHub.

Then this is one of the rare cases my limited knowledge of all things Emacs was not the issue :wink:

P.S. Your videos were very helpful in getting started with Emacs/Org-mode in the last year. Thanks a lot!

1 Like

Are you talking about IDs in the note, not in the org-roam-buffer (in the side-buffer)?

If so, this looks like something the Org-roam project / Jethro can look at.
Here is a result of my quick look. If it looks reasonable, you might like to report it to the project on GitHub to request a change.

Org-roam wraps the default org-id-open with its own org-roam-id-open.

org-id-open looks at org-link-frame-setup.

org-roam-id-open uses org-goto-marker-or-bmk, which calls pop-to-buffer-same-window. I do not see org-link-frame-setup used in this chain of functions.

Yes and I thought @rakoenig was referring to this. I added your info to the Github issue, thanks!

If code change needs to wait for side-buffer revamp (and/or V2), and you cannot wait, then it should be possible to implement your custom open-id-at-point (essentially, copy paste the parts from org-id version to replace org-roam one) and then replace the function set in the variable org-open-at-point-functions.

It should be set to org-roam-open-id-at-point when org-roam is activated – it should be globally applied even to files outside the org-roam-directory – this is how I understand all this works.

Alternatively, you could look to override org-roam-id-open with advice-add but that seems less clean way to me.

Sorry I cannot really do the code now, or do PR.

I was thinking about using the approach outlined on the Github page, e.g. turning this line into a comment:

(add-hook 'org-open-at-point-functions #'org-roam-open-id-at-point)

Could this cause any long-term issues I am not aware of?

This already really helpful and appreciated!

I cannot be too sure; very different system usage, so I cannot really judge. I prefer to rely on the Org-roam’s cache DB for ID store to org-id's method. I even keep org-id-link-to-org-use-id default nil.

But I don’t imagine there would be too much of an issue – or even if there were to be an issue, it could be rectified rather easily.

natask
This doesn’t use org roams database for ids but I haven’t had issues because all my files are found within org-id’s internal database

As natask says in the GitHub issue, you would need to use Org-id mechanism (you have turned on the variable, so that would be done, I think) to store ID links so that they work properly – I think Org-roam would store ID in its cache db in parallel anyway, even if you don’t use this to open ID links (what you are disabling is open function, not store function).