[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66846: 30.0.50; unexpected behavior of icon with non-existing image
From: |
David Ponce |
Subject: |
bug#66846: 30.0.50; unexpected behavior of icon with non-existing image file? |
Date: |
Tue, 31 Oct 2023 16:28:21 +0100 |
User-agent: |
Mozilla Thunderbird |
In fact, I wonder if a better implementation of the `icons--create'
method could be to delegate image creation to `find-image'?
Something like this:
(cl-defmethod icons--create ((_type (eql 'image)) icon keywords)
(when-let
((image
(find-image
`(( :file ,icon
,@(append
(if-let ((val (plist-get keywords :height)))
(list :height (if (eq val 'line)
(window-default-line-height)
val)))
(if-let ((val (plist-get keywords :width)))
(list :width (if (eq val 'font)
(default-font-width)
val)))
'(:scale 1)
(if-let ((val (plist-get keywords :rotation)))
(list :rotation val))
(if-let ((val (plist-get keywords :margin)))
(list :margin val))
(list :ascent (or (plist-get keywords :ascent)
'center))))))))
(propertize " " 'display image)))