From d4c97fee062c4fda800c8ac455ad201d934e9f25 Mon Sep 17 00:00:00 2001 From: TEC Date: Mon, 8 Jan 2024 18:17:01 +0800 Subject: [PATCH] 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 Link: https://list.orgmode.org/CAG8iPGxoAD7qmKzDXQ_SRFbmxD7jdM96piCa-dCSCpzae4rCsw@mail.gmail.com --- lisp/org-latex-preview.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index 6a10b4399..3f52e1f1e 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -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': ;;