Subject: bug#57813: Icon images are non-functional

From: Juri Linkov <[email-masked]>
Date: Fri, 23 Sep 2022 18:48:54 +0300

> diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el
> index ff4f20c207..ccc3657793 100644
> --- a/lisp/emacs-lisp/icons.el
> +++ b/lisp/emacs-lisp/icons.el
> @@ -202,7 +202,11 @@ icons--create
>                              :height (if (eq height 'line)
>                                          (window-default-line-height)
>                                        height)
> -                            :scale 1 :ascent 'center)
> +                            :scale 1
> +                            :rotation (plist-get keywords :rotation)

Oh, I noticed now this prints a warning in *Messages*:

  Invalid image ‘:rotation’ parameter nil

but still continues to work fine.

So maybe the keyword :rotation should be used only on this
condition (plist-member keywords :rotation) instead of:

              (create-image file
                            nil nil
                            :rotation (plist-get keywords :rotation)

I guess the only way is to convert this function call to 'apply'
with a constructed list of arguments?

Or better to change compute_image_rotation to allow nil in :rotation:

diff --git a/src/image.c b/src/image.c
index 1e323ba66a..6d9316c64b 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2548,6 +2548,8 @@ compute_image_rotation (struct image *img, double *rotation)
   Lisp_Object value = image_spec_value (img->spec, QCrotation, &foundp);
   if (!foundp)
     return;
+  if (NILP (value))
+    return;
   if (! NUMBERP (value))
     {
       image_error ("Invalid image `:rotation' parameter");