From c977370dd734be12ffbaf0da2f3db529d6175b62 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 16 Feb 2021 18:20:06 +0200 Subject: [PATCH] Avoid point movement when visiting image files * 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index aee91ee8b21..24be008f3f7 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -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.