A custom layout for org-roam-dailies

It’s been a while since I started using org-roam-dailies and it has and still is a great tool. In working with it, I’ve come up with a layout and a workflow that might be of interest to the community but, due to my lack of Elisp knowledge, I haven’t been able to turn into a solid solution. I was hoping you could help me do that.

When journaling with org-roam-dailies, I open two windows side by side, one on the right, another on the left. The window on the right holds only the org-roam-dailies note for the current date. The window on the left holds, at the beginning, the org-roam-dailies note for yesterday (or the previous note, if yesterday’s is not available). The focus is on the right window (today’s note) so that I can write. Using scroll-other-window and scroll-other-window-down I manage to browse through the previous day’s notes, which lets me sort of continue with the work and the ideas I’ve developed yesterday.

As is often the case, I also need to take a look at previous notes, i.e., notes from previous days (before yesterday). So with a couple of very elementary and simple functions, I manage to stay in today’s note (right window) but open previous notes in the left window. With appropriately defined keybindings, I manage to browse through notes back and forth in time in the left window, while always staying in today’s note at the right window.

Now my implementation for these functions is rather cumbersome (as I’m a noob) and mostly relies in using “(other-window 1)” for jumping to the other window, opening notes, and again for going back to the right window. I’ve included the code below.

Nevertheless, I encounter limitations in this approach, as you would probably guess. I do not know how to prevent the left window from displaying today’s notes, for instance. And I don’t see how I can make it so that the right window only displays today’s note, and not any other file. Besides that, I would love for this layout to be strictly used for org-roam-dailies notes, so that neither of both windows (left or right) display any other buffer but dailies notes, even when other buffers (such as code for instance) are open.

What is the common way to proceed here? Should I create a minor mode to accommodate all these requirements? Should I create (is it possible?) new types of windows for this purpose? To those more experienced than me in Elisp: what would be the organized way to make my system into something more robust?

Thanks in advance for all your help. For your info, I’m a data scientist, former vim user, with good programming knowledge (mostly R, Python, Fortran) but a total noob to emacs and Elisp.

Here’s my code for the simple functionalities I described:

(defun gg/org-roam-dailies-goto-previous-note-in-left-window nil
  "Open previous journal entry in other window."
  (other-window 1)
  (other-window 1))

(defun gg/org-roam-dailies-goto-next-note-in-left-window nil
  "Open next journal entry in other window."
  (other-window 1)
  (other-window 1))

;; Add keybindings for these functions
;; (I should make these keybindings local to the org-roam mode)
(map! :nvi "s-p" #'gg/org-roam-dailies-goto-previous-note-in-left-window)
(map! :nvi "s-n" #'gg/org-roam-dailies-goto-next-note-in-left-window)

This Reddit thread (the requirements and suggestions) may be relevant for your case.

I believe the approaches discussed there are advanced use of window-configuration (you can restore it to a “previous” state) or that of tabs.

My quick and simple hunch is, as an alternative approach, that you could have a dedicated frame for your two dailies windows, and have another frame for everything else. For this approach, Prot’s beframe` might be a good additional package or reference for your own custom coding.

Thanks a lot @nobiot ! Always helpful! I’ll take a look into those links and come back to report in case someone else might find it useful in the future. Thanks again.

1 Like