When working in a note, is it possible to preview the link-at-point? I know there are ways to open a separate buffer and jump to link-target. I was thinking of a more dynamic option. For example, the backlink buffer could be a place to display a few lines of the link-target (I imagine mini-buffer is too small). Another option is to show a preview when mouse hovers over the link.
EDIT: extending this question… a preview when looking at list of org-roam files would also be useful. One use-case is when executing org-roam-find-file. Another more interesting use-case is when using dired buffer.
Temporarily set display-buffer-alist so that a target buffer opens in a side-window at the bottom of a screen with a specified height of 25% of the screen
Use the standard org-open-at-point function to open the link at point (depending on your Org config it might behave differently on your end)
You can see that I am trying to “preview” the ID link. When I call my/link-preview command, a new buffer opens at the bottom and my cursor (point) moves into it – because of this, my *org-roam* buffer refreshes. It’s a V2 backlink buffer but that is not relevant now.
This is probably missing some elements you are really going for, but I think it’s not too far off the mark. You probably want a couple of more elements:
The cursor to stay in the note, so that you can keep working in your note
It should be possible to toggle the “preview buffer” easily with a single function key for instance (e.g. F9)
Display the preview buffer on the side, next to the backlink buffer (I prefer a side-buffer at the bottom this way)
These would be rather simple modifications to achieve.
This would be more involved. I am not interested in the mouse hover in Emacs in general, but as an example, @cool_ran has done something that you could look to apply to this purpose with postframe.
This would be something you might like to consider using consult package. For example, see the video demo@emacsomancer has put together for consult-ripgrep – if you run it for org-roam-directory, I think you get something pretty close.
As a similar attempt for Dired, I have done this, which might be close to what you are going for. There might be a better way with consult; it might converge with the V2 UI possibilities I mention above.
For all these options, my sense is that the first option that I did with a prototype is the easiest and most practical (for me). I might explorer it a bit more (I feel it rather useful for myself).
I came here with the same question as @midas (OP) so I tried out @nobiot’s code. To my surprise the code doesn’t seem to work as expected (which came as a surprise as @nobiot’s suggestions/solutions in this discourse group have helped me a lot in the past).
Indeed, the org-roam file to which the link points does open but not in a side-window, it replaces the current buffer in the active window. Bear in mind that I’m using doom emacs, so I’ve made sure to not be using the +popup module to test the code.
I’ve tried this on several files and all I could get is that this seems to work with org files but not with any of my org-roam files. I understand both are the same in the sense of extension, I’m just pointing out my findings in case anyone could come up with a reason for the weird behavior that I’m observing.