Proper Way to Delete Notes

I found nothing explicit about the right way to do this. Do I just delete the file, and trust that the DB will synchronize itself?

Yes. Deleting a file within Emacs using built-in functions should trigger db sync. If you delete a file outside Emacs (like with using your OS’s file manager), it is still OK; next time you run db sync in Emacs (manually or, more typically, automatically at the start of autosync-mode.

Dumb question: what’s the proper way to delete an org-roam file within emacs? If I naively do M-x delete-file, it prompts me for a path, and of course, I have no idea what the path is since it’s got a random ID prefix.

I do this. You can use Dired if you do not want to define your own function.

(defun my/delete-current-file ()
    "Move the file current buffer is visiting to trash.
It also kills the current buffer."
    (interactive)
    ;; Ensure `delete-by-moving-to-trash' is non-nil so that `delete-file'
    ;; moves the file to trash even if the customization is incorrect.
    (let ((delete-by-moving-to-trash t))
      (delete-file (buffer-file-name) t)
      (kill-current-buffer))))
1 Like

Thank you!