Subject: bug#36414: 27.0.50; svg-clock does not work anymore

From: Pip Cet <[email-masked]>
Date: Fri, 28 Jun 2019 06:57:28 +0000

On Fri, Jun 28, 2019 at 5:29 AM Dieter Deyke <[email-masked]> wrote:
> Executing (svg-clock) from elpa does not show the clock anymore, but just the
> single char '*'.

Sorry for barging in, I thought this might be related to the recent
image.c changes so I had a look.

svg-clock.el uses `svg-def', which is now an internal function,
`svg--def'. I believe Lars is the one working on this.

Can you try the attached patch to see whether that is indeed the problem?
From 7ed2545ee2f182e419abbaf9050f765b98bf8f05 Mon Sep 17 00:00:00 2001
From: Pip Cet <[email-masked]>
Date: Fri, 28 Jun 2019 06:56:31 +0000
Subject: [PATCH] Copy svg--def to manipulate the DOM directly from
 svg-clock.el

---
 packages/svg-clock/svg-clock.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/packages/svg-clock/svg-clock.el b/packages/svg-clock/svg-clock.el
index bf0147cf6..922ebdce8 100644
--- a/packages/svg-clock/svg-clock.el
+++ b/packages/svg-clock/svg-clock.el
@@ -115,6 +115,15 @@ and `hour-hand'.  The clock-face has a size of 1x1."
                                                 'rotate angle .5 .5)))
                               (number-sequence 0 354 6))))))
 
+(defun svg-clock--def (svg def)
+  (dom-append-child
+   (or (dom-by-tag svg 'defs)
+       (let ((node (dom-node 'defs)))
+	 (dom-add-child-before svg node)
+	 node))
+   def)
+  svg)
+
 (defun svg-clock--create-svg (time size foreground background)
   "Return an SVG element displaying an analog clock.
 The clock shows the given TIME, it has a diameter of SIZE, and
@@ -140,8 +149,8 @@ its colors are FOREGROUND and BACKGROUND."
                                 (svg-clock-transform
                                  'rotate
                                  (+ (* hours 30) (/ minutes 2.0))  .5 .5)))))
-    (dolist (def defs) (svg-def svg def))
-    (svg-def svg clock)
+    (dolist (def defs) (svg-clock--def svg def))
+    (svg-clock--def svg clock)
     (dom-append-child svg
                       (svg-clock-use 'clock
                                      (svg-clock-transform 'scale size size)))
-- 
2.20.1