]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid point movement when visiting image files
authorEli Zaretskii <eliz@gnu.org>
Tue, 16 Feb 2021 16:20:06 +0000 (18:20 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 16 Feb 2021 16:20:06 +0000 (18:20 +0200)
* lisp/image-mode.el (image-toggle-display-image): Preserve point
around the call to exif-parse-buffer, to prevent it from moving
into the image data.  (Bug#46552)

lisp/image-mode.el

index aee91ee8b21c7fb1fe13ab7308e82a8656af2918..24be008f3f76ebfaf7f7bb0a66c470352062e2aa 100644 (file)
@@ -829,7 +829,9 @@ was inserted."
       (setq image-transform-rotation
             (or (exif-orientation
                  (ignore-error exif-error
-                   (exif-parse-buffer)))
+                   ;; exif-parse-buffer can move point, so preserve it.
+                   (save-excursion
+                     (exif-parse-buffer))))
                 0.0)))
     ;; Swap width and height when changing orientation
     ;; between portrait and landscape.