Subject: Re: bug#33990: 27.0.50; image-transform-fit-to-height/-width violates assert

From: Eli Zaretskii <[email-masked]>
Date: Sat, 19 Jan 2019 10:29:11 +0200

> From: Benjamin Riefenstahl <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 15 Jan 2019 22:38:40 +0100
> 
> Eli Zaretskii writes:
> > Can you propose a patch that would implement your suggestion?
> 
> It looks like my analysis was wrong.  The problem is rather that
> create-image applies a default scaling, when :scale is not given.  This
> depends on the font size (only if char-width > 10 pixels), which
> explains why it happens on my laptop but not on my desktop machine.  I
> guess create-image is targeting image resources like toolbar buttons,
> where it may be a good idea to scale the images with the fonts for
> so-called "hidpi" displays.  But for image-mode the situation is
> different and I at least do not want that behaviour.
> 
> I attach three patches, the first is a minimal change that fixes the
> problem for me.  The second adds to the doc string of create-image,
> because I think that its behaviour is unexpected enough to warrant
> highlighting.  The third makes the image-mode transform parameters
> buffer-local, because that seems more appropriate and even complies with
> the doc string form image-transform-rotation better.  This third patch
> changes behaviour, though, so maybe a second opinion is in order.
> 
> The patches are against master, I haven't tested if they apply against
> emacs-26.  Let me know if there is something that needs to be changed.

Thanks, this LGTM.  I will wait for a few days for comments, and pushd
these if no objections are heard.

I understand these are not recent regressions?  If so, I think the
master branch is where they should go.  But if you think the bug is
grave enough, I could consider them for the emacs-26 branch instead.