Skip to content

Commit

Permalink
improve logic for tex-in-latex-p
Browse files Browse the repository at this point in the history
Do checking similar to how markdown mode is checked: specifically check
the text property, since an overlay could cover it up (e.g., hl-line-mode masks
things). Also check for 'tex-math face (defined in built-in latex-mode).
  • Loading branch information
dankessler committed Apr 19, 2024
1 parent 031025a commit c06c11e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions org-latex-impatient.el
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ available in upstream."

(defun org-latex-impatient--tex-in-latex-p ()
"Return t if in LaTeX fragment in `latex-mode', nil otherwise."
(let ((faces (face-at-point nil t)))
(or (-contains? faces 'font-latex-math-face)
(-contains? faces 'preview-face))))
(let ((faces (get-text-property (point) 'face)))
(or
(org-latex-impatient--equal-or-member 'font-latex-math-face faces)
(org-latex-impatient--equal-or-member 'preview-face faces)
(org-latex-impatient--equal-or-member 'tex-math faces))))

(defun org-latex-impatient--has-latex-overlay ()
"Return t if there is LaTeX overlay showing."
Expand Down

0 comments on commit c06c11e

Please sign in to comment.