]> code.delx.au - gnu-emacs/blobdiff - lisp/image-mode.el
* tramp.texi (top) [xxx, yyy, trampfn]: Provide two versions of
[gnu-emacs] / lisp / image-mode.el
index 4ac62fbb6fc9b504d98b4ae4507fb0ce207ac212..a95dde1d999cb13175d649b6a1f20ab802b57d0a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; image-mode.el --- support for visiting image files  -*- lexical-binding: t -*-
 ;;
-;; Copyright (C) 2005-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2013 Free Software Foundation, Inc.
 ;;
 ;; Author: Richard Stallman <rms@gnu.org>
 ;; Keywords: multimedia
@@ -63,8 +63,9 @@ otherwise it defaults to t, used for times when the buffer is not displayed."
   (when cleanup
     (setq image-mode-winprops-alist
          (delq nil (mapcar (lambda (winprop)
-                             (if (window-live-p (car-safe winprop))
-                                 winprop))
+                             (let ((w (car-safe winprop)))
+                               (if (or (not (windowp w)) (window-live-p w))
+                                   winprop)))
                            image-mode-winprops-alist))))
   (let ((winprops (assq window image-mode-winprops-alist)))
     ;; For new windows, set defaults from the latest.
@@ -746,8 +747,14 @@ close to a multiple of 90, see `image-transform-right-angle-fudge'."
            h)))))
 
 (defun image-transform-check-size ()
-  "Check that the image exactly fits the width/height of the window."
-  (unless (numberp image-transform-resize)
+  "Check that the image exactly fits the width/height of the window.
+
+Do this for an image of type `imagemagick' to make sure that the
+elisp code matches the way ImageMagick computes the bounding box
+of a rotated image."
+  (when (and (not (numberp image-transform-resize))
+            (boundp 'image-type)
+            (eq image-type 'imagemagick))
     (let ((size (image-display-size (image-get-display-property) t)))
       (cond ((eq image-transform-resize 'fit-width)
             (cl-assert (= (car size)