-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error following with org-roam-ui error rx ** range error #81
Comments
I would like to fix this issue if I can but I am unable to reproduce it. Could you give me more detail (eg. file samples, step-by-step description, org version). I am afraid I won't be able to help you if you are using Doom or unreleased version of Org or Emacs. |
Im using vanilla Emacs. I think I know where the problem is, I've come across this issue before.
In your docs you suggested that we use REPRODUCE
SOLUTION If the problem is that org roam is executing code in the markdown file because of a variable... This is my best guess. Figure out where or how roam is executing functions in the markdown file. Another solution would be to create your own function that would update the roam database TAGS On another note. I don't use obsidian anymore but I have lots of files that I would like to keep I had to modify the code to allow obsidian tags like this, more flexible. I don't understand ;; Allow obsidian tags
(setq md-roam-regex-tags-zettlr-style "\\([[,]+[ ]?\\)\\([[:alnum:]_-]+\\)[] ]?")
;; My modified code, more flexible. Removed substring
(defun md-roam-get-tags ()
"Get tags defined in the Zettlr style within frontmatter."
(let ((endpoint (md-roam-get-yaml-front-matter-endpoint)))
(cond (endpoint
(save-excursion
(let (tags)
(goto-char (point-min))
(while (re-search-forward md-roam-regex-tags-zettlr-style endpoint t)
(let ((tag (match-string-no-properties 2)))
(when tag
(setq tags
;; Remove the first char @ or #
;; (append tags (list (substring tag 1)))))))
;; HACK: 12/28/2023 to allow [ tag, tag, tag] for obsidian tags.
(append tags (list tag)))))) |
I don't have the error message. No error on my end. See the screen cast below I just took now. I could not include my mouse cursor in the frame, but I hope you see me opening two different markdown notes from within Perhaps you do it different way to get the error? Screencast.from.30-12-2023.17.31.21.mp4 |
It's good that you have your own hack that works for you. I tried your regexp. It does not seem to capture my tags with a "#", like this:
|
If you can't reproduce then this is going to be a tough one... I will have to go back to square one.
It's not suppose to capture a hash, the idea is to let the user decide on how to capture tags. A better, more flexible, and future proof alternative would be to let the user develop their own method of obtaining tags A change to The updated (when tag (append tags (list tag))) The gist is to allow a user the flexibility to use their file tags anywhere Hugo, obsidian, emacs ... |
I have no strong desire to align md-roam with Obsidian or Hugo, but YAML specification seems to be that special characters such as "#" would need to be escaped or put into a quotation marks to be read as literal (I cannot really confirm this and do not intend to do so at this point).
Regarding the tag, see be9ae73. I need '#' and/or '@' as prefix to the tag -- this is my usage and will not introduce a breaking change for my own use. If you don't use the prefix, this change will let you do so. With regard to the main issue of the org-roam-ui error, I really can't reproduce it so I won't be able to look at it. |
The error occurs when the markdown file contains a code blog with an org syntax such as this below: ```org #+title: Org title ``` Before this change, md-roam used function `org-roam-db-insert-file' to insert a new markdown file. This function tries to get the title of the file with function `org-roam-db--file-title' and it calls `org-collect-keywords'. Somewhere down this chain, the error gets raised because the buffer is not a org buffer (and rest of the buffer is written in the markdown syntax).
Hopefully d05d867 fixes the issue of the main error. Let me know how you go. closing for now. |
Thanks for the tags update, unfortunately I am still getting this error when switching to a markdown file.
Once I disable It looks like maybe your code somewhere is calling |
Could you make sure you are using the latest commit please? Ensure that your Emacs is not using a stale compiled script. If the issue still persists, perhaps you can share arch.md. I struggle to reproduce the issue. I suspect the content of your markdown file gives us a clue. |
What do you mean by stale compiled script? It happens with any markdown file. I do this:
I made a video, perhaps this will help: |
Does the error happen when you don’t use org-roam-ui? |
I cannot reproduce the issue. I can switch between org and md files with org-roam-ui shown. Please mute your speaker; there is my loud typing noise and I could not turn off the sound recording. 2024-01-16.12-48-49.mp4
If you compile a |
I made you a repo to reproduce the error, rename your emacs config and use this minimal config. git clone https://github.com/rickalex21/emacs-min.git I have reproduced this error both on Mac and Linux. You can see the error in this video with https://youtu.be/yNeny88ibIw?si=0b6UIQ_5GWHyvhqq Not sure what your setup is but you need to view the async log, once it gets stuck somewhere Steps to reproduce:
|
Can you remove evil and check if you can still repro the issue please? I cannot use vim key-bindings. Also how do I view the async log? |
I tried your repo and commented out evil. I cannot reproduce the error... 2024-01-17.08-19-45.mp4My Emacs version is GNU Emacs 29.1.50. Not sure if it is relevant. I don't know how evil can be relevant here but try removing it and see if it makes any difference. Other than that, perhaps the Emacs version may be also relevant. |
Okay, finally I think I can reproduce the issue. It's probably something in |
I think it's this line in your configuration: https://github.com/rickalex21/emacs-min/blob/main/init/org-roam-init.el#L28 The call to Can you remove/comment it out and try again, please? |
It still does it with I am using:
I presume I can boot in to void and see if I can reproduce there cause this is a pure gtk version of emacs. Update: Tested it on void, I'm getting the same error even with commenting. It looks like the error may have originated in Debugger entered--Lisp error: (error "rx ‘**’ range error")
error("rx `%s' range error" **)
rx--translate-bounded-repetition(** (1 0 "*"))
rx--translate-**((1 0 "*"))
rx--translate-form((** 1 0 "*"))
rx--translate((** 1 0 "*"))
rx--translate-seq((line-start (** 1 0 "*") " "))
rx--translate-form((seq line-start (** 1 0 "*") " "))
rx--translate((seq line-start (** 1 0 "*") " "))
rx-to-string((seq line-start (** 1 0 "*") " "))
org-element-headline-parser(nil fast)
org-element--parse-to(128)
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() The other error:
|
Function org-roam-id-at-point is called and causes the error inside via org-element-at-point within a markdown file.
Can you try this fix, please? Just pushed it: |
Now it can follow and the node is recognized :) . However, when I try to edit the frontmatter
If you want to reproduce try this. It's similar to the original one. Then edit ---
title: Test File
date: 2022-06-16T20:19:25-05:00
id: someid
draft: false
tags: [sometag,sometag2]
---
# Test
Test file.
[[linux]] Can nodes be added in the front matter? For example: ---
nodes: [[linux]] [[code]]
--- UPDATEAbove was my personal config but in the testing config minimal emacs I'm getting another error. Debugger entered--Lisp error: (error "rx ‘**’ range error")
error("rx `%s' range error" **)
rx--translate-bounded-repetition(** (1 0 "*"))
rx--translate-**((1 0 "*"))
rx--translate-form((** 1 0 "*"))
rx--translate((** 1 0 "*"))
rx--translate-seq((line-start (** 1 0 "*") " "))
rx--translate-form((seq line-start (** 1 0 "*") " "))
rx--translate((seq line-start (** 1 0 "*") " "))
rx-to-string((seq line-start (** 1 0 "*") " "))
org-element-headline-parser(nil fast)
org-element--parse-to(144)
org-element-at-point()
org-element-context()
org-roam-link-replace-at-point()
org-roam-link-replace-all()
run-hooks(before-save-hook)
basic-save-buffer(nil)
save-buffer()
evil-write(nil nil nil nil nil)
funcall-interactively(evil-write nil nil nil nil nil)
evil-ex-call-command(nil "w" nil)
evil-ex(nil)
funcall-interactively(evil-ex nil)
command-execute(evil-ex) A warning: Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer fake.md> (markdown-mode |
Before you call I noticed that your config does not get you this mode-line. If you disable and enable md-roam again, mode-line shows it. Then I don't get the error you report. I think your config is incorrectly done and this is the reason for this behaviour. (use-package md-roam
:straight (:host github :repo "nobiot/md-roam")
;;:after org-roam
;;:disabled t
:init
(setq md-roam-regex-tags-zettlr-style "\\([[,]+[ ]?\\)\\([[:alnum:]_-]+\\)[] ]?")
:custom
(md-roam-file-extension "md"))
(use-package org-roam
;; [... omit ...]
:config
;; [... omit ... ]
(md-roam-mode 1)
(org-roam-db-autosync-mode t)) |
Regarding this:
I don't think markdown-mode recognize this as correct wiki-link syntax. I do not do this so I am not sure if md-roam adds these wiki links to the links database table. You can try. I am not really keen to change the current behaviour. |
UPDATE: I'm not 100% sure what the issue is but for now I can use company-mode I'm in the talks with company-mode discussion, I'm trying to figure that out. It does look like you're right, the error does go away. I presume you don't use company-mode. I've noticed that the linking to nodes is not the same as org mode I'm not sure how In org void.org :
In markdown void.md :
I'm not sure what a good solution to this would be and keep the markdown syntax as markdown. |
I am not sure what where the support for One thing that is clear is that I will not implement Not related to the issue you are talking about, and I am sorry to say this, but I have hard time understanding the issue(s) you are reporting here.
I am happy to continue conversations and potentially I may be able to provide more help, if useful at all, to your specific issues or overall workflow you are trying to accomplish. In exchange, I request that you also respect some boundaries as Let me suggest you consider the following:
|
I understand. I was thinking about mentioning that I can't find a use case for it. I'm ok linking to the file only. The :NODES: is a property in an org heading that makes the heading link to something. I meant
On your part, you are done. The issue is closed and I can not reproduce with a minimal config. However,
I understand, that's why I was thinking I can't find a use case to link markdown headings. I'm ok
I want to use md-roam with no errors and all my packages. This requires me spending some time troubleshooting
Yes I do want to get rid of the errors because I can't edit markdown files with all the errors.
I did not want to constantly be opening issues on your github. If you had Github Discussions like other GitHub Emacs packages, perhaps I would have gone off on tangents. I think the issue will your package will continue weather it's your issue or not because there's not enough people using your package to experience the issue or willing to take the time like I did to help troubleshoot it. Part of me I do appreciate all your help, you have been very helpful. Thanks for all the great work you have done. |
If you wish to get errors resolved, I suggest that the only way is to create an issue with minimal configuration for each case. This is the only practical way to get it fixed by getting to the root cause. For |
I'm glad we figured it out, thanks. |
Hello, looking to move to markdown files to org roam. So far I manage to get one
node to link but I am getting several errors. Hopefully I can get all files linked.
I know the program works fine because I am able to run commands inside
the markdown buffer (e.g., md-roam-get-tags etc..).
When I change to a markdown file org-roam-ui will not follow it, instead I get this error:
Another error:
Debugger info:
Not sure if this is related to #80
Thanks
The text was updated successfully, but these errors were encountered: