Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I make org-roam's buffer look useful and nice like it does in doom emacs? #16519

Open
komali2 opened this issue Aug 6, 2024 · 6 comments
Assignees

Comments

@komali2
Copy link

komali2 commented Aug 6, 2024

My org roam buffer is quite ugly in spacemacs, and basically useless, however it looks quite nice in doom emacs, when pointing to the same org-roam directory.

First, it was completely useless until I switched off global-page-break-lines-mode (see org-roam/org-roam#1772). Now it's at least usable, however I'd like to configure it to look very nice and usable like it does in doom emacs.

Here's how it looks for me in spacemacs:

2024-08-06-220311_1899x701_scrot

And here's how it looks for the same file in doom emacs:

2024-08-06-215919_655x617_scrot

I'm less concerned with font faces and more really into the automated indenting in the doom version, as well as the fact that in doom, the org roam buffer automatically refreshes when I change. Also, in Doom the buffer just functions like an org file, and I can move around it quite easily, whereas in Spacemacs I constantly get errors if I press SPC for example to run an arbitrary command (Wrong type argument: commandp, spacemacs-cmds). I also like how in doom emacs, the lines actually wrap. I feel like I must have accidentally seriously misconfigured something when installing org roam.

Any ideas on how to make this prettier?

My spacemacs config: https://github.com/komali2/Configs/blob/master/emacs/.spacemacs

My Doom config: https://github.com/komali2/Configs/tree/master/emacs/.doom.d

Emacs: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) of 2023-11-14
Spacemacs: Spacemacs v.0.999.0

Edit: See below for some changes I made that made a pretty big difference. The only thing remaining is changing how the org roam buffer displays subheaders and content, e.g., instead of showing

2022-04-26 (good explanation of react useEffect)
content

It shows

* 2022-04-26
    * good explanation of react useEffect
        content
@komali2
Copy link
Author

komali2 commented Aug 7, 2024

I've gotten a little bit closer by copying some of doom emacs' org roam settings: https://github.com/doomemacs/doomemacs/blob/master/modules/lang/org/contrib/roam2.el

2024-08-07-100332_1290x627_scrot

  (add-hook 'org-roam-mode-hook #'turn-on-visual-line-mode)

The face for the backlink filename is org-roam-olp

@komali2
Copy link
Author

komali2 commented Aug 7, 2024

Another step: make it so backlinks show a subset of content, preferably just the line or paragraph the backlink is in, rather than the entire file:

org-roam/org-roam#1934

Add to configuration:

(defun my/preview-fetcher ()
  (let* ((elem (org-element-context))
         (parent (org-element-property :parent elem)))
    ;; TODO: alt handling for non-paragraph elements
    (string-trim-right (buffer-substring-no-properties
                        (org-element-property :begin parent)
                        (org-element-property :end parent)))))

(setq org-roam-preview-function #'my/preview-fetcher)

After reloading config or restarting emacs, I believe running org-roam-db-sync is required to see the change. However, there's some kind of bug in org right now that causes that function to fail for any org file with id links in them (so, ALL org roam related files), see #16520 for the spacemacs specific fix and org-roam/org-roam#2361 for the main issue.

Here's how it's looking now for me:

2024-08-07-111458_1283x942_scrot

@smile13241324
Copy link
Collaborator

I would be willing to try to improve the visual appearance of org-roam buffers (though I would prefer org-roam-ui anyway) but I need an example file and example config for org-roam. Would you be willing to provide a minimal example file and config for me @komali2?

@komali2
Copy link
Author

komali2 commented Aug 30, 2024

Wait, what's org-roam-ui ? I would like to check it out.

Hmm, minimal will take me a second to set up, but here's my config:

https://github.com/komali2/Configs/blob/master/emacs/.spacemacs

@nickanderson
Copy link
Contributor

Wait, what's org-roam-ui ? I would like to check it out.
https://github.com/org-roam/org-roam-ui
https://fosstodon.org/tags/OrgRoamUi

@emacs18
Copy link
Contributor

emacs18 commented Oct 1, 2024

My dotspacemacs/layers function sets up org mode as follows.

  (org
   :variables
   ...
   org-enable-roam-support t
   org-enable-roam-protocol t
   org-enable-roam-ui t
   ...
   )

Setting org-enable-roam-ui to t allows you to use org-roam-ui package, i.e., , r u is bound to org-roam-ui-mode command. This is documented in org layer documentation which you can reach via SPC h l followed by "org".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants