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 08:15:31 -0500
User-agent: Mutt/1.7.2+8 (b112fd7061fb) (2016-11-26)

On 16/12/16 at 10:21am, Eli Zaretskii wrote:
> > From: Mark Oteiza <address@hidden>
> > Date: Thu, 15 Dec 2016 21:36:38 -0500
> > 
> > The biggest problem right now is the aforementioned OOM killer problem:
> > that there is no notion of batching or scheduling and so potentially a
> > large number of "convert" processes get spun off.  I'm not sure yet how
> > I want to go about implementing that.
> 
> Would load-average help you?
> 
> Or we could add a function that returns the amount of free VM on the
> system.
> 
> Or you could arbitrarily limit the number of such processes to some
> small value.

The latter would probably be the easiest.

> > Also, is (redisplay) the right thing to call at the end a thumbnail's
> > creations so each of thumbnails get shown automatically as they are
> > created?
> 
> Please tell the details of how Emacs is notified about thumbnail
> creation (or point to the code which does that), because I don't see
> why you would need to explicitly trigger redisplay.  It should happen
> automatically whenever the buffer contents changes in any way that
> affects the displayed portion.

@@ -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)



reply via email to

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