From unknown Sat Jun 21 03:15:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#57961 <57961@debbugs.gnu.org> To: bug#57961 <57961@debbugs.gnu.org> Subject: Status: 29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on macOS Reply-To: bug#57961 <57961@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:15:07 +0000 retitle 57961 29.0.50; [PATCH] image-dired thumbnail generation fails for P= DFs on macOS reassign 57961 emacs submitter 57961 Daniel Mart=C3=ADn severity 57961 normal tag 57961 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 20 16:53:37 2022 Received: (at submit) by debbugs.gnu.org; 20 Sep 2022 20:53:37 +0000 Received: from localhost ([127.0.0.1]:59854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oakFM-0002BP-Qv for submit@debbugs.gnu.org; Tue, 20 Sep 2022 16:53:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:45434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oakFJ-0002BC-BK for submit@debbugs.gnu.org; Tue, 20 Sep 2022 16:53:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oakFI-0005O7-GA for bug-gnu-emacs@gnu.org; Tue, 20 Sep 2022 16:53:33 -0400 Received: from sonic311-31.consmr.mail.ir2.yahoo.com ([77.238.176.163]:45716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oakFE-0006gJ-LT for bug-gnu-emacs@gnu.org; Tue, 20 Sep 2022 16:53:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1663707202; bh=VNDQkMfeSg39FKZfoog+SqsSJ66tAeH5jMDsU8CSHKM=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=ABjuQZWQkpf90OVQbqJdL2KstDWYHEO4UZmXJ5fxtyd67Tp3w7RBtZ6KyKyFXK98I2Q3AOrY45B/lE9VSfMBy2LkzKTmtVm8gl6bZt/6psRowA55aH0IHt6otnhrBuxuadgB665wsFsYufG5bV9amg94H4pqcHILVbxr6ht4J9qpYmujMAyv1fgkjCF2dPyOm0g+PDOzhdOFUwY6gAFBqQIRqYWvCRRRgFbL/aC/7RVERRDYEzNBLrBj2oMpfmWKXGK7xpSTzRs8sm+DJowDUdqzvfaMGzOJDuedSlXNkxcYr7FVY7aGKNSTXReTBNG/v9Q2bh+hLCO851oZk4dupA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1663707202; bh=PjiPXd2RGA9WA1iC+9xzUL5rcP80O5G0AVGvsKeRlR6=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=EkUmCfI14TKJA8lxCPEnCDJUS28mxDmzYNPvFPEYX7CPSzLbwCz7m0i+Hu+JPLZJSpozUyhwXkHRHeoqCNK5OUx5mZnyYE+olt8RHSDhI1Fn4A3wRvEmfKwmirWLRCQF+EWyjkrJc8tj9oL6rF8Jm3lTfZB0zU4yJriLr0uGytGnli64YyZnZLWLNGej+N1qsn+HnW1EpaofbAlpFcrNKTb7rfWjL3EgHMQnGGM73yCl/F/pgrNChdLRnvwbbGttxnrYZuocvPlWTmkn2ERXDAq/pI56XLwHWqAFJiUYC6ROBVpZHPfYThK4A1CU1RuW/prRWhF/NCAu1YHx95sAwQ== X-YMail-OSG: 9eHzRJwVM1nVLvAujs6ebMvq.WIDQk4zzyGI3.u859nNi8ahYsMuwiu19ZBBeqY IW.PfUDid6mQEzKGUSr8HcoH4zO2KtgOK0lIr8blhveo9YMDoO0iybJEGUTRKCHmj7L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S2VRIL7vgA-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Tue, 20 Sep 2022 20:53:22 +0000 Received: by hermes--production-ir2-6787885cb-wkhbw (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 6b74899f1404799fabd942eefa309415; Tue, 20 Sep 2022 20:53:20 +0000 (UTC) From: =?utf-8?Q?Daniel_Mart=C3=ADn?= To: bug-gnu-emacs@gnu.org Subject: 29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on macOS Date: Tue, 20 Sep 2022 22:53:19 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" References: X-Mailer: WebService/1.1.20663 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 6301 Received-SPF: pass client-ip=77.238.176.163; envelope-from=mardani29@yahoo.es; helo=sonic311-31.consmr.mail.ir2.yahoo.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain I tried the new PDF thumbnail generation feature in image-dired and I got the following error in the macOS console, and the thumbnails are blank: CoreGraphics PDF has logged an error. Set environment variable "CG_PDF_VERBOSE" to learn more The reason seems to be that the thumbnails are actually JPG files, but they are created with PDF extension, so the image loading code in the NS port sees the extension and tries to search for a %PDF marker in the file, which always fails. I've created this patch so that PDF thumbnails get the correct JPG or PNG extension. That fixes the problem on macOS, at least. Any ideas if the logic is correct and makes sense? Thanks. In GNU Emacs 29.0.50 (build 3, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.6 (Build 21G115)) of 2022-09-20 built on Daniels-MacBook-Pro.local Repository revision: 1231a601ebe1fd9fe454c504dbeb9267440242e7 Repository branch: master Windowing system distributor 'Apple', version 10.3.2113 System Description: macOS 12.6 Configured using: 'configure CPPFLAGS=-I/opt/homebrew/opt/openjdk@11/include' Configured features: ACL DBUS GLIB GNUTLS JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS WEBP XIM ZLIB Important settings: value of $LANG: en_ES.UTF-8 locale-coding-system: utf-8-unix Major mode: Messages Minor modes in effect: tooltip-mode: t global-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 buffer-read-only: 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 mail-extr emacsbug message mailcap yank-media puny rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x misearch multi-isearch format-spec vc-git diff-mode easy-mmode vc-dispatcher image-file image-converter dired-aux image-dired image-dired-tags image-dired-external image-dired-util image-mode wallpaper xdg exif cl-loaddefs cl-lib dired dired-loaddefs rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util 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 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 dbusbind kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 82066 6542) (symbols 48 6208 0) (strings 32 19408 2168) (string-bytes 1 585126) (vectors 16 11857) (vector-slots 8 170638 10214) (floats 8 39 25) (intervals 56 5237 164) (buffers 1000 12)) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-a-bug-where-PDF-thumbnails-were-stored-with-PDF-.patch >From 37583170eff4858b6bd288cc78e2ec967ee0073f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Tue, 20 Sep 2022 22:27:56 +0200 Subject: [PATCH] Fix a bug where PDF thumbnails were stored with PDF extension * lisp/image/image-dired-util.el (image-dired-file-name-extension): New function to compute the filename extension for a thumbnail. This new function ensures that the extension of a PDF thumbnail is either JPG or PNG. * lisp/image/image-dired-util.el (image-dired-thumb-name): Use the new function. --- lisp/image/image-dired-util.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index dcf0b22cfe..89513f9441 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -57,6 +57,19 @@ image-dired-dir (message "Thumbnail directory created: %s" image-dired-dir)) image-dired-dir)) +(defun image-dired-file-name-extension (file) + "Return the filename extension for thumbnail FILE. +Return the value of `file-name-extension', but for PDF files +return PNG or JPG, depending on the thumbnail storage +configuration." + (let ((extension (file-name-extension file))) + (cond ((string-equal extension "pdf") + (cond ((memq image-dired-thumbnail-storage + image-dired--thumbnail-standard-sizes) + "png") + (t "jpg"))) + (t extension)))) + (defun image-dired-thumb-name (file) "Return absolute file name for thumbnail FILE. Depending on the value of `image-dired-thumbnail-storage', the @@ -91,13 +104,13 @@ image-dired-thumb-name (file-name-as-directory (expand-file-name (image-dired-dir))) (file-name-base f) (if hash (concat "_" hash) "") - (file-name-extension f)))) + (image-dired-file-name-extension f)))) ((eq 'per-directory image-dired-thumbnail-storage) (let ((f (expand-file-name file))) (format "%s.image-dired/%s.thumb.%s" (file-name-directory f) (file-name-base f) - (file-name-extension f)))))) + (image-dired-file-name-extension f)))))) (defvar image-dired-thumbnail-buffer "*image-dired*" "Image-Dired's thumbnail buffer.") -- 2.34.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 21 07:42:25 2022 Received: (at 57961) by debbugs.gnu.org; 21 Sep 2022 11:42:25 +0000 Received: from localhost ([127.0.0.1]:60939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oay7V-0000Sv-50 for submit@debbugs.gnu.org; Wed, 21 Sep 2022 07:42:25 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oay7T-0000Si-45 for 57961@debbugs.gnu.org; Wed, 21 Sep 2022 07:42:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=MN8gbkI6OaKoSDTmlSnpBhCssD+Schj82klN9g7m3Qw=; b=ohujxoHmsE5+Mj092HkKG4nvVd R8OzSfV1XVVreuMGSTT51v6+p9KBg4IQme2BVQHk26FbF8yqnPi9qgDyN5Md0a8JQJAh6WeHF0OsG tPySa1KkXKQvfdF6qA6IBNjpIWHPgR3YaY1V1p7sOVPOf0b3BGx5QDd625z9bhU2I1CM=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oay7K-0004Zk-LR; Wed, 21 Sep 2022 13:42:17 +0200 From: Lars Ingebrigtsen To: Daniel =?utf-8?Q?Mart=C3=ADn?= Subject: Re: bug#57961: 29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on macOS In-Reply-To: ("Daniel =?utf-8?Q?Mart=C3=ADn=22's?= message of "Tue, 20 Sep 2022 22:53:19 +0200") References: X-Now-Playing: Niki Mono's _Contradictions are a Luxury_: "I Am Your Feeling" Date: Wed, 21 Sep 2022 13:42:14 +0200 Message-ID: <87sfkl6jjd.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Daniel Martín writes: > I've created this patch so that PDF thumbnails get the correct JPG or > PNG extension. That fixes the problem on macOS, at least. > > Any ideas if the logic is correct and makes sense? Thanks. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 57961 Cc: 57961@debbugs.gnu.org, Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Daniel Mart=C3=ADn writes: > I've created this patch so that PDF thumbnails get the correct JPG or > PNG extension. That fixes the problem on macOS, at least. > > Any ideas if the logic is correct and makes sense? Thanks. I think the patch makes sense. Perhaps Stefan has some comments; added to the CCs. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 21 09:09:40 2022 Received: (at 57961) by debbugs.gnu.org; 21 Sep 2022 13:09:40 +0000 Received: from localhost ([127.0.0.1]:32933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oazTv-0007D8-R4 for submit@debbugs.gnu.org; Wed, 21 Sep 2022 09:09:40 -0400 Received: from mail-oa1-f45.google.com ([209.85.160.45]:39849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oazTu-0007Cu-2c for 57961@debbugs.gnu.org; Wed, 21 Sep 2022 09:09:38 -0400 Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-11e9a7135easo8936442fac.6 for <57961@debbugs.gnu.org>; Wed, 21 Sep 2022 06:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:mime-version :references:in-reply-to:from:from:to:cc:subject:date; bh=1H9Vokjz+vnhGaSo5h8TfmajhOhBKwgtImi6ee+qWEI=; b=WysPDrf1TtkYgbE/GLocbo3tlVdB8hcTQjServ90ylrQl+OOIRHZI79MalH2c1r01V vtiulYpjmepTzZ1Zh6+FgE9s3E86maG+1cS9wln1iRUULc+O3msJWNYymeK0NdjY0C42 /rHejl1ELs43wxh/pXsLscUgI5JgGgJXygqqgskQLMIbbU93QHAPpcE3mpNWSwVO54bC SYj3z8xOZsgMLQj5GSyz6iEoDGqtRO0jTQ4fl9Pw83BybiuNsV9GkwZXbU/RAWLTTlbI EHp2JI7WpUwP9GsoAX4UI7TNFrfmc+bU6aix3OWpPzRvEZPqI8KQuVxuEvj2l/OWZuv+ HOtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:mime-version :references:in-reply-to:from:x-gm-message-state:from:to:cc:subject :date; bh=1H9Vokjz+vnhGaSo5h8TfmajhOhBKwgtImi6ee+qWEI=; b=iPquLcZIj2CzPktNHP2DthLlmQLeeB/1H+hO2roPHj6YvdKeiMGxhSxQgLixNjCZfD 9Dq9OWjV015Q6Tpwcu0soJAvF2oz2WKnzjHN+BFqmiTXA7cBJ/tVEfXkS2BUrEa+1ODK Jf3ld5+spqAiAQ5zU1YRAcE0tzbmd8us8ae3s/VF99mMSgz6QuwDbwafSfp2uyF450UM bz6NLPh3ASBuxuGnIiL1pD+jtCmPN/i5b8pR4tkjlteO9n+YwV2D3+2iJNRKAfeLj4a4 KUTwzUfQVJ+dyoArQmwo57G6qo7WcuJ68eSCum2A1cIRQjUNx+Ovbt3/K1T+ucsO/Du3 6Fkg== X-Gm-Message-State: ACrzQf0C0nwDKFfB/cnUuhkVc9p7eVnGAF7+ydZqGBiJFbeH612Ldea5 k+u5KlaruM6cgpZ/cthBPanNh4J9mDwY50S3UNI= X-Google-Smtp-Source: AMsMyM7/1ZJbYaZ26wmlygsj0EKJrnuMDwX9QKAshvsPls7PhdN6+XfZrq33vFX2sVPKWMoT9/O7V0C9Z05JCMbxRuA= X-Received: by 2002:a05:6870:b508:b0:12d:1c59:90d9 with SMTP id v8-20020a056870b50800b0012d1c5990d9mr5001392oap.199.1663765772372; Wed, 21 Sep 2022 06:09:32 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 21 Sep 2022 06:09:31 -0700 From: Stefan Kangas In-Reply-To: References: X-Hashcash: 1:20:220921:57961@debbugs.gnu.org::pCNvjdcorNndYcSs:3pL/ MIME-Version: 1.0 Date: Wed, 21 Sep 2022 06:09:31 -0700 Message-ID: Subject: Re: bug#57961: 29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on macOS To: =?UTF-8?Q?Daniel_Mart=C3=ADn?= , 57961@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57961 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > I've created this patch so that PDF thumbnails get the correct JPG or > PNG extension. That fixes the problem on macOS, at least. Thanks for your testing and the patch! Some comments below: > diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util= .el > index dcf0b22cfe..89513f9441 100644 > --- a/lisp/image/image-dired-util.el > +++ b/lisp/image/image-dired-util.el > @@ -57,6 +57,19 @@ image-dired-dir > (message "Thumbnail directory created: %s" image-dired-dir)) > image-dired-dir)) > > +(defun image-dired-file-name-extension (file) > + "Return the filename extension for thumbnail FILE. > +Return the value of `file-name-extension', but for PDF files > +return PNG or JPG, depending on the thumbnail storage > +configuration." > + (let ((extension (file-name-extension file))) > + (cond ((string-equal extension "pdf") > + (cond ((memq image-dired-thumbnail-storage > + image-dired--thumbnail-standard-sizes) > + "png") > + (t "jpg"))) > + (t extension)))) > + I don't think we need this when (memq image-dired-thumbnail-storage image-dired--thumbnail-standard-sizes) because the files are then already saved to, e.g.: ~/.cache/thumbnails/normal/790f6914e3e396bf1b63f20769bd531d.png > (defun image-dired-thumb-name (file) > "Return absolute file name for thumbnail FILE. > Depending on the value of `image-dired-thumbnail-storage', the > @@ -91,13 +104,13 @@ image-dired-thumb-name > (file-name-as-directory (expand-file-name (image-dire= d-dir))) > (file-name-base f) > (if hash (concat "_" hash) "") > - (file-name-extension f)))) > + (image-dired-file-name-extension f)))) Given that we already hard-code the use of JPEG, perhaps we should just hard-code ".jpg" here too? Of course, that will break when users start messing with `image-dired-cmd-create-thumbnail-options' but on the other hand they are then on their own in any case. > ((eq 'per-directory image-dired-thumbnail-storage) > (let ((f (expand-file-name file))) > (format "%s.image-dired/%s.thumb.%s" > (file-name-directory f) > (file-name-base f) > - (file-name-extension f)))))) > + (image-dired-file-name-extension f)))))) Same here. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 21 09:58:43 2022 Received: (at 57961) by debbugs.gnu.org; 21 Sep 2022 13:58:43 +0000 Received: from localhost ([127.0.0.1]:34867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ob0FO-0000Y8-RO for submit@debbugs.gnu.org; Wed, 21 Sep 2022 09:58:43 -0400 Received: from mail-ot1-f54.google.com ([209.85.210.54]:43848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ob0FM-0000Xu-T9 for 57961@debbugs.gnu.org; Wed, 21 Sep 2022 09:58:41 -0400 Received: by mail-ot1-f54.google.com with SMTP id cm7-20020a056830650700b006587fe87d1aso3977713otb.10 for <57961@debbugs.gnu.org>; Wed, 21 Sep 2022 06:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date; bh=/7nRpuSivRE4ui1cz9NQOs7RXgHNxuItRlJz12eds0U=; b=ciPHwJPn4KT2h32hthxUlVwm1/odFyZReezV0eMMuF7fV8M6xsftUMdeizvSV+jSuA QT8M+1cNKxHFFkaHHbMCXi0Fr6C+9jswQZyi4uJu1pc2BPfpFIrukoiOnFHPprHwI1o5 OWus3pU3odx5Qd84GlNcesS54yeh3MfBUwqkPzrSqtE+d9QokfRnbAsewl/Zf1WSaxwd BrXLW2h9VksIjKdnQAclWPWzc2hc4BGxr4ubRRVxenpXd1PIZ/xK6TNcuOCk3MkMvISb xh/ii3gaeDMpQBXKwhbMKmdlcDWEG023NLwL0DFH2VGaivZVE+p1GDeSdqaJXYuGJT3O asxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc:subject:date; bh=/7nRpuSivRE4ui1cz9NQOs7RXgHNxuItRlJz12eds0U=; b=agBmzrrh511gmOFh+MTyPEl/MuRa7ix2BAujA428ef1hf2zXNf83SXfVrTpiCH8QAm eY6RiAIilUIb4Q0V6i4YBXQiPeqDCC/cltFUZ4UfY37/WsIOHskBrrsmJ7z3ewwHEvUS CtZpWs5Z2fVyZgmhv88RGPdU6W3jwLyLFt3h6R0JZOKZzLdc7Lc4AjKyho3jG9P4BQrD /bxwY06QWRf0+9b7fU4vWlOzDfT2n3RQK5GbyHiebHI/HYABbT5U8YSlp8Ke845rs1gh zQOT6A6alIEWDc3N2g6yLafHam7xxHxpttYW9E+aET+/ssgcRVctnQbdm3aiSH3m/yGO ghDQ== X-Gm-Message-State: ACrzQf1yemdiOHZ/gHLO3ckDfUsznEAI/Wj3lYsSaBM22MXqG67qlC21 PVz8qFjxcVcOTrlZr/vyXEbeM0cdX5PRGPrIjSk= X-Google-Smtp-Source: AMsMyM6RePr3pY4Ospwh7g0a8tXXk1I2yRqJot7qOhisKbTzwth7qb35MHoFVJxujwdZFvyOWL7XWh5aYL1sf1BpX7M= X-Received: by 2002:a9d:7c89:0:b0:655:dfb1:331c with SMTP id q9-20020a9d7c89000000b00655dfb1331cmr12076129otn.224.1663768715132; Wed, 21 Sep 2022 06:58:35 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 21 Sep 2022 06:58:34 -0700 From: Stefan Kangas In-Reply-To: References: X-Hashcash: 1:20:220921:mardani29@yahoo.es::GGTWLc/SlYLDxCqx:0CWD MIME-Version: 1.0 Date: Wed, 21 Sep 2022 06:58:34 -0700 Message-ID: Subject: Re: bug#57961: 29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on macOS To: =?UTF-8?Q?Daniel_Mart=C3=ADn?= , 57961@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57961 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) BTW, I just pushed some tests to master (commit 661be73b5e), so I please update them too. Thanks in advance. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 28 06:46:00 2022 Received: (at control) by debbugs.gnu.org; 28 Sep 2022 10:46:00 +0000 Received: from localhost ([127.0.0.1]:60317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odUZj-0001Ci-UH for submit@debbugs.gnu.org; Wed, 28 Sep 2022 06:46:00 -0400 Received: from mail-oi1-f178.google.com ([209.85.167.178]:35683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odUZf-0001CL-Ng for control@debbugs.gnu.org; Wed, 28 Sep 2022 06:45:58 -0400 Received: by mail-oi1-f178.google.com with SMTP id v130so14932520oie.2 for ; Wed, 28 Sep 2022 03:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date; bh=QIWXruwLhtxtN15qjwIYWN2osP3qjzrWNxfENXj/Xr4=; b=P/+Coi0LkiLQSsexAnohyM/QZVhpeYQlgl3Bsy8e3E26iSJdiIAgF+hIJmdxBiuXHw 63Ezui2N5QaXsm138EcConkExmRE+tsx0iXcJDJ93tSi1AwJBNFU0keScx1/xV0iCCXQ SpdzTJsHUmvHgPUhXwgqZDVnDPeE18oA9V0oN4uMLOslsL10tRAoIW5v4L24oYnOD4u8 sJny/lCFV0s0VMuFW+yHGYFO+lpQvb8RlZz4tkHhvRpsJV9djnp7+TyeL4YOOSCZlGb7 0wLgkkRU5Efagmgxm6yuD0qKJvfSZpfntaZ5wddrnBW6OxXq8wgzcATI3A6owQtfw3bM BWJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date; bh=QIWXruwLhtxtN15qjwIYWN2osP3qjzrWNxfENXj/Xr4=; b=B+HnaFbWEieZ70PSy0CV82oxOr0OkjfZStUMeT4MRR1hbdocmTiZYrcWYsf07oH2gR EsxrsCqSaKmF3p+m5apy/nM/XNo4OubiltfIkwoYBpi1CUawCzWKlsieAT74fNiJvag2 Ab/AyFmJG3bkA2YbHFZOsLoXR2Ij2EXxb2NNz8p4eqqSOAAf50X+YzwrRR5bgl0yyhfr PSu6EZZwxmssW7Im+Zfu+HGcRGcv0eOPgUvrRLsmCCIIK+roZ0LBi4AMrddApkYLvJxN k7LdM+dryRkRy+I0fYvm5/K5MLZ2e1/rTXjE5x6jB024HBqPiJxV/JYF+zaOHXxUXK4g NV+w== X-Gm-Message-State: ACrzQf2+e1YSVK8srNkEtgBIr8JyEXeGLtY9hu8MGS0q0QsVTNiS6sjG TSgmcGhbnwIgSPVMRerA5sV1LqeGsuyr+6HaKhM= X-Google-Smtp-Source: AMsMyM5rsUUR4F3Qqiwt64OQoY7ajLGB0hsglzOB1SK4WaT2YHcI0QEspP+mYzJj+4hrhUqNzSRro11Im2mHSaBY7d4= X-Received: by 2002:a05:6808:1688:b0:345:ea9a:2954 with SMTP id bb8-20020a056808168800b00345ea9a2954mr3989570oib.199.1664361950029; Wed, 28 Sep 2022 03:45:50 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 28 Sep 2022 06:45:49 -0400 From: Stefan Kangas In-Reply-To: (Stefan Kangas's message of "Wed, 21 Sep 2022 06:09:31 -0700") References: X-Hashcash: 1:20:220927:mardani29@yahoo.es::V2i3yhjOqxstce6+:2UKX MIME-Version: 1.0 Date: Wed, 28 Sep 2022 06:45:49 -0400 Message-ID: Subject: Re: bug#57961: 29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on macOS To: =?UTF-8?Q?Daniel_Mart=C3=ADn?= Content-Type: text/plain; charset="UTF-8" Bcc: control@debbugs.gnu.org X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control Cc: 57961@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 57961 29.1 thanks Stefan Kangas writes: > Given that we already hard-code the use of JPEG, perhaps we should just > hard-code ".jpg" here too? I took a closer look at this, and I decided that while forcing the file extension to ".jpg", we might as well take the opportunity to simplify the naming of thumbnails. So I did that in commit 6cffaa3b6d, and I'm therefore closing this bug report. From unknown Sat Jun 21 03:15:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 26 Oct 2022 11:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator