Subject: Re: bug#61734: 30.0.50; [PATCH] Defaults to zero for image-dired--number-of-thumbnails

From: Manuel Giraud <[email-masked]>
Date: Mon, 27 Feb 2023 17:20:10 +0100

Eli Zaretskii <[email-masked]> writes:

[...]

> I only ever keep the last version, and it's certainly not for
> emacs-29.

Ok, sorry.  So here is the first version.
>>From c88f74aaa381580c183a8692bc467bfef7cd192b Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Thu, 23 Feb 2023 16:42:48 +0100
Subject: [PATCH] Defaults to zero for image-dired--number-of-thumbnails

* lisp/image/image-dired.el (image-dired--number-of-thumbnails):
Defaults to zero to avoid wrong type error down the line.
---
 lisp/image/image-dired.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 8e2a75a418f..6ecb307ce12 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)
-- 
2.39.1

> What do you want to install on emacs-29, and what problem(s) is that
> supposed to fix?

This fixes a "wrong type error" when comparing
image-dired--number-of-thumbnails to zero.  Here is a recipe to make it
happen:

    - Do not have an existing *image-dired* buffer
    - Hit 'C-t a' (image-dired-display-thumbs-append) on an image file
      from Dired

And you're right that the rest of the patch should not go into emacs-29.
-- 
Manuel Giraud