Subject: Re: bug#77384: 31.0.50; Image slice is ignored on mode/header/tab line

From: David Ponce <[email-masked]>
Date: Sun, 30 Mar 2025 17:44:18 +0200

On 2025-03-30 16:53, Eli Zaretskii wrote:
>> Date: Sun, 30 Mar 2025 16:01:14 +0200
>> From:  David Ponce via "Bug reports for GNU Emacs,
>>   the Swiss army knife of text editors" <[email-masked]>
>>
>> Following is a short recipe to eval in the *scratch-buffer*, that exhibits
>> the issue.  The expected sliced image is inserted in the current buffer,
>> but the whole image is displayed in the header line.
>>
>> (let* ((img (find-image '((:file "splash.svg"))))
>>          (size (image-size img t))
>>          (h (frame-char-height))
>>          (y (- (cdr size) h h h))
>>          (txt (propertize " " 'display (list img `(slice 0 ,y 0.5 ,h)))))
>>     (insert txt "\n")
>>     (setq header-line-format txt))
> 
> You need to do it the other way around:
> 
>    (let* ((img (find-image '((:file "splash.svg"))))
> 	  (size (image-size img t))
> 	  (h (frame-char-height))
> 	  (y (- (cdr size) h h h))
> 	  (txt (propertize " " 'display (list `(slice 0 ,y 0.5 ,h) img))))
>       (insert txt "\n")                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>       (setq header-line-format txt))
> 
> IOW, first slice, then the image spec.

Oh! I didn't even think to try that. It works perfectly now.
You can close this bug.

Thank you so much for your help, once again!

Have a great Sunday!