org-latex-preview: Optimize overlay-modify hook

*
lisp/org-latex-preview.el (org-latex-preview-auto--mark-overlay-modified):
Reduce slightly the number of checks needed to run each time text
inside a LaTeX fragment overlay is modified.
This commit is contained in:
Karthik Chikmagalur 2023-04-21 22:22:49 -07:00 committed by TEC
parent 3ab374790d
commit 7bd5973233
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 4 additions and 2 deletions

View File

@ -378,8 +378,10 @@ overlay face is set to `org-latex-preview-processing-face'."
(defun org-latex-preview-auto--mark-overlay-modified (ov after-p _beg _end &optional _l)
"When AFTER-P mark OV as modified and display nothing."
(when after-p
(overlay-put ov 'preview-state 'modified)
(overlay-put ov 'display nil)))
(unless (eq (overlay-get ov 'preview-state) 'modified)
(overlay-put ov 'preview-state 'modified)
(overlay-put ov 'face nil)
(overlay-put ov 'display nil))))
(defun org-latex-preview--update-overlay (ov path-info)
"Update the overlay OV to show the image specified by PATH-INFO."