branch: externals-release/org
commit 7fac67e2e0a087319109ac222fa8e385740b29a0
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    org-latex-preview: Disable previews in untrusted buffers
    
    * lisp/org.el (org-latex-preview): Make use of the new
    `trusted-content-p' that gives more control to users over which
    buffers should be trusted.
    
    Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74879#74
---
 lisp/org.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 084e02497b..3684053418 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16201,7 +16201,16 @@ fragments in the buffer."
   (interactive "P")
   (cond
    ((not (display-graphic-p)) nil)
-   ((and untrusted-content (not org--latex-preview-when-risky)) nil)
+   ((and
+     ;; Since Emacs 30, prefer `trusted-content-p' API.
+     (not (fboundp 'trusted-content-p))
+     untrusted-content
+     (not org--latex-preview-when-risky))
+    nil)
+   ((and (fboundp 'trusted-content-p) ; Available since Emacs 30
+         (not (trusted-content-p))
+         (not org--latex-preview-when-risky))
+    nil)
    ;; Clear whole buffer.
    ((equal arg '(64))
     (org-clear-latex-preview (point-min) (point-max))

Reply via email to