]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't resize images in image-mode if we have a rotation
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 16 Feb 2021 13:00:55 +0000 (14:00 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 16 Feb 2021 13:00:55 +0000 (14:00 +0100)
* lisp/image-mode.el (image-fit-to-window): Don't resize of we
have a manually rotated imaged (and explain the resizing logic a
bit).

lisp/image-mode.el

index 9ed295e2aa18608f37b0c14c2daabc9e37c28a6e..ec0a559c8dba5e9bbd6eef68d0dee28f10c9cb5c 100644 (file)
@@ -985,7 +985,13 @@ Otherwise, display the image by calling `image-mode'."
                    (edges (window-inside-pixel-edges window))
                    (window-width  (- (nth 2 edges) (nth 0 edges)))
                    (window-height (- (nth 3 edges) (nth 1 edges))))
+              ;; If the size has been changed manually (with `+'/`-'),
+              ;; then :max-width/:max-height is nil.  In that case, do
+              ;; no automatic resizing.
               (when (and image-width image-height
+                         ;; Don't do resizing if we have a manual
+                         ;; rotation (from the `r' command), either.
+                         (not (plist-get (cdr spec) :rotation))
                          (or (not (= image-width  window-width))
                              (not (= image-height window-height))))
                 (unless image-fit-to-window-lock