jupyter-insert-latex: Remove modification-hooks from overlays

The modification-hooks added by `org-format-latex` cause the overlay to be
deleted whenever it is modified and this will also happen during text property
changes which we want to avoid. Since the buffer is read-only anyways, there is
no need for this hook.
This commit is contained in:
Nathaniel Nicandro 2019-02-16 09:33:57 -06:00
parent 87f1acbf86
commit 0579dbcd97
No known key found for this signature in database
GPG key ID: C34814B309DD06B8

View file

@ -357,13 +357,18 @@ image."
:matchers ,(plist-get org-format-latex-options :matchers))))
(jupyter-with-insertion-bounds
beg end (insert tex)
;; FIXME: Best way to cleanup these files? Just delete them by reading
;; the image data and using that for the image instead?
(org-format-latex
org-preview-latex-image-directory
beg end org-babel-jupyter-resource-directory
'overlays "Creating LaTeX image...%s"
'forbuffer
"ltximg" beg end org-babel-jupyter-resource-directory
'overlays nil 'forbuffer
;; Use the default method for creating image files
org-preview-latex-default-process)
(dolist (o (overlays-in beg end))
(when (eq (overlay-get o 'org-overlay-type)
'org-latex-overlay)
(overlay-put o 'modification-hooks nil)))
(overlay-recenter end)
(goto-char end))))
;;; Images