From: Lars Ingebrigtsen Date: Fri, 23 Sep 2022 15:31:23 +0000 (+0200) Subject: Delete the correct region after cropping an image X-Git-Tag: emacs-29.0.90~1856^2~293 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f13300e84aecb89626eec6d62ce651270619a3e3;p=emacs.git Delete the correct region after cropping an image * lisp/image/image-crop.el (image-crop): Delete the correct region after editing (bug#58027). --- 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)