From f13300e84aecb89626eec6d62ce651270619a3e3 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 23 Sep 2022 17:31:23 +0200 Subject: [PATCH] Delete the correct region after cropping an image * lisp/image/image-crop.el (image-crop): Delete the correct region after editing (bug#58027). --- lisp/image/image-crop.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/image/image-crop.el b/lisp/image/image-crop.el index d17c2ae389b..8ec4679b9ba 100644 --- a/lisp/image/image-crop.el +++ b/lisp/image/image-crop.el @@ -176,7 +176,7 @@ After cropping an image, you can save it by `M-x image-save' or (point-max))))) (text (buffer-substring image-start image-end)) (inhibit-read-only t) - orig-data) + orig-data svg-end) (with-temp-buffer (set-buffer-multibyte nil) (if (null data) @@ -196,6 +196,7 @@ After cropping an image, you can save it by `M-x image-save' or (with-buffer-unmodified-if-unchanged (delete-region image-start image-end) (svg-insert-image svg) + (setq svg-end (point)) (let ((area (condition-case _ (save-excursion (forward-line 1) @@ -205,7 +206,7 @@ After cropping an image, you can save it by `M-x image-save' or (message (substitute-command-keys "Type \\[image-save] to save %s image to file") (if cut "cut" "cropped")) - (delete-region (pos-bol) (pos-eol)) + (delete-region image-start svg-end) (if area (image-crop--crop-image-update area orig-data size type cut text) -- 2.39.2