unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David Ponce <da_vid@orange.fr>
To: 66846@debbugs.gnu.org
Subject: bug#66846: 30.0.50; unexpected behavior of icon with non-existing image file?
Date: Tue, 31 Oct 2023 16:28:21 +0100	[thread overview]
Message-ID: <89c6f6a5-d35e-4363-a04a-995dab69a361@orange.fr> (raw)
In-Reply-To: <6a6a88f4-dc7c-44a4-9f09-5b3f184df971@orange.fr>

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)))







  reply	other threads:[~2023-10-31 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 12:29 bug#66846: 30.0.50; unexpected behavior of icon with non-existing image file? David Ponce
2023-10-31 15:28 ` David Ponce [this message]
2023-11-03  9:49   ` David Ponce
2024-01-05 17:45 ` David Ponce
2024-01-06 11:28   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89c6f6a5-d35e-4363-a04a-995dab69a361@orange.fr \
    --to=da_vid@orange.fr \
    --cc=66846@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).