From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: AKIYAMA Kouhei Newsgroups: gmane.emacs.bugs Subject: bug#73231: 30.0.91; image-dired cannot be operated until all thumbnails are created (MS-Windows) Date: Fri, 13 Sep 2024 22:07:48 +0900 Message-ID: <861q1n1z2z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7781"; mail-complaints-to="usenet@ciao.gmane.io" To: 73231@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 13 17:30:05 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sp8FI-0001m1-0F for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Sep 2024 17:30:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp8FA-0006uM-5g; Fri, 13 Sep 2024 11:29:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sp8F8-0006mh-9j for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 11:29:54 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sp8F7-00017k-GN for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 11:29:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=uF4/Ih0Cicp7GOITG9d+J8rVN7hBRUaK3iYIeRUuaGE=; b=mhTrDSxSbsxxHVJE7i1cELZ+nr1WtUZj3F4Q87FFu0UAOOuxb/no9sYO968Qv8tpdBFoZHONbaugU2eR4tf8RgMsaqc6tUwT4du77cqajLpYJBt0yzvOZ/RkcQBuefcuqwUncZxwBlSDmTuAZO28LjfYCHULbTCexEbQ46wjekliS9z/NNJuWkVndruymfpfP7oVWQyvQ/ErIqWSbaAhUunsp/cqmaFsox18Ol3u08sbaXGC5Z/vY4tCl2nWrWfB9y4peW7k7iuWoKPGqYTytGY6Bym6LQQOfKlcTjtffY9Iedg5csV3fOs13cR5/e/FoslRmG32RheJYL/0V6rCZQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sp8FG-0005wq-H4 for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 11:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: AKIYAMA Kouhei Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Sep 2024 15:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73231 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172624134422720 (code B ref -1); Fri, 13 Sep 2024 15:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Sep 2024 15:29:04 +0000 Original-Received: from localhost ([127.0.0.1]:44032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp8EJ-0005uJ-EN for submit@debbugs.gnu.org; Fri, 13 Sep 2024 11:29:04 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp61v-00052a-8b for submit@debbugs.gnu.org; Fri, 13 Sep 2024 09:08:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sp61l-00030w-SZ for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 09:07:57 -0400 Original-Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sp61j-0000ep-R3 for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 09:07:57 -0400 Original-Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-7191901abd6so655099b3a.3 for ; Fri, 13 Sep 2024 06:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726232873; x=1726837673; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=uF4/Ih0Cicp7GOITG9d+J8rVN7hBRUaK3iYIeRUuaGE=; b=Myg8zD1LomAckcqsIVJwKRLJFMM5tj3ntanZ2Gnl4XQBGbIzuqq3AWU7gIkDZ+5GSt hTEMu/JrTtoIUNmLzjimPVUZRbpdzOsU/rdrcpf2WTzqkJPoYFEweFjgDfGkM4Ci9kgI /YpG+D8rEnYy/bYIDJA9bD7tzk1gEjp8X/V1I2ECB4yQsEHSos0reWZ+nemsIxVrcYU1 W3qJS6CbXI6MBwGVxEsLZT/jVAlewAWKzjmw/I4eOi7a646U8Lraw5u8i5Kgo6jzepFJ LypWA51ol5U18BsIQjwc8cGouGFewHDs9JgYA88HNovG0CS8rKWxkiTcLqPA8UTPid2F bLjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726232873; x=1726837673; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uF4/Ih0Cicp7GOITG9d+J8rVN7hBRUaK3iYIeRUuaGE=; b=NvcHj+aXF0b3Bowu4Rtw6cMDVwXKQE3xFr+UmZWeaRJkjZ/fwkxXTXYj6BWJACAmOr agJi5PGw2bxnRlBBaNdAQfE66yQ22X+BDS4aik0j8chY7LrFcjUger6tYq5nnRokN/t6 1DUNzkke8hiXwgGmtsd8NNtsDZWwy0ALeu5WUoGCouOvv7zkg3KyXKa3kpssmDuFMSRf +k9hFUEt1S32+N+/XQ9BDH93CBHcHGar/D1Ll0byNASH4FBlLFj5kDSEn/1XvixPw0as O0SIrOhSsU+dClwSH16iWggoEHKnTJRBnaCZmMy9tBTmjPqe5bGcGVb8sYodnwC3Sv6g NifA== X-Gm-Message-State: AOJu0YxkUoxk46MGoBIoaGj6IWVYALCjJYHyBB79fLAdBsgG/VQTnNUk TADWjNhrlgj7V0GgS2vG0r3StC2KKLlwFLn0IgzrP/gasjw7rgJgOIc2RA== X-Google-Smtp-Source: AGHT+IEE4uu9Vms17N40kU5lkt+IB7qV5yShVerHZWpLXbTJYFp6UpGZ0yY5t0MYbtWlhRjX46sytw== X-Received: by 2002:a05:6a00:c89:b0:70a:fb91:66d7 with SMTP id d2e1a72fcca58-71936afab6cmr4192092b3a.20.1726232872430; Fri, 13 Sep 2024 06:07:52 -0700 (PDT) Original-Received: from YAMABUKI (pl934.ag1212.nttpc.ne.jp. [61.197.25.166]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-719090ad8d7sm6052716b3a.160.2024.09.13.06.07.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 06:07:51 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=misohena@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 13 Sep 2024 11:29:01 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291660 Archived-At: When using image-dired without ImageMagick or GraphicsMagick available, operations could not be performed until all thumbnails had been created. * Steps to reproduce 1. Open a command prompt (cmd.exe) 2. wget https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-30/emacs-30.0.91.zip 3. unzip emacs-30.0.91.zip 4. set PATH=c:\Windows\system32 (Make sure ImageMagick is not included) 5. .\bin\emacs -Q --init-directory=%CD%\.emacs.d (Start with a brand new .emacs.d) 6. C-x C-f RET ( contains 247 jpg files) 7. M-x image-dired RET RET 8. After 36 seconds, the *image-dired* buffer is open with all thumbnails converted. (The aspect ratio of the image will be ignored and it will not be rotated correctly, but that's a separate issue.) Let me compare it with my previous setup. I'm using MSYS2's magick.exe. 9. C-x C-c (exit emacs) 10. rmdir /S .emacs.d (Remove thumbnails) 11. .\bin\emacs -Q --init-directory=%CD%\.emacs.d 12. (setq image-dired-cmd-create-thumbnail-program "c:/msys64/ucrt64/bin/magick.exe" image-dired-cmd-create-thumbnail-options '("convert" "-auto-orient" "-define" "jpeg:size=%wx%h" "-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t")) 13. C-x C-f RET 14. M-x image-dired RET RET 15. After 5 seconds the *image-dired* buffer is opened. Only the first few thumbnails have been converted. 16. After 19 seconds (from start) all thumbnails have been converted and displayed. * Cause: The cause is the image-dired-thumb-queue-run function and the image-dired-create-thumb function that calls it. The image-dired-create-thumb function executes image-dired-thumb-queue-run with a delay using (run-at-time 0 nil #'image-dired-thumb-queue-run). Later, image-dired-thumb-queue-run is called all at once in succession. In the latter half of the image-dired-thumb-queue-run function, image-dired-create-thumb-2 is executed with a delay using (run-with-timer 0.05 nil #'image-dired-create-thumb-2 orig-file thumb-file). There is no limit to the number of timers, so a new timer is added even if one has already been scheduled. Therefore, all thumbnails are created continuously and without interruption. The number of seconds, 0.05, is not very meaningful. (I apologize if these behaviors were intended) * Solution: You can achieve a similar behavior by limiting the number of images when using the image-dired-create-thumb-2 function. I tried modifying the latter half of the image-dired-thumb-queue-run function as follows and tested it again. ;; We are on MS-Windows with ImageMagick/GraphicsMagick, and need to ;; generate thumbnails by our lonesome selves. (while (and image-dired-queue (< image-dired-queue-active-jobs 1)) (cl-incf image-dired-queue-active-jobs) (let* ((job (pop image-dired-queue)) (orig-file (car job)) (thumb-file (cadr job))) (run-with-timer 0.00 nil (lambda (a b) (cl-decf image-dired-queue-active-jobs) (image-dired-create-thumb-2 a b)) orig-file thumb-file))) As a result, the *image-dired* buffer appeared after 17 seconds, and all thumbnails were created after 34 seconds. The performance has dropped, but this is because image-dired--probe-thumbnail-cmd is slow. So I set it as follows to avoid matching "convert", and avoided the slow check process. (setq image-dired-cmd-create-thumbnail-program "") I tested it again, and the *image-dired* buffer appeared after 5 seconds, and all thumbnails were created after 7 seconds. This was faster than when I used the magick command (despite running it in multiple processes), and I got very good results. I think it's better not to call image-dired--probe-thumbnail-cmd too frequently. Recently, I have been increasingly using image-dired for organizing my photos. I look forward to seeing how image-dired continues to evolve. Thank you. ------- In GNU Emacs 30.0.91 (build 2, x86_64-w64-mingw32) of 2024-09-12 built on AVALON Windowing system distributor 'Microsoft Corp.', version 10.0.19045 System Description: Microsoft Windows 10 Enterprise (v10.0.2009.19045.4894) Configured using: 'configure --with-modules --without-dbus --with-native-compilation=aot --without-compress-install --with-tree-sitter --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB (NATIVE_COMP present but libgccjit not available) Important settings: value of $LANG: ja_JP.CP932 locale-coding-system: cp932 Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort emacsbug mail-extr message sendmail mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader cl-loaddefs cl-lib japan-util rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel touch-screen dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty move-toolbar make-network-process native-compile emacs) Memory information: ((conses 16 58721 16525) (symbols 48 6296 1) (strings 32 17245 3277) (string-bytes 1 453015) (vectors 16 10080) (vector-slots 8 252453 22466) (floats 8 32 648) (intervals 56 1127 635) (buffers 992 11)) -- # This report was created using machine translation. AKIYAMA Kouhei misohena@gmail.com