all messages for Emacs-related lists mirrored at yhetil.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 09:16:14 -0500	[thread overview]
Message-ID: <20161216141614.GB1009@holos.localdomain> (raw)
In-Reply-To: <83d1gs7zpu.fsf@gnu.org>

On 16/12/16 at 03:47pm, Eli Zaretskii wrote:
> > Date: Fri, 16 Dec 2016 08:15:31 -0500
> > From: Mark Oteiza <mvoteiza@udel.edu>
> > Cc: emacs-devel@gnu.org
> > 
> > @@ -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	other threads:[~2016-12-16 14:16 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
2016-12-16 13:47     ` Eli Zaretskii
2016-12-16 14:16       ` Mark Oteiza [this message]
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

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

  git send-email \
    --in-reply-to=20161216141614.GB1009@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 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.