bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32672: 27.0.50; image resize on window resizing


From: Eli Zaretskii
Subject: bug#32672: 27.0.50; image resize on window resizing
Date: Thu, 27 Dec 2018 17:48:28 +0200

> From: Juri Linkov <juri@linkov.net>
> Date: Thu, 27 Dec 2018 01:42:54 +0200
> 
> +(defun image-window-change (window)
> +  (when (and (eq window (selected-window)) (derived-mode-p 'image-mode))
> +    (let ((spec (image-get-display-property)))
> +      (when (eq (car-safe spec) 'image)
> +        (let* ((image-width  (plist-get (cdr spec) :max-width))
> +               (image-height (plist-get (cdr spec) :max-height))
> +               (window-edges (window-inside-pixel-edges window))
> +               (window-width  (- (nth 2 window-edges) (nth 0 window-edges)))
> +               (window-height (- (nth 3 window-edges) (nth 1 window-edges))))
> +          (when (or (not (= image-width  window-width))
> +                    (not (= image-height window-height)))
> +            (image-toggle-display-image)))))))

What happoens in Emacs that was not built with Imagemagick?  Should we
perhaps do nothing in this hook in that case?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]