Emacs has support frame background transparency since 29, add `:mask heuristic` to overlay property list to make its transparent part masked when displayed in a transparent frame.

There is a related thread [[https://emacs-china.org/t/org-latex-preview-png/29167/12]] .

This is my first time to try to contribute, if I have anything done wrong, please tell me!

From 814173a7d5035af2028c3c9173f6b3aa06abfee3 Mon Sep 17 00:00:00 2001
From: gynamics <dybfys...@163.com>
Date: Sun, 16 Mar 2025 02:22:50 +0800
Subject: [PATCH] Support png overlay background transparency in a transparent
 frame.

---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index bc61a7c46..b0f30156e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16166,7 +16166,7 @@ as a string.  It defaults to \"png\"."
 			 (delete-overlay o))))
     (overlay-put ov
 		 'display
-		 (list 'image :type imagetype :file image :ascent 'center))))
+		 (list 'image :type imagetype :file image :ascent 'center :mask heuristic))))
 
 (defun org-clear-latex-preview (&optional beg end)
   "Remove all overlays with LaTeX fragment images in current buffer.
-- 
2.48.1

Reply via email to