[-- Attachment #1.1: Type: text/plain, Size: 169 bytes --]
The hash computed for LaTeX previews did not actually take into account the
true foreground/background text color, so org would not refresh previews
when themes change.
[-- Attachment #1.2: Type: text/html, Size: 194 bytes --]
[-- Attachment #2: 0001-lisp-org.el-Update-previews-correctly-when-color-chn.patch --]
[-- Type: application/octet-stream, Size: 2129 bytes --]
From dbecdbb6f3cc5f9b6d094310ecdd6c5aedfe5505 Mon Sep 17 00:00:00 2001
From: "Yuri D. Lensky" <ydl@Yuris-MacBook-Pro.local>
Date: Wed, 24 Feb 2021 12:40:25 -0800
Subject: [PATCH] lisp/org.el: Update previews correctly when color chnages.
* lisp/org.el (org-format-latex): When computing a hash that
determines if a preview needs to be re-generated, use the actual color
of the face rather than just the setting symbol.
---
lisp/org.el | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 7d8733448..4ae604fe6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15965,15 +15965,25 @@ Some of the options can be changed using the variable
(fg
(let ((color (plist-get org-format-latex-options
:foreground)))
- (if (and forbuffer (eq color 'auto))
- (face-attribute face :foreground nil 'default)
- color)))
+ (if forbuffer
+ (cond
+ ((eq color 'auto)
+ (face-attribute face :foreground nil 'default))
+ ((eq color 'default)
+ (face-attribute 'default :foreground nil))
+ (t color))
+ color)))
(bg
(let ((color (plist-get org-format-latex-options
:background)))
- (if (and forbuffer (eq color 'auto))
- (face-attribute face :background nil 'default)
- color)))
+ (if forbuffer
+ (cond
+ ((eq color 'auto)
+ (face-attribute face :background nil 'default))
+ ((eq color 'default)
+ (face-attribute 'default :background nil))
+ (t color))
+ color)))
(hash (sha1 (prin1-to-string
(list org-format-latex-header
org-latex-default-packages-alist
--
2.24.3 (Apple Git-128)