unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [RFC] making image-dired thumbnail creation asynchronous
Date: Fri, 16 Dec 2016 08:15:31 -0500	[thread overview]
Message-ID: <20161216131531.GA1009@holos.localdomain> (raw)
In-Reply-To: <83mvfw8etl.fsf@gnu.org>

On 16/12/16 at 10:21am, Eli Zaretskii wrote:
> > From: Mark Oteiza <mvoteiza@udel.edu>
> > 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	other threads:[~2016-12-16 13:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16  2:36 [RFC] making image-dired thumbnail creation asynchronous Mark Oteiza
2016-12-16  8:21 ` Eli Zaretskii
2016-12-16 13:15   ` Mark Oteiza [this message]
2016-12-16 13:47     ` Eli Zaretskii
2016-12-16 14:16       ` Mark Oteiza
2016-12-17  3:42         ` [PATCH] " Mark Oteiza

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20161216131531.GA1009@holos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).