nobiot/md-roam

Run into "range error" while opening a .md file

hy-zhao23 opened this issue · 10 comments

Hi, Here is what I get in my emacs when I open and click a .md file in a md roam project.

 The error was: (error "rx ‘**’ range error")
 Backtrace:
"  backtrace-to-string(nil)
  org-element-at-point()
  org-back-to-heading(t)
  org-back-to-heading-or-point-min(t)
  org-roam-id-at-point()
  org-roam-ui--update-current-node()
"
 Please report this to Org mode mailing list (M-x org-submit-bug-report). 

I have reported this to org-mode contributors. And they think it might because md-roam package modified `org-roam-buffer-p' and caused the breakage.

Hope this could help you to fix the issue.

nobiot commented

Does this happen any md file?

It happens when I open a new md-roam project, then open a file in it and click inside inside that file for the first time. I have been managed several roam projects with .dir-locals.el files. I don't know if this approach would cause the problem.

nobiot commented

Does it happen when you open a md file in a directory without .dir-local.el?

Does it happen when you open every md file? (I am suspecting that the content of the file may influence the behavior).

nobiot commented

Also, whats your org version and Emacs version?

nobiot commented

Additionally, you seem to be opening a md file from org-roam-ui. Does the problem happen if you open the same file from within Emacs via find-file?

Org: 9.7
Emacs: 28.2

It only happens for the first file visiting with SPC-p-p. And I can't trigger it now after I redefined org-roam-directory, which is useless for my workflow.

But once I redefined org-roam-directory, I can't use multiple roam projects anymore under md-roam. For example, when I try to find a node under a project with SPC-n-r-f, the pop-up window is blank. And it works pretty well under org-roam no matter that directory is defined or not.

Plus, I started run into errors as the following when I disabled the directory definition
Error caused by user's config or system: /Users/melody/.doom.d/config.el, (file-missing Opening directory No such file or directory /Users/melody/Documents/emacs/org/roam)

I guess it might come from a recent update, because it works fine before that when I can both define the directory and use .dir-locals.el to manage multiple projects.

It is resolved after I disable org-roam-db-autosync-mode, which caused the conflicts I guess. Thanks for your help!

After I disabled definition of directory, turn off org-roam-db-autosync-mode and tried to use dir-locals.el to enable multiple projects. The problem appears again when I tried to open another file with SPC-n-r-f.
Please check the error message below:

Warning (org-element-cache): org-element--cache: Org parser error in 23-08-10-explanation.md::215. Resetting.
 The error was: (error "rx ‘**’ range error")
 Backtrace:
nil

This might be unrelated but I ran into the same error when adding a markdown file containing a #+title: 1 inside of a codeblock. Removing the line or even adding ;; for comments resolved the issue.

Hopefully d05d867 fixes the issue. Let me know how you go. Closing for now.