> From: Evgeny Zajcev <lg.zevlg@gmail.com>
> Date: Thu, 23 Jan 2025 10:10:05 +0300
>
> I'm having problem displaying an image slice in the right margin. To
> reproduce this, download
> https://www.gnu.org/software/emacs/images/emacs.png to your ~/Downloads
> folder. Activate right margin with M-x visual-fill-column RET. And consider three pieces of code:
>
> 1. (insert
> (propertize "E" 'display `((slice 0 0 1.0 20) ,(create-image
> "~/Downloads/emacs.png" nil nil :scale 1.0))))
>
> Displays image slice in the buffer as expected.
>
> 2. (insert
> (propertize "E" 'display `((margin right-margin) ,(create-image
> "~/Downloads/emacs.png" nil nil :scale 1.0))))
>
> Displays image in the right margin as expected.
>
> 3. (insert
> (propertize "E" 'display `((margin right-margin)
> ((slice 0 0 1.0 20)
> ,(create-image "~/Downloads/emacs.png" nil nil :scale 1.0)))))
>
> Displays "E"
>
> Documentation say that ((margin right-margin) SPEC) can be used to
> display image in the right margin, and SPEC is totally valid in the
> 3. because 2. works.
>
> Is this a bug?
You need to construct the display property in a different order:
(insert
(propertize "E" 'display
`((slice 0 0 1.0 20)
((margin left-margin)
,(create-image "~/Downloads/emacs.png"
nil nil :scale 1.0)))))
This works perfectly! Thanks for your reply and comprehensive explanation