rougier/svg-lib

`svg-lib-concat` error

mpardalos opened this issue · 3 comments

Using svg-lib-concat gives an error. Evaluating the following elisp in an otherwise empty scratch buffer:

(insert-image (svg-lib-concat (svg-lib-tag "A") (svg-lib-tag "B"))) 

Gives this error

insert-image: Not an image: (svg ((width . 40) (height . 18.900000000000002) (version . 1.1) (xmlns . http://www.w3.org/2000/svg) (xmlns:xlink . http://www.w3.org/1999/xlink))   (rect ((width . 20) (height . 18.900000000000002) (x . 0.0) (y . 0) (rx . 3) (fill . #000000)))   (rect ((width . 18) (height . 16.900000000000002) (x . 1.0) (y . 1.0) (rx . 2.0) (fill . #ffffff)))   (text ((y . 13) (x . 6.0) (fill . #000000) (font-size . 13) (font-weight . 400) (font-family . DejaVu Sans Mono))  A)   (rect ((width . 20) (height . 18.900000000000002) (x . 0.0) (y . 0) (rx . 3) (fill . #000000) (transform . translate(20.000000,0))))   (rect ((width . 18) (height . 16.900000000000002) (x . 1.0) (y . 1.0) (rx . 2.0) (fill . #ffffff) (transform . translate(20.000000,0))))   (text ((y . 13) (x . 6.0) (fill . #000000) (font-size . 13) (font-weight . 400) (font-family . DejaVu Sans Mono) (transform . translate(20.000000,0)))  B))

I just realised the error. svg-lib-concat returns the svg args, not and svg "object" (?) It is meant to be given to svg-image or svg-lib-image. So, the following works:

(insert-image (svg-lib--image (svg-lib-concat (svg-lib-tag "A") (svg-lib-tag "B"))))

I don't know whether this is intended or an oversight, so I'm leaving the issue open.

This is on purpose yes (this is what allows concatenation) and user is responsible for display by calling svg-image.

Alright then. Closing since this is intentional.