Try it in a buffer visiting a file in Org-roam, or any buffer visiting a file. Scratch buffer does not visit a file; that error is expected there.
I’ll see if I can address the case when the current buffer is not visiting a file.
Edit: In addition… I just realised there is an issue with this approach:
(setq org-remark-notes-file-name
(concat "~/org-roam/highlights/" (file-name-base (org-remark-notes-file-name-function)) ".org"))
It will fix org--remark--notes-file-name
to one file name.
In order to dynamically change the file name per file, you need to set the variable to a function. So…
(setq org-remark-notes-file-name
(lambda ()
(concat "~/org-roam/highlights/"
(file-name-base (org-remark-notes-file-name-function))
".org")))
Or create a custom function and then set it to a variable (I’d prefer a named function like this):
(defun my/function ()
(concat "~/org-roam/highlights/"
(file-name-base (org-remark-notes-file-name-function))
".org"))
(setq org-remark-notes-file-name
#'my/function)