localauthor / org-side-tree

Navigate Org-mode outlines in Emacs via side window
GNU General Public License v3.0
40 stars 4 forks source link

Error "Invalid search bound (wrong side of point)" #19

Open nohzafk opened 1 month ago

nohzafk commented 1 month ago

When invoking the function org-side-tree, an error "Invalid search bound (wrong side of point)" is frequently encountered. As a result, the side window fails to open. On occasions where the side window does open, modifying the file often reproduces the error, causing instability.

Steps to Reproduce

  1. Open an Org-mode file.
  2. Invoke the function org-side-tree.
  3. Observe the error message: "Invalid search bound (wrong side of point)".
  4. In some cases, the side window may open successfully.
  5. Modify the Org file (e.g., add or edit headings, src blocks).
  6. Note that the error may reoccur, causing inconsistent behavior with the side window.

Debug Information

Environment

Additional Information

The error seems to be related to the presence of src blocks within the beg and end positions passed to the function org-side-tree-overlays-to-text.

localauthor commented 1 month ago

Thanks for the detailed report. I cannot reproduce it, so could you provide more details about the file that raises the error? Or could you share a file that I could use to try to reproduce the issue (with sensitive info taken out, of course)?

localauthor commented 1 month ago

Additional Information

The error seems to be related to the presence of src blocks within the beg and end positions passed to the function org-side-tree-overlays-to-text.

This part doesn't make sense to me.

The beg and end positions should be the beginning and end of a heading. So it shouldn't be possible for there to be a src block between beg and end.

Have you modified outline-regexp in some way?

localauthor commented 1 month ago

I think I see the problem. Does the error occur when all headlines are unfolded?

I don't know how to fix this yet, but I would suggest setting org-side-tree-add-overlays to nil for the time being.

nohzafk commented 1 month ago

yes, i think the error occur when all headlines are expanded. Sometimes the beg is at the heading, sometimes the beg is at the first line of heading (which is a src block)

I will give it a try setting org-side-tree-add-overlays to nil later

localauthor commented 1 month ago

Just pushed a change, let me know if it helps

nohzafk commented 1 month ago

Thanks! I've tested it. With the latest commit, the side tree can be opened.

However, if I turn on the debugger using M-x toggle-debug-on-error, the error still pops up after I click the heading on the org-side-tree buffer. This time, it doesn't affect usage. So i think i just turn off the debugger is OK, the error message is for your reference.

Here is the screenshot. The "beg" point reported at the error message is actually at the next line of the heading.

image
nohzafk commented 1 month ago

also i found out that if the org-side-tree window is opend at the right side, the error still happens and the window won't open. situation of left side is described above.