GNU bug report logs - #73231
30.0.91; image-dired cannot be operated until all thumbnails are created (MS-Windows)

Previous Next

Package: emacs;

Reported by: AKIYAMA Kouhei <misohena <at> gmail.com>

Date: Fri, 13 Sep 2024 15:30:02 UTC

Severity: normal

Found in version 30.0.91

Full log


Message #35 received at 73231 <at> debbugs.gnu.org (full text, mbox):

From: AKIYAMA Kouhei <misohena <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 73231 <at> debbugs.gnu.org
Subject: Re: bug#73231: 30.0.91; image-dired cannot be operated until all
 thumbnails are created (MS-Windows)
Date: Sun, 15 Sep 2024 16:32:34 +0900
> > By the way, why didn't you include the option to use
> > w32image-create-thumbnail in image-dired-cmd-create-thumbnail-program?
> > In other words, wouldn't it have been okay to define it like this:
> >
> > (defcustom image-dired-cmd-create-thumbnail-program
> >   (cond
> >    ((executable-find "gm") "gm")
> >    ((and (not (image-dired--probe-thumbnail-cmd "convert"))
> >          (fboundp 'w32image-create-thumbnail))
> >     'built-in-function)
> >    (t "convert"))
> >   "..."
> >   :type (if (fboundp 'w32image-create-thumbnail)
> >             '(choice (const built-in-function) file)
> >           'file)
> >   :version "29.1")
>
> This causes trouble for run-time tests, because a defcustom is
> evaluated only once, when the package is loaded by Emacs.

What are the trouble for runtime tests? If this is implemented,
obviously no check for the existence of the command will be performed
at runtime. If necessary, the user can change the settings of the
program that creates thumbnails by themselves (after installing
ImageMagick or GraphicsMagick). In other words, first create
thumbnails with the built-in function (w32image-create-thumbnail), and
if a user is dissatisfied with them, they can install either
ImageMagick or GraphicsMagick and specify the program they installed
via M-x customize-variable
image-dired-cmd-create-thumbnail-program. Isn't this the same for most
other parts of Emacs? For example, if a user is dissatisfied with grep
and installs ripgrep, they will have to manually change grep-command
themselves. Isn't it the same? Why does Emacs automatically determine
the thumbnail creation method without the user's permission?

> > This way, even if convert is installed, users who want to try the
> > w32image-create-thumbnail function can explicitly select it.
>
> I didn't expect users who have ImageMagick installed to want to use
> w32image-create-thumbnail.  If we hear enough requests for that, we
> might need to reconsider.

If the quality of ImageMagick is bad as you say, the convert command
may have a bug that makes it impossible to convert some images. Also,
if w32image-create-thumbnail is improved in the future (at least if
the aspect ratio and rotation are resolved), people will want to use
it. It seems that w32image-create-thumbnail is faster in many
cases. To be honest, I don't understand why you want to prioritize the
even more legacy command of ImageMagick, which you dislike.

> > > > > I'm open to ideas.  ("Queue length is 0" would mean you don't test
> > > > > when a new image directory is visited, right?
> > > >
> > > > This is incorrect. The "queue" being referred to here is the
> > > > image-dired-queue. In other words, while there are pending conversion
> > > > jobs, no checks are made, but once the conversion jobs are cleared,
> > > > the check is performed the next time a conversion job is added.
> > >
> > > The scenario I had in mind was that the user installs ImageMagick,
> > > then visits a directory with images.  In this case, the queue will not
> > > be empty, so Emacs would not check for the availability of 'convert',
> > > which is not what the user will expect.
> >
> > Sorry, I don't quite understand this. So you start Emacs, then install
> > ImageMagick, then go to the directory with the images and run M-x
> > image-dired, etc.? Of course the queue is empty at first.
>
> No, not AFAIU, because the moment you invoke image-dired, it starts
> thumbnail creation.  So by the time you get to the test, the queue
> is already not empty.

Ah, sorry. That was a mistake on my part. The queue is definitely not
empty when queue-run is first called. Checking whether the queue is
empty would be meaningless unless it is done before the first job is
added to the queue. Or I need to use the approach you showed.

> Maybe we should simply have a command to check whether an external
> tool is installed, and then thumbnail creation will use the results
> of that check.  The variable that holds the result of the check
> could be initialized to 'unknown, in which case the first thumbnail
> creation will perform the check and set the variable to either nil
> or t.  This will probably be simpler, although it will now be up to
> the user to invoke the command manually if ImageMagick is installed
> while an Emacs sessions runs.

So when the queue is empty, just after the last of the series of
thumbnails has been created, we set it back to 'unknown.




This bug report was last modified 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.