0

What I'm experiencing:

A custom org-num-format-function causes org-latex-preview warn when it called.

Exact warning I'm getting.

⛔ Warning (org-element-cache): org-element--cache: Org parser error in ask.org::648. Resetting.
 The error was: (error "Invalid search bound (wrong side of point)")
 Backtrace:
nil
 Please report this to Org mode mailing list (M-x org-submit-bug-report).

Info about when this Warning comes:

  • Comes when equation change from "previewed-state (image)" back to "text-state"
  • Warning only comes when equation is changed.

To reproduce this issue

Following block will change org-num-format-function. (1.1 -> 1.01)

(defun my/org-num-format (numbering)
    (concat
     (number-to-string (car numbering)) "." (mapconcat (lambda (x) (format "%02d" x)) (cdr numbering) ".") " "))

(setq org-num-format-function #'my/org-num-format)
  1. Change the org-num-format-function as shown above
  2. (In org-file) Turn-on org-num-mode
  3. (In org-file) Create/Change any equation
  4. And then, run org-latex-preview twice that equation.

(When org-num-mode turned off, it doesn't produce warning)

5
  • Org version? FWIW, in light testing with current upstream Org mode version 9.7-pre (release_9.6.26-1361-g08c047), I cannot reproduce it. You might want to upgrade and try again or you might want to report it with M-x org-submit-bug-report and provide your version, but chances are that the bug has been fixed. FYI, the Org element cache code has seen its share of bugs over the years, but the current maintainer has rewritten and improved much of the code, and actively squashes bugs, often within hours of a report being sent in. I was running with the cache disabled before, but no longer.
    – NickD
    Commented Apr 13 at 2:20
  • 1
    Hi @NickD, Mine is on Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/29.3/lisp/org/) with emacs-29.3. I just submitted as bug, I'll post further updates on the issue.
    – Garid
    Commented Apr 13 at 8:39
  • 1
    I got an reply, they were able to reproduce the issue with stable-orgmode-version, but on development-version it was OK. I guess, Now I'm considering either updating org-mode-version, or suppress this warning. (Updating org-mode feels bit too much work) Do you have any idea how to suppress this warning?
    – Garid
    Commented Apr 13 at 14:01
  • 1
    You can turn off the cahce altogether by doing (setq org-element-use-cache t) in your init file, but that will slow down the parser (although you will only see that in special situations: most of the time you will not notice). I don't see a way to turn off just the warning, short of redefining the relevant macro (which is more trouble than it's worth). I would live with it for now and wait for the next version where it will hopefully be fixed.
    – NickD
    Commented Apr 13 at 18:35
  • I see, I guess I'm gonna wait until next org-mode update. Until then, turning off the org-num-mode temporarily when I'm working with org-latex-preview is seems the best for me. Thanks @NickD
    – Garid
    Commented Apr 14 at 7:20

1 Answer 1

0

Update:

I reported this issue, and got an reply

  • On current stable version, they were able to reproduce this issue
  • On development version, there is no this issue.

It seems best to wait (at least for me) for the next release. (I'm just posting this so I can close this question)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.