emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] making image-dired thumbnail creation asynchronous


From: Mark Oteiza
Subject: Re: [RFC] making image-dired thumbnail creation asynchronous
Date: Fri, 16 Dec 2016 09:16:14 -0500
User-agent: Mutt/1.7.2+8 (b112fd7061fb) (2016-11-26)

On 16/12/16 at 03:47pm, Eli Zaretskii wrote:
> > Date: Fri, 16 Dec 2016 08:15:31 -0500
> > From: Mark Oteiza <address@hidden>
> > Cc: address@hidden
> > 
> > @@ -868,10 +1004,9 @@ image-dired-display-thumbs
> >            (goto-char (point-max)))
> >          (dolist (curr-file files)
> >            (setq thumb-name (image-dired-thumb-name curr-file))
> > -          (if (and (not (file-exists-p thumb-name))
> > -                   (not (= 0 (image-dired-create-thumb curr-file 
> > thumb-name))))
> > -              (message "Thumb could not be created for file %s" curr-file)
> > -            (image-dired-insert-thumbnail thumb-name curr-file 
> > dired-buf))))
> > +          (when (not (file-exists-p thumb-name))
> > +            (image-dired-create-thumb curr-file thumb-name))
> > +          (image-dired-insert-thumbnail thumb-name curr-file dired-buf)))
> >        (if do-not-pop
> >            (display-buffer buf)
> >          (pop-to-buffer buf))
> > 
> > Here is the relevant hunk. image-dired-create-thumb is the starting
> > point for asynchronous thumbnail creation. At this point,
> > image-dired-insert-thumbnail is called immediately after invoking
> > image-dired-create-thumb, so in practice the buffer has already been
> > populated with images for files that potentially do not yet exist; i.e.
> > the buffer contents are already finished changing before thumbnails are
> > created.
> > 
> > There is currently nothing notifying Emacs once a thumbnail has been
> > created, but it would go somewhere in image-dired-create-thumb or one of
> > the functions its sentinel calls (the hunk previous to the one I pasted)
> 
> If the function that senses that the file was created re-inserts the
> thumbnail image into its buffer, redisplay will happen automatically.
> 
> AFAIK, we don't have any infrastructure for delayed loading of images
> that would do the above for you, but I guess something like that could
> be implemented based on file notifications.

Ah! I can call (clear-image-cache THUMB-FILE) in a sentinel and that
seems to do the right thing.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]