Org-roam major redesign

If I move the old db out of the way, org-roam won’t create a new db, no matter what I do (setup, sync-db, etc.).

If you can reliably reproduce this, do file an issue.

Yes, file nodes shouldn’t have issues with missing titles, will fix this soon.

Only items with IDs (including files) will be picked up.

1 Like

You can redefine org-roam-db-insert-file-node and org-roam-db-insert-tags to change how tags are collected if you really want to, but I advise against it. It’s unlikely that I’ll add back subdirectory tagging because I intend to use Org’s tag-related functions (e.g. forming sparse trees).

Also I’m trying to minimize areas of customizability especially around areas of what goes into the db, because the display and retrieval functions need to make solid assumptions of what’s inside.

The commands written are for the basic completing-read API, we’ll probably want powered-up versions of (org-roam-node-read) and (org-roam-ref-read) for helm, ivy, and consult, but those wont’ be shipped with Org-roam (feel free to have a go).

That is correct :slight_smile:

@bruce , where are you looking to confirm this? The default DB location now is under your emacs config directory. Check org-roam-db-location variable — it’s from a recent commit of V1. In my case, it’s “~/.config/emacs/org-roam.db“.

Yeah, I figured that out. I had assumed I could specify the db location, but it’s fine as is.

Now working as expected, once I added the org-ids.

Is it possible to pin the org-roam buffer to the sidebar, as with v1?

1 Like

Gotcha.

edit: nevermind, I see the code now.

I am halfway-there. I am doing this below. It does not refresh the content when I open a different note – that’s the next step.

(setq display-buffer-alist
      '(;; Left side window
        ("org-roam:.*"
         (display-buffer-in-side-window)
         (window-width . 0.25)
         (side . left)
         (slot . 0))))

;; this one  is for org-roam-buffer-toggle
(setq display-buffer-alist
      '(;; Left side window
        (".org-roam.*"
         (display-buffer-in-side-window)
         (window-width . 0.25)
         (side . left)
         (slot . 0))))

EDIT: Corrected the snippet above to work with org-roam-buffer-toggle – the buffer name is different between org-roam-buffer and org-roam-buffer-toggle. I don’t know regex enough to make one that works both cases (I think you can). My brain is fried now. I would love someone do it…

1 Like

V2 by jethrokuan · Pull Request #1401 · org-roam/org-roam · GitHub adds this, with org-roam-buffer-toggle. This is the persistent buffer. org-roam-buffer still lets you create a “frozen” buffer for the node.

You’ll still need @nobiot 's snippet on customizing display-buffer-alist to configure how it looks.

2 Likes

… adds this, with org-roam-buffer-toggle

Great; I figured that was coming.

Not sure when or how you want bug reports, @jethro, but are you aware of this?

Error in post-command-hook (magit-section-update-highlight): (wrong-type-argument (or eieio-object class) nil obj)

I get it when turning on org-roam-mode, though not consistently enough for me to have a sense of details beyond that ATM.

When are you doing this? This is not a thing anymore (org-roam-mode is now the mode for the buffer)

Anyway I’ll need a full backtrace to figure out what’s going on.

I think I figured out how to reproduce, and why a user would do this:

  1. use find-file to open an org-roam note
  2. recognize you are now in org mode, run org-roam-mode

That’s it.

Can you reproduce that?

1 Like

@bruce, I believe the function of org-roam-mode has changed. It’s only a mode for the backlink window; you don’t use it in the main Org buffer. You just use org-roam-buffer or (new one) org-roam-buffer-toggle from the Org buffer.

@jethro
By the way, org-roam-buffer-toggle works nicely :slight_smile:.
I added another snippet above for this new toggle one (buffer name is different, so the snippet needs to be adjusted).

I like the way moving around in the same buffer, and the backlink buffer changes if you move across one node to another.

OK, thanks @nobiot.

But surely I’m not the only user that will try this? It shouldn’t generate an error message, and break things.

1 Like

I’d agree.

This was my suggestion a few weeks (months? I forgot) ago.

Your suggestion for org-roam-mode is to programmatically prevent an error message – that’s for @jethro .

I might start collecting some of these “migration” issues. This was your suggestion about wiki – essentially the same idea – that includes the difference in concepts, such as use of tags, file vs node, etc.

1 Like

Definitely agree @nobiot.

To demonstrate what I mean by “breaking”, here’s what accompanies the error message.

Just installed and configured this.

Looks good; thanks!

I assume I should be able to click on a link in the buffer and have the file open?

Still TODO?

Edit: also, I notice the buffer seems to conflict with Doom evil mode, in the sense I can’t use the kbs anymore there.

Maybe my brain is fried too, but looks to me it’s the same variable.

RET.
It should be modifiable with org-roam-mode-map (or some name like this).

Yeah, you got the right name. Thanks again.

“Modifiable” so clickable with mouse, etc.?

And so that the buffer stays, but the “thing” opens in another buffer, as with v1?

Or those are more likely on the TODO list?

@bruce There is absolutely nothing wrong with new org-roam-mode “breaking things”. Just try running fundamental-mode or magit-mode or actually any other major-mode not derived from org-mode while in an Org buffer. The things will look equally broken. They are not, however. Emacs tries its best to display your Org data in the new major mode. Accidentally, if you run org-mode in an Elisp buffer, for example, in your Doom config.el you’ll break break that buffer too. To “fix” the things just run the major-mode command appropriate for that data, e.g. org-mode for Org data.

Now let’s clarify why one shouldn’t even attempt to fix the accompanying error. The error is triggered when you run a magit-section-... command in the broken buffer. I could consistently reproduce it by hitting M-1, M-2, etc when trying to switch to another perspective – Doom binds the keys to +workspace/switch-to-N. But putting the buffer in org-roam-mode rebinds these keys to magit-section-show-level-N-all (org-roam-mode is derived from magit-section-mode) and since the buffer is broken – or rather org-roam-mode is broken by having been fed with wrong data – errors are triggered by commands which are not supposed to be run in this environment. You were probably hitting different keys and some of them would trigger magit-section commands and throw the error. Attempting to fix this error would be just a waste of time because it is absolutely normal under the circumstances – when using a thing in a wrong way expect that it will misbehave.

So the only problem here is (or rather will be) when v2 is rolled out and users start transitioning to it. People are used to org-roam-mode being a minor mode that can be enabled anywhere and many will get frustrated unless this major breaking change is very clearly communicated in some migration guide.

1 Like

Conflict is incorrect word here. It’s just Doom evil mode doesn’t have support for new org-roam-mode.

1 Like