Fix background of latex segments in org buffers

'auto doesn't seem to work correctly, especially where face-remap is
involved (e.g. with solaire-mode or auto-dim-other-buffers).
This commit is contained in:
Henrik Lissner 2020-04-14 15:34:20 -04:00
parent 661fa18af0
commit 10a6b510d7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -116,10 +116,20 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
;; Fontify latex blocks and entities, but not natively -- that's too slow
(setq org-highlight-latex-and-related '(latex script entities))
(plist-put org-format-latex-options :scale 1.5) ; larger previews
(add-hook! 'doom-load-theme-hook
(defun +org-refresh-latex-background-h ()
"Previews are rendered with the incorrect background.
This forces it to read the background before rendering."
(plist-put! org-format-latex-options
:scale 1.5 ; larger previews
:foreground 'auto ; match the theme foreground
:background 'auto) ; ... and its background
:background
(face-attribute (if-let (remap (cadr (assq 'default face-remapping-alist)))
(if (keywordp (car-safe remap))
(plist-get remap :background)
remap)
'default)
:background nil t))))
;; HACK Face specs fed directly to `org-todo-keyword-faces' don't respect
;; underlying faces like the `org-todo' face does, so we define our own