io12 / org-fragtog

Automatically toggle Org mode LaTeX fragment previews as the cursor enters and exits them
MIT License
397 stars 14 forks source link

org-fragtog--post-cmd: wrong-type-argument on Emacs 29 #47

Closed alopezrivera closed 1 year ago

alopezrivera commented 1 year ago

First of all thanks for all the work put into the package. It's great :)

Describe the bug org-fragtog-mode seems to not work on Emacs 29.

To Reproduce Steps to reproduce the behavior:

  1. Toggle buffer-wide org-latex-preview
  2. M-x org-fragtog-mode
  3. The following error message is shown:
    Error in post-command-hook (org-fragtog--post-cmd): (wrong-type-argument number-or-marker-p nil)

The bug seems to take place within org-fragtog--frag-end. Bug trace:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  org-fragtog--frag-end((latex-environment (:standard-properties [724 923 nil nil 1 735 nil t nil nil nil nil element nil (section (:standard-properties [548 923 548 923 0 548 nil t nil 548 923 section element nil (headline ...) nil nil #<buffer calc.org>])) nil nil #<buffer calc.org>] :value [org-element-deferred org-element--substring (11 198) nil] :results (""))))
  org-fragtog--cursor-frag()
  org-fragtog--post-cmd()
  eval((org-fragtog--post-cmd) t)
  eval-expression((org-fragtog--post-cmd) nil nil 127)
  funcall-interactively(eval-expression (org-fragtog--post-cmd) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

Expected behavior org-fragtog-mode starts and inline previews of LaTeX equations work as expected.

Videos Can provide if needed.

Version and environment

Additional context Can provide if needed.

io12 commented 1 year ago

If you are using straight.el, I think this might be the same issue as https://github.com/org-roam/org-roam/issues/2361. There are some workarounds in that thread. Can you try pinning your Org version to 8ef6205a560cd3a92f8c5f8fe34953b80121c2cb?

alopezrivera commented 1 year ago

That was it exactly! Thank you so much :)