From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [RFC] making image-dired thumbnail creation asynchronous Date: Fri, 16 Dec 2016 15:47:25 +0200 Message-ID: <83d1gs7zpu.fsf@gnu.org> References: <87fulo8urt.fsf@udel.edu> <83mvfw8etl.fsf@gnu.org> <20161216131531.GA1009@holos.localdomain> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1481896147 16035 195.159.176.226 (16 Dec 2016 13:49:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2016 13:49:07 +0000 (UTC) Cc: emacs-devel@gnu.org To: Mark Oteiza Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 16 14:49:02 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 1cHssg-0003GI-C1 for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 14:49:02 +0100 Original-Received: from localhost ([::1]:60616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHssk-0004sx-R7 for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 08:49:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHss4-0004nq-3O for emacs-devel@gnu.org; Fri, 16 Dec 2016 08:48:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHsrz-0001Yx-O2 for emacs-devel@gnu.org; Fri, 16 Dec 2016 08:48:24 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHsrz-0001Yr-KX; Fri, 16 Dec 2016 08:48:19 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2744 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cHsrx-0008Em-CM; Fri, 16 Dec 2016 08:48:19 -0500 In-reply-to: <20161216131531.GA1009@holos.localdomain> (message from Mark Oteiza on Fri, 16 Dec 2016 08:15:31 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:210508 Archived-At: > 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.