all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: AKIYAMA Kouhei <misohena@gmail.com>
Cc: 73231@debbugs.gnu.org
Subject: bug#73231: 30.0.91; image-dired cannot be operated until all thumbnails are created (MS-Windows)
Date: Sat, 14 Sep 2024 14:38:45 +0300	[thread overview]
Message-ID: <8634m2h3cq.fsf@gnu.org> (raw)
In-Reply-To: <CAAo_Hv90GUbA7wm_v8gLGeRAULjmis27YLuFsBpGDFZVvi41JA@mail.gmail.com> (message from AKIYAMA Kouhei on Sat, 14 Sep 2024 20:18:04 +0900)

> From: AKIYAMA Kouhei <misohena@gmail.com>
> Date: Sat, 14 Sep 2024 20:18:04 +0900
> Cc: 73231@debbugs.gnu.org
> 
> > The error message cannot be suppressed, at least not literally,
> > because it comes from the bowels of the display engine.  Whenever
> > Emacs is requested to display a non-existent file, the display
> > engine will always emit this message, and rightfully so.  The
> > message is not specific to image-dired in any way, it is a generic
> > message, and we do want to keep it for other cases where Emacs is
> > requested to display images that don't exist, e.g., because their
> > file names were misspelled.
> 
> I was surprised when I saw the implementation of image-dired. It's
> okay to specify an image file that doesn't yet exist! And then it
> calls clear-image-cache later to prompt a reload. I don't think I
> would have thought of that.
> 
> I would like to confirm one thing: specifying an image file that does
> not yet exist in the display text property is a supported usage,
> right?

No, it isn't.  An image file specified in a 'display' property should
already exist.  The fact that you don't see any serious consequences
when the file does not exist is that the display code catches any
errors and recovers after logging the error message in *Messages*, but
this is generally deemed as a bug that needs to be fixed in the Lisp
program which caused that.

> I fully understand wanting to keep the message for diagnostic
> purposes. However, I feel that it is going too far to uniformly issue
> an error when specifying a non-existent image file is a normal
> usage. Is it possible to provide a way to suppress the message by
> adding some text property, image descriptor property, or some other
> form?

We could perhaps do that, but I'm not sure we should.  It seems to be
a way to exonerate unclean Lisp programming.

> > The way to fix this is to change the algorithm of image-dired's
> > display of thumbnails so that it specifies the images to display in
> > JIT manner, perhaps using the jit-lock machinery or something
> > similar. When this is done, the fallback code that uses internal
> > Windows APIs could also be modified to avoid the delays I've
> > introduced in order to avoid these error messages.
> 
> >From a simple perspective, it seems that there is no need to specify
> an image for the display property of thumbnails that haven't been
> created yet (ideally, something like a creating indicator text or
> image could be displayed instead). After creation is complete, the
> display property can be changed. In other words, when an thumbnail
> image is created in image-dired-create-thumb-1 or
> image-dired-create-thumb-2, the text property is changed instead of
> clear-image-cache (a method is also needed to determine the text
> position corresponding to the image file name). If an ordinary
> programmer were to create something like image-dired, this seems like
> a reasonable approach, so is there any particular inconvenience that
> led to the current implementation?

This could also be am okay implementation.

> Is a mechanism like jit-lock really necessary?

Not necessary, no.  I just mentioned it as an existing infrastructure
that could be used in this case.

> I'm not sure of the exact timing of when images added outside of the
> visible area are loaded.

They are loaded when Emacs is about to display them, or slightly
before that.  When redisplay kicks in, it usually examines the portion
of the buffer that is slightly more than what will be shown in the
window.

> I've heard that ImageMagick has had some issues in the past. I imagine
> you've had a lot of difficulties.
> 
> I really like the way Emacs tries to do everything on its own. I think
> it would be great if in the future it were possible to create
> thumbnails on all platforms using only Emacs.
> 
> However, this is not about building it with Emacs, but only about
> using it as an external command. Isn't it outdated that convert is the
> current default? Rather than using convert, wouldn't it be better to
> use magick and have convert and gm available as options?

MS-Windows users of Emacs are unlikely to have 'convert' unless they
have an Emacs compiled with ImageMagick support.  It's possible, of
course, just not likely.

> > 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.

> The second idea is to perform the check just once when the user
> executes the command to add thumbnails. This is perfectly reasonable
> since the user would expect thumbnails to be added based on the
> current setup at that moment.

Yes, that'd be reasonable as well.  But note that a user could add
thumbnails while some thumbnails are already being created...

> > This assumes the typical (and IMNSHO incorrect) way of installing
> > stuff on Windows, whereby each package is installed into its own
> > directory, which then requires to add some subdirectory to PATH.
> > A much better way of installing packages is to have a single bin
> > directory for all the executables and shared libraries, like on a
> > typical Unix system.  In that case, not PATH adjustment is ever
> > needed.
> 
> I feel like that idea is a little too tied to the Unix way.

Maybe so, but it's much simpler in practice (all the programs work
together in unison seamlessly), and Emacs is a Unix program after all,
so it already uses a lot of Unix conventions, like the bin/, lib/, and
libexec/ directories where it installs its files.





  reply	other threads:[~2024-09-14 11:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13 13:07 bug#73231: 30.0.91; image-dired cannot be operated until all thumbnails are created (MS-Windows) AKIYAMA Kouhei
2024-09-13 16:02 ` Eli Zaretskii
2024-09-14  0:25   ` AKIYAMA Kouhei
2024-09-14  6:47     ` Eli Zaretskii
2024-09-14 11:18       ` AKIYAMA Kouhei
2024-09-14 11:38         ` Eli Zaretskii [this message]
2024-09-15  1:25           ` AKIYAMA Kouhei
2024-09-15  6:24             ` Eli Zaretskii
2024-09-15  7:32               ` AKIYAMA Kouhei
2024-09-15  8:05                 ` Eli Zaretskii
2024-09-15  9:33                   ` AKIYAMA Kouhei
2024-09-15  9:45                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8634m2h3cq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73231@debbugs.gnu.org \
    --cc=misohena@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.