emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 466d1c98a9e: Fix icons.el when icon does not exist as a file


From: Eli Zaretskii
Subject: emacs-29 466d1c98a9e: Fix icons.el when icon does not exist as a file
Date: Sat, 6 Jan 2024 06:27:30 -0500 (EST)

branch: emacs-29
commit 466d1c98a9ef7490332469165f63a38c2b07a05d
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix icons.el when icon does not exist as a file
    
    * lisp/emacs-lisp/icons.el (icons--create): Handle the case when
    ICON is a file that doesn't exists or is unreadable.  Suggested by
    David Ponce <da_vid@orange.fr>.  (Bug#66846)
---
 lisp/emacs-lisp/icons.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el
index a35a00ec1f3..1fc0e39f9fe 100644
--- a/lisp/emacs-lisp/icons.el
+++ b/lisp/emacs-lisp/icons.el
@@ -187,11 +187,13 @@ present if the icon is represented by an image."
   merged)
 
 (cl-defmethod icons--create ((_type (eql 'image)) icon keywords)
-  (let ((file (if (file-name-absolute-p icon)
-                  icon
-                (and (fboundp 'image-search-load-path)
-                     (image-search-load-path icon)))))
-    (and (display-images-p)
+  (let* ((file (if (file-name-absolute-p icon)
+                   icon
+                 (and (fboundp 'image-search-load-path)
+                      (image-search-load-path icon))))
+         (file-exists (and (stringp file) (file-readable-p file))))
+    (and file-exists
+         (display-images-p)
          (fboundp 'image-supported-file-p)
          (image-supported-file-p file)
          (propertize



reply via email to

[Prev in Thread] Current Thread [Next in Thread]