hniksic / emacs-htmlize

Convert buffer text and decorations to HTML.
193 stars 44 forks source link

Splicing in overlays breaks for literate-calc-mode #35

Open sulami opened 3 years ago

sulami commented 3 years ago

This was noticed by a user (sulami/literate-calc-mode.el#17).

I have not done any extensive research, but I can provide a traceback & a minimal example.

#+begin_src literate-calc
Pi = 3.14159
#+end_src
Debugger entered--Lisp error: (args-out-of-range "Pi " 0 12)
  substring("Pi " 0 12)
  htmlize-add-before-after-strings(1 4 "Pi ")
  htmlize-get-text-with-display(1 4)
  htmlize-buffer-substring-no-invisible(1 4)
  htmlize-extract-text(1 4 nil)
  htmlize-buffer-1()
  htmlize-region(1 13)
  org-html-htmlize-region-for-paste(1 13)
  org-html-fontify-code("Pi = 3.14159" "literate-calc")
  org-html-do-format-code("Pi = 3.14159" "literate-calc" nil t nil nil)
  [ more frames omitted ]

This is where the traceback leads me.