Subject: bug#16839: 24.3.50; image-mode-fit-frame fails to use all display space with image larger than display

From: [email-masked] (N. Jackson)
Date: Thu, 03 Mar 2016 17:21:03 -0400

At 21:00 -0400 on Friday 2014-02-21, N. Jackson wrote:
>
> Recipe:
> =======
> This recipe requires an image file bigger than the display (I used
> a 2048 x 1536 pixel JPEG file on a display with a resolution of
> 1366 x 768).
>
> 1. emacs -Q
> 2. C-x C-f big-image.jpg
> 3. M-x image-mode-fit-frame

Just a quick update on this bug report.

The recipe I provided above doesn't work on Emacs 25 (currently
testing on the second pretest 25.0.92) because it seems that images
are now shrunk to fit into the frame when they are opened.

In any case the image-mode-fit-frame function still seems to be
broken. The documented behaviour is:

    If called interactively, or if TOGGLE is non-nil, toggle between
    fitting FRAME to the current image and restoring the size and
    window configuration prior to the last ‘image-mode-fit-frame’
    call.

The toggling makes it slightly confusing to figure out what's going
on but it seems that the function is only doing half of its job.

When it needs to adjust only the height of the frame and when it
needs to adjust only the width of the frame, the function seems to
work correctly. But when it needs to adjust both the height and the
width, it only adjusts the height and fails to adjust the width.