I am trying to override the face used by doom-hierarchy
elements from the org-roam-display-template
.
I use the theme doom-dark+
, and the problem is that ‘filetitle’ and ‘olp’ elements use 'face 'shadow
and it is unreadable when using org-roam-node-find
in Vertico (especially for the selected candidate).
Since I could not find faces to customize the ‘usual’ way, I resolved to copy to my config.el
the cl-defmethod
I found in modules/lang/org/autoload/contrib-roam2.el
and modify the faces used for each element there.
It works fine after doom-reload
, but not on startup. I tried as usual to execute the code after the doom module is loaded, but I am not having any luck figuring out how to do it.
I englobed the cl-defmethod
in a (after! ...)
statement, and tried the following:
- since the module is in the
org
namespace:(after! org ...)
-
(after! org-roam)
,(after! (org org-roam) ...)
- since I am using faces from
outline
:(after! (org org-roam outline))
- also tried adding an
:after-hook
statement hoping it would run after any kind of lazy loading defered stuff.
At the end of it all all attempts work after M-x doom-reload
, none on startup. I leave the code for my last attempt below.
Thank you for your time.
(after! (org outline org-roam)
:after-hook 'org-roam-mode-hook
(cl-defmethod org-roam-node-doom-hierarchy ((node org-roam-node))
"Return hierarchy for NODE, constructed of its file title, OLP and direct title.
If some elements are missing, they will be stripped out."
(let ((title (org-roam-node-title node))
(olp (org-roam-node-olp node))
(level (org-roam-node-level node))
(filetitle (org-roam-node-doom-filetitle node))
(separator (propertize org-eldoc-breadcrumb-separator 'face 'outline-8)))
(cl-case level
;; node is a top-level file
(0 filetitle)
;; node is a level 1 heading
(1 (concat (propertize filetitle 'face '(outline-5 italic))
separator title))
;; node is a heading with an arbitrary outline path
(t (concat (propertize filetitle 'face '(outline-5 italic))
separator (propertize (string-join olp separator) 'face '(outline-6 italic))
separator title))))))