From 04a3bc1cf9b3c2685c3edba1e0f792d8f28de6b2 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Thu, 23 Feb 2023 16:42:48 +0100 Subject: [PATCH] Defaults to zero for image-dired--number-of-thumbnails (bug#61734) * lisp/image/image-dired.el (image-dired--number-of-thumbnails): Defaults to zero to avoid wrong type error down the line. (image-dired-delete-char): Update thumbnails counter upon deletion. --- lisp/image/image-dired.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 8e2a75a418f..2c2968b1b49 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -546,7 +546,7 @@ image-dired--line-up-with-method (t (image-dired-line-up-dynamic)))) -(defvar-local image-dired--number-of-thumbnails nil) +(defvar-local image-dired--number-of-thumbnails 0) ;;;###autoload (defun image-dired-display-thumbs (&optional arg append do-not-pop) @@ -1127,9 +1127,11 @@ image-dired-delete-char "Remove current thumbnail from thumbnail buffer and line up." (interactive nil image-dired-thumbnail-mode) (let ((inhibit-read-only t)) - (delete-char 1)) + (delete-char 1) + (cl-decf image-dired--number-of-thumbnails)) (let ((pos (point))) (image-dired--line-up-with-method) + (image-dired--update-header-line) (goto-char pos))) (defun image-dired-line-up () -- 2.39.1