iqbalansari / emacs-emojify

Display emojis in Emacs
GNU General Public License v3.0
413 stars 40 forks source link

Lines with emojis do not get scaled down in minimap #69

Open xmacex opened 4 years ago

xmacex commented 4 years ago

Thanks for a nice package, this brings me joy 😹 . Lines with emojis are displayed full-height in minimap. Do tiny teeny emojis even make sense at all? Or would this more appropriately be addressed over at @dengste's minimap repo?

Screenshot 2020-05-02 at 14 43 11

Would this be a matter of something like

(add-hook 'mini-map-mode
    '(lambda ()
        (emojify-mode -1)))
iqbalansari commented 4 years ago

Hello @xmacex. thanks for the bug report, unfortunately minimap uses indirect buffers to render the minimap and as per Elisp manual, indirect buffers share text properties with their base buffer. Which means that the display text property that emojify uses to render emojis cannot be changed in the minimap without also affecting the original buffer. So the approach you suggested might not work. Let me see if there is some way to workaround this

dengste commented 4 years ago

Yes, indirect buffers always share text properties, but you can change display in the indirect buffer through overlays. This is also how Minimap makes the text small without affecting the original buffer. Some overlays are explicitly synced, though: the 'invisible property (otherwise hidden text would appear in the minimap) and 'face, so that you can see font-lock in the minimap. This is controlled through 'minimap-sync-overlay-properties'. I haven't looked at emacs-emojify, but maybe the sync of 'face' is actually the problem - you could remove this temporarily and see what happens. If this is not the case, we probably could scale the emojis down through an additional overlay.

iqbalansari commented 4 years ago

Hello @dengste, thanks for looking into this. The issue is with the display text property, emojify uses it to render emojis as images.

Thanks a lot for the suggestions, especially about the overlays. I am currently trying to use overlays to hide emojis (basically using a separate display overlay property). But the suggestion to downscale emojis seems interesting, I am wondering though how it can be achieved using an overlay, my understanding is that if I set a display property via an overlay it completely overrides the display text property without affecting it, am I missing something, is there a way to downscale image rendered via display text property using overlays?

dengste commented 4 years ago

Yes, maybe scaling is not possible, I don't know. Hiding the emojis would probably be the next best thing. I guess it would make sense that minimap simply hides all images by default.

iqbalansari commented 4 years ago

Okay thanks will double check on the scaling. And yes hiding images seems to be a sensible default for minimap, since a misplaced image might interfere with minimap's functionality.

Also on emojify side, I am thinking I will try displaying emoji using overlay properties instead of text properties. I initially decided to go with text properties because the manual cautions about overlays being inefficient to manage when they are large numbers. But I guess text properties might cause additional problems with indirect buffers