Subject: Re: bug#76761: 31.0.50; Image icons from 'icons.el' could be accidentally dropped

From: Eli Zaretskii <[email-masked]>
Date: Wed, 05 Mar 2025 15:47:56 +0200

> From: Pengji Zhang <[email-masked]>
> Date: Wed, 05 Mar 2025 18:10:38 +0800
> 
> Currently in 'icons.el' image icons returned by 'icon-string' is a space
> with a display property (see 'icons--create'). However, IMO it is common
> to stripped spaces, and that means the icon could be accidentally
> removed. For example,
> 
>   - Run 'emacs -Q'
>   - Evaluate the following snippet:
> 
> --8<---------------cut here---------------start------------->8---
> (require 'outline) ; for the icon
> (setopt mode-line-compact t)
> (setf global-mode-string
>       '("" (:eval (icon-string 'outline-open)) " "))
> (force-mode-line-update t)
> --8<---------------cut here---------------end--------------->8---
> 
> Notice that the down arrow icon does not show at all in the mode line
> due to 'mode-line-compact'.
> 
> I suppose an easy fix is to use a non-space character. WDYT?

Isn't that rather a bug in mode-line-compact?  It shouldn't remove
spaces which have 'display' properties on them, since they are not
"empty space" on the mode line.