From: Peter Münster Date: Wed, 28 Sep 2022 23:25:10 +0000 (+0200) Subject: image-dired-delete-char: Don't disturb formatting X-Git-Tag: emacs-29.0.90~1856^2~141 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1457c231b52ea2c1694b7564f824b3a61d0e0fe1;p=emacs.git image-dired-delete-char: Don't disturb formatting * lisp/image/image-dired.el (image-dired-delete-char): Don't disturb the expected formatting of the thumbnail buffer (always one space/newline after a thumbnail). --- diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index f4ae6e9bfda..661fa9dec18 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -460,7 +460,8 @@ and IMAGE-NUMBER." (defmacro image-dired--with-marked (&rest body) "Eval BODY with point on each marked thumbnail. If no marked file could be found, execute BODY on the current -thumbnail." +thumbnail. It's expected that a thumbnail is always followed +by exactly one space or one newline character." `(with-current-buffer image-dired-thumbnail-buffer (let (found) (save-mark-and-excursion @@ -1113,9 +1114,10 @@ With a negative prefix argument, prompt user for the delay." "Remove current thumbnail from thumbnail buffer and line up." (interactive nil image-dired-thumbnail-mode) (let ((inhibit-read-only t)) - (delete-char 1) - (when (= (following-char) ?\s) - (delete-char 1)))) + (delete-char 1)) + (let ((pos (point))) + (image-dired--line-up-with-method) + (goto-char pos))) (defun image-dired-line-up () "Line up thumbnails according to `image-dired-thumbs-per-row'. @@ -1364,7 +1366,9 @@ for deletion instead." '(face image-dired-thumb-mark)))))) (defun image-dired--thumb-update-marks () - "Update the marks in the thumbnail buffer." + "Update the marks in the thumbnail buffer. +It's expected, that a thumbnail is always followed +by exactly one space or one newline character." (when image-dired-thumb-visible-marks (with-current-buffer image-dired-thumbnail-buffer (save-mark-and-excursion