From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61639: 30.0.50; [PATCH] Do not error out on non image file in image-dired Date: Mon, 20 Feb 2023 15:13:37 +0100 Message-ID: <87k00ctofi.fsf@ledu-giraud.fr> References: <87sff1quwk.fsf@ledu-giraud.fr> <83sff0v6wz.fsf@gnu.org> <87ttzgtq6p.fsf@ledu-giraud.fr> <83edqkv48n.fsf@gnu.org> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19677"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61639@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 20 15:14:29 2023 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 1pU6w0-0004yX-Qv for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Feb 2023 15:14:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU6vd-0000EG-Dg; Mon, 20 Feb 2023 09:14:05 -0500 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 1pU6vb-0000CA-Aq for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 09:14:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU6vb-0002xT-2Q for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 09:14:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pU6va-00042s-Qp for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 09:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Feb 2023 14:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61639 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61639-submit@debbugs.gnu.org id=B61639.167690242615508 (code B ref 61639); Mon, 20 Feb 2023 14:14:02 +0000 Original-Received: (at 61639) by debbugs.gnu.org; 20 Feb 2023 14:13:46 +0000 Original-Received: from localhost ([127.0.0.1]:51090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU6vJ-000422-GX for submit@debbugs.gnu.org; Mon, 20 Feb 2023 09:13:45 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]:28798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU6vD-00041e-Uj for 61639@debbugs.gnu.org; Mon, 20 Feb 2023 09:13:41 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=YFIlPWDA +BNtUryplftJPOJki98CF+10DxzOE4ssfIE=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=Hkoy4rTpFxGj+ilkQZXdz9NHxuBVuy go6Bea6pFGjBMQ3kuD1UbXICRZi0PSY3fTJxS2I7RnYJw3FzQB2vL9AQ== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=YFIlPWDA+BNtUryp lftJPOJki98CF+10DxzOE4ssfIE=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=s9fDQm3bcTnWDivLX2DcGZOAIS5znyGffChRx8 l8Qodjf+BqjldWwk5ajZV+pL1q6KlTRO9BTLiplxhwXKeEHT6dO7riA8Q5tB0TnbpHiVqt RddtgFMJ5nWBIJoP1vFvacGicikIJPmQvSFwTfiU7AsSN7SxXiNJ1m7j9QbhMcWrVJBs0l zO1JV5goAtYO3eCDyFffYve7AUzGBAj/utl7kWeY/XGjIr34+xPu0Vp35LZgTy63BcMOUN LCmPPuC78UFlwtw+D7y1i5oiZDZVu22pkIw71TdBbjPrdXuhYMRSIGCoyHk/zMSPZW667i UzTJvWjs73BK1uo5zlwtlj1g== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id fc4f3aca (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 20 Feb 2023 15:13:38 +0100 (CET) In-Reply-To: <83edqkv48n.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Feb 2023 15:46:48 +0200") 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:256179 Archived-At: Eli Zaretskii writes: >> From: Manuel Giraud >> Cc: 61639@debbugs.gnu.org >> Date: Mon, 20 Feb 2023 14:35:42 +0100 >> >> Eli Zaretskii writes: >> >> >> Date: Sun, 19 Feb 2023 21:09:47 +0100 >> >> From: Manuel Giraud via "Bug reports for GNU Emacs, >> >> the Swiss army knife of text editors" >> >> >> >> This patch prevent errors when using image-dired on non image files. >> > >> > Why is it better to show a message than to signal an error? The >> > former could go unnoticed, especially if some other message is shown >> > in the echo-area soon enough. >> >> I don't think it is better. But for some image-dired usage, I do not >> find it convenient. Example: you carefully select some images from a >> dired buffer and hit `C-t d' to see them in image-dired. But your >> selection was not correct and one of those file is not an image: you >> receive an error (and have to correct your selection) and don't get to >> see any of the correctly selected images. > > So maybe "C-t d" should filter the selected "images" before it calls > the function which errors out? That is what `image-dired-show-all-from-dir' is doing: it selects files from the given directory with the correct "image files" regexp and so no non image will be present. So your idea is to keep `image-dired--get-create-thumbnail-file' as is and filter its input in `image-dired-display-thumbs'? But then we won't get any message or error that something was not an image (this could go unnoticed as well ;-) > IOW, if the application doesn't want an API to fail for reasons > specific to the application, the onus of avoiding the error is on the > application, no? Yes, but maybe `image-dired--get-create-thumbnail-file' is not really an established API. It is called twice in Emacs (and the other place it is called non images are already filtered out). Do you think it could have been used in third-party package? -- Manuel Giraud