Function: org-roam-dailies-goto-next-note

org-roam-dailies-goto-next-note is an interactive and byte-compiled function defined in org-roam-dailies.el.

Signature

(org-roam-dailies-goto-next-note &optional N)

Documentation

Find next daily-note.

With numeric argument N, find note N days in the future. If N is negative, find note N days in the past.

Key Bindings

Aliases

org-roam-dailies-find-next-note (obsolete since org-roam 2.0)

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-dailies.el
;;;; Navigation
(defun org-roam-dailies-goto-next-note (&optional n)
  "Find next daily-note.

With numeric argument N, find note N days in the future. If N is
negative, find note N days in the past."
  (interactive "p")
  (unless (org-roam-dailies--daily-note-p)
    (user-error "Not in a daily-note"))
  (setq n (or n 1))
  (let* ((dailies (org-roam-dailies--list-files))
         (position
          (cl-position-if (lambda (candidate)
                            (string= (buffer-file-name (buffer-base-buffer)) candidate))
                          dailies))
         note)
    (unless position
      (user-error "Can't find current note file - have you saved it yet?"))
    (pcase n
      ((pred (natnump))
       (when (eq position (- (length dailies) 1))
         (user-error "Already at newest note")))
      ((pred (integerp))
       (when (eq position 0)
         (user-error "Already at oldest note"))))
    (setq note (nth (+ position n) dailies))
    (find-file note)
    (run-hooks 'org-roam-dailies-find-file-hook)))