How to make org-roam-dailies-goto always go to default template?

Hi all, first post here <3

I have been using org-roam-dailies for a bit, and I recently added a second template. So I have a “default” and a “journal” org-roam-dailies-capture-template. However I don’t want to ever select “journal” when using org-roam-dailies-goto and just always default to default when searching. I found this code snippet, that works for everything except for org-roam-dailies-goto-tomorrow/yeserday because of the N argument I think. I don’t know how to fix this.

(defun my/org-roam-dailies-goto-default (orig-fun &rest args)
    (interactive)
    (let* ((x (list (car org-roam-dailies-capture-templates)))
            (org-roam-dailies-capture-templates x))
        (apply orig-fun args)))

   (advice-add #'org-roam-dailies-goto-today :around #'my/org-roam-dailies-goto-default)
    (advice-add #'org-roam-dailies-goto-tomorrow :around #'my/org-roam-dailies-goto-default)
    (advice-add #'org-roam-dailies-goto-yesterday :around #'my/org-roam-dailies-goto-default)
1 Like

For yesterday and tomorrow, how about creating your own commands to call instead of using advice?

The documentation of org-roam-dailies-goto-yesterday has this:

ELisp programs can set KEYS to a string associated with a template.
In this case, interactive selection will be bypassed.

So… you can pass a template key to the command. An example below (only lightly tested; I don’t use dailies). Adjust the second argument "d" passed to the standard function.

(defun my/org-roam-dailies-goto-yesterday (n)
  (interactive "p")
  (org-roam-dailies-goto-yesterday n "d"))

It might be an easier option for goto-today, too:

(defun my/org-roam-dailies-goto-today ()
  (interactive)
  (org-roam-dailies-goto-today "d"))

Ah, yeah, that is a much more simple and direct approach. Thank you.

For others interested I also added:

(defun my/org-roam-dailies-goto-date (&optional prefer-future)
  (interactive)
  (org-roam-dailies-goto-date prefer-future "d"))

I am annoyed by the same problem as in the original post. I just added a second org-roam-dailies-capture-templates and now org-roam is bugging me to “select a template” when I do org-roam-dailies-goto-today. I just want to view the today’s daily file, so, it asking me to pick a template is illogical (the file already exists, IF the daily file I am trying to view doesn’t exist, then, it should ask me about which template to USE).

Is there no solution to this apart from patching our own elisp code?

Alright. Using some phind.com help, I was able to come up with a solution. I define some tiny “lambda functions” which essentially call (org-roam-dailies-goto-today "d"). I also do the same for the ...-goto-tomorrow and ...-goto-yesterday.

Here’s the relevant part of my use-package config:

(use-package org-roam
    :ensure t
    [...]
    :bind (("C-c n l" . org-roam-buffer-toggle)
           ("C-c n f" . org-roam-node-find)
           ("C-c n g" . org-roam-graph)
           ("C-c n i" . org-roam-node-insert)
           ("C-c n c" . org-roam-capture)
           ;; Dailies
           ("C-c n j" . org-roam-dailies-capture-today)
           ("C-c C-o" . org-open-at-point)
           :map org-mode-map
           ("C-M-i" . completion-at-point)
           :map org-roam-dailies-map
           ("Y" . org-roam-dailies-capture-yesterday)
           ("T" . org-roam-dailies-capture-tomorrow)
           ("d" . (lambda () (interactive) (org-roam-dailies-goto-today "d")))
           ("y" . (lambda () (interactive) (org-roam-dailies-goto-yesterday 1 "d")))
           ("t" . (lambda () (interactive) (org-roam-dailies-goto-tomorrow 1 "d"))))
    :bind-keymap
    ("C-c n d" . org-roam-dailies-map)
    [...]

Check out the :bind keys defined by “d”, “y” and “t”.

What do you think? Am I using lambda stuff (which I have no idea what I am doing with) wrong? They seem to work on my setup, but I might be doing something wrong.