org-latex-preview: Fix face selection Emacs 28 bug

* lisp/org-latex-preview.el (org-latex-preview--face-around): On Emacs
28 (and presumably below), should a face with :extend set be identified
as appropriate, the overlay may cast a pall (background colour) over the
rest of the line.  This can be addressed by replacing the use of the
default face to normalise display with an anonymous face that inherits
from default and has the :extend attribute set.

Reported-by: Roshan Shariff <roshan.shariff@gmail.com>
Link: https://list.orgmode.org/CAG8iPGxoAD7qmKzDXQ_SRFbmxD7jdM96piCa-dCSCpzae4rCsw@mail.gmail.com
This commit is contained in:
TEC 2024-01-08 18:17:01 +08:00
parent bc2ef6c91d
commit d4c97fee06
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 6 additions and 4 deletions

View File

@ -538,13 +538,15 @@ Faces in `org-latex-preview--ignored-faces' are ignored."
(get-text-property (1- start) 'face))
(and (> (point-max) end)
(not (eq (char-after end) ?\n))
(get-text-property end 'face)))))
(get-text-property end 'face))))
(normalising-face
(if (>= emacs-major-version 29) 'default '(:inherit default :extend t))))
(cond
((consp face)
(nconc (cl-set-difference face org-latex-preview--ignored-faces) (list 'default)))
(nconc (cl-set-difference face org-latex-preview--ignored-faces) (list normalising-face)))
((and face (not (memq face org-latex-preview--ignored-faces)))
(list face 'default))
(t 'default))))
(list face normalising-face))
(t normalising-face))))
;; Code for `org-latex-preview-auto-mode':
;;