From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: Re: [RFC] making image-dired thumbnail creation asynchronous Date: Fri, 16 Dec 2016 09:16:14 -0500 Message-ID: <20161216141614.GB1009@holos.localdomain> References: <87fulo8urt.fsf@udel.edu> <83mvfw8etl.fsf@gnu.org> <20161216131531.GA1009@holos.localdomain> <83d1gs7zpu.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1481897786 22235 195.159.176.226 (16 Dec 2016 14:16:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2016 14:16:26 +0000 (UTC) User-Agent: Mutt/1.7.2+8 (b112fd7061fb) (2016-11-26) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 16 15:16:22 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHtJ8-0005BS-4A for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 15:16:22 +0100 Original-Received: from localhost ([::1]:60767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHtJC-0004Xk-44 for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 09:16:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHtJ6-0004Xa-CB for emacs-devel@gnu.org; Fri, 16 Dec 2016 09:16:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHtJ3-0003c9-4f for emacs-devel@gnu.org; Fri, 16 Dec 2016 09:16:20 -0500 Original-Received: from mail-qk0-x22a.google.com ([2607:f8b0:400d:c09::22a]:36711) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cHtJ2-0003bL-Vj for emacs-devel@gnu.org; Fri, 16 Dec 2016 09:16:17 -0500 Original-Received: by mail-qk0-x22a.google.com with SMTP id n21so91564618qka.3 for ; Fri, 16 Dec 2016 06:16:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=A/t+itng9PWH3QomCoIsfY6bvglTcghqlzSvZxQSVhs=; b=G22xaXvijp38OOEnlwwjl0w5+zEanIRaUBp+FVSA4EAlRV2uPFXs4pogKtToDLFGFB xDGZVZoKLXiY5QZnk2r2rJR9yfkVxUW30zyJciXQFjmJEZvexRnaVvAN+O6bGCXrKgrV HBZhe/GUPGDmYCeIZkW0LB32ztgh5TAhZluqILL1GFuwbNN8zxJobx59BPrxOTYm62k+ lG45v9VeEDKZ1H10yMOBfeSuDnT2P6z33Lv+dws0FJazj3ANsVR7P7SGf6SJwA0XDRW1 /i0eTej3HTEtn61YZnnLOEkpe7aMsd5+hARVk4i+dah3coAxLQRKfIjzDtOscHXat4uB VBYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=A/t+itng9PWH3QomCoIsfY6bvglTcghqlzSvZxQSVhs=; b=YhYZeTE9i8sPW2fvmwd/QBjywKMFMJ+1i7/aPJZMNVP9O5XLtMbhpkh+k8dbXaiglK RNkQ2E9IlgkK0LE8GSbYkBtFfU4tVKazNuqb/6oEySSszZcwIBiQENCERRppdNqP0rFV 2IGM2lyRQWyqv3wRgz+2a2UkvXWVJZJeu5hSSUxcZ03QRVQwlv+uO48TDWDMAtk+gblm ISkwgOV1VzflzRkRKrBWdyEhQ2B/p2gBs9eX8+Cjvil2cHOlhhiSIlPC6hnuwzQhLrA4 UXS5AiwPWKPqU6gYvdegYe2P5LnYKTzzXGNawtDPR4JY31a/RS89UDkPZ2lwuX3DbXSC vQsQ== X-Gm-Message-State: AIkVDXL1AIS3+p+bo4iVez/dkm1psKL6L2uu9rVd213kJ5L6LOnf2pDFykIScg7uP1d42DZ7 X-Received: by 10.55.16.67 with SMTP id a64mr3357034qkh.215.1481897776396; Fri, 16 Dec 2016 06:16:16 -0800 (PST) Original-Received: from holos.localdomain ([69.250.222.218]) by smtp.gmail.com with ESMTPSA id a81sm3770823qkg.28.2016.12.16.06.16.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Dec 2016 06:16:15 -0800 (PST) Original-Received: by holos.localdomain (Postfix, from userid 1000) id E88A666151; Fri, 16 Dec 2016 09:16:14 -0500 (EST) Content-Disposition: inline In-Reply-To: <83d1gs7zpu.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210510 Archived-At: On 16/12/16 at 03:47pm, Eli Zaretskii wrote: > > Date: Fri, 16 Dec 2016 08:15:31 -0500 > > From: Mark Oteiza > > 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.