On Friday, 12 Aug 2022 at 14:35, ed...@openmail.cc wrote:
> It worked! Thanks. I send a counter-patch :)  (for SVG).

Excellent.  I forgot about SVG.  So I throw one back at you! ;-) Just
deleted a spurious message line.

Maybe somebody with submit access can have a look and see if this is
suitable for applying to master?  Or if there is a better way of doing
this (I'm sure there is...)?

-- 
: Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50
From e11a09b2d69db6f7da55914276751daa8e34395b Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fr...@ucl.ac.uk>
Date: Fri, 12 Aug 2022 15:50:17 +0100
Subject: [PATCH] lisp/ox-beamer: Enable use of overlays for images

* ox-beamer.el (org-beamer-link): If an overlay beamer attributed has
been provided, use it for images.
---
 lisp/ox-beamer.el | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index e6232d8d2..cb35850b9 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -734,13 +734,22 @@ used as a communication channel."
   (or (org-export-custom-protocol-maybe link contents 'beamer info)
       ;; Fall-back to LaTeX export.  However, prefer "\hyperlink" over
       ;; "\hyperref" since the former handles overlay specifications.
-      (let ((latex-link (org-export-with-backend 'latex link contents info)))
-	(if (string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)
-	    (replace-match
-	     (format "\\\\hyperlink%s{\\1}"
-		     (or (org-beamer--element-has-overlay-p link) ""))
-	     nil nil latex-link)
-	  latex-link))))
+      (let* ((latex-link (org-export-with-backend 'latex link contents info))
+             (parent (org-export-get-parent-element link))
+             (attr (org-export-read-attribute :attr_beamer parent))
+             (overlay (plist-get attr :overlay)))
+        (cond ((string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)
+               (replace-match
+                (format "\\\\hyperlink%s{\\1}"
+                        (or (org-beamer--element-has-overlay-p link) ""))
+                nil nil latex-link))
+              ((string-match "\\\\include\\(graphics\\|svg\\)\\([[{]?\\)" latex-link)
+               ;; check for overlay specification and insert if present
+               (replace-match
+                (format "\\\\include\\1%s\\2"
+                        (if overlay overlay ""))
+                nil nil latex-link))
+              (t latex-link)))))
 
 
 ;;;; Plain List
-- 
2.30.2

Reply via email to