mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(feat): add useful warning message to org-roam-dailies-find-next-note (#1365)
If the user creates a new daily via `org-roam-dailies-find-today`, they will get a new buffer that hasn't yet been saved to disk. If they then try to navigate to the previous daily via `org-roam-dailies-find-previous-note`, they will get the error: `Wrong type argument: number-or-marker-p, nil` This is because the value of the local variable `position` is set only if the current buffer exists as a file in the dailies directory. It doesn't until the user explicitly saves it. That's not a big problem, but the solution is not obvious from the error message. I added a check that will provide the user with a more informative error message, so they know how to fix the issue: "Can't find current note file - have you saved it yet?"
This commit is contained in:
@ -301,6 +301,8 @@ negative, find note N days in the past."
|
||||
(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))
|
||||
|
Reference in New Issue
Block a user